node-cli-tester 21.0.14 → 21.0.18

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.
Files changed (72) hide show
  1. package/browser/package.json +1 -1
  2. package/browser-prod/package.json +1 -1
  3. package/browser-prod.re-export.json +1 -0
  4. package/lib/base-project-structure.backend.js +10 -7
  5. package/lib/base-project-structure.backend.js.map +1 -1
  6. package/lib/build-info._auto-generated_.d.ts +1 -1
  7. package/lib/build-info._auto-generated_.js +1 -1
  8. package/lib/meta-content-md.backend.js +3 -3
  9. package/lib/meta-content-md.backend.js.map +1 -1
  10. package/lib/node-cli-tester.js +4 -4
  11. package/lib/node-cli-tester.js.map +1 -1
  12. package/lib/package.json +1 -1
  13. package/lib-prod/base-project-structure.backend.js +71 -71
  14. package/lib-prod/build-info._auto-generated_.js +14 -30
  15. package/lib-prod/cli-test.backend.js +133 -122
  16. package/lib-prod/env/env.angular-node-app.js +130 -71
  17. package/lib-prod/env/env.docs-webapp.js +130 -71
  18. package/lib-prod/env/env.electron-app.js +130 -71
  19. package/lib-prod/env/env.mobile-app.js +130 -71
  20. package/lib-prod/env/env.npm-lib-and-cli-tool.js +130 -71
  21. package/lib-prod/env/env.vscode-plugin.js +130 -71
  22. package/lib-prod/env/index.js +6 -23
  23. package/lib-prod/index._auto-generated_.js +0 -6
  24. package/lib-prod/index.js +10 -14
  25. package/lib-prod/meta-content-md.backend.js +214 -228
  26. package/lib-prod/migrations/index.js +1 -19
  27. package/lib-prod/migrations/migrations_index._auto-generated_.js +0 -4
  28. package/lib-prod/node-cli-tester.js +193 -200
  29. package/lib-prod/package.json +1 -1
  30. package/lib-prod/spec-templates.backend.js +49 -54
  31. package/lib-prod/start.backend.js +13 -26
  32. package/lib-prod.re-export.json +1 -0
  33. package/package.json +2 -1
  34. package/websql/package.json +1 -1
  35. package/websql-prod/package.json +1 -1
  36. package/websql-prod.re-export.json +1 -0
  37. package/lib-prod/base-project-structure.backend.d.ts +0 -13
  38. package/lib-prod/base-project-structure.backend.js.map +0 -1
  39. package/lib-prod/build-info._auto-generated_.d.ts +0 -24
  40. package/lib-prod/build-info._auto-generated_.js.map +0 -1
  41. package/lib-prod/cli-test.backend.d.ts +0 -24
  42. package/lib-prod/cli-test.backend.js.map +0 -1
  43. package/lib-prod/env/env.angular-node-app.d.ts +0 -64
  44. package/lib-prod/env/env.angular-node-app.js.map +0 -1
  45. package/lib-prod/env/env.docs-webapp.d.ts +0 -64
  46. package/lib-prod/env/env.docs-webapp.js.map +0 -1
  47. package/lib-prod/env/env.electron-app.d.ts +0 -64
  48. package/lib-prod/env/env.electron-app.js.map +0 -1
  49. package/lib-prod/env/env.mobile-app.d.ts +0 -64
  50. package/lib-prod/env/env.mobile-app.js.map +0 -1
  51. package/lib-prod/env/env.npm-lib-and-cli-tool.d.ts +0 -64
  52. package/lib-prod/env/env.npm-lib-and-cli-tool.js.map +0 -1
  53. package/lib-prod/env/env.vscode-plugin.d.ts +0 -64
  54. package/lib-prod/env/env.vscode-plugin.js.map +0 -1
  55. package/lib-prod/env/index.d.ts +0 -6
  56. package/lib-prod/env/index.js.map +0 -1
  57. package/lib-prod/index._auto-generated_.d.ts +0 -0
  58. package/lib-prod/index._auto-generated_.js.map +0 -1
  59. package/lib-prod/index.d.ts +0 -4
  60. package/lib-prod/index.js.map +0 -1
  61. package/lib-prod/meta-content-md.backend.d.ts +0 -42
  62. package/lib-prod/meta-content-md.backend.js.map +0 -1
  63. package/lib-prod/migrations/index.d.ts +0 -1
  64. package/lib-prod/migrations/index.js.map +0 -1
  65. package/lib-prod/migrations/migrations_index._auto-generated_.d.ts +0 -0
  66. package/lib-prod/migrations/migrations_index._auto-generated_.js.map +0 -1
  67. package/lib-prod/node-cli-tester.d.ts +0 -25
  68. package/lib-prod/node-cli-tester.js.map +0 -1
  69. package/lib-prod/spec-templates.backend.d.ts +0 -6
  70. package/lib-prod/spec-templates.backend.js.map +0 -1
  71. package/lib-prod/start.backend.d.ts +0 -2
  72. package/lib-prod/start.backend.js.map +0 -1
@@ -1,192 +1,182 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MetaMd = void 0;
4
- exports.extract = extract;
5
- //#region imports
6
- const glob = require("glob");
7
- const lib_prod_1 = require("tnp-core/lib-prod");
8
- const lib_prod_2 = require("tnp-core/lib-prod");
9
- const lib_prod_3 = require("tnp-helpers/lib-prod");
10
- const lib_prod_4 = require("typescript-class-helpers/lib-prod");
11
- const base_project_structure_backend_1 = require("./base-project-structure.backend");
12
- //#endregion
13
- /**
14
- * Special forma of .md for keeping metadata, testfile, and test template for file
15
- */
1
+ import * as glob from "glob";
2
+ import { path, ___NS__first, ___NS__isObject, ___NS__keys, ___NS__maxBy, ___NS__merge, ___NS__minBy, Utils__NS__uniqArray } from "tnp-core/lib-prod";
3
+ import { config } from "tnp-core/lib-prod";
4
+ import { BaseProject as Project, Helpers__NS__createSymLink, Helpers__NS__error, Helpers__NS__exists, Helpers__NS__isFolder, Helpers__NS__log, Helpers__NS__mkdirp, Helpers__NS__parse, Helpers__NS__readFile, Helpers__NS__removeFolderIfExists, Helpers__NS__stringify, Helpers__NS__writeFile } from "tnp-helpers/lib-prod";
5
+ import { CLASS } from "typescript-class-helpers/lib-prod";
6
+ import { BaseProjectStructure } from "./base-project-structure.backend";
16
7
  class MetaMd {
17
- filePath;
18
- //#region static fields
19
- static JSON_PART = '@jsonPart';
20
- static FILE_CONTENT_PART = '@fileContentPart';
21
- static TEST_PART = '@testPart';
22
- //#region static fields / create
23
- static async create(json, fileContent, testContent) {
24
- return await create((lib_prod_1._.isObject(json) ? lib_prod_3.Helpers.stringify(json) : json), fileContent, testContent);
25
- }
26
- //#endregion
27
- //#region static fields / preserve file
28
- static async preserveFiles(originalAnyTypeFiles, destinationFolder, editorCwd, foundProjectsFn = (a) => a, baseProjectsStructurePath, // navi-cli folder or current folder,
29
- overrideThisFileName = void 0, overrideTimehash = void 0) {
30
- const properDestName = overrideThisFileName ? overrideThisFileName :
31
- `${lib_prod_1.path.basename(lib_prod_1._.first(originalAnyTypeFiles))}.${lib_prod_2.config.file.meta_config_md}`; // TODO later menu to confirm name
32
- if (!lib_prod_3.Helpers.isFolder(destinationFolder)) {
33
- lib_prod_3.Helpers.error(`[tnp-helpers][meta-content-md] Destination folder "${destinationFolder}"
8
+ //#endregion
9
+ //#region constructor
10
+ constructor(filePath) {
11
+ this.filePath = filePath;
12
+ }
13
+ //#region static fields
14
+ static JSON_PART = "@jsonPart";
15
+ static FILE_CONTENT_PART = "@fileContentPart";
16
+ static TEST_PART = "@testPart";
17
+ //#region static fields / create
18
+ static async create(json, fileContent, testContent) {
19
+ return await create(___NS__isObject(json) ? Helpers__NS__stringify(json) : json, fileContent, testContent);
20
+ }
21
+ //#endregion
22
+ //#region static fields / preserve file
23
+ static async preserveFiles(originalAnyTypeFiles, destinationFolder, editorCwd, foundProjectsFn = (a) => a, baseProjectsStructurePath, overrideThisFileName = void 0, overrideTimehash = void 0) {
24
+ const properDestName = overrideThisFileName ? overrideThisFileName : `${path.basename(___NS__first(originalAnyTypeFiles))}.${config.file.meta_config_md}`;
25
+ if (!Helpers__NS__isFolder(destinationFolder)) {
26
+ Helpers__NS__error(`[tnp-helpers][meta-content-md] Destination folder "${destinationFolder}"
34
27
  is not a folder`, false, true);
35
- }
36
- let foundedProjectsInPath = resolveFoundedProject(originalAnyTypeFiles, editorCwd, foundProjectsFn);
37
- const mostBaseLocationFound = lib_prod_1._.minBy(foundedProjectsInPath, p => p.location.length).location;
38
- // console.log(foundedProjectsInPath.map(p => p.location))
39
- const projects = foundedProjectsInPath
40
- .reduce((a, b) => {
41
- const baseStructureHash = base_project_structure_backend_1.BaseProjectStructure.generate(b).insideIfNotExists(baseProjectsStructurePath);
42
- return lib_prod_1._.merge(a, {
43
- [lib_prod_1.path.join(lib_prod_1.path.basename(mostBaseLocationFound), b.location.replace(mostBaseLocationFound, ''))]: {
44
- githash: b.git.lastCommitHash(),
45
- name: b.name,
46
- baseStructureHash,
47
- }
48
- });
49
- }, {});
50
- const timeHash = overrideTimehash ? overrideTimehash : (+new Date).toString(36);
51
- const c = await MetaMd.create({
52
- orgFileBasenames: originalAnyTypeFiles.map(a => lib_prod_1.path.basename(a)),
53
- orgRelativePathes: originalAnyTypeFiles.map(a => {
54
- return lib_prod_1.path.join(lib_prod_1.path.basename(mostBaseLocationFound), a.replace(mostBaseLocationFound, ''));
55
- }),
56
- projects,
57
- firstProjectBasename: lib_prod_1.path.basename(mostBaseLocationFound),
58
- timeHash,
59
- }, originalAnyTypeFiles.map(a => lib_prod_3.Helpers.readFile(a)));
60
- lib_prod_3.Helpers.writeFile(lib_prod_1.path.join(destinationFolder, properDestName), c);
61
- }
62
- //#endregion
63
- async addFiles(newFilesPathes, destinationFolder, editorCwd, foundProjectFn = void 0, baseProjectsStructurePath) {
64
- let foundedProjectsInPath = resolveFoundedProject(newFilesPathes, editorCwd, foundProjectFn);
65
- const mostBaseLocationFound = lib_prod_1._.minBy(foundedProjectsInPath, p => p.location.length).location;
66
- newFilesPathes = lib_prod_3.Helpers.arrays.uniqArray([
67
- ...newFilesPathes,
68
- ...this.readonlyMetaJson.orgRelativePathes.map(a => {
69
- return lib_prod_1.path.join(lib_prod_1.path.dirname(mostBaseLocationFound), a);
70
- }),
71
- ]);
72
- newFilesPathes.forEach(f => {
73
- if (!lib_prod_3.Helpers.exists(f)) {
74
- lib_prod_3.Helpers.error(`File doesn't exists`, false, true);
75
- }
76
- });
77
- await MetaMd.preserveFiles(newFilesPathes, destinationFolder, editorCwd, foundProjectFn, baseProjectsStructurePath, lib_prod_1.path.basename(this.filePath), this.readonlyMetaJson.timeHash);
78
28
  }
79
- //#region static fields / handle instance from meta-content.md file
80
- static instanceFrom(filePath) {
81
- return new MetaMd(filePath);
82
- }
83
- static allInstancesFrom(folderPath) {
84
- return glob.sync(`${folderPath}/*.${lib_prod_2.config.file.meta_config_md}`).map(f => {
85
- return MetaMd.instanceFrom(f);
86
- });
87
- }
88
- //#endregion
89
- //#endregion
90
- //#region getters
91
- get json() {
92
- const content = lib_prod_3.Helpers.readFile(this.filePath) || '';
93
- try {
94
- const extracted = lib_prod_1._.first(extract(content, MetaMd.JSON_PART));
95
- const parsed = lib_prod_3.Helpers.parse(extracted, true);
96
- return parsed;
97
- }
98
- catch (error) {
99
- return {};
29
+ let foundedProjectsInPath = resolveFoundedProject(originalAnyTypeFiles, editorCwd, foundProjectsFn);
30
+ const mostBaseLocationFound = ___NS__minBy(foundedProjectsInPath, (p) => p.location.length).location;
31
+ const projects = foundedProjectsInPath.reduce((a, b) => {
32
+ const baseStructureHash = BaseProjectStructure.generate(b).insideIfNotExists(baseProjectsStructurePath);
33
+ return ___NS__merge(a, {
34
+ [path.join(path.basename(mostBaseLocationFound), b.location.replace(mostBaseLocationFound, ""))]: {
35
+ githash: b.git.lastCommitHash(),
36
+ name: b.name,
37
+ baseStructureHash
100
38
  }
101
- }
102
- get readonlyMetaJson() {
103
- return Object.freeze(this.json);
104
- }
105
- fileContentByIndex(i) {
106
- const content = lib_prod_3.Helpers.readFile(this.filePath) || '';
107
- const extracted = extract(content, MetaMd.FILE_CONTENT_PART)[i];
108
- return extracted;
109
- }
110
- get basename() {
111
- return lib_prod_1.path.basename(this.filePath);
112
- }
113
- get dirname() {
114
- return lib_prod_1.path.dirname(this.filePath);
115
- }
116
- //#endregion
117
- //#region constructor
118
- constructor(filePath) {
119
- this.filePath = filePath;
120
- }
121
- //#endregion
122
- //#region recreate files/content/env before any tests
123
- /**
124
- * recate original files before any unit/intergration test
125
- */
126
- recreate(testCwd, cwdProj, ProjectClass = lib_prod_3.BaseProject, onlyIfNotExists = false) {
127
- // recreat whole structure
128
- const hashDir = lib_prod_1.path.join(testCwd, this.json.timeHash);
129
- if (onlyIfNotExists && lib_prod_3.Helpers.exists(hashDir)) {
130
- return;
131
- }
132
- lib_prod_3.Helpers.removeFolderIfExists(hashDir);
133
- lib_prod_3.Helpers.mkdirp(hashDir);
134
- const firstToFind = this.json.projects[this.json.firstProjectBasename].baseStructureHash;
135
- const allBaseStructures = base_project_structure_backend_1.BaseProjectStructure.allBaseStructures(cwdProj);
136
- const baseStructure = allBaseStructures.find(p => p.baseStructureHash === firstToFind);
137
- if (!baseStructure) {
138
- lib_prod_3.Helpers.error(`[node-cli-test][regenerate] base structure was not generated for ${firstToFind}`, false, true);
139
- }
140
- baseStructure.copyto(hashDir);
141
- lib_prod_1._.keys(this.json.projects)
142
- .filter(key => key !== this.json.firstProjectBasename)
143
- .map(key => {
144
- const baseStructureHashChild = this.json.projects[key].baseStructureHash;
145
- const childBaseStruct = allBaseStructures.find(p => p.baseStructureHash === baseStructureHashChild);
146
- if (childBaseStruct) {
147
- childBaseStruct.copyto(lib_prod_1.path.join(hashDir, lib_prod_1.path.dirname(key)), lib_prod_1.path.basename(key));
148
- }
149
- });
150
- this.readonlyMetaJson.orgRelativePathes.forEach((f, i) => {
151
- const fileToWritePath = lib_prod_1.path.join(hashDir, f);
152
- lib_prod_3.Helpers.writeFile(fileToWritePath, this.fileContentByIndex(i));
153
- });
154
- const proj = ProjectClass.ins.From(lib_prod_1.path.join(hashDir, this.readonlyMetaJson.firstProjectBasename));
155
- const linksToLInk = []; // proj?.forEmptyStructure().filter(f => !!f.relativeLinkFrom) || [];
156
- linksToLInk.forEach(l => {
157
- const source = lib_prod_1.path.resolve(lib_prod_1.path.join(proj.location, l.relativeLinkFrom));
158
- if (lib_prod_3.Helpers.exists(source)) {
159
- const dest = lib_prod_1.path.resolve(lib_prod_1.path.join(proj.location, l.relativePath));
160
- lib_prod_3.Helpers.createSymLink(source, dest);
161
- }
162
- else {
163
- lib_prod_3.Helpers.log(`[cli-tester][recreate-env] not exist ${source}`);
164
- }
165
- });
166
- }
39
+ });
40
+ }, {});
41
+ const timeHash = overrideTimehash ? overrideTimehash : (+/* @__PURE__ */ new Date()).toString(36);
42
+ const c = await MetaMd.create({
43
+ orgFileBasenames: originalAnyTypeFiles.map((a) => path.basename(a)),
44
+ orgRelativePathes: originalAnyTypeFiles.map((a) => {
45
+ return path.join(path.basename(mostBaseLocationFound), a.replace(mostBaseLocationFound, ""));
46
+ }),
47
+ projects,
48
+ firstProjectBasename: path.basename(mostBaseLocationFound),
49
+ timeHash
50
+ }, originalAnyTypeFiles.map((a) => Helpers__NS__readFile(a)));
51
+ Helpers__NS__writeFile(path.join(destinationFolder, properDestName), c);
52
+ }
53
+ //#endregion
54
+ async addFiles(newFilesPathes, destinationFolder, editorCwd, foundProjectFn = void 0, baseProjectsStructurePath) {
55
+ let foundedProjectsInPath = resolveFoundedProject(newFilesPathes, editorCwd, foundProjectFn);
56
+ const mostBaseLocationFound = ___NS__minBy(foundedProjectsInPath, (p) => p.location.length).location;
57
+ newFilesPathes = Utils__NS__uniqArray([
58
+ ...newFilesPathes,
59
+ ...this.readonlyMetaJson.orgRelativePathes.map((a) => {
60
+ return path.join(path.dirname(mostBaseLocationFound), a);
61
+ })
62
+ ]);
63
+ newFilesPathes.forEach((f) => {
64
+ if (!Helpers__NS__exists(f)) {
65
+ Helpers__NS__error(`File doesn't exists`, false, true);
66
+ }
67
+ });
68
+ await MetaMd.preserveFiles(
69
+ newFilesPathes,
70
+ destinationFolder,
71
+ editorCwd,
72
+ foundProjectFn,
73
+ baseProjectsStructurePath,
74
+ path.basename(this.filePath),
75
+ this.readonlyMetaJson.timeHash
76
+ );
77
+ }
78
+ //#region static fields / handle instance from meta-content.md file
79
+ static instanceFrom(filePath) {
80
+ return new MetaMd(filePath);
81
+ }
82
+ static allInstancesFrom(folderPath) {
83
+ return glob.sync(`${folderPath}/*.${config.file.meta_config_md}`).map((f) => {
84
+ return MetaMd.instanceFrom(f);
85
+ });
86
+ }
87
+ //#endregion
88
+ //#endregion
89
+ //#region getters
90
+ get json() {
91
+ const content = Helpers__NS__readFile(this.filePath) || "";
92
+ try {
93
+ const extracted = ___NS__first(extract(content, MetaMd.JSON_PART));
94
+ const parsed = Helpers__NS__parse(extracted, true);
95
+ return parsed;
96
+ } catch (error) {
97
+ return {};
98
+ }
99
+ }
100
+ get readonlyMetaJson() {
101
+ return Object.freeze(this.json);
102
+ }
103
+ fileContentByIndex(i) {
104
+ const content = Helpers__NS__readFile(this.filePath) || "";
105
+ const extracted = extract(content, MetaMd.FILE_CONTENT_PART)[i];
106
+ return extracted;
107
+ }
108
+ get basename() {
109
+ return path.basename(this.filePath);
110
+ }
111
+ get dirname() {
112
+ return path.dirname(this.filePath);
113
+ }
114
+ //#endregion
115
+ //#region recreate files/content/env before any tests
116
+ /**
117
+ * recate original files before any unit/intergration test
118
+ */
119
+ recreate(testCwd, cwdProj, ProjectClass = Project, onlyIfNotExists = false) {
120
+ const hashDir = path.join(testCwd, this.json.timeHash);
121
+ if (onlyIfNotExists && Helpers__NS__exists(hashDir)) {
122
+ return;
123
+ }
124
+ Helpers__NS__removeFolderIfExists(hashDir);
125
+ Helpers__NS__mkdirp(hashDir);
126
+ const firstToFind = this.json.projects[this.json.firstProjectBasename].baseStructureHash;
127
+ const allBaseStructures = BaseProjectStructure.allBaseStructures(cwdProj);
128
+ const baseStructure = allBaseStructures.find((p) => p.baseStructureHash === firstToFind);
129
+ if (!baseStructure) {
130
+ Helpers__NS__error(`[node-cli-test][regenerate] base structure was not generated for ${firstToFind}`, false, true);
131
+ }
132
+ baseStructure.copyto(hashDir);
133
+ ___NS__keys(this.json.projects).filter((key) => key !== this.json.firstProjectBasename).map((key) => {
134
+ const baseStructureHashChild = this.json.projects[key].baseStructureHash;
135
+ const childBaseStruct = allBaseStructures.find((p) => p.baseStructureHash === baseStructureHashChild);
136
+ if (childBaseStruct) {
137
+ childBaseStruct.copyto(path.join(
138
+ hashDir,
139
+ path.dirname(key)
140
+ ), path.basename(key));
141
+ }
142
+ });
143
+ this.readonlyMetaJson.orgRelativePathes.forEach((f, i) => {
144
+ const fileToWritePath = path.join(hashDir, f);
145
+ Helpers__NS__writeFile(fileToWritePath, this.fileContentByIndex(i));
146
+ });
147
+ const proj = ProjectClass.ins.From(path.join(hashDir, this.readonlyMetaJson.firstProjectBasename));
148
+ const linksToLInk = [];
149
+ linksToLInk.forEach((l) => {
150
+ const source = path.resolve(path.join(proj.location, l.relativeLinkFrom));
151
+ if (Helpers__NS__exists(source)) {
152
+ const dest = path.resolve(path.join(proj.location, l.relativePath));
153
+ Helpers__NS__createSymLink(source, dest);
154
+ } else {
155
+ Helpers__NS__log(`[cli-tester][recreate-env] not exist ${source}`);
156
+ }
157
+ });
158
+ }
159
+ //#endregion
167
160
  }
168
- exports.MetaMd = MetaMd;
169
- //#region create
170
161
  async function create(json5string, fileContents, testContent) {
171
- const metadataJSON = lib_prod_3.Helpers.parse(json5string, true);
172
- // Helpers.log(`metadataJSON.orgFileBasename: ${metadataJSON.orgFileBasename}`)
173
- if (!testContent) {
174
- const projPath = lib_prod_1._.maxBy(lib_prod_1._.keys(metadataJSON.projects).map(projRelPath => {
175
- return { path: projRelPath, length: projRelPath.length };
176
- }), c => c.length)?.path || '';
177
- let TestTemplatesClass = lib_prod_4.CLASS.getBy('TestTemplates');
178
- if (!TestTemplatesClass) {
179
- TestTemplatesClass = await (await Promise.resolve().then(() => require('./spec-templates.backend'))).TestTemplates;
180
- }
181
- testContent = TestTemplatesClass.testPart(metadataJSON.orgRelativePathes, projPath, metadataJSON.timeHash);
182
- }
183
- const filesContestString = fileContents.map((fileContent, i) => {
184
- const ext = lib_prod_1.path.extname(metadataJSON.orgFileBasenames[i]).replace(/^\./, '');
185
- return `\`\`\`${ext} ${MetaMd.FILE_CONTENT_PART}
162
+ const metadataJSON = Helpers__NS__parse(json5string, true);
163
+ if (!testContent) {
164
+ const projPath = ___NS__maxBy(___NS__keys(metadataJSON.projects).map((projRelPath) => {
165
+ return { path: projRelPath, length: projRelPath.length };
166
+ }), (c) => c.length)?.path || "";
167
+ let TestTemplatesClass = CLASS.getBy("TestTemplates");
168
+ if (!TestTemplatesClass) {
169
+ TestTemplatesClass = await (await import("./spec-templates.backend")).TestTemplates;
170
+ }
171
+ testContent = TestTemplatesClass.testPart(metadataJSON.orgRelativePathes, projPath, metadataJSON.timeHash);
172
+ }
173
+ const filesContestString = fileContents.map((fileContent, i) => {
174
+ const ext = path.extname(metadataJSON.orgFileBasenames[i]).replace(/^\./, "");
175
+ return `\`\`\`${ext} ${MetaMd.FILE_CONTENT_PART}
186
176
  ${fileContent}
187
177
  \`\`\``;
188
- }).join('\n\n');
189
- return `
178
+ }).join("\n\n");
179
+ return `
190
180
  \`\`\`ts ${MetaMd.TEST_PART}
191
181
  ${testContent}
192
182
  \`\`\`
@@ -196,55 +186,51 @@ ${json5string}
196
186
  \`\`\`
197
187
 
198
188
  ${filesContestString}
199
- `.split('\n').map(l => {
200
- return l.trim().startsWith('\`\`\`') ? l.trimLeft() : l;
201
- }).join('\n').trim() + '\n';
189
+ `.split("\n").map((l) => {
190
+ return l.trim().startsWith("```") ? l.trimLeft() : l;
191
+ }).join("\n").trim() + "\n";
202
192
  }
203
- //#endregion
204
- //#region extract data parts from content md file
205
193
  function extract(content, PARTS_TO_FIND) {
206
- if (!content) {
207
- return;
208
- }
209
- const parts = [];
210
- let lines = [];
211
- const allLines = content.split('\n');
212
- let pushingActive = false;
213
- for (let index = 0; index < allLines.length; index++) {
214
- const orgLine = (allLines[index] || '');
215
- const line = orgLine.trim();
216
- if (pushingActive) {
217
- if (line.startsWith('\`\`\`')) {
218
- parts.push(lines.join('\n'));
219
- lines = [];
220
- }
221
- else {
222
- lines.push(orgLine);
223
- }
224
- }
225
- if (line.startsWith('\`\`\`') && (line.search(PARTS_TO_FIND) !== -1)) {
226
- pushingActive = true;
227
- }
228
- }
229
- return parts.filter(f => !!f.trim());
194
+ if (!content) {
195
+ return;
196
+ }
197
+ const parts = [];
198
+ let lines = [];
199
+ const allLines = content.split("\n");
200
+ let pushingActive = false;
201
+ for (let index = 0; index < allLines.length; index++) {
202
+ const orgLine = allLines[index] || "";
203
+ const line = orgLine.trim();
204
+ if (pushingActive) {
205
+ if (line.startsWith("```")) {
206
+ parts.push(lines.join("\n"));
207
+ lines = [];
208
+ } else {
209
+ lines.push(orgLine);
210
+ }
211
+ }
212
+ if (line.startsWith("```") && line.search(PARTS_TO_FIND) !== -1) {
213
+ pushingActive = true;
214
+ }
215
+ }
216
+ return parts.filter((f) => !!f.trim());
230
217
  }
231
- //#endregion
232
- //#region resolve founded projects
233
218
  function resolveFoundedProject(originalAnyTypeFiles, editorCwd, foundProjectFn) {
234
- let foundedProjectsInPath = [];
235
- for (let index = 0; index < originalAnyTypeFiles.length; index++) {
236
- const fileAbsPath = originalAnyTypeFiles[index];
237
- foundedProjectsInPath = [
238
- ...foundedProjectsInPath,
239
- ...lib_prod_3.BaseProject.ins.allProjectFrom(fileAbsPath, editorCwd)
240
- ];
241
- if (foundProjectFn) {
242
- foundedProjectsInPath = foundProjectFn(lib_prod_3.Helpers.arrays.uniqArray(foundedProjectsInPath, 'location'));
243
- }
244
- }
245
- foundedProjectsInPath = lib_prod_3.Helpers.arrays.uniqArray(foundedProjectsInPath, 'location');
246
- return foundedProjectsInPath;
219
+ let foundedProjectsInPath = [];
220
+ for (let index = 0; index < originalAnyTypeFiles.length; index++) {
221
+ const fileAbsPath = originalAnyTypeFiles[index];
222
+ foundedProjectsInPath = [
223
+ ...foundedProjectsInPath,
224
+ ...Project.ins.allProjectFrom(fileAbsPath, editorCwd)
225
+ ];
226
+ if (foundProjectFn) {
227
+ foundedProjectsInPath = foundProjectFn(Utils__NS__uniqArray(foundedProjectsInPath, "location"));
228
+ }
229
+ }
230
+ foundedProjectsInPath = Utils__NS__uniqArray(foundedProjectsInPath, "location");
231
+ return foundedProjectsInPath;
247
232
  }
248
- //#endregion
249
- //#endregion
250
- //# sourceMappingURL=meta-content-md.backend.js.map
233
+ export {
234
+ MetaMd,
235
+ extract
236
+ };
@@ -1,19 +1 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- //@ts-nocheck
18
- __exportStar(require("./migrations_index._auto-generated_"), exports);
19
- //# sourceMappingURL=index.js.map
1
+ export * from "./migrations_index._auto-generated_";
@@ -1,4 +0,0 @@
1
- // THIS FILE IS GENERATED - DO NOT MODIFY
2
- // THIS FILE IS GENERATED - DO NOT MODIFY
3
- // THIS FILE IS GENERATED - DO NOT MODIFY
4
- //# sourceMappingURL=migrations_index._auto-generated_.js.map