mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-14 13:22:37 +00:00
The ESM main-module guard compared import.meta.url with "file://" + process.argv[1],
which never matches on Windows (file://D:\a\... vs file:///D:/a/...). On the Windows
desktop release job, scripts/github-release.mjs therefore printed nothing and
gh release upload received an empty release lookup ("release not found"), leaving
v0.8.0-beta.1 without a Windows build. Compare resolved paths instead, shared by
every release script that runs as a CLI.
11 lines
513 B
JavaScript
11 lines
513 B
JavaScript
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
// `import.meta.url === \`file://${process.argv[1]}\`` is false on Windows, where argv[1] is
|
|
// `D:\a\...` and the module URL is `file:///D:/a/...`, so a script guarded that way silently
|
|
// does nothing on a Windows runner. Compare resolved filesystem paths instead.
|
|
export function isMainModule(importMetaUrl, argvPath = process.argv[1]) {
|
|
if (!argvPath) return false;
|
|
return fileURLToPath(importMetaUrl) === path.resolve(argvPath);
|
|
}
|