Skip to content

Commit

Permalink
NPM workspaces manage all dependencies (#984)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrmod committed Jan 17, 2023
1 parent 5e2ac38 commit 2a23a6f
Show file tree
Hide file tree
Showing 24 changed files with 38,748 additions and 5,435 deletions.
13 changes: 3 additions & 10 deletions .github/workflows/test-extension-manifest-v2.yml
Expand Up @@ -18,19 +18,10 @@ jobs:
with:
cache: 'npm'
node-version: '18'
cache-dependency-path: ./extension-manifest-v2/package-lock.json
cache-dependency-path: ./package-lock.json
- name: Install dependencies in repo root
run: npm ci
working-directory: .
- name: Install dependencies in libs
run: npm ci
working-directory: libs
- name: Install dependencies in ui
run: npm ci
working-directory: ui
- name: Install dependencies
run: |
npm ci
- name: Build Licenses
run: |
npm run licenses
Expand All @@ -40,4 +31,6 @@ jobs:
- name: Test
run: |
npm run test
- name: Build
run: npm run build.prod

17 changes: 5 additions & 12 deletions .github/workflows/test-extension-manifest-v3.yml
Expand Up @@ -18,18 +18,11 @@ jobs:
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: ./extension-manifest-v3/package-lock.json
cache-dependency-path: ./package-lock.json
- name: Install dependencies in repo root
run: npm ci
working-directory: .
- name: Install dependencies in libs
run: npm ci
working-directory: libs
- name: Install dependencies in ui
run: npm ci
working-directory: ui
- name: Install dependencies
run: |
npm ci
- run: npm ci --ignore-scripts
- run: npm test
- name: Test
run: npm test
- name: Build
run: npm run build
6 changes: 4 additions & 2 deletions .github/workflows/test-libs.yml
Expand Up @@ -18,6 +18,8 @@ jobs:
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: ./libs/package-lock.json
- run: npm ci
cache-dependency-path: ./package-lock.json
- name: Install dependencies in repo root
run: npm ci
working-directory: .
- run: npm run lint
6 changes: 4 additions & 2 deletions .github/workflows/test-ui.yml
Expand Up @@ -18,6 +18,8 @@ jobs:
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: ./ui/package-lock.json
- run: npm ci
cache-dependency-path: ./package-lock.json
- name: Install dependencies in repo root
run: npm ci
working-directory: .
- run: npm run lint
10 changes: 0 additions & 10 deletions extension-manifest-v2/.gitignore
Expand Up @@ -2,10 +2,6 @@
dist/
build/

## Node
node_modules/
npm-debug.log

## Development Files
*.swp
*.pem
Expand All @@ -31,9 +27,3 @@ out/

## Jest
coverage/

## OSX
.DS_Store

## Other Files
bug-list.md
2 changes: 0 additions & 2 deletions extension-manifest-v2/README.md
Expand Up @@ -22,8 +22,6 @@ Node.js 18 (or higher) is required to build the extension.

```sh
$ (cd .. && npm ci)
$ (cd ../libs && npm ci)
$ npm ci
```

## Building
Expand Down
11 changes: 5 additions & 6 deletions extension-manifest-v2/package.json
Expand Up @@ -24,16 +24,16 @@
"docs": "jsdoc -c jsdoc.json -d docs -r",
"leet": "node ./tools/leet/leet-en.js",
"leet.reset": "node ./tools/leet/leet-reset.js",
"postinstall": "patch-package && vendor-copy && npm run licenses",
"postinstall": "vendor-copy && npm run licenses",
"locales.wtm": "hybrids extract -c --format=chrome.i18n node_modules/@whotracksme/webextension-packages/packages ./_locales/en/messages.json",
"locales.ui": "hybrids extract -c --format=chrome.i18n node_modules/@ghostery/ui ./_locales/en/messages.json",
"locales.src": "hybrids extract -c --format=chrome.i18n ./app ./_locales/en/messages.json",
"locales": "npm run locales.wtm && npm run locales.ui && npm run locales.src"
},
"vendorCopy": [
{
"from": "node_modules/ghostery-common/build/gbe/assets",
"to": "common"
"from": "../node_modules/ghostery-common/build/gbe/assets",
"to": "./common"
}
],
"repository": {
Expand All @@ -57,9 +57,9 @@
"foundation-sites": "^6.6.2",
"ghostery-common": "^1.2.48",
"history": "^4.10.1",
"hybrids": "^8.1.10",
"hybrids": "^8.1.13",
"json-api-normalizer": "^1.0.4",
"linkedom": "0.14.12",
"linkedom": "^0.14.21",
"moment": "^2.29.1",
"prop-types": "^15.6.2",
"react": "^16.13.1",
Expand Down Expand Up @@ -99,7 +99,6 @@
"mini-css-extract-plugin": "^2.7.2",
"oboe": "^2.1.5",
"os-browserify": "^0.3.0",
"patch-package": "^6.5.0",
"path": "^0.12.7",
"react-router": "^5.2.0",
"react-test-renderer": "^16.13.1",
Expand Down
41 changes: 0 additions & 41 deletions extension-manifest-v2/patches/webextension-polyfill+0.7.0.patch

This file was deleted.

3 changes: 1 addition & 2 deletions extension-manifest-v2/webpack.config.js
Expand Up @@ -77,7 +77,6 @@ module.exports = {

// Sass
foundation: [`${SASS_DIR}/vendor/foundation.scss`],
licenses: [`${SASS_DIR}/licenses.scss`],
purplebox_styles: [`${SASS_DIR}/purplebox.scss`],
trackers_preview_content_script_styles: [`${SASS_DIR}/trackers-preview_content_script.scss`],
},
Expand Down Expand Up @@ -177,7 +176,7 @@ module.exports = {
implementation: sass,
sassOptions: {
includePaths: [
path.resolve(__dirname, 'node_modules/foundation-sites/scss'),
path.resolve(__dirname, '../node_modules/foundation-sites/scss'),
path.resolve(__dirname, 'app/scss'),
]
}
Expand Down
4 changes: 1 addition & 3 deletions extension-manifest-v3/.gitignore
@@ -1,5 +1,3 @@
.DS_Store
node_modules
build
tmp
dist
Expand All @@ -13,4 +11,4 @@ web-ext-artifacts/
# xcode
*.xcuserstate
xcuserdata
*.xcloc
*.xcloc
2 changes: 0 additions & 2 deletions extension-manifest-v3/README.md
Expand Up @@ -10,8 +10,6 @@ First, you need to install JavaScript dependencies and download additional resou

```sh
$ (cd .. && npm ci)
$ (cd ../libs && npm ci)
$ npm ci
```

Now everything is ready. Change the code, and run it in Chrome:
Expand Down
5 changes: 2 additions & 3 deletions extension-manifest-v3/package.json
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"download-cosmetics": "node scripts/download-cosmetics.js",
"download-dnr-lists": "node scripts/download-dnr-lists.js",
"postinstall": "patch-package && npm run download-cosmetics && npm run download-dnr-lists",
"postinstall": "npm run download-cosmetics && npm run download-dnr-lists",
"build": "node scripts/build.js",
"build.chromium": "npm run build -- --target chromium",
"build.safari": "npm run build -- --target safari",
Expand All @@ -33,7 +33,6 @@
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"node-fetch": "^3.2.3",
"patch-package": "^6.5.0",
"prettier": "^2.6.1",
"rimraf": "^3.0.2",
"shelljs": "^0.8.5",
Expand All @@ -49,7 +48,7 @@
"@ghostery/ui": "file:../ui",
"@github/relative-time-element": "^4.1.5",
"@whotracksme/webextension-packages": "^2.1.0",
"hybrids": "^8.1.12",
"hybrids": "^8.1.13",
"lodash-es": "^4.17.21",
"tldts-experimental": "^5.7.66"
},
Expand Down
2 changes: 1 addition & 1 deletion extension-manifest-v3/scripts/download-cosmetics.js
Expand Up @@ -13,7 +13,7 @@ import { readFile } from 'fs/promises';
import fetch from 'node-fetch';

const pkg = JSON.parse(
await readFile(new URL('../package-lock.json', import.meta.url)),
await readFile(new URL('../../package-lock.json', import.meta.url)),
);

const adblockerVersion = pkg.dependencies['@cliqz/adblocker'].version;
Expand Down
1 change: 1 addition & 0 deletions extension-manifest-v3/scripts/download-dnr-lists.js
Expand Up @@ -30,6 +30,7 @@ try {
});

writeJSONPlaceholder('categories.json', {});
writeJSONPlaceholder('companies.json', {});
writeJSONPlaceholder('trackers.json', {});
writeJSONPlaceholder('tracker_domains.json', {});

Expand Down

0 comments on commit 2a23a6f

Please sign in to comment.