From f318f8e05d3318097a1264f30c0b22fd25d779dc Mon Sep 17 00:00:00 2001 From: Dusk1e <135010814+Dusk1e@users.noreply.github.com> Date: Fri, 14 Aug 2026 03:06:49 +0300 Subject: [PATCH] fix(table-generator): run the CLI when invoked from a Windows path The entry-point guard compared import.meta.url against a template string built from process.argv[1]. argv[1] is a filesystem path, not a URL, so on Windows it never matches the percent-encoded module URL and main() never runs: pnpm update-table and pnpm check-table both exit 0 without doing anything. The same happens on any path that needs percent-encoding, such as one containing a space. Compare against pathToFileURL(process.argv[1]).href instead. --- packages/table-generator/src/cli.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/table-generator/src/cli.ts b/packages/table-generator/src/cli.ts index aa74232..31de1e2 100644 --- a/packages/table-generator/src/cli.ts +++ b/packages/table-generator/src/cli.ts @@ -1,6 +1,7 @@ #!/usr/bin/env tsx import { resolve } from "node:path"; +import { pathToFileURL } from "node:url"; import { updateAppsTable } from "./index.js"; /** @@ -85,8 +86,11 @@ function main() { } } -// Run if this script is executed directly -if (import.meta.url === `file://${process.argv[1]}`) { +// Run if this script is executed directly. +// process.argv[1] is a filesystem path, so it has to be converted to a file +// URL before comparing: interpolating it directly never matches on Windows, +// nor on any path that needs percent-encoding. +if (import.meta.url === pathToFileURL(process.argv[1]).href) { try { main(); } catch (error) {