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.
- package/browser/package.json +1 -1
- package/browser-prod/package.json +1 -1
- package/browser-prod.re-export.json +1 -0
- package/lib/base-project-structure.backend.js +10 -7
- package/lib/base-project-structure.backend.js.map +1 -1
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/meta-content-md.backend.js +3 -3
- package/lib/meta-content-md.backend.js.map +1 -1
- package/lib/node-cli-tester.js +4 -4
- package/lib/node-cli-tester.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib-prod/base-project-structure.backend.js +71 -71
- package/lib-prod/build-info._auto-generated_.js +14 -30
- package/lib-prod/cli-test.backend.js +133 -122
- package/lib-prod/env/env.angular-node-app.js +130 -71
- package/lib-prod/env/env.docs-webapp.js +130 -71
- package/lib-prod/env/env.electron-app.js +130 -71
- package/lib-prod/env/env.mobile-app.js +130 -71
- package/lib-prod/env/env.npm-lib-and-cli-tool.js +130 -71
- package/lib-prod/env/env.vscode-plugin.js +130 -71
- package/lib-prod/env/index.js +6 -23
- package/lib-prod/index._auto-generated_.js +0 -6
- package/lib-prod/index.js +10 -14
- package/lib-prod/meta-content-md.backend.js +214 -228
- package/lib-prod/migrations/index.js +1 -19
- package/lib-prod/migrations/migrations_index._auto-generated_.js +0 -4
- package/lib-prod/node-cli-tester.js +193 -200
- package/lib-prod/package.json +1 -1
- package/lib-prod/spec-templates.backend.js +49 -54
- package/lib-prod/start.backend.js +13 -26
- package/lib-prod.re-export.json +1 -0
- package/package.json +2 -1
- package/websql/package.json +1 -1
- package/websql-prod/package.json +1 -1
- package/websql-prod.re-export.json +1 -0
- package/lib-prod/base-project-structure.backend.d.ts +0 -13
- package/lib-prod/base-project-structure.backend.js.map +0 -1
- package/lib-prod/build-info._auto-generated_.d.ts +0 -24
- package/lib-prod/build-info._auto-generated_.js.map +0 -1
- package/lib-prod/cli-test.backend.d.ts +0 -24
- package/lib-prod/cli-test.backend.js.map +0 -1
- package/lib-prod/env/env.angular-node-app.d.ts +0 -64
- package/lib-prod/env/env.angular-node-app.js.map +0 -1
- package/lib-prod/env/env.docs-webapp.d.ts +0 -64
- package/lib-prod/env/env.docs-webapp.js.map +0 -1
- package/lib-prod/env/env.electron-app.d.ts +0 -64
- package/lib-prod/env/env.electron-app.js.map +0 -1
- package/lib-prod/env/env.mobile-app.d.ts +0 -64
- package/lib-prod/env/env.mobile-app.js.map +0 -1
- package/lib-prod/env/env.npm-lib-and-cli-tool.d.ts +0 -64
- package/lib-prod/env/env.npm-lib-and-cli-tool.js.map +0 -1
- package/lib-prod/env/env.vscode-plugin.d.ts +0 -64
- package/lib-prod/env/env.vscode-plugin.js.map +0 -1
- package/lib-prod/env/index.d.ts +0 -6
- package/lib-prod/env/index.js.map +0 -1
- package/lib-prod/index._auto-generated_.d.ts +0 -0
- package/lib-prod/index._auto-generated_.js.map +0 -1
- package/lib-prod/index.d.ts +0 -4
- package/lib-prod/index.js.map +0 -1
- package/lib-prod/meta-content-md.backend.d.ts +0 -42
- package/lib-prod/meta-content-md.backend.js.map +0 -1
- package/lib-prod/migrations/index.d.ts +0 -1
- package/lib-prod/migrations/index.js.map +0 -1
- package/lib-prod/migrations/migrations_index._auto-generated_.d.ts +0 -0
- package/lib-prod/migrations/migrations_index._auto-generated_.js.map +0 -1
- package/lib-prod/node-cli-tester.d.ts +0 -25
- package/lib-prod/node-cli-tester.js.map +0 -1
- package/lib-prod/spec-templates.backend.d.ts +0 -6
- package/lib-prod/spec-templates.backend.js.map +0 -1
- package/lib-prod/start.backend.d.ts +0 -2
- package/lib-prod/start.backend.js.map +0 -1
|
@@ -1,192 +1,182 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
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
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
const
|
|
184
|
-
|
|
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
|
-
|
|
189
|
-
|
|
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(
|
|
200
|
-
|
|
201
|
-
|
|
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
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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
|
-
|
|
249
|
-
|
|
250
|
-
|
|
233
|
+
export {
|
|
234
|
+
MetaMd,
|
|
235
|
+
extract
|
|
236
|
+
};
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
|
|
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_";
|