1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +02:00

Plugin Repo: Simplify publishing script

This commit is contained in:
Laurent Cozic
2021-12-21 12:38:05 +01:00
parent 721d00874f
commit 7ca75718c3
12 changed files with 664 additions and 57 deletions

View File

@ -78,13 +78,7 @@ async function insertChangelog(tag: string, changelogPath: string, changelog: st
return output.join('\n');
}
export async function completeReleaseWithChangelog(changelogPath: string, newVersion: string, newTag: string, appName: string, isPreRelease: boolean) {
const changelog = (await execCommand2(`node ${rootDir}/packages/tools/git-changelog ${newTag} --publish-format full`, { })).trim();
const newChangelog = await insertChangelog(newTag, changelogPath, changelog, isPreRelease);
await fs.writeFile(changelogPath, newChangelog);
export function releaseFinalGitCommands(appName: string, newVersion: string, newTag: string): string {
const finalCmds = [
'git pull',
'git add -A',
@ -94,6 +88,16 @@ export async function completeReleaseWithChangelog(changelogPath: string, newVer
'git push --tags',
];
return finalCmds.join(' && ');
}
export async function completeReleaseWithChangelog(changelogPath: string, newVersion: string, newTag: string, appName: string, isPreRelease: boolean) {
const changelog = (await execCommand2(`node ${rootDir}/packages/tools/git-changelog ${newTag} --publish-format full`, { })).trim();
const newChangelog = await insertChangelog(newTag, changelogPath, changelog, isPreRelease);
await fs.writeFile(changelogPath, newChangelog);
console.info('');
console.info('Verify that the changelog is correct:');
console.info('');
@ -101,7 +105,7 @@ export async function completeReleaseWithChangelog(changelogPath: string, newVer
console.info('');
console.info('Then run these commands:');
console.info('');
console.info(finalCmds.join(' && '));
console.info(releaseFinalGitCommands(appName, newVersion, newTag));
}
async function loadGitHubUsernameCache() {
@ -160,7 +164,8 @@ export function execCommandVerbose(commandName: string, args: string[] = []) {
interface ExecCommandOptions {
showInput?: boolean;
showOutput?: boolean;
showStdout?: boolean;
showStderr?: boolean;
quiet?: boolean;
}
@ -173,14 +178,16 @@ interface ExecCommandOptions {
export async function execCommand2(command: string | string[], options: ExecCommandOptions = null): Promise<string> {
options = {
showInput: true,
showOutput: true,
showStdout: true,
showStderr: true,
quiet: false,
...options,
};
if (options.quiet) {
options.showInput = false;
options.showOutput = false;
options.showStdout = false;
options.showStderr = false;
}
if (options.showInput) {
@ -195,7 +202,8 @@ export async function execCommand2(command: string | string[], options: ExecComm
const executableName = args[0];
args.splice(0, 1);
const promise = execa(executableName, args);
if (options.showOutput) promise.stdout.pipe(process.stdout);
if (options.showStdout) promise.stdout.pipe(process.stdout);
if (options.showStderr) promise.stdout.pipe(process.stderr);
const result = await promise;
return result.stdout.trim();
}