From 4f5ced0e74a3126f20d08424708edbd7c3927be4 Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Fri, 29 Sep 2023 17:26:13 +0400 Subject: [PATCH 1/2] chore: prompt for oauth credentials during build This prompts the user for the OAuth credentials if they are not provided during the yarn package script This makes it easier for new users and makes sure that OAuth credentials are provided. --- create-packages.sh | 34 +++++++++++++++++++++++++++++++++- package.json | 2 +- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/create-packages.sh b/create-packages.sh index b3d48057a2..c9ccb8d10f 100755 --- a/create-packages.sh +++ b/create-packages.sh @@ -3,6 +3,38 @@ # Extract version from package.json VERSION=$(node -pe "require('./package.json').version") +if [ -z ${ALBY_OAUTH_CLIENT_ID_CHROME+x} ]; +then + echo "OAuth client id for Chrome:" + read ALBY_OAUTH_CLIENT_ID_CHROME +fi + +if [ -z ${ALBY_OAUTH_CLIENT_SECRET_CHROME+x} ]; +then + echo "OAuth client secret for Chrome:" + read ALBY_OAUTH_CLIENT_SECRET_CHROME +fi + +if [ -z ${ALBY_OAUTH_CLIENT_ID_FIREFOX+x} ]; +then + echo "OAuth client id for Firefox:" + read ALBY_OAUTH_CLIENT_ID_FIREFOX +fi + +if [ -z ${ALBY_OAUTH_CLIENT_SECRET_FIREFOX+x} ]; +then + echo "OAuth client secret for Firefox:" + read ALBY_OAUTH_CLIENT_SECRET_FIREFOX +fi + +if [ -z ${ALBY_API_URL+x} ]; +then + ALBY_API_URL="https://api.getalby.com" +fi + +echo "Creating the build for v$VERSION" +yarn build + echo "Creating zip packages for v$VERSION" cd dist/production @@ -38,4 +70,4 @@ echo "Created alby-opera-v$VERSION.crx (SHA512: $SHA)" echo "done!" -cd ../../../ \ No newline at end of file +cd ../../../ diff --git a/package.json b/package.json index 9eaafc3d75..32b7e6be3b 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "build:firefox": "NODE_ENV=production TARGET_BROWSER=firefox webpack", "build:opera": "NODE_ENV=production TARGET_BROWSER=opera webpack", "build": "yarn build:chrome && yarn build:firefox && yarn build:opera", - "package": "yarn build && ./create-packages.sh", + "package": "./create-packages.sh", "lint": "yarn lint:js && yarn tsc:compile && yarn format:fix", "lint:js": "eslint src --ext .js,.jsx,.ts,.tsx --max-warnings 0", "lint:js:fix": "eslint src --ext .js,.jsx,.ts,.tsx --fix", From 50bcb5d5803f04bf5dd86f0f3ddf38d8d8cd433d Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Fri, 29 Sep 2023 18:27:04 +0400 Subject: [PATCH 2/2] chore: set node env to production for builds --- create-packages.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/create-packages.sh b/create-packages.sh index c9ccb8d10f..82a8da6bc2 100755 --- a/create-packages.sh +++ b/create-packages.sh @@ -2,6 +2,7 @@ # Extract version from package.json VERSION=$(node -pe "require('./package.json').version") +NODE_ENV=production if [ -z ${ALBY_OAUTH_CLIENT_ID_CHROME+x} ]; then