vovk-cli 0.0.1-draft.71 → 0.0.1-draft.73
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.
|
@@ -16,14 +16,16 @@ ${segmentNames
|
|
|
16
16
|
})
|
|
17
17
|
.join('\n')}`;
|
|
18
18
|
const dTsContent = `// auto-generated ${new Date().toISOString()}
|
|
19
|
+
import type { VovkSchema } from 'vovk';
|
|
19
20
|
declare const fullSchema: {
|
|
20
|
-
${segmentNames.map((segmentName) => ` '${segmentName}':
|
|
21
|
+
${segmentNames.map((segmentName) => ` '${segmentName}': VovkSchema;`).join('\n')}
|
|
21
22
|
};
|
|
22
23
|
export default fullSchema;`;
|
|
23
24
|
const tsContent = `// auto-generated ${new Date().toISOString()}
|
|
25
|
+
import type { VovkSchema } from 'vovk';
|
|
24
26
|
${segmentNames.map((segmentName, i) => `import segment${i} from './${segmentName || ROOT_SEGMENT_SCHEMA_NAME}.json';`).join('\n')}
|
|
25
27
|
const fullSchema = {
|
|
26
|
-
${segmentNames.map((segmentName, i) => ` '${segmentName}': segment${i},`).join('\n')}
|
|
28
|
+
${segmentNames.map((segmentName, i) => ` '${segmentName}': segment${i} as VovkSchema,`).join('\n')}
|
|
27
29
|
};
|
|
28
30
|
export default fullSchema;`;
|
|
29
31
|
const jsAbsolutePath = path.join(schemaOutAbsolutePath, 'main.cjs');
|
|
@@ -33,13 +35,13 @@ export default fullSchema;`;
|
|
|
33
35
|
const existingDTs = await fs.readFile(dTsAbsolutePath, 'utf-8').catch(() => null);
|
|
34
36
|
const existingTs = await fs.readFile(tsAbsolutePath, 'utf-8').catch(() => null);
|
|
35
37
|
await fs.mkdir(schemaOutAbsolutePath, { recursive: true });
|
|
36
|
-
if (existingJs !== jsContent) {
|
|
38
|
+
if (existingJs?.split('\n').slice(1).join('\n') !== jsContent.split('\n').slice(1).join('\n')) {
|
|
37
39
|
await fs.writeFile(jsAbsolutePath, jsContent);
|
|
38
40
|
}
|
|
39
|
-
if (existingDTs !== dTsContent) {
|
|
41
|
+
if (existingDTs?.split('\n').slice(1).join('\n') !== dTsContent.split('\n').slice(1).join('\n')) {
|
|
40
42
|
await fs.writeFile(dTsAbsolutePath, dTsContent);
|
|
41
43
|
}
|
|
42
|
-
if (existingTs !== tsContent) {
|
|
44
|
+
if (existingTs?.split('\n').slice(1).join('\n') !== tsContent.split('\n').slice(1).join('\n')) {
|
|
43
45
|
await fs.writeFile(tsAbsolutePath, tsContent);
|
|
44
46
|
}
|
|
45
47
|
// Create JSON files (if not exist) with name [segmentName].json (where segmentName can include /, which means the folder structure can be nested)
|
package/dist/generate/index.mjs
CHANGED
|
@@ -46,7 +46,7 @@ export default async function generate({ projectInfo, segments, segmentsSchema,
|
|
|
46
46
|
// Read existing file content to compare
|
|
47
47
|
const existingContent = await fs.readFile(outPath, 'utf-8').catch(() => '');
|
|
48
48
|
// Determine if we need to rewrite the file
|
|
49
|
-
const needsWriting = existingContent !== rendered;
|
|
49
|
+
const needsWriting = existingContent.split('\n').slice(1).join('\n') !== rendered.split('\n').slice(1).join('\n');
|
|
50
50
|
return {
|
|
51
51
|
outPath,
|
|
52
52
|
rendered,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vovk-cli",
|
|
3
|
-
"version": "0.0.1-draft.
|
|
3
|
+
"version": "0.0.1-draft.73",
|
|
4
4
|
"bin": {
|
|
5
5
|
"vovk": "./dist/index.mjs"
|
|
6
6
|
},
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://vovk.dev",
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"vovk": "^3.0.0-draft.
|
|
39
|
+
"vovk": "^3.0.0-draft.74"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@inquirer/prompts": "^7.3.1",
|