diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9e6bdd8f..59c1b2bb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,7 @@ jobs: - name: Update filterlist run: | npm run update-filterlist - git add lib/filterlist-engine.ts + git add -f lib/filterlist-engine.ts git commit -m "update filterlist [skip ci]" git push diff --git a/package.json b/package.json index ca74909a..603f4673 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "clean": "rm -r dist", "lint": "eslint addon/ lib/ playwright/ tests/ tests-wtr/ rules/autoconsent/*.json", "bundle": "./build.sh", - "watch": "npm run prepublish && chokidar \"lib\" \"addon\" \"rules/autoconsent\" \"rules/filterlist.txt\" \"rules/filterlist-overrides.txt\" --ignore 'lib/filterlist-engine.ts' -c \"npm run prepublish\"", + "build-all": "npm run rebuild-filterlist && npm run build-rules && npm run bundle", + "watch": "npm run prepublish && chokidar \"lib\" \"addon\" \"rules/autoconsent\" \"rules/filterlist.txt\" \"rules/filterlist-overrides.txt\" --ignore 'lib/filterlist-engine.ts' -c \"npm run build-all\"", "create-rule": "node rules/create-rule.mjs", "test": "playwright test", "test:webkit": "playwright test --project webkit", @@ -25,7 +26,7 @@ "build-rules": "node rules/build.mjs", "version": "node update_version.js && git add addon/manifest.*.json", "vendor-copy": "mkdir -p addon/vendor && cp node_modules/mocha/mocha.* addon/vendor/ && cp node_modules/chai/chai.js addon/vendor/", - "prepublish": "npm run rebuild-filterlist && npm run build-rules && npm run bundle", + "prepublish": "npm run update-filterlist && npm run build-all", "launch:firefox": "web-ext run -s dist/addon-firefox", "release": "auto shipit", "get-text-for-xpath": "ts-node scripts/get-text-for-xpath.ts" diff --git a/readme.md b/readme.md index 012b467e..27fdb0c6 100644 --- a/readme.md +++ b/readme.md @@ -11,7 +11,7 @@ The web extension can be built with the following steps: ```bash # Download dependencies -npm ci +npm install # Build the extension npm run prepublish ``` @@ -22,6 +22,15 @@ You can load these in [Chrome](https://developer.chrome.com/docs/extensions/mv3/ in developer mode, and in [Firefox](https://extensionworkshop.com/documentation/develop/temporary-installation-in-firefox/) as a temporary addon. +### Watch mode +For development, you can run in watch mode + +```bash +npm run watch +``` + +This will rebuild the extension on every source file change. You still need to refresh the extension in the browser to see the changes. + ## Rules The library's functionality is implemented as a set of rules that define how to manage consent on diff --git a/rules/rebuild-filterlist.mjs b/rules/rebuild-filterlist.mjs index c7bf1dab..98e76a27 100644 --- a/rules/rebuild-filterlist.mjs +++ b/rules/rebuild-filterlist.mjs @@ -23,6 +23,6 @@ fs.writeFile( path.join(rulesDir, "../lib/filterlist-engine.ts"), `export const serializedEngine = new Uint8Array( ${engineJson} - );`, +);`, () => console.log("Written filterlist-engine.ts") );