@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.
Files changed (2) hide show
  1. package/dist/cli.js +12 -4
  2. 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
- const isMain = typeof process !== 'undefined' &&
128
- process.argv[1] &&
129
- pathToFileURL(process.argv[1]).href === import.meta.url;
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));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ewyn/client",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Official TypeScript SDK for Ewyn email service with full type safety",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",