nuxt-openapi-hyperfetch 0.3.5-beta → 0.3.6-beta
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/index.js +6 -7
- package/package.json +1 -1
- package/src/index.ts +6 -6
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
3
|
import * as p from '@clack/prompts';
|
|
4
|
+
import { existsSync } from 'fs';
|
|
5
|
+
import * as path from 'path';
|
|
4
6
|
import { generateOpenApiFiles, generateHeyApiFiles, checkJavaInstalled } from './generate.js';
|
|
5
7
|
import { generateUseFetchComposables } from './generators/use-fetch/generator.js';
|
|
6
8
|
import { generateUseAsyncDataComposables } from './generators/use-async-data/generator.js';
|
|
@@ -197,13 +199,10 @@ program
|
|
|
197
199
|
}
|
|
198
200
|
// Generate headless connectors if requested (requires useAsyncData)
|
|
199
201
|
if (generateConnectorsFlag) {
|
|
200
|
-
// Check zod is available in the user's project
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
await import(zodId);
|
|
205
|
-
}
|
|
206
|
-
catch {
|
|
202
|
+
// Check zod is available in the user's project by probing their node_modules,
|
|
203
|
+
// not via import() which resolves from the CLI's own context (npx sandbox).
|
|
204
|
+
const zodPath = path.resolve(process.cwd(), 'node_modules', 'zod');
|
|
205
|
+
if (!existsSync(zodPath)) {
|
|
207
206
|
p.log.warn('Skipping connectors: "zod" is not installed in this project.\n' +
|
|
208
207
|
' Run: npm install zod');
|
|
209
208
|
generateConnectorsFlag = false;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
3
|
import * as p from '@clack/prompts';
|
|
4
|
+
import { existsSync } from 'fs';
|
|
5
|
+
import * as path from 'path';
|
|
4
6
|
import { generateOpenApiFiles, generateHeyApiFiles, checkJavaInstalled } from './generate.js';
|
|
5
7
|
import { generateUseFetchComposables } from './generators/use-fetch/generator.js';
|
|
6
8
|
import { generateUseAsyncDataComposables } from './generators/use-async-data/generator.js';
|
|
@@ -254,12 +256,10 @@ program
|
|
|
254
256
|
|
|
255
257
|
// Generate headless connectors if requested (requires useAsyncData)
|
|
256
258
|
if (generateConnectorsFlag) {
|
|
257
|
-
// Check zod is available in the user's project
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
await import(zodId);
|
|
262
|
-
} catch {
|
|
259
|
+
// Check zod is available in the user's project by probing their node_modules,
|
|
260
|
+
// not via import() which resolves from the CLI's own context (npx sandbox).
|
|
261
|
+
const zodPath = path.resolve(process.cwd(), 'node_modules', 'zod');
|
|
262
|
+
if (!existsSync(zodPath)) {
|
|
263
263
|
p.log.warn(
|
|
264
264
|
'Skipping connectors: "zod" is not installed in this project.\n' +
|
|
265
265
|
' Run: npm install zod'
|