@ewyn/client 0.4.0 → 0.5.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.js +12 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import { createRequire } from 'node:module';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { pathToFileURL } from 'node:url';
|
|
5
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
6
6
|
const EWYN_API_BASE_URL = 'https://www.ewyn.ai/api/v1';
|
|
7
7
|
const CONFIG_NAMES = ['ewyn.config.ts', 'ewyn.config.mjs', 'ewyn.config.js'];
|
|
8
8
|
const DEFAULT_OUTPUT_FILE = 'ewynTemplates.ts';
|
|
@@ -124,9 +124,17 @@ async function main() {
|
|
|
124
124
|
printUsage();
|
|
125
125
|
process.exit(1);
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
let isMain = false;
|
|
128
|
+
try {
|
|
129
|
+
if (typeof process !== 'undefined' && process.argv[1]) {
|
|
130
|
+
const ourPath = fs.realpathSync(fileURLToPath(import.meta.url));
|
|
131
|
+
const entryPath = fs.realpathSync(path.resolve(process.argv[1]));
|
|
132
|
+
isMain = entryPath === ourPath;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
isMain = false;
|
|
137
|
+
}
|
|
130
138
|
if (isMain) {
|
|
131
139
|
main().catch((err) => {
|
|
132
140
|
console.error(err instanceof Error ? err.message : String(err));
|