You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.3 KiB
42 lines
1.3 KiB
#! /usr/bin/env node
|
|
|
|
const { readdirSync, writeFileSync } = require('fs');
|
|
const { resolve, join } = require('path');
|
|
const { inc } = require('semver');
|
|
const rootPkg = require('../package.json');
|
|
|
|
const releases = ['major', 'minor', 'patch'];
|
|
const packages = resolve(__dirname, '../packages');
|
|
const [,,release] = process.argv;
|
|
|
|
if (!releases.includes(release)) {
|
|
throw new Error(`Release must be one of: major, minor, patch`);
|
|
}
|
|
|
|
const version = inc(rootPkg.version, release);
|
|
|
|
readdirSync(packages)
|
|
.map(name => {
|
|
const pkgPath = join(packages, name, 'package.json');
|
|
const pkg = require(pkgPath);
|
|
|
|
console.log(`Bumping ${name} to v${version}`);
|
|
pkg.version = version;
|
|
|
|
if (pkg.peerDependencies && pkg.peerDependencies.neutrino) {
|
|
console.log(` Bumping neutrino peer dependency to v${version}`);
|
|
pkg.peerDependencies.neutrino = `^${version}`;
|
|
}
|
|
|
|
Object
|
|
.keys(pkg.linkDependencies || {})
|
|
.map(key => {
|
|
console.log(` Bumping ${key} linked dependency to v${version}`);
|
|
pkg.linkDependencies[key].version = version;
|
|
});
|
|
|
|
writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
});
|
|
|
|
rootPkg.version = version;
|
|
writeFileSync(resolve(__dirname, '../package.json'), `${JSON.stringify(rootPkg, null, 2)}\n`);
|
|
|