Skip to content

Commit

Permalink
Update the build scripts to update filterlist when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
muodov committed Oct 16, 2024
1 parent cb7bf56 commit 5a9db3b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand Down
11 changes: 10 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rules/rebuild-filterlist.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
);

0 comments on commit 5a9db3b

Please sign in to comment.