1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-24 08:12:24 +02:00

Tools: Added script to release plugin generator

This commit is contained in:
Laurent Cozic 2020-11-18 10:36:19 +00:00
parent 8e2daef144
commit 52b13f6d56
7 changed files with 47 additions and 3 deletions

View File

@ -24,6 +24,7 @@
"releaseCli": "node packages/tools/release-cli.js",
"releaseClipper": "node packages/tools/release-clipper.js",
"releaseDesktop": "node packages/tools/release-electron.js",
"releasePluginGenerator": "node packages/tools/release-plugin-generator.js",
"setupNewRelease": "node ./packages/tools/setupNewRelease",
"updatePluginTypes": "./packages/generator-joplin/updateTypes.sh",
"tsc": "lerna run tsc --stream --parallel",

View File

@ -1,6 +1,6 @@
{
"name": "generator-joplin",
"version": "1.4.0",
"version": "1.4.4",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "generator-joplin",
"version": "1.4.0",
"version": "1.4.4",
"description": "Scaffolds out a new Joplin plugin",
"homepage": "https://joplinapp.org",
"author": {

View File

@ -3,3 +3,4 @@ set -e
git pull
npm version patch
npm publish

View File

@ -15,7 +15,7 @@ async function main() {
console.info(`New version number: ${version}`);
console.info(await execCommand('git add -A'));
console.info(await execCommand(`git commit -m "Electron release ${version}"`));
console.info(await execCommand(`git commit -m "Desktop release ${version}"`));
console.info(await execCommand(`git tag ${tagName}`));
console.info(await execCommand('git push && git push --tags'));

View File

@ -0,0 +1,30 @@
const { execCommand, execCommandVerbose, rootDir, gitPullTry } = require('./tool-utils.js');
const genDir = `${rootDir}/packages/generator-joplin`;
async function main() {
process.chdir(genDir);
console.info(`Running from: ${process.cwd()}`);
await gitPullTry();
const version = (await execCommand('npm version patch')).trim();
const tagName = `plugin-generator-${version}`;
console.info(`New version number: ${version}`);
await execCommandVerbose('npm', ['publish']);
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);
});

View File

@ -203,6 +203,18 @@ async function saveGitHubUsernameCache(cache) {
await fs.writeFile(path, JSON.stringify(cache));
}
toolUtils.gitPullTry = async function() {
try {
await toolUtils.execCommand('git pull');
} catch (error) {
if (error.message.includes('no tracking information for the current branch')) {
console.info('Skipping git pull because no tracking information on current branch');
} else {
throw error;
}
}
};
toolUtils.githubUsername = async function(email, name) {
const cache = await loadGitHubUsernameCache();
const cacheKey = `${email}:${name}`;