可以通过在amplify.yml中手动配置部署阶段的自动检测规则来实现。例如,要排除部署React静态文件中所有以“test”开头的文件,可以在amplify.yml中添加以下配置:
frontend:
phases:
preBuild:
commands:
- rm -rf build/
build:
commands:
- echo 'The build has started'
- yarn build
artifacts:
#include all artifacts
baseDirectory: build/
files:
- '**/*'
cache:
#Cache is cleared everytime code changes are pushed
disabled: true
# Auto-detect test files through '*.test.*' pattern.
# This pattern will include all files that contain '.test.' keywords.
# You can also use the '!' (not) operator to exclude files that contain certain keywords
# and prevent them from being considered test files.
# The '!lambda/**/*.js' pattern, for example, will exclude any js files in the lambda directory.
test:
pattern: !'*test*'
# include:
# - '!lambda/**/*.js'