From 541e4b68e7306d0eb476b081a8c550d90b3d66c2 Mon Sep 17 00:00:00 2001 From: linuxdev Date: Tue, 24 Dec 2024 08:16:24 -0500 Subject: [PATCH 1/6] fix(update): ignore .envs --- .gitignore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 078855b..15a0bdf 100644 --- a/.gitignore +++ b/.gitignore @@ -27,8 +27,8 @@ yarn-error.log* # local env files -.env.p* -.env.local +!.env.*example +.env.* out/ build/ From c64923c3ec65e07e7f25bac69a6c7f6e1d821b0d Mon Sep 17 00:00:00 2001 From: linuxdev Date: Tue, 24 Dec 2024 08:18:44 -0500 Subject: [PATCH 2/6] fix(update): build and dev script, action and make file, add --- Makefile | 18 ++++++++++-- action.sh | 87 ++----------------------------------------------------- 2 files changed, 19 insertions(+), 86 deletions(-) diff --git a/Makefile b/Makefile index 4a9a44e..2cefa29 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,21 @@ help: | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m %-43s\033[0m %s\n", $$1, $$2}' \ | sed -e 's/\[32m #-- /[33m/' +print-manifests: ## print out build target manifests + @ls ./build/jiffyReader-* |grep -E '.(xpi|zip|crx)' | xargs -I {} sh -c 'unzip -p "{}" manifest.json | jq -r ". | \"Version: \(.version), Name: \(.name), Version Name: \(.version_name), Target: \(.target), Scope: \(.scope) \""' + +test-build-manifests: ## test build manifests + @if make print-manifests | grep -E '(\W-\W|null)'; then exit 1; fi + + +test: ## test + @make test-build-manifests + + +_build: ## build all targets + @make build@latest + - build@latest: ## build latest using version in bump.txt - . action.sh \ No newline at end of file + . action.sh + @make test \ No newline at end of file diff --git a/action.sh b/action.sh index d268c5c..3d11f01 100644 --- a/action.sh +++ b/action.sh @@ -1,86 +1,5 @@ #!/bin/bash -appRoot="$(pwd)" -# take tag name as args - -goToAppRoot(){ - cd "$appRoot" -} - - -printMsg(){ - msg=$1 - echo ">>> $msg" -} - -getVersion(){ - # input: "version-scope" - tag=$1 - version=${tag%%-development} - echo $version -} - -getScope(){ - tag=$1 - # 10-development - suffix="$2" - scope_raw="${tag#${suffix}}" - scope="${scope_raw//-/}" - echo $scope -} - -buildEnv(){ - version="$(getVersion $1)" - scope=$2 - fullTag=$3 - echo "version: $version" - echo "scope: $scope" - echo "name: $fullTag" - - printf "VERSION=$version\nNAME=\"Jiffy Reader$scope\"\nTARGET=chrome\nDEBUG=FALSE\nSHORTCUT=Alt+B\nVERSION_NAME=$fullTag" > .env.production -} - - -zipPacks(){ - scope=$1 - cd build/chrome-mv3-prod/ && zip -r "../jiffyReader-chrome$scope" ./* - goToAppRoot - cd build/firefox-mv2-prod/ && zip -r "../jiffyReader-firefox$scope.xpi" ./* - goToAppRoot - printMsg "zipPacks complete $(ls build/ -l)" -} - - - -buildDevelopment(){ - printMsg "buildDevelopment:started" - fullname="$1-development" - buildEnv $1 " Dev" $fullname - pnpm gh:build:development && pnpm gh:build:bookmarklet && pnpm gh:build:firefox - printMsg "buildDevelopment:complete" - zipPacks "-development" -} - -buildRelease(){ - fullname="$1" - buildEnv $1 "" $fullname - pnpm gh:build:chrome && pnpm gh:build:firefox && pnpm gh:build:bookmarklet - zipPacks "" -} - -handle(){ - tag=$1 - buildDevelopment $tag - buildRelease $tag -} - -cleanBuildDirectory(){ - rm -rf build/ -} - - -tag=$1 -cleanBuildDirectory - -# tags= value in bump.txt if not set -handle "${tag:=$(npm pkg get version|tr -d '\"')}" \ No newline at end of file +rm -rf build/ +npm run gh:build +npm run gh:build:development \ No newline at end of file From 010f3ee35b7fe001d1be4508ce8f379bedb51034 Mon Sep 17 00:00:00 2001 From: linuxdev Date: Tue, 24 Dec 2024 09:57:49 -0500 Subject: [PATCH 3/6] fix(internal): improvements refact: scripts in package json --- Makefile | 12 ++- package.json | 210 +++++++++++++++++++++++++++------------------------ 2 files changed, 120 insertions(+), 102 deletions(-) diff --git a/Makefile b/Makefile index 2cefa29..b184032 100644 --- a/Makefile +++ b/Makefile @@ -19,5 +19,13 @@ _build: ## build all targets build@latest: ## build latest using version in bump.txt - . action.sh - @make test \ No newline at end of file + rm -rf build/* + npm run gh:build:development + npm run gh:build + @make test + +extract: ## extract files + rm -rf build/extracts + mkdir build/extracts + find build -name jiffyReader* | awk -F / '{print $$2}' | xargs -I{} sh -c "unzip build/{} -d build/extracts/{}" + \ No newline at end of file diff --git a/package.json b/package.json index d0fed1a..86d5475 100644 --- a/package.json +++ b/package.json @@ -1,102 +1,112 @@ { - "name": "jiffy-reader", - "displayName": "Jiffy reader", - "version": "1.2.0", - "description": "jiffy reader", - "packageManager": "yarn@1.22.19", - "scripts": { - "dev": "plasmo dev", - "build": "plasmo build", - "dev:chrome": "cross-env-shell VERSION=$(npm pkg get version | tr -d '\"') NAME=jiffy-reader-chrome-dev VERSION_NAME=$VERSION-$NAME TARGET=chrome SHORTCUT=\"Alt+B\" DEBUG=TRUE plasmo dev --target=chrome-mv3", - "dev:firefox": "cross-env-shell VERSION=$(npm pkg get version | tr -d '\"') NAME=jiffy-reader-firefox-dev VERSION_NAME=$VERSION-$NAME TARGET=firefox SHORTCUT=\"Alt+W\" DEBUG=TRUE plasmo dev --target=firefox-mv2", - "dev:safari": "cross-env-shell VERSION=$(npm pkg get version | tr -d '\"') NAME=jiffy-reader-safari-dev VERSION_NAME=$VERSION-$NAME TARGET=safari SHORTCUT=\"Alt+W\" DEBUG=TRUE plasmo dev --target=safari-mv2", - "build:chrome": "cross-env-shell VERSION=$(npm pkg get version | tr -d '\"') NAME=jiffy-reader-chrome-dev VERSION_NAME=$VERSION-$NAME TARGET=chrome SHORTCUT=\"Alt+B\" DEBUG=FALSE plasmo build --target=chrome-mv3", - "build:firefox": "cross-env-shell VERSION=$(npm pkg get version | tr -d '\"') NAME=jiffy-reader-firefox-dev VERSION_NAME=$VERSION-$NAME TARGET=firefox SHORTCUT=\"Alt+W\" DEBUG=FALSE plasmo build --target=firefox-mv2", - "build:safari": "cross-env-shell VERSION=$(npm pkg get version | tr -d '\"') NAME=jiffy-reader-safari-dev VERSION_NAME=$VERSION-$NAME TARGET=safari SHORTCUT=\"Alt+W\" DEBUG=FALSE plasmo build --target=safari-mv2", - "gh:build:chrome": "cross-env-shell VERSION=$(npm pkg get version | tr -d '\"') NAME=\"Jiffy Reader\" DEBUG=FALSE TARGET=chrome SHORTCUT=\"Alt+B\" plasmo build --target=chrome-mv3 && npm run bundle:chrome-opera", - "bundle:chrome-opera": "cd build/chrome-mv3-prod && zip -r ../jiffyReader-chrome ./* && zip -r ../jiffyReader-opera.crx ./*", - "gh:build:firefox": "cross-env-shell VERSION=$(npm pkg get version | tr -d '\"') NAME=\"Jiffy Reader\" DEBUG=FALSE TARGET=firefox SHORTCUT=\"Alt+W\" plasmo build --target=firefox-mv2 && cd build/firefox-mv2-prod/ && zip -r ../jiffyReader-firefox.xpi ./*", - "gh:build:safari": "cross-env-shell VERSION=$(npm pkg get version | tr -d '\"') NAME=\"Jiffy Reader\" DEBUG=FALSE TARGET=safari SHORTCUT=\"Alt+W\" plasmo build --target=safari-mv2 && cd build/safari-mv2-prod/ && zip -r ../jiffyReader-safari.xpi ./*", - "gh:build:development": "cross-env-shell VERSION=$(npm pkg get version | tr -d '\"') VERSION_NAME=$VERSION-$NAME DEBUG=FALSE SHORTCUT=\"Alt+B\" plasmo build --target=chrome-mv3 && DEBUG=FALSE SHORTCUT=\"Alt+W\" TARGET=firefox plasmo build --target=firefox-mv2", - "gh:build:bookmarklet": "cross-env-shell VERSION=$(npm pkg get version | tr -d '\"') VERSION_NAME=$VERSION-$NAME node src/Bookmarklet/esbuild.mjs", - "build:ios": "xcrun safari-web-extension-converter --rebuild-project \"Jiffy reader/Jiffy reader.xcodeproj\"", - "build:xcode": "pnpm build:safari && xcrun safari-web-extension-converter --swift --no-open --force --bundle-identifier com.jiffyreader build/safari-mv2-prod", - "build:xcode:all": "pnpm build:xcode && pnpm build:ios", - "dev:xcode": "xcrun safari-web-extension-converter --swift --no-open --force --bundle-identifier com.jiffyreader build/safari-mv2-dev", - "release": "commit-and-tag-version" - }, - "dependencies": { - "@plasmohq/prettier-plugin-sort-imports": "^1.1.1", - "@plasmohq/storage": "^0.8.1", - "axios": "^1.6.5", - "commit-and-tag-version": "^12.5.0", - "cross-env": "^7.0.3", - "esbuild": "^0.14.53", - "esbuild-sass-plugin": "^2.3.1", - "mellowtel": "1.4.2", - "plasmo": "0.70.0", - "postcss": "^8", - "react": "18.2.0", - "react-dom": "18.2.0", - "webpack": "^4.0.0" - }, - "devDependencies": { - "@parcel/transformer-sass": "2.6.2", - "@types/chrome": "0.0.193", - "@types/firefox-webext-browser": "^111.0.1", - "@types/node": "18.6.1", - "@types/react": "18.0.15", - "@types/react-dom": "18.0.6", - "console-browserify": "^1.2.0", - "cws-publish": "^2.1.1", - "eslint-config-airbnb-base-typescript-prettier": "^4.1.0", - "prettier": "2.7.1", - "process": "^0.11.10", - "typescript": "4.7.4" - }, - "manifest": { - "name": "$NAME", - "version_name": "$VERSION_NAME", - "version": "$VERSION", - "description": "A Browser Extension for Faster Reading on ANY website!", - "default_locale": "en", - "permissions": [ - "activeTab", - "declarativeNetRequest", - "tabs" - ], - "host_permissions": [ - "" - ], - "commands": { - "toggle-bionic": { - "suggested_key": { - "default": "$SHORTCUT" - }, - "description": "Toggle bionic reading mode" - } - }, - "web_accessible_resources": [ - { - "resources": [ - "assets/icon512.png", - "assets/sun-light-solid.svg", - "assets/moon-solid.svg" - ], - "matches": [ - "" - ] - } - ] - }, - "repository": { - "type": "git", - "url": "https://github.com/ansh/jiffyreader.com" - }, - "author": "", - "license": "ISC", - "bugs": { - "url": "https://github.com/ansh/jiffyreader.com/issues" - }, - "homepage": "https://github.com/ansh/jiffyreader.com#readme" + "name": "jiffy-reader", + "displayName": "Jiffy reader", + "version": "1.2.0", + "description": "jiffy reader", + "packageManager": "yarn@1.22.19", + "scripts": { + "dev": "VERSION=\"$(npm pkg get version | tr -d '\"')\" TARGET=${TARGET:-chrome} NAME=${NAME:-\"jiffy-reader-chrome\"} TAG=${TAG:=local} VERSION_NAME=$VERSION-$TARGET-$TAG DEBUG=${DEBUG:-TRUE} SHORTCUT=${SHORTCUT:-\"Alt+B\"} plasmo dev --target=${MANIFEST_VERSION:-chrome-mv3}", + "buildx": "VERSION=\"$(npm pkg get version | tr -d '\"')\" TARGET=${TARGET:-chrome} NAME=${NAME:-\"Jiffy Reader\"} TAG=${TAG:=prod} VERSION_NAME=$VERSION-$TARGET-$TAG DEBUG=${DEBUG:-FALSE} SHORTCUT=${SHORTCUT:-\"Alt+B\"} plasmo build --target=${MANIFEST_VERSION:-chrome-mv3}", + "build": "npm run build:opera && npm run build:chrome & npm run build:firefox & npm run build:safari", + "dev:chrome": "npm run dev", + "dev:firefox": "NAME=jiffy-reader-firefox TARGET=firefox SHORTCUT=\"Alt+W\" MANIFEST_VERSION=firefox-mv2 npm run dev", + "dev:safari": "NAME=jiffy-reader-safari TARGET=safari SHORTCUT=\"Alt+W\" MANIFEST_VERSION=safari-mv2 npm run dev", + "build:chrome": "npm run buildx && npm run bundle:chrome", + "build:opera": "TARGET=opera npm run build:chrome && npm run bundle:opera", + "build:firefox": "NAME=jiffy-reader-firefox TARGET=firefox SHORTCUT=\"Alt+W\" MANIFEST_VERSION=firefox-mv2 npm run buildx && npm run bundle:firefox", + "build:safari": "NAME=jiffy-reader-safari TARGET=safari SHORTCUT=\"Alt+W\" MANIFEST_VERSION=safari-mv2 npm run buildx && npm run bundle:safari", + "gh:build:chrome": "TARGET=chrome SHORTCUT=\"Alt+B\" MANIFEST_VERSION=chrome-mv3 npm run buildx && npm run bundle:chrome", + "gh:build:opera": "TARGET=opera SHORTCUT=\"Alt+B\" MANIFEST_VERSION=chrome-mv3 npm run buildx && npm run bundle:opera", + "gh:build:firefox": "TARGET=firefox SHORTCUT=\"Alt+W\" MANIFEST_VERSION=firefox-mv2 npm run buildx && npm run bundle:firefox", + "gh:build:safari": "TARGET=safari SHORTCUT=\"Alt+W\" MANIFEST_VERSION=safari-mv2 npm run buildx && npm run bundle:safari", + "gh:build": "echo 'TAG=prod NODE_ENV=production npm run gh:build:' | xargs -I{} bash -c '{}opera && {}chrome & {}firefox & {}safari'", + "gh:build:development": "echo 'TAG=dev NODE_ENV=development npm run gh:build:' | xargs -I{} bash -c '{}opera && {}chrome & {}firefox & {}safari'", + "gh:build:bookmarklet": "VERSION=\"$(npm pkg get version | tr -d '\"')\" node src/Bookmarklet/esbuild.mjs", + "bundle": "npm run bundle:chrome & npm run bundle:firefix & npm run bundle:safari", + "bundle:firefox": "cd build/firefox-mv2-prod/ && zip -r ../jiffyReader-firefox-$TAG.xpi ./*", + "bundle:safari": "cd build/safari-mv2-prod/ && zip -r ../jiffyReader-safari-$TAG.xpi ./*", + "bundle:opera": " mv build/chrome-mv3-prod build/opera-mv3-prod && cd build/opera-mv3-prod && zip -r ../jiffyReader-opera-$TAG.crx ./*", + "bundle:chrome": "cd build/chrome-mv3-prod && zip -r ../jiffyReader-chrome-$TAG.zip ./*", + "build:ios": "xcrun safari-web-extension-converter --rebuild-project \"Jiffy reader/Jiffy reader.xcodeproj\"", + "build:xcode": "pnpm build:safari && xcrun safari-web-extension-converter --swift --no-open --force --bundle-identifier com.jiffyreader build/safari-mv2-prod", + "build:xcode:all": "pnpm build:xcode && pnpm build:ios", + "dev:xcode": "xcrun safari-web-extension-converter --swift --no-open --force --bundle-identifier com.jiffyreader build/safari-mv2-dev", + "release": "commit-and-tag-version" + }, + "dependencies": { + "@plasmohq/prettier-plugin-sort-imports": "^1.1.1", + "@plasmohq/storage": "^0.8.1", + "axios": "^1.6.5", + "commit-and-tag-version": "^12.5.0", + "cross-env": "^7.0.3", + "esbuild": "^0.14.53", + "esbuild-sass-plugin": "^2.3.1", + "mellowtel": "1.4.2", + "plasmo": "0.70.0", + "react": "18.2.0", + "react-dom": "18.2.0" + }, + "devDependencies": { + "@parcel/transformer-sass": "2.6.2", + "@types/chrome": "0.0.193", + "@types/firefox-webext-browser": "^111.0.1", + "@types/node": "18.6.1", + "@types/react": "18.0.15", + "@types/react-dom": "18.0.6", + "console-browserify": "^1.2.0", + "cws-publish": "^2.1.1", + "eslint-config-airbnb-base-typescript-prettier": "^4.1.0", + "prettier": "2.7.1", + "process": "^0.11.10", + "typescript": "4.7.4" + }, + "manifest": { + "name": "$NAME", + "target": "$TARGET", + "version": "$VERSION", + "tag": "$TAG", + "version_name": "$VERSION_NAME", + "environment": "$NODE_ENV", + "scope": "$TAG", + "description": "A Browser Extension for Faster Reading on ANY website!", + "default_locale": "en", + "permissions": [ + "activeTab", + "declarativeNetRequest", + "tabs" + ], + "host_permissions": [ + "" + ], + "commands": { + "toggle-bionic": { + "suggested_key": { + "default": "$SHORTCUT" + }, + "description": "Toggle bionic reading mode" + } + }, + "web_accessible_resources": [ + { + "resources": [ + "assets/icon512.png", + "assets/sun-light-solid.svg", + "assets/moon-solid.svg" + ], + "matches": [ + "" + ] + } + ] + }, + "repository": { + "type": "git", + "url": "https://github.com/ansh/jiffyreader.com" + }, + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/ansh/jiffyreader.com/issues" + }, + "homepage": "https://github.com/ansh/jiffyreader.com#readme" } From 15defa46bada19498e99f85e80a92de1a534b7b2 Mon Sep 17 00:00:00 2001 From: linuxdev Date: Tue, 24 Dec 2024 10:07:54 -0500 Subject: [PATCH 4/6] fix(ci): refactor --- .github/workflows/publish-release.yml | 2 +- .github/workflows/run-test-plasmo.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 6fe016e..0061ae3 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -56,7 +56,7 @@ jobs: git config --global user.name "gh-action" npm run release - . action.sh + make build@latest git push --follow-tags origin HEAD - name: Read version from package.json diff --git a/.github/workflows/run-test-plasmo.yml b/.github/workflows/run-test-plasmo.yml index fce9655..67b2984 100644 --- a/.github/workflows/run-test-plasmo.yml +++ b/.github/workflows/run-test-plasmo.yml @@ -55,5 +55,5 @@ jobs: git config --global user.name "gh-action" npm run release && head -n10 CHANGELOG.md - . action.sh + make build@latest From af40167d9a2b02255939eb6957de2c814eff2315 Mon Sep 17 00:00:00 2001 From: linuxdev Date: Tue, 24 Dec 2024 10:08:27 -0500 Subject: [PATCH 5/6] fix: sass build warings --- src/styles/contentStyle.scss | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/styles/contentStyle.scss b/src/styles/contentStyle.scss index 02dc62a..534aa79 100644 --- a/src/styles/contentStyle.scss +++ b/src/styles/contentStyle.scss @@ -1,3 +1,4 @@ +@use "sass:color"; $maxFixations: 4; $maxSaccadesInterval: 4; $activeFixationOpacity: 100%; @@ -44,13 +45,13 @@ $saccadesColorsBase: (0, $hue1), (1, $hue2), (2, $hue3), (3, $hue4); @mixin makeColorVariants($color, $id, $delta, $label) { &[saccades-color='#{$label}'] { br-bold:nth-of-type(#{$maxSaccadesInterval}n + #{$id}) { - --saccadesColor: #{adjust-color($color, $lightness: $delta)}; + --saccadesColor: #{color.adjust($color, $lightness: $delta)}; } } &[saccades-color='#{$label}-100'] { br-bold:nth-of-type(#{$maxSaccadesInterval}n + #{$id}) { - --saccadesColor: #{adjust-color($color, $lightness: $delta * 2.7)}; + --saccadesColor: #{color.adjust($color, $lightness: $delta * 2.7)}; } } } From 1ff3e3a413eec3c6831e129bca58eaa29bc3b03d Mon Sep 17 00:00:00 2001 From: linuxdev Date: Tue, 24 Dec 2024 10:12:36 -0500 Subject: [PATCH 6/6] fix(ci): run make test --- .github/workflows/publish-release.yml | 2 +- .github/workflows/run-test-plasmo.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 0061ae3..fa261c8 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -56,7 +56,7 @@ jobs: git config --global user.name "gh-action" npm run release - make build@latest + make build@latest test git push --follow-tags origin HEAD - name: Read version from package.json diff --git a/.github/workflows/run-test-plasmo.yml b/.github/workflows/run-test-plasmo.yml index 67b2984..8aa4075 100644 --- a/.github/workflows/run-test-plasmo.yml +++ b/.github/workflows/run-test-plasmo.yml @@ -55,5 +55,5 @@ jobs: git config --global user.name "gh-action" npm run release && head -n10 CHANGELOG.md - make build@latest + make build@latest test