|
1 |
| -# TSUrlFilter |
| 1 | +# TSUrlFilter libraries |
2 | 2 |
|
3 |
| -This repo contains typescript packages implementing AdGuard filtering engine. |
| 3 | +This repo contains typescript packages that implement AdGuard filtering engine. |
4 | 4 |
|
5 |
| -## Packages: |
| 5 | +## Packages |
6 | 6 |
|
7 |
| -- tsurlfilter |
8 |
| -- tswebextension |
9 |
| -- adguard-api |
10 |
| -- agtree |
11 |
| -- examples/manifest-v2 |
12 |
| -- examples/manifest-v3 |
13 |
| -- examples/tswebextension-example |
14 |
| -- examples/tswebextension-mv3 |
| 7 | +- `tsurlfilter` |
| 8 | +- `tswebextension` |
| 9 | +- `adguard-api` |
| 10 | +- `agtree` |
| 11 | +- `examples/manifest-v2` |
| 12 | +- `examples/manifest-v3` |
| 13 | +- `examples/tswebextension-example` |
| 14 | +- `examples/tswebextension-mv3` |
15 | 15 |
|
16 | 16 | See packages details in `./packages`.
|
17 | 17 |
|
18 | 18 | ### TSUrlFilter
|
19 | 19 |
|
20 |
| -TSUrlFilter is a TypeScript library that implements AdGuard's blocking rules logic. |
21 |
| -See details in [`./packages/tsurlfilter`](/packages/tsurlfilter/README.md). |
| 20 | +TSUrlFilter is a TypeScript library that implements AdGuard's blocking rules |
| 21 | +logic. See details in [`./packages/tsurlfilter`][tsurlfilterreadme]. |
| 22 | + |
| 23 | +[tsurlfilterreadme]: /packages/tsurlfilter/README.md |
22 | 24 |
|
23 | 25 | ### TSWebExtension
|
24 | 26 |
|
25 |
| -TSWebExtension is a TypeScript library that wraps webextension api for tsurlfilter library. |
26 |
| -See details in [`./packages/tswebextension`](/packages/tswebextension/README.md). |
| 27 | +TSWebExtension is a TypeScript library that wraps webextension api for the |
| 28 | +tsurlfilter library. See details in |
| 29 | +[`./packages/tswebextension`][tswebextensionreadme]. |
| 30 | + |
| 31 | +[tswebextensionreadme]: /packages/tswebextension/README.md |
27 | 32 |
|
28 | 33 | ### AdGuard API
|
29 | 34 |
|
30 |
| -AdGuard API is a TypeScript filtering library that provides filter list management, ad filtering via [@adguard/tswebextension](/packages/tswebextension/README.md). |
31 |
| -See details in [`./packages/adguard-api`](/packages/adguard-api/README.md). |
| 35 | +AdGuard API is a TypeScript filtering library that provides filter list |
| 36 | +management, ad filtering via [@adguard/tswebextension][tswebextensionreadme]. |
| 37 | +See details in [`./packages/adguard-api`][adguardapireadme]. |
32 | 38 |
|
33 |
| -### Sample extensions |
| 39 | +[adguardapireadme]: /packages/adguard-api/README.md |
34 | 40 |
|
35 |
| -Source code of the sample extensions is located in the directory `./packages/examples`. |
| 41 | +### AGTree |
36 | 42 |
|
37 |
| -To build sample manifest-v2 extension go to the one of the examples and run: |
38 |
| -``` |
39 |
| -$ lerna bootstrap && lerna run --scope manifest-v2 build |
40 |
| -``` |
41 |
| -Reciprocally with manifest-v3: |
42 |
| -``` |
43 |
| -$ lerna bootstrap && lerna run --scope manifest-v3 build |
44 |
| -``` |
45 |
| -and |
46 |
| -``` |
47 |
| -$ lerna bootstrap && lerna run --scope tswebextension-example build |
48 |
| -``` |
| 43 | +AGTree is an AST implementation for adguard filtering rules. See details in |
| 44 | +[`./packages/agtree`][agtreereadme]. |
49 | 45 |
|
50 |
| -After that it's ready to be added to Chrome using "Load unpacked" in developer mode. |
| 46 | +[agtreereadme]: /packages/agtree/README.md |
51 | 47 |
|
52 |
| -To test if this extension works correctly you can use next test pages: |
| 48 | +## Development |
53 | 49 |
|
54 |
| -Test pages: |
55 |
| -- [Simple rules test](http://testcases.adguard.com/Filters/simple-rules/test-simple-rules.html) |
56 |
| -- [Script rules test](http://testcases.adguard.com/Filters/script-rules/test-script-rules.html) |
| 50 | +Prepare your local environment. |
57 | 51 |
|
| 52 | +```shell |
| 53 | +# Install dev dependencies and lerna locally. |
| 54 | +yarn install |
58 | 55 |
|
59 |
| -## Development |
| 56 | +# Prepare and build tswebextension package as they are required for |
| 57 | +# bootstrapping examples. |
| 58 | +npx lerna bootstrap --scope=@adguard/tswebextension --include-dependencies |
| 59 | +npx lerna run build --scope=@adguard/tswebextension |
60 | 60 |
|
61 |
| -``` |
62 |
| -npm install -g lerna |
| 61 | +# Bootstrap all packages. |
| 62 | +npx lerna bootstrap |
63 | 63 | ```
|
64 | 64 |
|
65 |
| -``` |
66 |
| -lerna bootstrap |
67 |
| -``` |
| 65 | +Bootstraps packages in the current repo. Installs all their dependencies and |
| 66 | +linking any cross-dependencies. |
68 | 67 |
|
69 |
| -Bootstrap the packages in the current repo. Installing all their dependencies and linking any cross-dependencies. |
| 68 | +**Note**: If you want to use another linked packages in monorepo workspace, link |
| 69 | +it in root folder. |
70 | 70 |
|
71 |
| -**Note**: If you want to use another linked packages in monorepo workspace, link it in root folder |
| 71 | +Runs tests in all packages: |
72 | 72 |
|
73 |
| -``` |
74 |
| -lerna run test |
| 73 | +```shell |
| 74 | +npx lerna run test |
75 | 75 | ```
|
76 | 76 |
|
77 |
| -Runs tests in all packages. |
| 77 | +Builds the packages in the current repo: |
78 | 78 |
|
| 79 | +```shell |
| 80 | +npx lerna run build |
79 | 81 | ```
|
80 |
| -lerna run build |
81 |
| -``` |
82 | 82 |
|
83 |
| -Builds the packages in the current repo. |
| 83 | +### Sample extensions |
| 84 | + |
| 85 | +Source code of sample extensions can be found in `./packages/examples`. |
| 86 | + |
| 87 | +- `npx lerna run build --scope tswebextension-mv2` - MV2 sample extension. |
| 88 | +- `npx lerna run build --scope tswebextension-mv3` - MV3 sample extension. |
| 89 | +- `npx lerna run build --scope adguard-api-example` - AdGuard API example. |
| 90 | + |
| 91 | +To test if this extension works correctly you can use the following test pages: |
| 92 | + |
| 93 | +Test pages: |
| 94 | + |
| 95 | +- [Simple rules test][testcasessimplerules] |
| 96 | +- [Script rules test][testcasesscriptrules] |
| 97 | + |
| 98 | +[testcasessimplerules]: https://testcases.agrd.dev/Filters/simple-rules/test-simple-rules.html |
| 99 | +[testcasesscriptrules]: https://testcases.agrd.dev/Filters/script-rules/test-script-rules.html |
0 commit comments