tnp-core 19.0.48 → 19.0.50

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 (67) hide show
  1. package/README.md +20 -20
  2. package/browser/README.md +24 -24
  3. package/browser/fesm2022/tnp-core.mjs +277 -32
  4. package/browser/fesm2022/tnp-core.mjs.map +1 -1
  5. package/browser/lib/helpers.d.ts +10 -2
  6. package/browser/lib/utils.d.ts +19 -0
  7. package/browser/package.json +1 -1
  8. package/cli.backend.js +2 -2
  9. package/cli.backend.js.map +1 -1
  10. package/index.js.map +1 -1
  11. package/lib/build-info._auto-generated_.d.ts +1 -1
  12. package/lib/build-info._auto-generated_.js +1 -1
  13. package/lib/build-info._auto-generated_.js.map +1 -1
  14. package/lib/command-exists.js.map +1 -1
  15. package/lib/core-cli.js.map +1 -1
  16. package/lib/core-config.js.map +1 -1
  17. package/lib/core-imports.js +2 -1
  18. package/lib/core-imports.js.map +1 -1
  19. package/lib/core-models.js.map +1 -1
  20. package/lib/env/env.angular-node-app.d.ts +1 -0
  21. package/lib/env/env.angular-node-app.js +3 -2
  22. package/lib/env/env.angular-node-app.js.map +1 -1
  23. package/lib/env/env.docs-webapp.d.ts +1 -0
  24. package/lib/env/env.docs-webapp.js +3 -2
  25. package/lib/env/env.docs-webapp.js.map +1 -1
  26. package/lib/env/env.electron-app.d.ts +1 -0
  27. package/lib/env/env.electron-app.js +3 -2
  28. package/lib/env/env.electron-app.js.map +1 -1
  29. package/lib/env/env.mobile-app.d.ts +1 -0
  30. package/lib/env/env.mobile-app.js +3 -2
  31. package/lib/env/env.mobile-app.js.map +1 -1
  32. package/lib/env/env.npm-lib-and-cli-tool.d.ts +1 -0
  33. package/lib/env/env.npm-lib-and-cli-tool.js +3 -2
  34. package/lib/env/env.npm-lib-and-cli-tool.js.map +1 -1
  35. package/lib/env/env.vscode-plugin.d.ts +1 -0
  36. package/lib/env/env.vscode-plugin.js +3 -2
  37. package/lib/env/env.vscode-plugin.js.map +1 -1
  38. package/lib/env/index.js.map +1 -1
  39. package/lib/framework-name.d.ts +2 -2
  40. package/lib/framework-name.js.map +1 -1
  41. package/lib/helpers-isomorphic.js.map +1 -1
  42. package/lib/helpers-messages.js.map +1 -1
  43. package/lib/helpers.d.ts +12 -2
  44. package/lib/helpers.js +25 -27
  45. package/lib/helpers.js.map +1 -1
  46. package/lib/index._auto-generated_.js.map +1 -1
  47. package/lib/index.js.map +1 -1
  48. package/lib/node-chalk-mock.js +2 -2
  49. package/lib/node-chalk-mock.js.map +1 -1
  50. package/lib/node-path-mock.js +2 -2
  51. package/lib/node-path-mock.js.map +1 -1
  52. package/lib/progress-data.js.map +1 -1
  53. package/lib/public-api.js.map +1 -1
  54. package/lib/required-global-npm-packages.js.map +1 -1
  55. package/lib/utils.d.ts +19 -0
  56. package/lib/utils.js +226 -5
  57. package/lib/utils.js.map +1 -1
  58. package/migrations/index.js.map +1 -1
  59. package/migrations/migrations_index._auto-generated_.js.map +1 -1
  60. package/package.json +1 -1
  61. package/websql/README.md +24 -24
  62. package/websql/fesm2022/tnp-core.mjs +277 -32
  63. package/websql/fesm2022/tnp-core.mjs.map +1 -1
  64. package/websql/lib/helpers.d.ts +10 -2
  65. package/websql/lib/utils.d.ts +19 -0
  66. package/websql/package.json +1 -1
  67. package/tmp-environment.json +0 -33
package/README.md CHANGED
@@ -1,20 +1,20 @@
1
- # taon-core ( tnp-core )
2
-
3
- - Part of [taon.dev](https://github.com/darekf77/taon)
4
- - JavasScript/Typescript most essential helpers
5
- - Basic taon releated helpers
6
- - Purpose:
7
- + lightweight most essential helpers library
8
- + crossplatform helpers for NodeJs/Browser
9
-
10
-
11
- ## Usage
12
- - in taon isomorphic libs/apps or any NodeJS apps/libs:
13
- ```ts
14
- import { Helpers } from 'tnp-core';
15
- ```
16
-
17
- - in any frontend browser apps (except taon libs/apps)
18
- ```ts
19
- import { Helpers } from 'tnp-core/browser';
20
- ```
1
+ # taon-core ( tnp-core )
2
+
3
+ - Part of [taon.dev](https://github.com/darekf77/taon)
4
+ - JavasScript/Typescript most essential helpers
5
+ - Basic taon releated helpers
6
+ - Purpose:
7
+ + lightweight most essential helpers library
8
+ + crossplatform helpers for NodeJs/Browser
9
+
10
+
11
+ ## Usage
12
+ - in taon isomorphic libs/apps or any NodeJS apps/libs:
13
+ ```ts
14
+ import { Helpers } from 'tnp-core';
15
+ ```
16
+
17
+ - in any frontend browser apps (except taon libs/apps)
18
+ ```ts
19
+ import { Helpers } from 'tnp-core/browser';
20
+ ```
package/browser/README.md CHANGED
@@ -1,24 +1,24 @@
1
- # MyLib
2
-
3
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.2.0.
4
-
5
- ## Code scaffolding
6
-
7
- Run `ng generate component component-name --project my-lib` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project my-lib`.
8
- > Note: Don't forget to add `--project my-lib` or else it will be added to the default project in your `angular.json` file.
9
-
10
- ## Build
11
-
12
- Run `ng build my-lib` to build the project. The build artifacts will be stored in the `dist/` directory.
13
-
14
- ## Publishing
15
-
16
- After building your library with `ng build my-lib`, go to the dist folder `cd dist/my-lib` and run `npm publish`.
17
-
18
- ## Running unit tests
19
-
20
- Run `ng test my-lib` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
-
22
- ## Further help
23
-
24
- To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
1
+ # MyLib
2
+
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.2.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Run `ng generate component component-name --project my-lib` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project my-lib`.
8
+ > Note: Don't forget to add `--project my-lib` or else it will be added to the default project in your `angular.json` file.
9
+
10
+ ## Build
11
+
12
+ Run `ng build my-lib` to build the project. The build artifacts will be stored in the `dist/` directory.
13
+
14
+ ## Publishing
15
+
16
+ After building your library with `ng build my-lib`, go to the dist folder `cd dist/my-lib` and run `npm publish`.
17
+
18
+ ## Running unit tests
19
+
20
+ Run `ng test my-lib` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
+
22
+ ## Further help
23
+
24
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
@@ -729,7 +729,8 @@ const crossPlatformPath = (pathStringOrPathParts) => {
729
729
  }
730
730
  if (hasNonAscii) {
731
731
  const allNonAscii = pathStringOrPathParts.match(/[^\u0000-\u0080]+/g) || '';
732
- Helpers.logWarn(`[taon-core][crossPlatformPath]: Path contains non-ascii characters: ${allNonAscii}`);
732
+ Helpers.logWarn(`[taon-core][crossPlatformPath]: path below contains non-ascii characters (${allNonAscii}):
733
+ "${pathStringOrPathParts}"`);
733
734
  Helpers.logWarn(pathStringOrPathParts);
734
735
  }
735
736
  pathStringOrPathParts = (pathStringOrPathParts || '')
@@ -2132,6 +2133,7 @@ var UtilsProcess;
2132
2133
  return (void 0);
2133
2134
  };
2134
2135
  //#endregion
2136
+ //#region utils process / get current process and child processes usage
2135
2137
  /**
2136
2138
  * Get CPU and memory usage for a single PID.
2137
2139
  */
@@ -2159,6 +2161,8 @@ var UtilsProcess;
2159
2161
  /* */
2160
2162
  return (void 0);
2161
2163
  };
2164
+ //#endregion
2165
+ //#region utils process / get child PIDs
2162
2166
  /**
2163
2167
  * Return a list of direct child PIDs for the given PID on a Unix-like system.
2164
2168
  * Uses `ps -o pid= --ppid <pid>` to find child processes.
@@ -2181,6 +2185,8 @@ var UtilsProcess;
2181
2185
  /* */
2182
2186
  return (void 0);
2183
2187
  }
2188
+ //#endregion
2189
+ //#region utils process / get child PIDs on Windows
2184
2190
  /**
2185
2191
  * Return a list of direct child PIDs for the given PID on Windows.
2186
2192
  * Uses `wmic process where (ParentProcessId=<pid>) get ProcessId` to find child processes.
@@ -2204,6 +2210,8 @@ var UtilsProcess;
2204
2210
  /* */
2205
2211
  return (void 0);
2206
2212
  }
2213
+ //#endregion
2214
+ //#region utils process / get child PIDs once
2207
2215
  /**
2208
2216
  * Cross-platform function to list *direct* child PIDs of a given PID.
2209
2217
  * Uses the appropriate command depending on `process.platform`.
@@ -2218,6 +2226,8 @@ var UtilsProcess;
2218
2226
  return (void 0);
2219
2227
  }
2220
2228
  UtilsProcess.getChildPidsOnce = getChildPidsOnce;
2229
+ //#endregion
2230
+ //#region utils process / get current process and child usage
2221
2231
  /**
2222
2232
  * Get CPU and memory usage for the current process (the Node.js process itself),
2223
2233
  * plus any child processes spawned by it.
@@ -2250,6 +2260,72 @@ var UtilsProcess;
2250
2260
  /* */
2251
2261
  return (void 0);
2252
2262
  };
2263
+ //#endregion
2264
+ //#region kill process on port
2265
+ UtilsProcess.killProcessOnPort = async (port) => {
2266
+ if (!port || isNaN(port) || UtilsOs.isBrowser) {
2267
+ Helpers.warn(`[UtilsProcess.killProcessOnPort]: Invalid port number: ${port}`);
2268
+ return false;
2269
+ }
2270
+ /* */
2271
+ /* */
2272
+ /* */
2273
+ /* */
2274
+ /* */
2275
+ /* */
2276
+ /* */
2277
+ /* */
2278
+ /* */
2279
+ /* */
2280
+ /* */
2281
+ /* */
2282
+ /* */
2283
+ /* */
2284
+ /* */
2285
+ /* */
2286
+ /* */
2287
+ /* */
2288
+ /* */
2289
+ /* */
2290
+ /* */
2291
+ /* */
2292
+ /* */
2293
+ /* */
2294
+ /* */
2295
+ /* */
2296
+ /* */
2297
+ /* */
2298
+ /* */
2299
+ /* */
2300
+ /* */
2301
+ /* */
2302
+ /* */
2303
+ /* */
2304
+ /* */
2305
+ /* */
2306
+ /* */
2307
+ /* */
2308
+ /* */
2309
+ /* */
2310
+ /* */
2311
+ /* */
2312
+ /* */
2313
+ /* */
2314
+ /* */
2315
+ /* */
2316
+ /* */
2317
+ /* */
2318
+ /* */
2319
+ /* */
2320
+ /* */
2321
+ /* */
2322
+ /* */
2323
+ /* */
2324
+ /* */
2325
+ /* */
2326
+ return (void 0);
2327
+ };
2328
+ //#endregion
2253
2329
  })(UtilsProcess || (UtilsProcess = {}));
2254
2330
  //#endregion
2255
2331
  //#region utils os
@@ -2447,6 +2523,44 @@ var UtilsOs;
2447
2523
  /* */
2448
2524
  /* */
2449
2525
  /* */
2526
+ /* */
2527
+ /* */
2528
+ /* */
2529
+ /* */
2530
+ /* */
2531
+ /* */
2532
+ /* */
2533
+ /* */
2534
+ /* */
2535
+ /* */
2536
+ /* */
2537
+ /* */
2538
+ /* */
2539
+ /* */
2540
+ /* */
2541
+ /* */
2542
+ /* */
2543
+ /* */
2544
+ /* */
2545
+ /* */
2546
+ /* */
2547
+ /* */
2548
+ /* */
2549
+ /* */
2550
+ /* */
2551
+ /* */
2552
+ /* */
2553
+ /* */
2554
+ /* */
2555
+ /* */
2556
+ /* */
2557
+ /* */
2558
+ /* */
2559
+ /* */
2560
+ /* */
2561
+ /* */
2562
+ /* */
2563
+ /* */
2450
2564
  return (void 0);
2451
2565
  };
2452
2566
  //#endregion
@@ -2540,6 +2654,27 @@ var UtilsOs;
2540
2654
  return (void 0);
2541
2655
  };
2542
2656
  //#endregion
2657
+ //#region utils os / is docker available
2658
+ UtilsOs.isDockerAvailable = async () => {
2659
+ if (UtilsOs.isBrowser) {
2660
+ return false;
2661
+ }
2662
+ /* */
2663
+ /* */
2664
+ /* */
2665
+ /* */
2666
+ /* */
2667
+ /* */
2668
+ /* */
2669
+ /* */
2670
+ /* */
2671
+ /* */
2672
+ /* */
2673
+ /* */
2674
+ /* */
2675
+ return (void 0);
2676
+ };
2677
+ //#endregion
2543
2678
  UtilsOs.openFolderInVSCode = (folderPath) => {
2544
2679
  /* */
2545
2680
  /* */
@@ -2665,6 +2800,17 @@ var UtilsTerminal;
2665
2800
  });
2666
2801
  };
2667
2802
  //#endregion
2803
+ //#region wait
2804
+ UtilsTerminal.waitMiliseconds = (miliseconds) => {
2805
+ // Helpers.taskStarted(`Waiting ${miliseconds} miliseconds...`);
2806
+ return new Promise((resolve, reject) => {
2807
+ setTimeout(() => {
2808
+ // Helpers.taskDone(`Done waiting ${miliseconds} miliseconds`);
2809
+ resolve(void 0);
2810
+ }, miliseconds);
2811
+ });
2812
+ };
2813
+ //#endregion
2668
2814
  //#region clear
2669
2815
  UtilsTerminal.clearConsole = () => {
2670
2816
  /* */
@@ -3211,6 +3357,103 @@ var UtilsTerminal;
3211
3357
  //#endregion
3212
3358
  })(UtilsTerminal || (UtilsTerminal = {}));
3213
3359
  //#endregion
3360
+ //#region utils json
3361
+ var UtilsJson;
3362
+ (function (UtilsJson) {
3363
+ //#region read json
3364
+ /**
3365
+ * read json from absolute path
3366
+ * @returns json object
3367
+ */
3368
+ UtilsJson.readJson = (absoluteFilePath, defaultValue = {}, useJson5 = false) => {
3369
+ /* */
3370
+ /* */
3371
+ /* */
3372
+ /* */
3373
+ /* */
3374
+ /* */
3375
+ /* */
3376
+ /* */
3377
+ /* */
3378
+ /* */
3379
+ /* */
3380
+ /* */
3381
+ /* */
3382
+ /* */
3383
+ /* */
3384
+ /* */
3385
+ /* */
3386
+ /* */
3387
+ /* */
3388
+ return (void 0);
3389
+ };
3390
+ //#endregion
3391
+ //#region read json with comments
3392
+ UtilsJson.readJsonWithComments = (absoluteFilePath, defaultValue = {}) => {
3393
+ /* */
3394
+ /* */
3395
+ return (void 0);
3396
+ };
3397
+ //#endregion
3398
+ })(UtilsJson || (UtilsJson = {}));
3399
+ //#endregion
3400
+ var UtilsYaml;
3401
+ (function (UtilsYaml) {
3402
+ UtilsYaml.yamlToJson = (yamlString) => {
3403
+ /* */
3404
+ /* */
3405
+ /* */
3406
+ /* */
3407
+ /* */
3408
+ /* */
3409
+ /* */
3410
+ /* */
3411
+ /* */
3412
+ return (void 0);
3413
+ };
3414
+ UtilsYaml.jsonToYaml = (json) => {
3415
+ /* */
3416
+ /* */
3417
+ /* */
3418
+ /* */
3419
+ /* */
3420
+ /* */
3421
+ /* */
3422
+ /* */
3423
+ /* */
3424
+ /* */
3425
+ /* */
3426
+ /* */
3427
+ return (void 0);
3428
+ };
3429
+ //#region read yaml as json
3430
+ UtilsYaml.readYamlAsJson = (absFilePathToYamlOrYmlFile, options) => {
3431
+ /* */
3432
+ /* */
3433
+ /* */
3434
+ /* */
3435
+ /* */
3436
+ /* */
3437
+ /* */
3438
+ /* */
3439
+ /* */
3440
+ /* */
3441
+ /* */
3442
+ return (void 0);
3443
+ };
3444
+ //#endregion
3445
+ //#region write json to yaml
3446
+ UtilsYaml.writeJsonToYaml = (destinationYamlfileAbsPath, json) => {
3447
+ /* */
3448
+ /* */
3449
+ /* */
3450
+ /* */
3451
+ /* */
3452
+ /* */
3453
+ return (void 0);
3454
+ };
3455
+ //#endregion
3456
+ })(UtilsYaml || (UtilsYaml = {}));
3214
3457
 
3215
3458
  class HelpersIsomorphic {
3216
3459
  /**
@@ -4978,6 +5221,9 @@ class HelpersCore extends HelpersMessages {
4978
5221
  /* */
4979
5222
  //#endregion
4980
5223
  //#region methods / kill process by port
5224
+ /**
5225
+ * @deprecated use UtilsProcess.killProcessOnPort
5226
+ */
4981
5227
  async killProcessByPort(portOrPortsToKill, options) {
4982
5228
  /* */
4983
5229
  /* */
@@ -5832,42 +6078,22 @@ class HelpersCore extends HelpersMessages {
5832
6078
  //#endregion
5833
6079
  //#region methods / read json
5834
6080
  /**
5835
- * read json from absolute path
5836
- * @returns json object
6081
+ * @deprecated use UtilsJson.readJson or UtilsJson.readJson5
5837
6082
  */
5838
6083
  readJson(absoluteFilePath, defaultValue = {}, useJson5 = false) {
5839
- /* */
5840
- /* */
5841
- /* */
5842
- /* */
5843
- /* */
5844
- /* */
5845
- /* */
5846
- /* */
5847
- /* */
5848
- /* */
5849
- /* */
5850
- /* */
5851
- /* */
5852
- /* */
5853
- /* */
5854
- /* */
5855
- /* */
5856
- /* */
5857
- /* */
5858
- /* */
5859
- /* */
5860
- return (void 0);
6084
+ return UtilsJson.readJson(absoluteFilePath, defaultValue, useJson5);
5861
6085
  }
6086
+ /**
6087
+ * @deprecated use UtilsJson.readJsonWithComments
6088
+ */
5862
6089
  readJson5(absoluteFilePath, defaultValue = {}) {
5863
- /* */
5864
- /* */
5865
- return (void 0);
6090
+ return UtilsJson.readJsonWithComments(absoluteFilePath, defaultValue);
5866
6091
  }
6092
+ /**
6093
+ * @deprecated use UtilsJson.readJsonWithComments
6094
+ */
5867
6095
  readJsonC(absoluteFilePath, defaultValue = {}) {
5868
- /* */
5869
- /* */
5870
- return (void 0);
6096
+ return UtilsJson.readJsonWithComments(absoluteFilePath, defaultValue);
5871
6097
  }
5872
6098
  //#endregion
5873
6099
  //#region methods / parse
@@ -6135,6 +6361,25 @@ class HelpersCore extends HelpersMessages {
6135
6361
  /* */
6136
6362
  /* */
6137
6363
  /* */
6364
+ /* */
6365
+ /* */
6366
+ /* */
6367
+ /* */
6368
+ /* */
6369
+ /* */
6370
+ /* */
6371
+ /* */
6372
+ /* */
6373
+ /* */
6374
+ /* */
6375
+ /* */
6376
+ /* */
6377
+ /* */
6378
+ /* */
6379
+ /* */
6380
+ /* */
6381
+ /* */
6382
+ /* */
6138
6383
  //#endregion
6139
6384
  //#region methods / links from
6140
6385
  /* */
@@ -6472,5 +6717,5 @@ let Helpers = HelpersCore.InstanceCore;
6472
6717
  * Generated bundle index. Do not edit.
6473
6718
  */
6474
6719
 
6475
- export { $, CLI, CoreConfig, HelpersCore as CoreHelpers, CoreModels, Helpers, PROGRESS_DATA, Utils, UtilsMigrations, UtilsOs, UtilsProcess, UtilsString, UtilsTerminal, chalk, child_process, chokidar, crossPlatformPath, fg, fkill, frameworkName, frameworkNameBe, fse, glob, http, https, isElevated, mkdirp, ncp, net, os, path, ps, psList, requiredForDev, rimraf, spawn, win32Path };
6720
+ export { $, CLI, CoreConfig, HelpersCore as CoreHelpers, CoreModels, Helpers, PROGRESS_DATA, Utils, UtilsJson, UtilsMigrations, UtilsOs, UtilsProcess, UtilsString, UtilsTerminal, UtilsYaml, chalk, child_process, chokidar, crossPlatformPath, fg, fkill, frameworkName, frameworkNameBe, fse, glob, http, https, isElevated, mkdirp, ncp, net, os, path, ps, psList, requiredForDev, rimraf, spawn, win32Path };
6476
6721
  //# sourceMappingURL=tnp-core.mjs.map