ci(scripts): add version updating process to publish script #2346

pull/2366/head
mehmet-erim 6 years ago
parent c959d6484a
commit c5aa981a79

@ -0,0 +1,5 @@
{
"version": "1.1.0",
"packages": ["dist/*"],
"npmClient": "yarn"
}

@ -1,7 +0,0 @@
{
"version": "1.1.1",
"packages": [
"packages/*"
],
"npmClient": "yarn"
}

@ -0,0 +1,5 @@
{
"version": "1.1.0",
"packages": ["packages/*"],
"npmClient": "yarn"
}

@ -1,12 +1,13 @@
// ESM syntax is supported.
import execa from 'execa';
import fse from 'fs-extra';
const versions = ['major', 'minor', 'patch', 'premajor', 'preminor', 'prepatch', 'prerelease'];
let nextSemanticVersion = (process.argv[2] || '').toLowerCase();
if (versions.indexOf(nextSemanticVersion) < 0) {
console.log(
"Please enter the next semantic version like this: 'npm run publish patch'. Available versions: " +
"Please enter the next semantic version like this: 'npm run publish patch'. Available versions:\n " +
JSON.stringify(versions),
);
@ -16,6 +17,16 @@ if (versions.indexOf(nextSemanticVersion) < 0) {
(async () => {
try {
await execa('yarn', ['install-new-dependencies'], { stdout: 'inherit' });
await fse.rename('../lerna.version.json', '../lerna.json');
await execa(
'yarn',
['lerna', 'version', nextSemanticVersion, '--yes', '--no-commit-hooks', '--skip-git'],
{ stdout: 'inherit', cwd: '../' },
);
await fse.rename('../lerna.json', '../lerna.version.json');
} catch (error) {
console.error(error.stderr);
process.exit(1);

Loading…
Cancel
Save