Skip to content

Commit

Permalink
Add script to sync engines with core version
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed Oct 27, 2021
1 parent 84e07f2 commit 63c64b4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions scripts/update-engines.js
@@ -0,0 +1,25 @@
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;

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 = coreVersion;
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
}
}

0 comments on commit 63c64b4

Please sign in to comment.