chore: Add dependency consistency checker
ADD
.github/workflows/depcheck.yml
+name: Test project mutual dependency versions
+
+# run CI on pushes to master, and on all PRs (even the ones that target other
+# branches)
+
+on:
+ push:
+ branches: [master]
+ pull_request:
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ node-version: ['14.x']
+ steps:
+ - uses: actions/checkout@v1
+ with:
+ submodules: 'true'
+ - uses: actions/setup-node@v1
+ with:
+ node-version: ${{ matrix.node-version }}
+ - name: check dependencies
+ run: yarn depcheck

MODIFY
package.json
package.json
},
"scripts": {
"clean": "lerna clean",
- "depcheck": "lerna run --no-bail depcheck",
+ "depcheck": "node scripts/check-mismatched-dependencies.js",
"update": "lernaupdate --dedupe",
"prettier": "lerna run prettier",
"lint": "yarn clean --yes && lerna run lint",

MODIFY
packages/compartment-mapper/package.json
packages/compartment-mapper/package.json
"scripts": {
"build": "rollup --config rollup.config.js",
"clean": "rm -rf dist",
- "depcheck": "depcheck",
"lint": "eslint '**/*.js'",
"lint-fix": "eslint --fix '**/*.js'",
"prepublish": "yarn clean && yarn build",

MODIFY
packages/endo/package.json
packages/endo/package.json
"license": "Apache-2.0",
"type": "module",
"scripts": {
- "depcheck": "depcheck",
"lint": "eslint '**/*.js'",
"lint-fix": "eslint --fix '**/*.js'",
"postinstall": "node src/postinstall.js",

MODIFY
packages/make-hardener/package.json
packages/make-hardener/package.json
"scripts": {
"prepublish": "yarn clean && yarn build",
"clean": "rm -rf dist",
- "depcheck": "depcheck",
"lint": "eslint '**/*.js'",
"lint-fix": "eslint --fix '**/*.js'",
"test": "tap --no-esm --no-coverage --reporter spec 'test/**/*.test.js'",

MODIFY
packages/make-importer/package.json
packages/make-importer/package.json
"prepublish": "yarn clean && yarn build",
"build": "rollup --config rollup.config.js",
"clean": "rm -rf dist",
- "depcheck": "depcheck",
"lint": "eslint '**/*.js'",
"lint-fix": "eslint --fix '**/*.js'",
"OFF-test": "tap --no-esm --no-coverage --reporter spec 'test/**/*.test.js'",

MODIFY
packages/make-simple-evaluate/package.json
packages/make-simple-evaluate/package.json
"type": "module",
"main": "./src/main.js",
"scripts": {
- "depcheck": "depcheck",
"lint": "eslint '**/*.js'",
"lint-fix": "eslint --fix '**/*.js'",
"OFF-test": "tap --no-esm --no-coverage --reporter spec 'test/**/*.test.js'"

MODIFY
packages/ses-integration-test/package.json
packages/ses-integration-test/package.json
"main": "index.js",
"private": true,
"scripts": {
- "depcheck": "depcheck",
"lint": "eslint '**/*.js'",
"lint-fix": "eslint --fix '**/*.js'",
"test:pre-release": "node -r esm puppeteer-test/pre-release.test.js",
"author": "",
"license": "ISC",
"dependencies": {
- "ses": "file:../ses"
+ "ses": "^0.11.0"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^13.0.0",

MODIFY
packages/ses/package.json
packages/ses/package.json
},
"scripts": {
"prepublish": "yarn clean && yarn build",
- "depcheck": "depcheck",
"clean": "rm -rf dist",
"lint": "eslint '**/*.js'",
"lint-fix": "eslint --fix '**/*.js'",

MODIFY
packages/test262-runner/package.json
packages/test262-runner/package.json
"type": "module",
"main": "./src/main.js",
"scripts": {
- "depcheck": "depcheck",
"lint-fix": "eslint --fix '**/*.js'",
"lint": "eslint '**/*.js'"
},

MODIFY
packages/transform-module/package.json
packages/transform-module/package.json
"clean": "rm -rf dist",
"build": "rollup --config rollup.config.js",
"prepublish": "yarn clean && yarn build",
- "depcheck": "depcheck",
"lint": "eslint '**/*.js'",
"lint-fix": "eslint --fix '**/*.js'",
"OFF-test": "tap --no-esm --no-coverage --reporter spec 'test/**/*.test.js'"

ADD
scripts/check-mismatched-dependencies.js
+#!/usr/bin/env node
+
+const { spawnSync } = require('child_process');
+
+console.log(`running 'yarn workspaces info' to check for mismatched dependencies`);
+const s = spawnSync('yarn', ['--silent', 'workspaces', 'info'], {
+ stdio: ['ignore', 'pipe', 'inherit']
+});
+if (s.status !== 0) {
+ console.log(`error running 'yarn workspaces info':`);
+ console.log(s.status);
+ console.log(s.signal);
+ console.log(s.error);
+ console.log(s.stdout);
+ console.log(s.stderr);
+ process.exit(1);
+}
+
+const d = JSON.parse(s.stdout);
+for (const pkgname of Object.getOwnPropertyNames(d)) {
+ const md = d[pkgname].mismatchedWorkspaceDependencies;
+ if (md.length) {
+ console.log(`package '${pkgname}' has mismatched dependencies on: ${md}`);
+ process.exitCode = 1;
+ }
+}

MODIFY
scripts/check-packages.sh
scripts/check-packages.sh
@@ -33,7 +33,6 @@ for JSON in $(find packages -depth 2 -name 'package.json'); do
assert .scripts.prepublish "yarn clean && yarn build"
assert .scripts.clean "rm -rf dist"
assert .scripts.build "rollup --config rollup.config.js"
- assert .scripts.depcheck depcheck
assert .scripts.lint "eslint '**/*.js'"
assert '.scripts["lint-fix"]' "eslint --fix '**/*.js'"
assert '.devDependencies["@rollup/plugin-node-resolve"]' '^6.1.0'

MODIFY
scripts/repackage.sh
scripts/repackage.sh
@@ -56,7 +56,6 @@ NEWPKGJSONHASH=$(
prepublish: "yarn clean && yarn build",
clean: "rm -rf dist",
build: "rollup --config rollup.config.js",
- depcheck: "depcheck",
test: "yarn build && tap --no-esm --no-coverage --reporter spec 'test/**/*.test.js'",
lint: "eslint '"'**/*.js'"'",
"lint-fix": "eslint --fix '"'**/*.js'"'",

chore: Add dependency consistency checker (#531)