vovk 0.2.3-beta.119 → 0.2.3-beta.120
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/cli/generateClient.mjs +10 -2
- package/package.json +1 -1
package/cli/generateClient.mjs
CHANGED
|
@@ -6,7 +6,13 @@ import getReturnPath from './lib/getReturnPath.mjs';
|
|
|
6
6
|
/** @type {(moduleName: string) => Promise<boolean>} */
|
|
7
7
|
async function canImport(moduleName) {
|
|
8
8
|
try {
|
|
9
|
-
|
|
9
|
+
if (moduleName.endsWith('.json')) {
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
11
|
+
// @ts-ignore Ignore dynamic imports errors
|
|
12
|
+
await import(moduleName, { assert: { type: 'json' } });
|
|
13
|
+
} else {
|
|
14
|
+
await import(moduleName);
|
|
15
|
+
}
|
|
10
16
|
return true; // The module exists and can be imported
|
|
11
17
|
} catch (e) {
|
|
12
18
|
return false; // The module does not exist or cannot be imported
|
|
@@ -42,7 +48,9 @@ export default async function generateClient({ ...env }) {
|
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
if (!(await canImport(localJsonPath))) {
|
|
45
|
-
throw new Error(
|
|
51
|
+
throw new Error(
|
|
52
|
+
`Unble to generate Vovk Client: cannot find ".vovk.json" file '${localJsonPath}' (original value '${jsonPath}').`
|
|
53
|
+
);
|
|
46
54
|
}
|
|
47
55
|
|
|
48
56
|
const controllersPath = path.join(returnDir, env.VOVK_ROUTE).replace(/\.ts$/, '');
|