1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-27 10:32:58 +02:00
joplin/packages/tools/release-plugin-generator.js

41 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-12-28 00:22:29 +02:00
const { execCommand, execCommandVerbose, rootDir, gitPullTry, setPackagePrivateField } = require('./tool-utils.js');
const genDir = `${rootDir}/packages/generator-joplin`;
async function main() {
process.chdir(genDir);
2020-12-28 00:22:29 +02:00
const packageFilePath = `${genDir}/package.json`;
console.info(`Running from: ${process.cwd()}`);
await gitPullTry();
const version = (await execCommand('npm version patch')).trim();
const tagName = `plugin-generator-${version}`;
2020-12-28 00:25:17 +02:00
console.info(`New version number: ${version}`);
2020-12-28 00:22:29 +02:00
2021-12-27 19:23:50 +02:00
await execCommandVerbose('bash', ['updateTypes.sh']);
2020-12-28 00:25:17 +02:00
await setPackagePrivateField(packageFilePath, false);
2020-12-28 00:22:29 +02:00
try {
2021-12-27 19:02:18 +02:00
await execCommandVerbose('npm', ['publish']);
2020-12-28 00:22:29 +02:00
} finally {
await setPackagePrivateField(packageFilePath, true);
}
2020-12-28 00:25:17 +02:00
await gitPullTry();
await execCommandVerbose('git', ['add', '-A']);
await execCommandVerbose('git', ['commit', '-m', `Plugin Generator release ${version}`]);
await execCommandVerbose('git', ['tag', tagName]);
await execCommandVerbose('git', ['push']);
await execCommandVerbose('git', ['push', '--tags']);
}
main().catch((error) => {
console.error('Fatal error');
console.error(error);
process.exit(1);
});