feat(Packaging): Deprecate package.include and package.exclude

This commit is contained in:
Mariusz Nowak 2021-12-13 17:16:43 +01:00 committed by Mariusz Nowak
parent b5069ef8cb
commit 62017754f7
2 changed files with 30 additions and 0 deletions

View File

@ -38,6 +38,16 @@ Note:
- The `serverless.yml` setting is ineffective for deprecations reported before the configuration is read.
- `SLS_DEPRECATION_DISABLE` and `disabledDeprecations` remain respected, and no errors will be thrown for mentioned deprecation codes.
<a name="PACKAGE_PATTERNS"><div>&nbsp;</div></a>
## New way to define packaging patterns
Deprecation code: `PACKAGE_PATTERNS`
Support for `package.include` and `package.exclude` will be removed with v4.0.0. Instead please use `package.patterns` with which both _include_ and _exclude_ (prefixed with `!`) rules can be configured.
Check [Packaging Patterns](/framework/docs/providers/aws/guide/packaging/#patterns) documentation for more info.
<a name="CLI_DEPLOY_FUNCTION_OPTION_V3"><div>&nbsp;</div></a>
## CLI `--function`/`-f` option for `deploy` command

View File

@ -33,6 +33,26 @@ class Package {
};
this.hooks = {
'initialize': () => {
const usesIncludeOrExclude = (packageConfig = {}) =>
packageConfig.include || packageConfig.exclude;
if (
usesIncludeOrExclude(this.serverless.service.package || {}) ||
Object.values(this.serverless.service.functions).some((func) =>
usesIncludeOrExclude(func.package)
) ||
Object.values(this.serverless.service.layers || {}).some((func) =>
usesIncludeOrExclude(func.package)
)
) {
this.serverless._logDeprecation(
'PACKAGE_PATTERNS',
'Support for "package.include" and "package.exclude" will be removed in the next' +
' major release. Please use "package.patterns" instead'
);
}
},
'package:createDeploymentArtifacts': async () =>
BbPromise.bind(this).then(this.packageService),