Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/commands-schema/aws-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to proposal, it was suggested to remove this option from the schema - what was the reason against doing so?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs to stay in schema, otherwise it will not be properly recognized and the expected deprecation won't be reported

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's probably right to keep it (same way as keep schema for deprecated config properties)

shortcut: 'f',
},
'aws-s3-accelerate': {
Expand Down
11 changes: 11 additions & 0 deletions lib/plugins/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down