chore: fix recognize lack of argument for scripts (#2015)
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import {
|
||||
determineSemverChange,
|
||||
loadChangelogConfig,
|
||||
parseCommits,
|
||||
generateMarkDown,
|
||||
loadChangelogConfig,
|
||||
parseChangelogMarkdown,
|
||||
parseCommits,
|
||||
} from 'changelogen';
|
||||
import spawn from 'nano-spawn';
|
||||
import { getPkgTag, grabPackageDetails, listCommitsInDir } from './git';
|
||||
@@ -12,7 +12,7 @@ import fs from 'fs-extra';
|
||||
import path from 'node:path';
|
||||
|
||||
const pkg = process.argv[2];
|
||||
if (pkg == null) {
|
||||
if (!pkg) {
|
||||
throw Error(
|
||||
'Package name missing. Usage: tsx bump-package-version.ts <package-name>',
|
||||
);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
createGithubRelease,
|
||||
GithubRelease,
|
||||
loadChangelogConfig,
|
||||
parseChangelogMarkdown,
|
||||
} from 'changelogen';
|
||||
@@ -8,7 +9,7 @@ import { grabPackageDetails } from './git';
|
||||
import consola from 'consola';
|
||||
|
||||
const pkg = process.argv[2];
|
||||
if (pkg == null) {
|
||||
if (!pkg) {
|
||||
throw Error(
|
||||
'Package name missing. Usage: tsx create-github-release.ts <package-name>',
|
||||
);
|
||||
@@ -29,7 +30,6 @@ await createGithubRelease(config, {
|
||||
tag_name: prevTag,
|
||||
name: `${pkgName} v${currentVersion}`,
|
||||
body: releases[0].body,
|
||||
// @ts-expect-error: Not typed in changelogen, but present: https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#create-a-release
|
||||
make_latest: String(pkg === 'wxt'),
|
||||
});
|
||||
} as GithubRelease & { make_latest: string });
|
||||
consola.success('Created release');
|
||||
|
||||
@@ -9,7 +9,7 @@ import fs from 'fs-extra';
|
||||
import consola from 'consola';
|
||||
|
||||
const pkg = process.argv[2];
|
||||
if (pkg == null) {
|
||||
if (!pkg) {
|
||||
throw Error(
|
||||
'Package name missing. Usage: tsx sync-releases.ts <package-name>',
|
||||
);
|
||||
|
||||
+6
-12
@@ -62,27 +62,22 @@ async function main(): Promise<never> {
|
||||
const isMajor = ['-m', '--major'].some((arg) => args.includes(arg));
|
||||
const upgrades = await detectUpgrades(dependencies, isMajor);
|
||||
|
||||
if (upgrades.length === 0) {
|
||||
console.log();
|
||||
consola.info("No upgrades found, you're up to date!");
|
||||
console.log();
|
||||
if (!upgrades.length) {
|
||||
consola.info("\nNo upgrades found, you're up to date!\n");
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
printUpgrades(upgrades);
|
||||
|
||||
if (!isWrite) {
|
||||
consola.info('Run with `-w` to write changes to package.json files');
|
||||
console.log();
|
||||
consola.info('Run with `-w` to write changes to package.json files\n');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
consola.start('Writing new versions to package.json files...');
|
||||
await writeUpgrades(packageJsonFiles, upgrades);
|
||||
consola.success('Done!');
|
||||
console.log();
|
||||
consola.info('Run `pnpm i` to install new dependencies');
|
||||
console.log();
|
||||
consola.info('\nRun `pnpm i` to install new dependencies\n');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
@@ -285,7 +280,6 @@ async function detectUpgrades(
|
||||
}
|
||||
|
||||
if (upgradeToRange === currentRange) continue;
|
||||
// if (currentVersion === latestVersion) continue;
|
||||
|
||||
results.push({
|
||||
name: dep.name,
|
||||
@@ -315,8 +309,8 @@ function printUpgrades(upgrades: UpgradeDetails[]): void {
|
||||
);
|
||||
const numberPadding = String(upgrades.length + 1).length + 1;
|
||||
|
||||
consola.info(`Found ${upgrades.length} upgrades:`);
|
||||
console.log();
|
||||
consola.info(`Found ${upgrades.length} upgrades:\n`);
|
||||
|
||||
for (let i = 0; i < upgrades.length; i++) {
|
||||
const upgrade = upgrades[i];
|
||||
const num = `\x1b[2m${(i + 1).toString().padStart(numberPadding)}.\x1b[0m`;
|
||||
|
||||
Reference in New Issue
Block a user