Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to sync engines with core version #7207

Merged
merged 2 commits into from
Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@
"unlink-all": "node scripts/unlink-all.js packages",
"check": "flow check",
"lint": "eslint . && prettier \"./packages/*/*/{src,bin,test}/**/*.{js,json,md}\" --list-different && cargo fmt --all -- --check",
"lint:readme": "node scripts/validate-readme-toc.js",
"prepublishOnly": "yarn build && yarn build-ts && node scripts/update-config-dependencies.js",
"prepublishOnly": "yarn build && yarn build-ts && yarn adjust-versions",
"test:unit": "cross-env NODE_ENV=test mocha",
"test:integration": "yarn workspace @parcel/integration-tests test",
"test:integration-ci": "yarn workspace @parcel/integration-tests test-ci",
"test": "yarn test:unit && yarn test:integration",
"update-readme-toc": "doctoc README.md",
"nightly:release": "lerna publish -y --canary --preid nightly --dist-tag=nightly --exact --force-publish=* --no-git-tag-version --no-push",
"tag:prerelease": "lerna version --exact --force-publish=* --no-git-tag-version --no-push && node scripts/update-config-dependencies.js",
"tag:release": "lerna version --force-publish=* --no-git-tag-version --no-push && node scripts/update-config-dependencies.js",
"tag:prerelease": "lerna version --exact --force-publish=* --no-git-tag-version --no-push && yarn adjust-versions --exact",
"tag:release": "lerna version --force-publish=* --no-git-tag-version --no-push && yarn adjust-versions",
"adjust-versions": "node scripts/update-config-dependencies.js && node scripts/update-engines.js",
"release": "lerna publish -y from-package --pre-dist-tag=next --no-git-tag-version --no-push",
"prepare": "husky install"
},
Expand All @@ -41,7 +40,6 @@
"@napi-rs/cli": "1.0.4",
"@types/node": "^15.12.4",
"cross-env": "^7.0.0",
"doctoc": "^1.4.0",
"eslint": "^7.20.0",
"flow-bin": "0.161.0",
"glob": "^7.1.6",
Expand Down
29 changes: 29 additions & 0 deletions scripts/update-engines.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const fs = require('fs');
const path = require('path');
const exec = require('child_process').execSync;

let packages = JSON.parse(
exec(
`${path.join(__dirname, '..', 'node_modules', '.bin', 'lerna')} ls --json`,
),
);
let packageVersions = new Map(
packages.map(pkg => [
pkg.name,
{version: pkg.version, location: pkg.location},
]),
);
let coreVersion = packageVersions.get('@parcel/core').version;
let coreRange =
coreVersion.includes('nightly') || process.argv.includes('--exact')
? coreVersion
: `^${coreVersion}`;

for (let [, {location}] of packageVersions) {
let pkgPath = path.join(location, 'package.json');
let pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
if (pkg.engines?.parcel != null) {
pkg.engines.parcel = coreRange;
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
}
}
19 changes: 0 additions & 19 deletions scripts/validate-readme-toc.js

This file was deleted.

Loading