From 49cbbfd7c4a45a59cdf3a1c816787e309caacbd5 Mon Sep 17 00:00:00 2001 From: Lemuel Cardenas Date: Fri, 29 Oct 2021 14:51:47 -0700 Subject: [PATCH 1/2] published updated package on npm and wrote a small script to help with publishing --- firestore-stripe-web-sdk/deploy.sh | 116 ++++++++++++++++++++++++++ firestore-stripe-web-sdk/package.json | 2 +- 2 files changed, 117 insertions(+), 1 deletion(-) create mode 100755 firestore-stripe-web-sdk/deploy.sh diff --git a/firestore-stripe-web-sdk/deploy.sh b/firestore-stripe-web-sdk/deploy.sh new file mode 100755 index 00000000..204b7019 --- /dev/null +++ b/firestore-stripe-web-sdk/deploy.sh @@ -0,0 +1,116 @@ +#!/bin/bash + +set -Eeuo pipefail + +GREEN=$(tput setaf 2) +RED=$(tput setaf 1) +RED_BG=$(tput setab 1) +YELLOW=$(tput setaf 3) +RESET=$(tput sgr 0) +BOLD=$(tput bold) + +# verify we meant to run this script +read -r -n 1 -p "${YELLOW}WARNING:${RESET} running this script deploys changes publicly. Are you sure you want to continue? [y/n] " +echo +echo +if [[ ! "${REPLY}" =~ ^[Yy]$ ]]; then exit 1; fi + +# verify the user has required permissions +read -r -n 1 -p "Do you have a stripe npm account with 2FA? [y/n] " +echo +echo +if [[ ! "${REPLY}" =~ ^[Yy]$ ]]; then + echo "${RED}ERROR:${RESET} Please create a stripe npm account to continue" + exit 1 +fi + +version=$(nodenv version | cut -d . -f 1) +if [ ! "${version}" -gt "12" ]; then + echo "${RED}ERROR:${RESET} must have node version 12 or greater" + echo "current version is ${YELLOW}$(nodenv version | cut -d ' ' -f 1)${RESET}" + echo + echo "set new node version with ${BOLD}nodenv shell 14.7.0${RESET} or any other installed version 12 or greater to continue" + exit 1 +fi +echo "${GREEN}SUCCESS:${RESET} your current node version is 12 or greater (${GREEN}$(nodenv version | cut -d ' ' -f 1)${RESET})" +echo + +if ! npm team ls @stripe:developers &> /dev/null; then + echo "Please login to your stripe npm account" + npm login +fi + +while ! npm team ls @stripe:developers &> /dev/null; +do + echo + echo "${RED}ERROR:${RESET} either you haven't logged into your stripe npm account or your account doesn't belong to the stripe org" + echo + echo "${RED_BG}verify${RESET} that you are logged in to your stripe npm account by running ${BOLD}npm whoami${RESET}" + echo "${BOLD}npm whoami${RESET} should return ${GREEN}$USER-stripe${RESET}" + current_npm_user=$(npm whoami) + echo "${BOLD}npm whoami${RESET} currently returns ${RED}$current_npm_user${RESET}" + echo + echo "${RED_BG}verify${RESET} that you belong to the stripe org by checking your listed organizations at ${BOLD}https://npmjs.com/~$USER-stripe${RESET}" + echo "if you don't belong to the stripe org, be sure to ping ${BOLD}#payments-web${RESET}" + echo + read -r -n 1 -p "Do you want to try again? [y/n] " + echo + if [[ ! "${REPLY}" =~ ^[Yy]$ ]]; then exit 1; fi + echo + echo "Please login to your stripe npm account" + npm login +done + +echo +echo "${GREEN}SUCCESS:${RESET} you are logged into your stripe npm account" +echo + +# build the release artifact +if ! npm run test; then + echo + echo "${RED}ERROR:${RESET} some tests have failed, please fix them to continue" + exit 1 +fi + +echo +echo "${GREEN}SUCCESS:${RESET} all tests have passed" +echo + +if ! rm stripe-firestore-stripe-payments-*.tgz; then + echo + echo "${RED}ERROR:${RESET} encountered an error removing old release artifacts" + exit 1 +fi + +if ! npm run build; then + echo + echo "${RED}ERROR:${RESET} encountered an error while building the release artifact" + exit 1 +fi + +if ! npm pack; then + echo + echo "${RED}ERROR:${RESET} encountered an error while building the release artifact" + exit 1 +fi + +echo +echo "${GREEN}SUCCESS:${RESET} built the release artifact" +echo + +read -r -n 1 -p "Did you notify #developer-products and #developer-advocacy about this release? [y/n] " +echo +echo +if [[ ! "${REPLY}" =~ ^[Yy]$ ]]; then + echo "${RED}ERROR:${RESET} Please notify #developer-products and #developer-advocacy before any release" + exit 1 +fi + +# publish +if ! npm publish stripe-firestore-stripe-payments-*.tgz --access restricted; then + echo + echo "${RED}ERROR:${RESET} encountered an error while publishing new version" + exit 1 +fi + +echo "${GREEN}SUCCESS:${RESET} published the new version!" \ No newline at end of file diff --git a/firestore-stripe-web-sdk/package.json b/firestore-stripe-web-sdk/package.json index 0f1ce485..9494d956 100644 --- a/firestore-stripe-web-sdk/package.json +++ b/firestore-stripe-web-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@stripe/firestore-stripe-payments", - "version": "0.0.1", + "version": "0.0.2", "description": "Client SDK for the firestore-stripe-payments Firebase Extension", "main": "./lib/index.js", "typings": "./lib/index.d.ts", From 01d1546f94e8f7bdfc090a304edc1980ac985821 Mon Sep 17 00:00:00 2001 From: Lemuel Cardenas Date: Mon, 1 Nov 2021 12:57:47 -0700 Subject: [PATCH 2/2] upgraded dependencies to see if fixed weird testing bug --- firestore-stripe-web-sdk/package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/firestore-stripe-web-sdk/package.json b/firestore-stripe-web-sdk/package.json index 9494d956..6c9b6bc8 100644 --- a/firestore-stripe-web-sdk/package.json +++ b/firestore-stripe-web-sdk/package.json @@ -31,30 +31,30 @@ "README.md" ], "devDependencies": { - "@microsoft/api-documenter": "^7.13.63", - "@microsoft/api-extractor": "^7.18.7", + "@microsoft/api-documenter": "^7.13.65", + "@microsoft/api-extractor": "^7.18.17", "@types/chai": "^4.2.21", "@types/chai-as-promised": "^7.1.4", "@types/chai-like": "^1.1.1", "@types/mocha": "^9.0.0", - "@types/sinon": "^10.0.2", + "@types/sinon": "^10.0.6", "@types/sinon-chai": "^3.2.5", "chai": "^4.3.4", "chai-as-promised": "^7.1.1", "chai-like": "^1.1.1", - "firebase-tools": "^9.18.0", + "firebase-tools": "^9.21.0", "jsdom": "^17.0.0", "jsdom-global": "^3.0.2", "mocha": "^9.1.1", - "replace-in-file": "^6.2.0", + "replace-in-file": "^6.3.2", "sinon": "^11.1.2", "sinon-chai": "^3.7.0", - "ts-node": "^10.2.1", + "ts-node": "^10.4.0", "typescript": "^4.4.2" }, "dependencies": { - "@firebase/app": "^0.7.0", + "@firebase/app": "^0.7.5", "@firebase/auth": "^0.17.2", - "@firebase/firestore": "^3.0.1" + "@firebase/firestore": "^3.2.0" } }