@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.
Files changed (2) hide show
  1. package/dist/falgen.js +12 -2
  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 { pathToFileURL } from "url";
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
- if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@merpuya/falgen-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "falgen": "./dist/falgen.js"