Skip to content

Commit

Permalink
feat: Log deprecation on usage
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Jul 14, 2021
1 parent 57200ca commit ae6f29e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

## DEPRECATED

Please upgrade to Serverless Framework 2.3.0, this is now supported natively.
All functionalities as provided by this plugin are now supported by Serverless Framework natively:

Below is the legacy readme for reference:
- With version v2.3.0 the default variable regex was updated to not collide with AWS pseudo parameters
- With version v2.50.0, new variables sources `${aws:accountId}` and `${aws:region}` were introduced, which can be used in properties where CloudFormation pseudo paramaters cannot be used. Please use them instead of `#{AWS::...}` format as supported by this plugin

_Below is the legacy readme for reference:_

## Original Readme

Expand Down
18 changes: 18 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
'use strict';

const semver = require('semver');

class ServerlessAWSPseudoParameters {
constructor(serverless, options) {
this.serverless = serverless;
this.options = options || {};
this.hooks = {
initialize: () => {
const frameworkVersion = (() => {
try {
return require('serverless/package').version;
} catch (error) {
return null;
}
})();
if (!frameworkVersion) return;
if (!semver.gte(frameworkVersion, '2.50.0')) return;
this.serverless.logDeprecation(
'OBSOLETE_PSEUDO_PARAMETERS_PLUGIN',
'"serverless-pseudo-parameters" plugin is no longer needed. Please uninstall it as it will not work with next Framework major release.\n' +
'Instead rely on "${aws:region}" and "${aws:accountId}" Serverless Framework variables'
);
},
'after:aws:package:finalize:mergeCustomProviderResources': this.addParameters.bind(this)
};
this.skipRegionReplace = get(
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"name": "serverless-pseudo-parameters",
"version": "2.5.0",
"dependencies": {
"semver": "^7.3.5"
},
"devDependencies": {
"jest": "^24.9.0"
},
Expand Down

0 comments on commit ae6f29e

Please sign in to comment.