vovk-cli 0.0.1-draft.116 → 0.0.1-draft.117
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.
|
@@ -11,12 +11,15 @@ export default async function ensureClient({ config, cwd, log }) {
|
|
|
11
11
|
generateFrom: config.generateFrom,
|
|
12
12
|
});
|
|
13
13
|
let usedTemplateNames = [];
|
|
14
|
-
const
|
|
14
|
+
const defaultText = `// auto-generated ${new Date().toISOString()}
|
|
15
15
|
// This is a temporary placeholder to avoid compilation errors if client is imported before it's generated.
|
|
16
16
|
// If you still see this text, the client is not generated yet because of an unknown problem.
|
|
17
17
|
// Feel free to report an issue at https://github.com/finom/vovk/issues`;
|
|
18
18
|
for (const { outPath, templateName } of templateFiles) {
|
|
19
19
|
const existing = await fs.readFile(outPath, 'utf-8').catch(() => null);
|
|
20
|
+
const text = templateName === 'fullSchema' && outPath.endsWith('.cjs')
|
|
21
|
+
? defaultText + '\nmodule.exports.fullSchema = {}' // avoid compilation errors when { fullSchema } is imported on server-side for openapi
|
|
22
|
+
: defaultText;
|
|
20
23
|
if (!existing) {
|
|
21
24
|
await fs.mkdir(path.dirname(outPath), { recursive: true });
|
|
22
25
|
await fs.writeFile(outPath, outPath.endsWith('.py') ? text.replace(/\/\//g, '#') : text);
|
|
@@ -9,9 +9,6 @@ export default async function updateNPMScripts(pkgJson, root, updateScriptsMode)
|
|
|
9
9
|
pkgJson.update({
|
|
10
10
|
scripts: {
|
|
11
11
|
...pkgJson.content.scripts,
|
|
12
|
-
generate: pkgJson.content.scripts?.generate
|
|
13
|
-
? `${pkgJson.content.scripts.generate} && vovk generate`
|
|
14
|
-
: 'vovk generate',
|
|
15
12
|
dev: getDevScript(pkgJson, updateScriptsMode),
|
|
16
13
|
},
|
|
17
14
|
});
|