From 8b95fd81753839bf7870874dbd8567a4fdec6f2f Mon Sep 17 00:00:00 2001 From: Lance Ball Date: Thu, 30 Jul 2020 14:51:40 -0400 Subject: [PATCH] chore(release): add postinstall script to warn users of name change Since we have recently changed the name of this module to 'cloudevents', users may not be aware that version 2.0.2 is out of date, since it won't automatically be upgraded on `npm install`. This commit adds a postinstall script to warn users of this fact, and adds a bold, top-level warning to the README. Fixes: https://github.com/cloudevents/sdk-javascript/issues/291 Signed-off-by: Lance Ball squash --- README.md | 7 +++++++ package.json | 3 ++- postinstall/message.js | 10 ++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 postinstall/message.js diff --git a/README.md b/README.md index a4783752..7024cee9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,12 @@ # JavaScript SDK for CloudEvents +## WARNING: This module has changed its name to 'cloudevents'. +### PLEASE CONSIDER UPGRADING YOUR DEPENDENCY + +`npm install cloudevents` + +--- + [![Codacy Badge](https://api.codacy.com/project/badge/Grade/bd66e7c52002481993cd6d610534b0f7)](https://www.codacy.com/app/fabiojose/sdk-javascript?utm_source=github.com&utm_medium=referral&utm_content=cloudevents/sdk-javascript&utm_campaign=Badge_Grade) [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/bd66e7c52002481993cd6d610534b0f7)](https://www.codacy.com/app/fabiojose/sdk-javascript?utm_source=github.com&utm_medium=referral&utm_content=cloudevents/sdk-javascript&utm_campaign=Badge_Coverage) ![Node.js CI](https://github.com/cloudevents/sdk-javascript/workflows/Node.js%20CI/badge.svg) diff --git a/package.json b/package.json index f653f558..692fef5f 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "coverage-publish": "wget -qO - https://coverage.codacy.com/get.sh | bash -s report -l JavaScript -r coverage/lcov.info", "generate-docs": "typedoc --tsconfig ./tsconfig.json --plugin typedoc-plugin-markdown src", "release": "standard-version", - "prepublish": "npm run build" + "prepublish": "npm run build", + "postinstall": "node ./postinstall/message.js" }, "files": [ "index.js", diff --git a/postinstall/message.js b/postinstall/message.js new file mode 100644 index 00000000..7f4c5f56 --- /dev/null +++ b/postinstall/message.js @@ -0,0 +1,10 @@ +// eslint-disable-next-line no-console +console.log("\x1b[1m\x1b[31m%s\x1b[0m",` + >>>> Thank you for using cloudevents-sdk! <<<< + + Note: As of version 3.0.0, this project has been renamed to 'cloudevents'. + To use the latest version of this module, please run: + + npm install cloudevents + +`); \ No newline at end of file