@merpuya/falgen-cli 0.1.0 → 0.1.1
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/falgen.js +12 -2
- package/package.json +1 -1
package/dist/falgen.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/falgen.ts
|
|
4
|
-
import {
|
|
4
|
+
import { realpathSync } from "fs";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
5
6
|
import { Command } from "commander";
|
|
6
7
|
|
|
7
8
|
// src/commands/auth.ts
|
|
@@ -116,7 +117,16 @@ function buildProgram() {
|
|
|
116
117
|
);
|
|
117
118
|
return program;
|
|
118
119
|
}
|
|
119
|
-
|
|
120
|
+
function isMainModule() {
|
|
121
|
+
const entry = process.argv[1];
|
|
122
|
+
if (!entry) return false;
|
|
123
|
+
try {
|
|
124
|
+
return realpathSync(entry) === realpathSync(fileURLToPath(import.meta.url));
|
|
125
|
+
} catch {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (isMainModule()) {
|
|
120
130
|
buildProgram().parseAsync().catch((err) => {
|
|
121
131
|
console.error(err instanceof Error ? err.message : err);
|
|
122
132
|
process.exitCode = 1;
|