Skip to content

Commit

Permalink
Setup release commands
Browse files Browse the repository at this point in the history
  • Loading branch information
perry-mitchell committed Mar 21, 2024
1 parent 1205c73 commit c841aa2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,16 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run test:format
release:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v2
- name: Node.js specs ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run release
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@
"type": "module",
"types": "./dist/background/index.d.ts",
"scripts": {
"build": "run-s clean set-version build:production",
"build": "run-s set-version build:production",
"build:chrome": "BROWSER=chrome npm run build",
"build:edge": "BROWSER=edge npm run build",
"build:firefox": "BROWSER=firefox npm run build",
"build:production": "webpack --mode production --progress --config webpack.config.js",
"clean": "rimraf dist/* release/*",
"dev": "npm run clean && npm run set-version && webpack --mode development -w --progress --config webpack.config.js",
"dev:chrome": "BROWSER=chrome npm run dev",
"dev:firefox": "concurrently -k \"BROWSER=firefox npm run dev\" \"cd dist && web-ext run\" --restart-tries 20 --restart-after 5000",
"format": "prettier --write '{{source,test}/**/*.{ts,js},webpack.config.js}'",
"release": "npm run build && mkdirp release release/chrome release/firefox release/edge && run-s release:chrome release:firefox release:edge",
"release:chrome": "zip -r release/chrome/extension.zip ./dist",
"release:edge": "zip -r release/edge/extension.zip ./dist",
"release:firefox": "run-s release:firefox:extension release:firefox:source",
"release": "run-s clean release:chrome release:firefox release:edge",
"release:chrome": "npm run build:chrome && mkdirp release/chrome && zip -r release/chrome/extension.zip ./dist",
"release:edge": "npm run build:edge && mkdirp release/edge && zip -r release/edge/extension.zip ./dist",
"release:firefox": "npm run build:firefox && mkdirp release/firefox && run-s release:firefox:extension release:firefox:source",
"release:firefox:extension": "cd dist && web-ext build --overwrite-dest && cd .. && mv ./dist/web-ext-artifacts/*.zip ./release/firefox/",
"release:firefox:source": "zip -r release/firefox/source.zip . --exclude=/.git* --exclude=/node_modules* --exclude=/.history* --exclude=/dist* --exclude=/release* --exclude=*.DS_Store*",
"set-version": "node scripts/version.js",
Expand Down
3 changes: 2 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import manifestV3 from "./resources/manifest.v3.json" assert { type: "json" };

const { BannerPlugin } = webpack;
const { BROWSER } = process.env;
const V3_BROWSERS = ["chrome", "edge"];
const require = createRequire(import.meta.url);
const __dirname = fileURLToPath(new URL(".", import.meta.url));
const DIST = path.resolve(__dirname, "dist");
Expand Down Expand Up @@ -157,7 +158,7 @@ export default [
compiler.hooks.afterEmit.tap("AfterEmitPlugin", (compilation) => {
buildManifest(
Object.keys(compilation.getStats().compilation.assets),
BROWSER === "chrome" ? manifestV3 : manifestV2
V3_BROWSERS.includes(BROWSER) ? manifestV3 : manifestV2
);
});
}
Expand Down

0 comments on commit c841aa2

Please sign in to comment.