@companyhelm/cli 0.1.5 → 0.2.0
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/cli.d.ts +1 -0
- package/dist/cli.js +11 -1
- package/package.json +1 -1
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { realpathSync } from "node:fs";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
1
4
|
import { buildProgram } from "./commands/register-commands.js";
|
|
2
5
|
import { InteractiveCommandCancelledError } from "./commands/interactive.js";
|
|
3
6
|
export async function main(argv = process.argv) {
|
|
@@ -13,6 +16,13 @@ export async function main(argv = process.argv) {
|
|
|
13
16
|
throw error;
|
|
14
17
|
}
|
|
15
18
|
}
|
|
16
|
-
|
|
19
|
+
function isCliEntrypoint(argv = process.argv) {
|
|
20
|
+
const entrypointPath = argv[1];
|
|
21
|
+
if (!entrypointPath) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return pathToFileURL(realpathSync(entrypointPath)).href === import.meta.url;
|
|
25
|
+
}
|
|
26
|
+
if (isCliEntrypoint()) {
|
|
17
27
|
void main();
|
|
18
28
|
}
|