refactor(AWS Deploy): Deprecate function option in deploy command

Co-authored-by: Piotr Grzesik <pj.grzesik@gmail.com>
This commit is contained in:
Jaakko Lappalainen 2021-06-29 13:37:37 +01:00 committed by GitHub
parent 20612ff85c
commit d861d119ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 1 deletions

View File

@ -32,6 +32,14 @@ Note:
- Configuration setting is ineffective for deprecations reported before service configuration is read.
- `SLS_DEPRECATION_DISABLE` env var and `disabledDeprecations` configuration setting remain respected, and no errors will be thrown for mentioned deprecation coodes.
<a name="CLI_DEPLOY_FUNCTION_OPTION"><div>&nbsp;</div></a>
## CLI `--function`/`-f` option for `deploy` command
Deprecation code: `CLI_DEPLOY_FUNCTION_OPTION'`
Starting with v3.0.0, `--function` or `-f` option for `deploy` command will be removed. In order to deploy a single function, please use `deploy function` command instead.
<a name="CHANGE_OF_DEFAULT_RUNTIME_TO_NODEJS14X"><div>&nbsp;</div></a>
## Change of default runtime to `nodejs14.x`

View File

@ -26,7 +26,7 @@ commands.set('deploy', {
type: 'boolean',
},
'function': {
usage: "Function name. Deploys a single function (see 'deploy function')",
usage: "Function name. Deploys a single function. DEPRECATED: use 'deploy function' instead.",
shortcut: 'f',
},
'aws-s3-accelerate': {

View File

@ -29,6 +29,17 @@ class Deploy {
};
this.hooks = {
'initialize': () => {
const isDeployCommand =
this.serverless.processedInput.commands.length === 1 &&
this.serverless.processedInput.commands[0] === 'deploy';
if (isDeployCommand && this.options.function) {
this.serverless.logDeprecation(
'CLI_DEPLOY_FUNCTION_OPTION',
'Starting with v3.0.0, `--function` or `-f` option for `deploy` command will be removed. In order to deploy a single function, please use `deploy function` command instead.'
);
}
},
'before:deploy:deploy': async () => {
const provider = this.serverless.service.provider.name;
if (!this.serverless.getProvider(provider)) {