Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

shared: Script up the NPM release process for `@zulip/shared`.

Greg Pricedbe92ebbfecb
diff --git a/static/shared/.npmrc b/static/shared/.npmrc
new file mode 100644
index 00000000000..b9433a71b91
--- /dev/null
+++ b/static/shared/.npmrc
@@ -0,0 +1,3 @@
+# When running `npm version patch` etc., let our `version` script,
+# `tools/npm-version`, take care of making the new Git tag.
+git-tag-version = false
diff --git a/static/shared/package.json b/static/shared/package.json
index 63065dcb8a5..077b943cc7f 100644
--- a/static/shared/package.json
+++ b/static/shared/package.json
@@ -2,6 +2,10 @@
"name": "@zulip/shared",
"version": "0.0.13",
"license": "Apache-2.0",
+ "scripts": {
+ "version": "tools/npm-version",
+ "postversion": "tools/npm-postversion"
+ },
"dependencies": {
"katex": "^0.15.3",
"lodash": "^4.17.19"
diff --git a/static/shared/tools/npm-postversion b/static/shared/tools/npm-postversion
new file mode 100755
index 00000000000..c9079ecde44
--- /dev/null
+++ b/static/shared/tools/npm-postversion
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+set -eu -o pipefail
+
+echo >&2 "\
+Version updated: ${npm_package_version}
+
+Next steps:
+
+ \$ git log --stat -p upstream.. # check your work!
+
+ \$ git push upstream main shared-${npm_package_version}
+
+ \$ npm publish # should prompt for an OTP, from your 2FA setup
+"
diff --git a/static/shared/tools/npm-version b/static/shared/tools/npm-version
new file mode 100755
index 00000000000..d15b7f17e28
--- /dev/null
+++ b/static/shared/tools/npm-version
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -eu -o pipefail
+
+git commit -am "shared: Bump version to ${npm_package_version}"
+git tag "shared-${npm_package_version}"