Skip to content

Commit

Permalink
AG-31746 Compatibility table API
Browse files Browse the repository at this point in the history
Merge in ADGUARD-FILTERS/tsurlfilter from fix/AG-31746-ct-api to master

Squashed commit of the following:

commit acdf3e1
Merge: a009a0c d46b1af
Author: scripthunter7 <[email protected]>
Date:   Tue Jul 9 13:14:33 2024 +0200

    Merge branch 'master' into fix/AG-31746-ct-api

commit a009a0c
Author: scripthunter7 <[email protected]>
Date:   Tue Jul 9 13:07:57 2024 +0200

    update exports

commit f3a9a81
Author: scripthunter7 <[email protected]>
Date:   Mon Jul 8 20:14:00 2024 +0200

    improve docs

commit d47f1a6
Author: scripthunter7 <[email protected]>
Date:   Mon Jul 8 20:08:23 2024 +0200

    always deep freeze

commit ab6fc44
Author: scripthunter7 <[email protected]>
Date:   Mon Jul 8 19:45:30 2024 +0200

    fix nit

commit c7f1627
Author: scripthunter7 <[email protected]>
Date:   Mon Jul 8 19:36:28 2024 +0200

    fix nit

commit f29faf5
Author: scripthunter7 <[email protected]>
Date:   Mon Jul 8 19:35:10 2024 +0200

    separate safari content blockers

commit 8b866df
Author: scripthunter7 <[email protected]>
Date:   Mon Jul 8 19:17:17 2024 +0200

    fix style

commit 2c5cc06
Author: Slava Leleka <[email protected]>
Date:   Mon Jul 8 20:15:33 2024 +0300

    packages/agtree/scripts/build-compatibility-tables-wiki.ts edited online with Bitbucket

commit dad5b98
Author: Slava Leleka <[email protected]>
Date:   Mon Jul 8 20:15:22 2024 +0300

    packages/agtree/CHANGELOG.md edited online with Bitbucket

commit 61b3f02
Author: scripthunter7 <[email protected]>
Date:   Mon Jul 8 16:04:05 2024 +0200

    add check types to lint

commit af9009c
Author: scripthunter7 <[email protected]>
Date:   Mon Jul 8 14:13:05 2024 +0200

    update lock file

commit a99773f
Author: scripthunter7 <[email protected]>
Date:   Mon Jul 8 14:10:29 2024 +0200

    improve wiki generation

commit db04a43
Author: scripthunter7 <[email protected]>
Date:   Mon Jul 8 12:16:19 2024 +0200

    change enum

commit 843900e
Author: scripthunter7 <[email protected]>
Date:   Mon Jul 8 12:15:55 2024 +0200

    update todo list

commit 42e1e69
Author: scripthunter7 <[email protected]>
Date:   Fri Jul 5 23:09:11 2024 +0200

    export some helpers

commit 15cb72d
Author: scripthunter7 <[email protected]>
Date:   Fri Jul 5 23:06:14 2024 +0200

    remove prefix

commit 30c86c6
Author: scripthunter7 <[email protected]>
Date:   Fri Jul 5 23:04:22 2024 +0200

    fix linter warning

commit cfac415
Author: scripthunter7 <[email protected]>
Date:   Fri Jul 5 23:04:16 2024 +0200

    check types for scripts

commit 3167b7a
Author: scripthunter7 <[email protected]>
Date:   Fri Jul 5 23:00:10 2024 +0200

    jsdoc

... and 53 more commits
  • Loading branch information
scripthunter7 committed Jul 9, 2024
1 parent d46b1af commit 2144959
Show file tree
Hide file tree
Showing 191 changed files with 5,248 additions and 1,314 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
# agtree
npx lerna run --scope @adguard/agtree check-types
npx lerna run --scope @adguard/agtree check-compatibility-tables
npx lerna run --scope @adguard/agtree lint
npx lerna run --scope @adguard/agtree test
npx lerna run --scope @adguard/agtree build
Expand Down
6 changes: 3 additions & 3 deletions bamboo-specs/agtree-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ Test:
# Check TypeScript types with TSC
pnpm --filter @adguard/agtree check-types
# Validate compatibility tables
pnpm --filter @adguard/agtree check-compatibility-tables
# Check code with ESLint
pnpm --filter @adguard/agtree lint
# Run tests with Jest
pnpm --filter @adguard/agtree test
# Build should work
pnpm --filter @adguard/agtree build
final-tasks:
- script:
interpreter: SHELL
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
},
"devDependencies": {
"lerna": "^8.1.2"
}
},
"packageManager": "[email protected]+sha512.ea45517d5285d123eac02c3793505fa1fd6da90a2fc60d1e8d9e0c1e9292886ecfaff513f062b9d1cc8021bb8615033b1ac5bea3b2ee3fc165a6d7034bbe6b03"
}
16 changes: 16 additions & 0 deletions packages/agtree/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ The format is based on [Keep a Changelog][keepachangelog], and this project adhe
[keepachangelog]: https://keepachangelog.com/en/1.0.0/
[semver]: https://semver.org/spec/v2.0.0.html

## Unreleased

### Added

- Compatibility table API.
- Compatibility table wiki, which is generated from the compatibility table API.

### Changed

- Reworked the compatibility table structure.
- Library now use CJS.

### Removed

- Scriptlets library, since it is not needed anymore, because AGTree now has its own compatibility tables.

## 1.1.8 - 2024-04-24

### Added
Expand Down
5 changes: 3 additions & 2 deletions packages/agtree/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ During development, you can use the following commands (listed in `package.json`
- `pnpm build` - builds the library with [rollup][rollup] to the `dist` folder
- `pnpm build-txt` - creates a `dist/build.txt` file which contains the version of the library.
- `pnpm build-types` - build type definitions with [TypeScript][typescript] to the `dist/types` folder.
- `pnpm check-compatibility-tables` - checks if the [compatibility tables][compatibility-tables] are valid.
- `pnpm build-compatibility-tables` - build compatibility tables to `dist/compatibility-tables.json` file.
This is a transformed data structure that is used by the library.
- `build-compatibility-tables-wiki` - build compatibility tables to Markdown files in the `wiki` folder.
- `pnpm check-types` - check type definitions with [TypeScript][typescript].
- `pnpm clean` - remove the `dist` folder.
- `pnpm clean-types` - remove the `dist/types` folder.
Expand All @@ -55,7 +57,6 @@ During development, you can use the following commands (listed in `package.json`
- `pnpm precommit` - run all checks before committing.
- `pnpm test` - run tests with [Jest][jest].

[compatibility-tables]: https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree/src/compatibility-tables
[contribute]: https://adguard.com/contribute.html
[eslint]: https://eslint.org/
[git]: https://git-scm.com/
Expand Down
2 changes: 0 additions & 2 deletions packages/agtree/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ const config: Config = {
testTimeout: 30000,
testMatch: ['**/test/**/*.test.ts'],
transform: {
// Enable importing YAML files while testing
'.yml': 'yaml-jest-transform',
// Speed up tests by using SWC instead of Babel
'.ts': '@swc/jest',
},
Expand Down
27 changes: 14 additions & 13 deletions packages/agtree/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"url": "https://github.com/AdguardTeam/tsurlfilter/issues"
},
"homepage": "https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme",
"type": "module",
"main": "dist/agtree.cjs",
"module": "dist/agtree.esm.js",
"browser": "dist/agtree.umd.min.js",
Expand All @@ -42,16 +41,17 @@
"node": ">=14"
},
"scripts": {
"build": "pnpm clean && pnpm build-types && pnpm build-txt && pnpm rollup --config rollup.config.ts --configPlugin typescript && pnpm clean-types",
"build-txt": "node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/build-txt.ts",
"build": "pnpm clean && pnpm build-types && pnpm build-txt && pnpm build-compatibility-tables && pnpm build-compatibility-tables-wiki && pnpm rollup --config rollup.config.ts --configPlugin typescript && pnpm clean-types",
"build-txt": "tsx scripts/build-txt.ts",
"build-types": "tsc --declaration --emitDeclarationOnly --outdir dist/types",
"check-compatibility-tables": "node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/check-compatibility-tables.ts",
"build-compatibility-tables": "tsx scripts/build-compatibility-tables.ts",
"build-compatibility-tables-wiki": "tsx scripts/build-compatibility-tables-wiki.ts",
"check-types": "tsc --noEmit",
"clean": "rimraf dist",
"clean-types": "rimraf dist/types",
"coverage": "jest --runInBand --coverage",
"increment": "pnpm version patch --no-git-tag-version",
"lint": "pnpm lint:ts && pnpm lint:md",
"lint": "pnpm check-types && pnpm lint:ts && pnpm lint:md",
"lint:md": "markdownlint .",
"lint:ts": "eslint . --cache --ext .ts",
"precommit": "pnpm check-types && pnpm lint && pnpm test",
Expand All @@ -67,18 +67,18 @@
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-terser": "^0.4.3",
"@rollup/plugin-typescript": "^11.1.2",
"@rollup/plugin-yaml": "^4.1.1",
"@swc/core": "^1.3.100",
"@swc/helpers": "^0.5.3",
"@swc/jest": "^0.2.29",
"@types/clone-deep": "^4.0.1",
"@types/fs-extra": "^11.0.4",
"@types/jest": "^29.5.3",
"@types/jest": "^29.5.12",
"@types/js-yaml": "^4.0.5",
"@types/node": "^20.2.3",
"@types/semver": "^7.5.0",
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"camelcase-keys": "^7.0.2",
"eslint": "^8.43.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-plugin-import": "^2.27.5",
Expand All @@ -89,27 +89,28 @@
"jest": "^29.5.0",
"js-yaml": "^4.1.0",
"jsdoc": "^4.0.2",
"markdown-table": "^3.0.3",
"markdownlint": "^0.29.0",
"markdownlint-cli": "^0.35.0",
"prettier": "^3.3.2",
"regenerator-runtime": "^0.14.0",
"rimraf": "^5.0.1",
"rollup": "^3.25.3",
"rollup-plugin-dts": "^5.3.0",
"rollup-plugin-node-externals": "^6.1.1",
"rollup-plugin-polyfill-node": "^0.12.0",
"superstruct": "^1.0.3",
"ts-node": "^10.9.2",
"typescript": "^5.0.4",
"yaml-jest-transform": "^2.0.2",
"zod": "^3.22.2"
"tsx": "^4.7.3",
"type-fest": "^4.18.0",
"typescript": "^5.0.4"
},
"dependencies": {
"@adguard/ecss-tree": "^1.0.8",
"@adguard/scriptlets": "^1.9.61",
"clone-deep": "^4.0.1",
"json5": "^2.2.3",
"semver": "^7.5.3",
"tldts": "^5.7.112",
"xregexp": "^5.1.1"
"xregexp": "^5.1.1",
"zod": "^3.23.4"
}
}
17 changes: 12 additions & 5 deletions packages/agtree/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ import alias from '@rollup/plugin-alias';
import { getBabelOutputPlugin } from '@rollup/plugin-babel';
import json from '@rollup/plugin-json';
import terser from '@rollup/plugin-terser';
import yaml from '@rollup/plugin-yaml';
import path from 'path';
import { readFileSync } from 'fs';
import path from 'node:path';
import { readFileSync } from 'node:fs';

const ROOT_DIR = './';
const BASE_FILE_NAME = 'agtree';
Expand Down Expand Up @@ -62,8 +61,16 @@ const typeScriptPlugin = typescript({

// Common plugins for all types of builds
const commonPlugins = [
alias({
entries: [
// replace dynamic compatibility table data builder with the pre-built data file
{
find: './compatibility-table-data',
replacement: path.resolve(ROOT_DIR, 'dist', 'compatibility-tables.json'),
},
],
}),
json({ preferConst: true }),
yaml(),
commonjs({ sourceMap: false }),
resolve({ preferBuiltins: false }),
typeScriptPlugin,
Expand Down Expand Up @@ -97,7 +104,7 @@ const browserPlugins = [
entries: [
{
find: '@adguard/ecss-tree',
replacement: path.join(
replacement: path.resolve(
'node_modules/@adguard/ecss-tree/dist/ecsstree.umd.min.js',
),
},
Expand Down
Loading

0 comments on commit 2144959

Please sign in to comment.