diff --git a/README.md b/README.md index 3080296..2f85b91 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/lib/index.js b/lib/index.js index 7221819..7d494c0 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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( diff --git a/package.json b/package.json index 3313238..b3abaab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,9 @@ { "name": "serverless-pseudo-parameters", "version": "2.5.0", + "dependencies": { + "semver": "^7.3.5" + }, "devDependencies": { "jest": "^24.9.0" },