tnp-core 16.100.6 → 16.100.16
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/README.md +20 -20
- package/assets/shared/shared_folder_info.txt +1 -1
- package/browser/README.md +24 -24
- package/browser/esm2022/lib/helpers.mjs +173 -13
- package/browser/fesm2022/tnp-core.mjs +172 -12
- package/browser/fesm2022/tnp-core.mjs.map +1 -1
- package/browser/lib/helpers.d.ts +16 -3
- package/cli.backend.js +3 -3
- package/client/README.md +24 -24
- package/client/esm2022/lib/helpers.mjs +173 -13
- package/client/fesm2022/tnp-core.mjs +172 -12
- package/client/fesm2022/tnp-core.mjs.map +1 -1
- package/client/lib/helpers.d.ts +16 -3
- package/client/package.json +35 -34
- package/{package.json_tnp.json5 → firedev.jsonc} +72 -72
- package/lib/helpers.d.ts +18 -3
- package/lib/helpers.js +164 -8
- package/lib/helpers.js.map +1 -1
- package/lib/node-chalk-mock.js +3 -3
- package/lib/node-path-mock.js +3 -3
- package/package.json +2 -2
- package/tmp-environment.json +39 -38
- package/websql/README.md +24 -24
- package/websql/esm2022/lib/helpers.mjs +173 -13
- package/websql/fesm2022/tnp-core.mjs +172 -12
- package/websql/fesm2022/tnp-core.mjs.map +1 -1
- package/websql/lib/helpers.d.ts +16 -3
- package/package.json_devDependencies.json +0 -202
package/client/lib/helpers.d.ts
CHANGED
@@ -36,6 +36,19 @@ export declare class HelpersCore extends HelpersMessages {
|
|
36
36
|
allowRunningInsecureContent?: boolean;
|
37
37
|
}): any;
|
38
38
|
mediaTypeFromSrc(src: string): CoreModels.MediaType;
|
39
|
+
sleep(seconds?: number): any;
|
40
|
+
removeIfExists(absoluteFileOrFolderPath: string | string[]): any;
|
41
|
+
removeFileIfExists(absoluteFilePath: string | string[]): any;
|
42
|
+
removeFolderIfExists(absoluteFolderPath: string | string[]): any;
|
43
|
+
/**
|
44
|
+
* leave max 1 empty line
|
45
|
+
*/
|
46
|
+
removeEmptyLineFromString(str: string): string;
|
47
|
+
/**
|
48
|
+
* @deprecated
|
49
|
+
*/
|
50
|
+
tryRemoveDir(dirpath: string, contentOnly?: boolean, omitWarningNotExisted?: boolean): any;
|
51
|
+
remove(fileOrFolderPathOrPatter: string | string[], exactFolder?: boolean): any;
|
39
52
|
/**
|
40
53
|
* check if function is class
|
41
54
|
*/
|
@@ -65,15 +78,15 @@ export declare class HelpersCore extends HelpersMessages {
|
|
65
78
|
* @param destUrl M
|
66
79
|
*/
|
67
80
|
isSymlinkThatMatchesUrl(possibleSymlink: string, destUrl: string, absoluteFileMatch?: boolean): boolean;
|
68
|
-
isSymlinkFileExitedOrUnexisted(filePath: string): boolean;
|
81
|
+
isSymlinkFileExitedOrUnexisted(filePath: string | string[]): boolean;
|
69
82
|
/**
|
70
83
|
* If symbolnk link that target file does not exits
|
71
84
|
*/
|
72
|
-
isUnexistedLink(filePath: string): boolean;
|
85
|
+
isUnexistedLink(filePath: string | string[]): boolean;
|
73
86
|
/**
|
74
87
|
* @param existedLink check if source of link exists
|
75
88
|
*/
|
76
|
-
isExistedSymlink(filePath: string): boolean;
|
89
|
+
isExistedSymlink(filePath: string | string[]): boolean;
|
77
90
|
exists(folderOrFilePath: string | string[]): any;
|
78
91
|
/**
|
79
92
|
* this is HACK for running procesess inside processes
|
package/client/package.json
CHANGED
@@ -149,7 +149,6 @@
|
|
149
149
|
"@types/json-stringify-safe": "5.0.0",
|
150
150
|
"@types/json5": "0.0.29",
|
151
151
|
"@types/lockfile": "1.0.0",
|
152
|
-
"@types/lowdb": "1.0.6",
|
153
152
|
"@types/mocha": "5.2.5",
|
154
153
|
"@types/node": "16.18.21",
|
155
154
|
"@types/node-notifier": "5.4.0",
|
@@ -167,8 +166,8 @@
|
|
167
166
|
"angular-material-css-vars": "5.0.2",
|
168
167
|
"angular-resize-event": "3.2.0",
|
169
168
|
"animate.css": "4.1.1 ",
|
170
|
-
"any-project-cli": "
|
171
|
-
"background-worker-process": "
|
169
|
+
"any-project-cli": "16.100.5",
|
170
|
+
"background-worker-process": "16.100.4",
|
172
171
|
"base32": "0.0.7",
|
173
172
|
"bcryptjs": "2.4.3",
|
174
173
|
"better-sqlite3": "9.5.0",
|
@@ -211,16 +210,17 @@
|
|
211
210
|
"file-saver": "2.0.5",
|
212
211
|
"file-type": "18.5.0",
|
213
212
|
"firedev": "^16",
|
214
|
-
"firedev-crud": "
|
215
|
-
"firedev-crud-deamon": "
|
216
|
-
"firedev-ports": "
|
217
|
-
"firedev-storage": "
|
218
|
-
"firedev-type-sql": "
|
219
|
-
"firedev-typeorm": "
|
220
|
-
"firedev-ui": "
|
213
|
+
"firedev-crud": "16.100.5",
|
214
|
+
"firedev-crud-deamon": "16.100.4",
|
215
|
+
"firedev-ports": "16.100.5",
|
216
|
+
"firedev-storage": "16.100.3",
|
217
|
+
"firedev-type-sql": "16.100.3",
|
218
|
+
"firedev-typeorm": "16.100.3",
|
219
|
+
"firedev-ui": "16.100.5",
|
221
220
|
"font-awesome": "4.7.0",
|
222
221
|
"form-data": "4.0.0",
|
223
222
|
"fuzzy": "0.1.3",
|
223
|
+
"google-libphonenumber": "3.2.25",
|
224
224
|
"gulp": "3.9.1",
|
225
225
|
"helmet": "7.0.0",
|
226
226
|
"hostile": "1.3.3",
|
@@ -231,10 +231,10 @@
|
|
231
231
|
"image-focus": "1.2.1",
|
232
232
|
"immer": "10.0.2",
|
233
233
|
"immutable": "4.3.0",
|
234
|
-
"incremental-compiler": "
|
234
|
+
"incremental-compiler": "16.100.5",
|
235
235
|
"inquirer": "7.3.3",
|
236
236
|
"inquirer-autocomplete-prompt": "1.3.0",
|
237
|
-
"isomorphic-region-loader": "
|
237
|
+
"isomorphic-region-loader": "16.100.4",
|
238
238
|
"istanbul-instrumenter-loader": "2.0.0",
|
239
239
|
"jest": "29.5.0",
|
240
240
|
"jest-date-mock": "1.0.8",
|
@@ -245,29 +245,29 @@
|
|
245
245
|
"joi": "17.9.2",
|
246
246
|
"jscodeshift": "0.6.3",
|
247
247
|
"json-stringify-safe": "5.0.1",
|
248
|
-
"json10": "
|
249
|
-
"json10-writer": "
|
248
|
+
"json10": "16.100.3",
|
249
|
+
"json10-writer": "16.100.5",
|
250
250
|
"json5-writer": "0.2.0",
|
251
251
|
"jszip": "3.10.1",
|
252
252
|
"karma-cli": "1.0.1",
|
253
253
|
"lnk": "1.0.1",
|
254
254
|
"localforage": "1.10.0",
|
255
255
|
"lockfile": "1.0.4",
|
256
|
-
"lodash-walk-object": "
|
257
|
-
"lowdb": "
|
258
|
-
"magic-renamer": "
|
256
|
+
"lodash-walk-object": "16.100.3",
|
257
|
+
"lowdb": "7.0.1",
|
258
|
+
"magic-renamer": "16.100.4",
|
259
259
|
"material-design-icons": "3.0.1",
|
260
260
|
"method-override": "2.3.10",
|
261
261
|
"minimist": "1.2.0",
|
262
262
|
"mocha": "10.2.0",
|
263
|
-
"morphi": "~16.5.17",
|
264
263
|
"ng-for-track-by-property": "16.0.1",
|
265
264
|
"ng-in-viewport": "15.0.2",
|
266
265
|
"ng-lock": "16.0.1",
|
267
266
|
"ng-packagr": "16.0.1",
|
268
|
-
"ng-talkback": "
|
269
|
-
"ng2-logger": "
|
270
|
-
"ng2-
|
267
|
+
"ng-talkback": "16.100.3",
|
268
|
+
"ng2-logger": "16.100.5",
|
269
|
+
"ng2-pdfjs-viewer": "16.0.4",
|
270
|
+
"ng2-rest": "16.100.3",
|
271
271
|
"ngx-ace-wrapper": "14.0.0",
|
272
272
|
"ngx-editor": "15.3.0",
|
273
273
|
"ngx-highlightjs": "9.0.0",
|
@@ -280,7 +280,7 @@
|
|
280
280
|
"ngx-scrolltop": "6.0.0",
|
281
281
|
"ngx-store": "3.1.1",
|
282
282
|
"ngx-typed-js": "2.1.1",
|
283
|
-
"node-cli-tester": "
|
283
|
+
"node-cli-tester": "16.100.3",
|
284
284
|
"node-localstorage": "2.1.6",
|
285
285
|
"node-notifier": "6.0.0",
|
286
286
|
"node-polyfill-webpack-plugin": "2.0.1",
|
@@ -304,7 +304,7 @@
|
|
304
304
|
"prompts": "0.1.8",
|
305
305
|
"rallax.js": "2.0.4",
|
306
306
|
"randomcolor": "0.5.3",
|
307
|
-
"record-replay-req-res-scenario": "
|
307
|
+
"record-replay-req-res-scenario": "16.100.3",
|
308
308
|
"reflect-metadata": "0.1.10",
|
309
309
|
"rxjs": "~7.8.0",
|
310
310
|
"semver": "6.3.0",
|
@@ -314,7 +314,7 @@
|
|
314
314
|
"socket.io": "2.4.1",
|
315
315
|
"sort-package-json": "1.11.0",
|
316
316
|
"sql.js": "1.8.0",
|
317
|
-
"static-columns": "
|
317
|
+
"static-columns": "16.100.3",
|
318
318
|
"string-similarity": "4.0.2",
|
319
319
|
"sudo-block": "3.0.0",
|
320
320
|
"supertest": "6.3.3",
|
@@ -322,26 +322,27 @@
|
|
322
322
|
"systeminformation": "3.45.7",
|
323
323
|
"task.js": "0.1.5",
|
324
324
|
"threads": "1.7.0",
|
325
|
-
"tnp-cli": "
|
326
|
-
"tnp-config": "
|
327
|
-
"tnp-core": "
|
328
|
-
"tnp-db": "
|
329
|
-
"tnp-helpers": "
|
330
|
-
"tnp-models": "
|
325
|
+
"tnp-cli": "16.100.3",
|
326
|
+
"tnp-config": "16.100.5",
|
327
|
+
"tnp-core": "16.100.15",
|
328
|
+
"tnp-db": "16.100.4",
|
329
|
+
"tnp-helpers": "16.100.5",
|
330
|
+
"tnp-models": "16.100.5",
|
331
331
|
"ts-debug": "1.3.0",
|
332
|
+
"ts-json-schema-generator": "2.1.1",
|
332
333
|
"ts-loader": "2.3.1",
|
333
334
|
"ts-node": "10.9.1",
|
334
335
|
"tslib": "~2.3.0",
|
335
336
|
"tslint": "5.9.1",
|
336
337
|
"turndown": "7.1.2",
|
337
338
|
"typescript": "~5.0.2",
|
338
|
-
"typescript-class-helpers": "~16.100.
|
339
|
+
"typescript-class-helpers": "~16.100.5",
|
339
340
|
"typescript-formatter": "~7.2.2",
|
340
341
|
"underscore": "1.9.1",
|
341
342
|
"uuid": "8.3.2",
|
342
343
|
"validator": "9.2.0",
|
343
344
|
"video.js": "8.3.0",
|
344
|
-
"vpn-split": "
|
345
|
+
"vpn-split": "16.100.3",
|
345
346
|
"watch": "1.0.2",
|
346
347
|
"webpack": "~5.80",
|
347
348
|
"webpack-dev-middleware": "~6.0.2",
|
@@ -352,7 +353,7 @@
|
|
352
353
|
"license": "MIT",
|
353
354
|
"private": false,
|
354
355
|
"name": "tnp-core",
|
355
|
-
"version": "16.100.
|
356
|
-
"lastBuildTagHash": "
|
356
|
+
"version": "16.100.16",
|
357
|
+
"lastBuildTagHash": "282bb3b5c4b69e8930aefd7afff6eb07b9bd6aab",
|
357
358
|
"main": "index.js"
|
358
359
|
}
|
@@ -1,73 +1,73 @@
|
|
1
|
-
{
|
2
|
-
"resources": [
|
3
|
-
"README.md"
|
4
|
-
],
|
5
|
-
|
6
|
-
"overrided": {
|
7
|
-
"ignoreDepsPattern": [],
|
8
|
-
"includeAsDev": [],
|
9
|
-
|
10
|
-
"includeOnly": [
|
11
|
-
"axios",
|
12
|
-
"glob",
|
13
|
-
|
14
|
-
"fkill",
|
15
|
-
"copy-paste",
|
16
|
-
"chokidar",
|
17
|
-
"fs-extra",
|
18
|
-
"rimraf",
|
19
|
-
"mkdirp",
|
20
|
-
"lodash",
|
21
|
-
"@types/lodash",
|
22
|
-
"ps-list",
|
23
|
-
"ps-node",
|
24
|
-
"q",
|
25
|
-
"@types/q",
|
26
|
-
"json5",
|
27
|
-
"is-elevated",
|
28
|
-
"portfinder",
|
29
|
-
"cross-spawn",
|
30
|
-
"chalk",
|
31
|
-
"copy-paste",
|
32
|
-
"is-root",
|
33
|
-
"is-admin",
|
34
|
-
"dateformat"
|
35
|
-
],
|
36
|
-
|
37
|
-
"dependencies": {},
|
38
|
-
"linkedFolders": [],
|
39
|
-
|
40
|
-
},
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
"libReleaseOptions": {
|
46
|
-
"nodts": false,
|
47
|
-
"obscure": false,
|
48
|
-
"ugly": false,
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
},
|
55
|
-
|
56
|
-
|
57
|
-
"type": "isomorphic-lib",
|
58
|
-
"isCoreProject": false,
|
59
|
-
"useFramework": false,
|
60
|
-
"required": [],
|
61
|
-
"version": "v4",
|
62
|
-
|
63
|
-
"additionalNpmNames": [
|
64
|
-
"firedev-core"
|
65
|
-
],
|
66
|
-
|
67
|
-
"isGenerated": false,
|
68
|
-
"requiredServers": [],
|
69
|
-
"license": "MIT",
|
70
|
-
"private": false,
|
71
|
-
"main": "index.js",
|
72
|
-
"workerPlugins": {},
|
1
|
+
{
|
2
|
+
"resources": [
|
3
|
+
"README.md"
|
4
|
+
],
|
5
|
+
|
6
|
+
"overrided": {
|
7
|
+
"ignoreDepsPattern": [],
|
8
|
+
"includeAsDev": [],
|
9
|
+
|
10
|
+
"includeOnly": [
|
11
|
+
"axios",
|
12
|
+
"glob",
|
13
|
+
"moment",
|
14
|
+
"fkill",
|
15
|
+
"copy-paste",
|
16
|
+
"chokidar",
|
17
|
+
"fs-extra",
|
18
|
+
"rimraf",
|
19
|
+
"mkdirp",
|
20
|
+
"lodash",
|
21
|
+
"@types/lodash",
|
22
|
+
"ps-list",
|
23
|
+
"ps-node",
|
24
|
+
"q",
|
25
|
+
"@types/q",
|
26
|
+
"json5",
|
27
|
+
"is-elevated",
|
28
|
+
"portfinder",
|
29
|
+
"cross-spawn",
|
30
|
+
"chalk",
|
31
|
+
"copy-paste",
|
32
|
+
"is-root",
|
33
|
+
"is-admin",
|
34
|
+
"dateformat"
|
35
|
+
],
|
36
|
+
|
37
|
+
"dependencies": {},
|
38
|
+
"linkedFolders": [],
|
39
|
+
"npmFixes": [],
|
40
|
+
},
|
41
|
+
|
42
|
+
"smartContainerBuildTarget": "",
|
43
|
+
"linkedRepos": [],
|
44
|
+
|
45
|
+
"libReleaseOptions": {
|
46
|
+
"nodts": false,
|
47
|
+
"obscure": false,
|
48
|
+
"ugly": false,
|
49
|
+
"includeNodeModules": false,
|
50
|
+
"cliBuildNoDts": false,
|
51
|
+
"cliBuildObscure": false,
|
52
|
+
"cliBuildIncludeNodeModules": false,
|
53
|
+
"cliBuildUglify": false,
|
54
|
+
},
|
55
|
+
|
56
|
+
"smartContainerTarget": "",
|
57
|
+
"type": "isomorphic-lib",
|
58
|
+
"isCoreProject": false,
|
59
|
+
"useFramework": false,
|
60
|
+
"required": [],
|
61
|
+
"version": "v4",
|
62
|
+
|
63
|
+
"additionalNpmNames": [
|
64
|
+
"firedev-core"
|
65
|
+
],
|
66
|
+
|
67
|
+
"isGenerated": false,
|
68
|
+
"requiredServers": [],
|
69
|
+
"license": "MIT",
|
70
|
+
"private": false,
|
71
|
+
"main": "index.js",
|
72
|
+
"workerPlugins": {},
|
73
73
|
}
|
package/lib/helpers.d.ts
CHANGED
@@ -44,6 +44,18 @@ export declare class HelpersCore extends HelpersMessages {
|
|
44
44
|
allowRunningInsecureContent?: boolean;
|
45
45
|
}): void;
|
46
46
|
mediaTypeFromSrc(src: string): CoreModels.MediaType;
|
47
|
+
sleep(seconds?: number): string;
|
48
|
+
removeIfExists(absoluteFileOrFolderPath: string | string[]): void;
|
49
|
+
removeFileIfExists(absoluteFilePath: string | string[]): void;
|
50
|
+
removeFolderIfExists(absoluteFolderPath: string | string[]): void;
|
51
|
+
/**
|
52
|
+
* leave max 1 empty line
|
53
|
+
*/
|
54
|
+
removeEmptyLineFromString(str: string): string;
|
55
|
+
/**
|
56
|
+
* @deprecated
|
57
|
+
*/
|
58
|
+
tryRemoveDir(dirpath: string, contentOnly?: boolean, omitWarningNotExisted?: boolean): void;
|
47
59
|
remove(fileOrFolderPathOrPatter: string | string[], exactFolder?: boolean): void;
|
48
60
|
cleanExit(): void;
|
49
61
|
/**
|
@@ -87,15 +99,15 @@ export declare class HelpersCore extends HelpersMessages {
|
|
87
99
|
* @param destUrl M
|
88
100
|
*/
|
89
101
|
isSymlinkThatMatchesUrl(possibleSymlink: string, destUrl: string, absoluteFileMatch?: boolean): boolean;
|
90
|
-
isSymlinkFileExitedOrUnexisted(filePath: string): boolean;
|
102
|
+
isSymlinkFileExitedOrUnexisted(filePath: string | string[]): boolean;
|
91
103
|
/**
|
92
104
|
* If symbolnk link that target file does not exits
|
93
105
|
*/
|
94
|
-
isUnexistedLink(filePath: string): boolean;
|
106
|
+
isUnexistedLink(filePath: string | string[]): boolean;
|
95
107
|
/**
|
96
108
|
* @param existedLink check if source of link exists
|
97
109
|
*/
|
98
|
-
isExistedSymlink(filePath: string): boolean;
|
110
|
+
isExistedSymlink(filePath: string | string[]): boolean;
|
99
111
|
pathContainLink(p: string): boolean;
|
100
112
|
exists(folderOrFilePath: string | string[]): boolean;
|
101
113
|
/**
|
@@ -164,6 +176,7 @@ export declare class HelpersCore extends HelpersMessages {
|
|
164
176
|
* @returns json object
|
165
177
|
*/
|
166
178
|
readJson(absoluteFilePath: string | string[], defaultValue?: {}, useJson5?: boolean): any;
|
179
|
+
readJson5(absoluteFilePath: string | string[], defaultValue?: {}): any;
|
167
180
|
/**
|
168
181
|
* parse json from string
|
169
182
|
* @returns parse json object
|
@@ -183,7 +196,9 @@ export declare class HelpersCore extends HelpersMessages {
|
|
183
196
|
*/
|
184
197
|
writeJson(absoluteFilePath: string | (string[]), input: object, optoins?: {
|
185
198
|
preventParentFile?: boolean;
|
199
|
+
writeJson5?: boolean;
|
186
200
|
}): boolean;
|
201
|
+
writeJson5(absoluteFilePath: string | (string[]), input: object): boolean;
|
187
202
|
/**
|
188
203
|
* return absolute paths for folders inside folders
|
189
204
|
* @returns absoulte pathes to folders from path
|
package/lib/helpers.js
CHANGED
@@ -10,6 +10,7 @@ var core_models_1 = require("./core-models");
|
|
10
10
|
/* */
|
11
11
|
/* */
|
12
12
|
//#region @backend
|
13
|
+
var json5Write = require("json10-writer");
|
13
14
|
var buffer_1 = require("buffer");
|
14
15
|
var electron_1 = require("electron");
|
15
16
|
var encoding = 'utf8';
|
@@ -161,10 +162,127 @@ var HelpersCore = /** @class */ (function (_super) {
|
|
161
162
|
return core_imports_1._.first(media === null || media === void 0 ? void 0 : media.split('/'));
|
162
163
|
};
|
163
164
|
//#endregion
|
165
|
+
HelpersCore.prototype.sleep = function (seconds) {
|
166
|
+
if (seconds === void 0) { seconds = 1; }
|
167
|
+
//#region @backendFunc
|
168
|
+
return index_1.Helpers.run("sleep ".concat(seconds)).sync();
|
169
|
+
//#endregion
|
170
|
+
};
|
171
|
+
HelpersCore.prototype.removeIfExists = function (absoluteFileOrFolderPath) {
|
172
|
+
//#region @backendFunc
|
173
|
+
if (Array.isArray(absoluteFileOrFolderPath)) {
|
174
|
+
absoluteFileOrFolderPath = (0, core_imports_1.crossPlatformPath)(absoluteFileOrFolderPath);
|
175
|
+
}
|
176
|
+
if (process.platform === 'win32') {
|
177
|
+
core_imports_1.rimraf.sync(absoluteFileOrFolderPath);
|
178
|
+
return;
|
179
|
+
}
|
180
|
+
try {
|
181
|
+
core_imports_1.fse.unlinkSync(absoluteFileOrFolderPath);
|
182
|
+
}
|
183
|
+
catch (error) { }
|
184
|
+
if (core_imports_1.fse.existsSync(absoluteFileOrFolderPath)) {
|
185
|
+
if (core_imports_1.fse.lstatSync(absoluteFileOrFolderPath).isDirectory()) {
|
186
|
+
core_imports_1.fse.removeSync(absoluteFileOrFolderPath);
|
187
|
+
}
|
188
|
+
else {
|
189
|
+
core_imports_1.fse.unlinkSync(absoluteFileOrFolderPath);
|
190
|
+
}
|
191
|
+
}
|
192
|
+
//#endregion
|
193
|
+
};
|
194
|
+
HelpersCore.prototype.removeFileIfExists = function (absoluteFilePath) {
|
195
|
+
//#region @backendFunc
|
196
|
+
if (Array.isArray(absoluteFilePath)) {
|
197
|
+
absoluteFilePath = (0, core_imports_1.crossPlatformPath)(absoluteFilePath);
|
198
|
+
}
|
199
|
+
if (process.platform === 'win32') {
|
200
|
+
core_imports_1.rimraf.sync(absoluteFilePath);
|
201
|
+
return;
|
202
|
+
}
|
203
|
+
// console.log(`removeFileIfExists: ${absoluteFilePath}`)
|
204
|
+
if (core_imports_1.fse.existsSync(absoluteFilePath)) {
|
205
|
+
core_imports_1.fse.unlinkSync(absoluteFilePath);
|
206
|
+
}
|
207
|
+
//#endregion
|
208
|
+
};
|
209
|
+
HelpersCore.prototype.removeFolderIfExists = function (absoluteFolderPath) {
|
210
|
+
//#region @backendFunc
|
211
|
+
if (Array.isArray(absoluteFolderPath)) {
|
212
|
+
absoluteFolderPath = (0, core_imports_1.crossPlatformPath)(absoluteFolderPath);
|
213
|
+
}
|
214
|
+
index_1.Helpers.log("[helpers] Remove folder: ".concat(absoluteFolderPath));
|
215
|
+
if (process.platform === 'win32') {
|
216
|
+
// rimraf.sync(absoluteFolderPath);
|
217
|
+
this.tryRemoveDir(absoluteFolderPath, false, true);
|
218
|
+
return;
|
219
|
+
}
|
220
|
+
if (core_imports_1.fse.existsSync(absoluteFolderPath)) {
|
221
|
+
core_imports_1.fse.removeSync(absoluteFolderPath);
|
222
|
+
}
|
223
|
+
//#endregion
|
224
|
+
};
|
225
|
+
/**
|
226
|
+
* leave max 1 empty line
|
227
|
+
*/
|
228
|
+
HelpersCore.prototype.removeEmptyLineFromString = function (str) {
|
229
|
+
var lines = (str || '').split('\n');
|
230
|
+
var previousWasEmpty = false;
|
231
|
+
return lines.filter(function (line) {
|
232
|
+
if (line.trim() === '') {
|
233
|
+
if (previousWasEmpty) {
|
234
|
+
// Skip this line because the previous line was also empty
|
235
|
+
return false;
|
236
|
+
}
|
237
|
+
else {
|
238
|
+
// Allow this line, but set flag that next empty line should be skipped
|
239
|
+
previousWasEmpty = true;
|
240
|
+
return true;
|
241
|
+
}
|
242
|
+
}
|
243
|
+
else {
|
244
|
+
// Reset flag if the line is not empty
|
245
|
+
previousWasEmpty = false;
|
246
|
+
return true;
|
247
|
+
}
|
248
|
+
}).join('\n');
|
249
|
+
};
|
250
|
+
;
|
251
|
+
/**
|
252
|
+
* @deprecated
|
253
|
+
*/
|
254
|
+
HelpersCore.prototype.tryRemoveDir = function (dirpath, contentOnly, omitWarningNotExisted) {
|
255
|
+
if (contentOnly === void 0) { contentOnly = false; }
|
256
|
+
if (omitWarningNotExisted === void 0) { omitWarningNotExisted = false; }
|
257
|
+
//#region @backendFunc
|
258
|
+
if (!core_imports_1.fse.existsSync(dirpath)) {
|
259
|
+
if (!omitWarningNotExisted) {
|
260
|
+
index_1.Helpers.warn("[firedev-helper][tryRemoveDir] Folder ".concat(core_imports_1.path.basename(dirpath), " doesn't exist."));
|
261
|
+
}
|
262
|
+
return;
|
263
|
+
}
|
264
|
+
index_1.Helpers.log("[firedev-helpers][tryRemoveDir]: ".concat(dirpath));
|
265
|
+
try {
|
266
|
+
if (contentOnly) {
|
267
|
+
core_imports_1.rimraf.sync("".concat(dirpath, "/*"));
|
268
|
+
}
|
269
|
+
else {
|
270
|
+
core_imports_1.rimraf.sync(dirpath);
|
271
|
+
}
|
272
|
+
index_1.Helpers.log("Remove done: ".concat(dirpath));
|
273
|
+
return;
|
274
|
+
}
|
275
|
+
catch (e) {
|
276
|
+
index_1.Helpers.warn("\n\n Trying to remove directory: ".concat(dirpath, "\n\n\n (USER ACTION REQUIRED!!!)\n Please check if you did't open\n ").concat(dirpath, "\n in windows explorer\n\n\n "));
|
277
|
+
index_1.Helpers.sleep(1);
|
278
|
+
index_1.Helpers.tryRemoveDir(dirpath, contentOnly);
|
279
|
+
}
|
280
|
+
//#endregion
|
281
|
+
};
|
164
282
|
//#region methods / remove file or folder
|
165
|
-
//#region @backend
|
166
283
|
HelpersCore.prototype.remove = function (fileOrFolderPathOrPatter, exactFolder) {
|
167
284
|
if (exactFolder === void 0) { exactFolder = false; }
|
285
|
+
//#region @backendFunc
|
168
286
|
if (Array.isArray(fileOrFolderPathOrPatter)) {
|
169
287
|
fileOrFolderPathOrPatter = core_imports_1.path.join.apply(core_imports_1.path, tslib_1.__spreadArray([], tslib_1.__read(fileOrFolderPathOrPatter), false));
|
170
288
|
}
|
@@ -174,9 +292,9 @@ var HelpersCore = /** @class */ (function (_super) {
|
|
174
292
|
return;
|
175
293
|
}
|
176
294
|
core_imports_1.rimraf.sync(fileOrFolderPathOrPatter);
|
295
|
+
//#endregion
|
177
296
|
};
|
178
297
|
//#endregion
|
179
|
-
//#endregion
|
180
298
|
//#region methods / clean exit proces
|
181
299
|
//#region @backend
|
182
300
|
HelpersCore.prototype.cleanExit = function () {
|
@@ -509,6 +627,9 @@ var HelpersCore = /** @class */ (function (_super) {
|
|
509
627
|
//#region methods / is symlink file existed or unexisted
|
510
628
|
HelpersCore.prototype.isSymlinkFileExitedOrUnexisted = function (filePath) {
|
511
629
|
//#region @backendFunc
|
630
|
+
if (core_imports_1._.isArray(filePath)) {
|
631
|
+
filePath = (0, core_imports_1.crossPlatformPath)(core_imports_1.path.join.apply(core_imports_1.path, tslib_1.__spreadArray([], tslib_1.__read(filePath), false)));
|
632
|
+
}
|
512
633
|
try {
|
513
634
|
var linkToUnexitedLink = core_imports_1.fse.lstatSync(filePath).isSymbolicLink();
|
514
635
|
return linkToUnexitedLink;
|
@@ -525,6 +646,9 @@ var HelpersCore = /** @class */ (function (_super) {
|
|
525
646
|
*/
|
526
647
|
HelpersCore.prototype.isUnexistedLink = function (filePath) {
|
527
648
|
//#region @backendFunc
|
649
|
+
if (core_imports_1._.isArray(filePath)) {
|
650
|
+
filePath = (0, core_imports_1.crossPlatformPath)(core_imports_1.path.join.apply(core_imports_1.path, tslib_1.__spreadArray([], tslib_1.__read(filePath), false)));
|
651
|
+
}
|
528
652
|
filePath = index_1.Helpers.removeSlashAtEnd(filePath);
|
529
653
|
if (process.platform === 'win32') {
|
530
654
|
filePath = core_imports_1.path.win32.normalize(filePath);
|
@@ -545,6 +669,9 @@ var HelpersCore = /** @class */ (function (_super) {
|
|
545
669
|
*/
|
546
670
|
HelpersCore.prototype.isExistedSymlink = function (filePath) {
|
547
671
|
//#region @backendFunc
|
672
|
+
if (core_imports_1._.isArray(filePath)) {
|
673
|
+
filePath = (0, core_imports_1.crossPlatformPath)(core_imports_1.path.join.apply(core_imports_1.path, tslib_1.__spreadArray([], tslib_1.__read(filePath), false)));
|
674
|
+
}
|
548
675
|
filePath = index_1.Helpers.removeSlashAtEnd(filePath);
|
549
676
|
if (process.platform === 'win32') {
|
550
677
|
filePath = core_imports_1.path.win32.normalize(filePath);
|
@@ -1622,6 +1749,10 @@ var HelpersCore = /** @class */ (function (_super) {
|
|
1622
1749
|
return defaultValue;
|
1623
1750
|
}
|
1624
1751
|
};
|
1752
|
+
HelpersCore.prototype.readJson5 = function (absoluteFilePath, defaultValue) {
|
1753
|
+
if (defaultValue === void 0) { defaultValue = {}; }
|
1754
|
+
return index_1.Helpers.readJson(absoluteFilePath, defaultValue, true);
|
1755
|
+
};
|
1625
1756
|
//#endregion
|
1626
1757
|
//#endregion
|
1627
1758
|
//#region methods / parse
|
@@ -1690,6 +1821,8 @@ var HelpersCore = /** @class */ (function (_super) {
|
|
1690
1821
|
absoluteFilePath = core_imports_1.path.join.apply(this, absoluteFilePath);
|
1691
1822
|
}
|
1692
1823
|
absoluteFilePath = absoluteFilePath;
|
1824
|
+
// Helpers.info(`[firedev-core] writeFile: ${absoluteFilePath}`);
|
1825
|
+
// debugger
|
1693
1826
|
if (index_1.Helpers.isExistedSymlink(absoluteFilePath)) {
|
1694
1827
|
var beforePath = absoluteFilePath;
|
1695
1828
|
absoluteFilePath = core_imports_1.fse.realpathSync(absoluteFilePath);
|
@@ -1741,7 +1874,7 @@ var HelpersCore = /** @class */ (function (_super) {
|
|
1741
1874
|
absoluteFilePath = core_imports_1.path.join.apply(this, absoluteFilePath);
|
1742
1875
|
}
|
1743
1876
|
absoluteFilePath = absoluteFilePath;
|
1744
|
-
var
|
1877
|
+
var _a = optoins || {}, preventParentFile = _a.preventParentFile, writeJson5 = _a.writeJson5;
|
1745
1878
|
if (preventParentFile) {
|
1746
1879
|
if (index_1.Helpers.isFile(core_imports_1.path.dirname(absoluteFilePath)) && core_imports_1.fse.existsSync(core_imports_1.path.dirname(absoluteFilePath))) {
|
1747
1880
|
core_imports_1.fse.unlinkSync(core_imports_1.path.dirname(absoluteFilePath));
|
@@ -1750,12 +1883,33 @@ var HelpersCore = /** @class */ (function (_super) {
|
|
1750
1883
|
if (!core_imports_1.fse.existsSync(core_imports_1.path.dirname(absoluteFilePath))) {
|
1751
1884
|
index_1.Helpers.mkdirp(core_imports_1.path.dirname(absoluteFilePath));
|
1752
1885
|
}
|
1753
|
-
|
1754
|
-
|
1755
|
-
|
1756
|
-
|
1886
|
+
if (writeJson5) {
|
1887
|
+
var existedContent = index_1.Helpers.readFile(absoluteFilePath) || '{}';
|
1888
|
+
try {
|
1889
|
+
var writer = json5Write.load(existedContent);
|
1890
|
+
}
|
1891
|
+
catch (error) {
|
1892
|
+
console.error(error === null || error === void 0 ? void 0 : error.message);
|
1893
|
+
index_1.Helpers.error("Pleas fix your jsonc file (json with comments) in\n ".concat(absoluteFilePath), false, true);
|
1894
|
+
}
|
1895
|
+
writer.write(input);
|
1896
|
+
index_1.Helpers.writeFile(absoluteFilePath, this.removeEmptyLineFromString(writer.toSource({
|
1897
|
+
quote: 'double',
|
1898
|
+
trailingComma: false,
|
1899
|
+
quoteKeys: true
|
1900
|
+
})));
|
1901
|
+
}
|
1902
|
+
else {
|
1903
|
+
core_imports_1.fse.writeJSONSync(absoluteFilePath, input, {
|
1904
|
+
encoding: encoding,
|
1905
|
+
spaces: 2
|
1906
|
+
});
|
1907
|
+
}
|
1757
1908
|
return true;
|
1758
1909
|
};
|
1910
|
+
HelpersCore.prototype.writeJson5 = function (absoluteFilePath, input) {
|
1911
|
+
return index_1.Helpers.writeJson(absoluteFilePath, input, { writeJson5: true });
|
1912
|
+
};
|
1759
1913
|
//#endregion
|
1760
1914
|
//#endregion
|
1761
1915
|
//#region methods / folders from
|
@@ -1781,8 +1935,10 @@ var HelpersCore = /** @class */ (function (_super) {
|
|
1781
1935
|
try {
|
1782
1936
|
for (var files_1 = tslib_1.__values(files), files_1_1 = files_1.next(); !files_1_1.done; files_1_1 = files_1.next()) {
|
1783
1937
|
var file = files_1_1.value;
|
1784
|
-
if (file.isDirectory()
|
1938
|
+
if (file.isDirectory()
|
1939
|
+
&& !index_1.Helpers.isSymlinkFileExitedOrUnexisted([folderPath, file.name])) {
|
1785
1940
|
var dirPath = (0, core_imports_1.crossPlatformPath)([folderPath, file.name]);
|
1941
|
+
// console.log('dirPath', dirPath)
|
1786
1942
|
directories.push(dirPath);
|
1787
1943
|
// If recursive, read the directory found
|
1788
1944
|
if (recursive) {
|