Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/table-generator/src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env tsx

import { resolve } from "node:path";
import { pathToFileURL } from "node:url";
import { updateAppsTable } from "./index.js";

/**
Expand Down Expand Up @@ -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) {
Expand Down