You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-29 22:48:10 +02:00
Plugin Repo: Simplify publishing script
This commit is contained in:
@@ -45,7 +45,7 @@ async function checkPluginRepository(dirPath: string, dryRun: boolean) {
|
||||
async function extractPluginFilesFromPackage(existingManifests: any, workDir: string, packageName: string, destDir: string): Promise<any> {
|
||||
const previousDir = chdir(workDir);
|
||||
|
||||
await execCommand2(`npm install ${packageName} --save --ignore-scripts`, { showOutput: false });
|
||||
await execCommand2(`npm install ${packageName} --save --ignore-scripts`, { showStderr: false, showStdout: false });
|
||||
|
||||
const pluginDir = resolveRelativePathWithinDir(workDir, 'node_modules', packageName, 'publish');
|
||||
|
||||
@@ -194,8 +194,8 @@ async function processNpmPackage(npmPackage: NpmPackage, repoDir: string, dryRun
|
||||
|
||||
if (!dryRun) {
|
||||
if (!(await gitRepoClean())) {
|
||||
await execCommand2('git add -A', { showOutput: false });
|
||||
await execCommand2(['git', 'commit', '-m', commitMessage(actionType, manifest, previousManifest, npmPackage, error)], { showOutput: false });
|
||||
await execCommand2('git add -A', { showStdout: false });
|
||||
await execCommand2(['git', 'commit', '-m', commitMessage(actionType, manifest, previousManifest, npmPackage, error)], { showStdout: false });
|
||||
} else {
|
||||
console.info('Nothing to commit');
|
||||
}
|
||||
@@ -221,14 +221,14 @@ async function commandBuild(args: CommandBuildArgs) {
|
||||
if (!dryRun) {
|
||||
if (!(await gitRepoClean())) {
|
||||
console.info('Updating README...');
|
||||
await execCommand2('git add -A', { showOutput: true });
|
||||
await execCommand2('git commit -m "Update README"', { showOutput: true });
|
||||
await execCommand2('git add -A');
|
||||
await execCommand2('git commit -m "Update README"');
|
||||
}
|
||||
}
|
||||
|
||||
chdir(previousDir);
|
||||
|
||||
const searchResults = (await execCommand2('npm search joplin-plugin --searchlimit 5000 --json', { showOutput: false })).trim();
|
||||
const searchResults = (await execCommand2('npm search joplin-plugin --searchlimit 5000 --json', { showStdout: false, showStderr: false })).trim();
|
||||
const npmPackages = pluginInfoFromSearchResults(JSON.parse(searchResults));
|
||||
|
||||
for (const npmPackage of npmPackages) {
|
||||
@@ -239,8 +239,8 @@ async function commandBuild(args: CommandBuildArgs) {
|
||||
await commandUpdateRelease(args);
|
||||
|
||||
if (!(await gitRepoClean())) {
|
||||
await execCommand2('git add -A', { showOutput: true });
|
||||
await execCommand2('git commit -m "Update stats"', { showOutput: true });
|
||||
await execCommand2('git add -A');
|
||||
await execCommand2('git commit -m "Update stats"');
|
||||
}
|
||||
|
||||
await execCommand2('git push');
|
||||
@@ -248,8 +248,22 @@ async function commandBuild(args: CommandBuildArgs) {
|
||||
}
|
||||
|
||||
async function commandVersion() {
|
||||
const p = await readJsonFile(path.resolve(__dirname, 'package.json'));
|
||||
console.info(`Version ${p.version}`);
|
||||
const paths = [
|
||||
path.resolve(__dirname, 'package.json'),
|
||||
path.resolve(__dirname, '..', 'package.json'),
|
||||
];
|
||||
|
||||
for (const p of paths) {
|
||||
try {
|
||||
const info = await readJsonFile(p);
|
||||
console.info(`Version ${info.version}`);
|
||||
return;
|
||||
} catch (error) {
|
||||
// Try the next path
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error(`Cannot find package.json in any of these paths: ${JSON.stringify(paths)}`);
|
||||
}
|
||||
|
||||
async function main() {
|
||||
|
||||
Reference in New Issue
Block a user