From 00ae06182230debd44f8bdfb3b56710d1451a2d8 Mon Sep 17 00:00:00 2001
From: Patryk Kuniczak
Date: Fri, 6 Feb 2026 21:04:14 +0100
Subject: [PATCH] chore: fix recognize lack of argument for scripts (#2015)
---
scripts/bump-package-version.ts | 6 +++---
scripts/create-github-release.ts | 6 +++---
scripts/sync-releases.ts | 2 +-
scripts/upgrade-deps.ts | 18 ++++++------------
4 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/scripts/bump-package-version.ts b/scripts/bump-package-version.ts
index a4e290ce..542d25c9 100644
--- a/scripts/bump-package-version.ts
+++ b/scripts/bump-package-version.ts
@@ -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 ',
);
diff --git a/scripts/create-github-release.ts b/scripts/create-github-release.ts
index 29af303a..f33cc4aa 100644
--- a/scripts/create-github-release.ts
+++ b/scripts/create-github-release.ts
@@ -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 ',
);
@@ -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');
diff --git a/scripts/sync-releases.ts b/scripts/sync-releases.ts
index 5cbce4b6..793e6adc 100644
--- a/scripts/sync-releases.ts
+++ b/scripts/sync-releases.ts
@@ -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 ',
);
diff --git a/scripts/upgrade-deps.ts b/scripts/upgrade-deps.ts
index aa37c2e8..795dc4d9 100644
--- a/scripts/upgrade-deps.ts
+++ b/scripts/upgrade-deps.ts
@@ -62,27 +62,22 @@ async function main(): Promise {
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`;