hunter-harness 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +11 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/bin.ts
|
|
4
|
+
import { realpathSync } from "node:fs";
|
|
4
5
|
import { pathToFileURL } from "node:url";
|
|
5
6
|
import { createInterface } from "node:readline/promises";
|
|
6
7
|
import { Command, CommanderError } from "commander";
|
|
@@ -5262,9 +5263,18 @@ async function runCli(argv, overrides = {}) {
|
|
|
5262
5263
|
throw error;
|
|
5263
5264
|
}
|
|
5264
5265
|
}
|
|
5265
|
-
|
|
5266
|
+
function isDirectCliEntrypoint(entry = process.argv[1], metaUrl = import.meta.url) {
|
|
5267
|
+
if (entry === void 0) return false;
|
|
5268
|
+
try {
|
|
5269
|
+
return metaUrl === pathToFileURL(realpathSync(entry)).href;
|
|
5270
|
+
} catch {
|
|
5271
|
+
return metaUrl === pathToFileURL(entry).href;
|
|
5272
|
+
}
|
|
5273
|
+
}
|
|
5274
|
+
if (isDirectCliEntrypoint()) {
|
|
5266
5275
|
process.exitCode = await runCli(process.argv.slice(2));
|
|
5267
5276
|
}
|
|
5268
5277
|
export {
|
|
5278
|
+
isDirectCliEntrypoint,
|
|
5269
5279
|
runCli
|
|
5270
5280
|
};
|