vovk-cli 0.0.1-draft.98 → 0.0.1-draft.99
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/dev/ensureSchemaFiles.mjs +11 -11
- package/package.json +1 -1
|
@@ -35,17 +35,7 @@ export default fullSchema;`;
|
|
|
35
35
|
const existingJs = await fs.readFile(jsAbsolutePath, 'utf-8').catch(() => null);
|
|
36
36
|
const existingDTs = await fs.readFile(dTsAbsolutePath, 'utf-8').catch(() => null);
|
|
37
37
|
const existingTs = await fs.readFile(tsAbsolutePath, 'utf-8').catch(() => null);
|
|
38
|
-
await fs.mkdir(
|
|
39
|
-
// ignore 1st lines at the files
|
|
40
|
-
if (existingJs?.split('\n').slice(1).join('\n') !== jsContent.split('\n').slice(1).join('\n')) {
|
|
41
|
-
await fs.writeFile(jsAbsolutePath, jsContent);
|
|
42
|
-
}
|
|
43
|
-
if (existingDTs?.split('\n').slice(1).join('\n') !== dTsContent.split('\n').slice(1).join('\n')) {
|
|
44
|
-
await fs.writeFile(dTsAbsolutePath, dTsContent);
|
|
45
|
-
}
|
|
46
|
-
if (existingTs?.split('\n').slice(1).join('\n') !== tsContent.split('\n').slice(1).join('\n')) {
|
|
47
|
-
await fs.writeFile(tsAbsolutePath, tsContent);
|
|
48
|
-
}
|
|
38
|
+
await fs.mkdir(schemaJsonOutAbsolutePath, { recursive: true });
|
|
49
39
|
// Create JSON files (if not exist) with name [segmentName].json (where segmentName can include /, which means the folder structure can be nested)
|
|
50
40
|
await Promise.all(segmentNames.map(async (segmentName) => {
|
|
51
41
|
const { isCreated } = await writeOneSchemaFile({
|
|
@@ -62,6 +52,16 @@ export default fullSchema;`;
|
|
|
62
52
|
hasChanged = true;
|
|
63
53
|
}
|
|
64
54
|
}));
|
|
55
|
+
// ignore 1st lines at the files
|
|
56
|
+
if (existingJs?.split('\n').slice(1).join('\n') !== jsContent.split('\n').slice(1).join('\n')) {
|
|
57
|
+
await fs.writeFile(jsAbsolutePath, jsContent);
|
|
58
|
+
}
|
|
59
|
+
if (existingDTs?.split('\n').slice(1).join('\n') !== dTsContent.split('\n').slice(1).join('\n')) {
|
|
60
|
+
await fs.writeFile(dTsAbsolutePath, dTsContent);
|
|
61
|
+
}
|
|
62
|
+
if (existingTs?.split('\n').slice(1).join('\n') !== tsContent.split('\n').slice(1).join('\n')) {
|
|
63
|
+
await fs.writeFile(tsAbsolutePath, tsContent);
|
|
64
|
+
}
|
|
65
65
|
// Recursive function to delete unnecessary JSON files and folders
|
|
66
66
|
async function deleteUnnecessaryJsonFiles(dirPath) {
|
|
67
67
|
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|