From 8fcf505b141be3e24dadd9799fdc329241478c67 Mon Sep 17 00:00:00 2001 From: Guillaume Vincent Date: Fri, 19 Jul 2019 09:49:22 +0200 Subject: [PATCH] Clean web extension build process --- bin/build_web_extensions | 20 + bin/tag | 2 + package.json | 2 - packages/lesspass-web-extension/amo.md | 17 +- .../extension/dist/index.html | 2 - .../extension/dist/lesspass.min.css | 555 +++++++--------- .../extension/dist/lesspass.min.css.map | 2 +- .../extension/dist/lesspass.min.js | 30 +- .../lesspass-web-extension/extension/dist/popup.js | 7 - .../lesspass-web-extension/extension/manifest.json | 5 +- .../lesspass-web-extension/extension/popup.html | 2 +- packages/lesspass-web-extension/package.json | 12 +- yarn.lock | 714 +-------------------- 13 files changed, 298 insertions(+), 1072 deletions(-) create mode 100755 bin/build_web_extensions delete mode 100644 packages/lesspass-web-extension/extension/dist/popup.js diff --git a/bin/build_web_extensions b/bin/build_web_extensions new file mode 100755 index 0000000..09c5062 --- /dev/null +++ b/bin/build_web_extensions @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -o errexit +set -o pipefail +set -o nounset + +VERSION=$(grep -Po '(?<="version": ")[^"]*' package.json) +yarn install +yarn workspace lesspass-pure run build +rm -rf packages/lesspass-web-extension/extension/dist +mkdir packages/lesspass-web-extension/extension/dist +rm -rf packages/lesspass-web-extension/build +mkdir packages/lesspass-web-extension/build +cp -r packages/lesspass-pure/dist/. packages/lesspass-web-extension/extension/dist/ +cd packages/lesspass-web-extension/extension/ +zip --recurse-paths ../build/lesspass.zip ./* +cd .. +cp build/lesspass.zip build/lesspass.firefox-v${VERSION}.xpi +cp build/lesspass.zip build/lesspass.chrome-v${VERSION}.zip +rm build/lesspass.zip \ No newline at end of file diff --git a/bin/tag b/bin/tag index 6d79a98..821639d 100755 --- a/bin/tag +++ b/bin/tag @@ -56,6 +56,8 @@ function replace_versions_in_files { sed -i "s/\"lesspass\": \"${1}\"/\"lesspass\": \"${2}\"/g" packages/lesspass-pure/package.json sed -i "s/\"version\": \"${1}\"/\"version\": \"${2}\"/g" packages/lesspass-render-password/package.json sed -i "s/\"version\": \"${1}\"/\"version\": \"${2}\"/g" packages/lesspass-web-extension/package.json + sed -i "s/\"lesspass-pure\": \"${1}\"/\"lesspass-pure\": \"${2}\"/g" packages/lesspass-web-extension/package.json + sed -i "s/\"version\": \"${1}\"/\"version\": \"${2}\"/g" packages/lesspass-web-extension/extension/manifest.json sed -i "s/\"version\": \"${1}\"/\"version\": \"${2}\"/g" containers/frontend/package.json sed -i "s/VERSION=\"${1}\"/VERSION=\"${2}\"/g" containers/deploy } diff --git a/package.json b/package.json index a0e0517..9bfd841 100644 --- a/package.json +++ b/package.json @@ -29,10 +29,8 @@ "cross-env": "^5.2.0", "css-loader": "^3.0.0", "cypress": "^3.4.0", - "dot-json": "^1.1.0", "express": "^4.17.1", "file-loader": "^4.0.0", - "gulp": "^4.0.2", "html-webpack-plugin": "^3.2.0", "http-server": "^0.11.1", "jest": "^24.8.0", diff --git a/packages/lesspass-web-extension/amo.md b/packages/lesspass-web-extension/amo.md index 1b31ba4..28d59fd 100644 --- a/packages/lesspass-web-extension/amo.md +++ b/packages/lesspass-web-extension/amo.md @@ -11,13 +11,14 @@ npm --version: v6.4.1 untar src and install dependencies - cd packages/lesspass-web-extension/ - npm install && npm run build - cd extension - find . -type f -exec md5sum {} \; | md5sum + yarn install + ./bin/build_web_extensions + cd packages/lesspass-web-extension/build + find . -type f -exec md5sum {} \; -## Reproduce lesspass.min.js with sources +## Reproduce lesspass.min.js and dist folder with sources - cd packages/lesspass-pure/ - npm install && npm run build - md5sum dist/lesspass.min.js + yarn install + yarn workspace lesspass-pure run build + find packages/lesspass-web-extension/extension/dist/ -type f -exec md5sum {} \; + find packages/lesspass-pure/dist -type f -exec md5sum {} \; diff --git a/packages/lesspass-web-extension/extension/dist/index.html b/packages/lesspass-web-extension/extension/dist/index.html index a00e12c..a14da73 100644 --- a/packages/lesspass-web-extension/extension/dist/index.html +++ b/packages/lesspass-web-extension/extension/dist/index.html @@ -9,7 +9,6 @@ content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> -