tnp-core 19.0.49 → 19.0.51
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/browser/README.md +24 -24
- package/browser/fesm2022/tnp-core.mjs +118 -0
- package/browser/fesm2022/tnp-core.mjs.map +1 -1
- package/browser/lib/helpers.d.ts +3 -0
- package/browser/lib/utils.d.ts +3 -0
- package/browser/package.json +1 -1
- package/cli.backend.js +2 -2
- package/cli.backend.js.map +1 -1
- package/index.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/build-info._auto-generated_.js.map +1 -1
- package/lib/command-exists.js.map +1 -1
- package/lib/core-cli.js.map +1 -1
- package/lib/core-config.js.map +1 -1
- package/lib/core-imports.js.map +1 -1
- package/lib/core-models.js.map +1 -1
- package/lib/env/env.angular-node-app.js.map +1 -1
- package/lib/env/env.docs-webapp.js.map +1 -1
- package/lib/env/env.electron-app.js.map +1 -1
- package/lib/env/env.mobile-app.js.map +1 -1
- package/lib/env/env.npm-lib-and-cli-tool.js.map +1 -1
- package/lib/env/env.vscode-plugin.js.map +1 -1
- package/lib/env/index.js.map +1 -1
- package/lib/framework-name.js.map +1 -1
- package/lib/helpers-isomorphic.js.map +1 -1
- package/lib/helpers-messages.js.map +1 -1
- package/lib/helpers.d.ts +3 -0
- package/lib/helpers.js +3 -0
- package/lib/helpers.js.map +1 -1
- package/lib/index._auto-generated_.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/node-chalk-mock.js +2 -2
- package/lib/node-chalk-mock.js.map +1 -1
- package/lib/node-path-mock.js +2 -2
- package/lib/node-path-mock.js.map +1 -1
- package/lib/progress-data.js.map +1 -1
- package/lib/public-api.js.map +1 -1
- package/lib/required-global-npm-packages.js.map +1 -1
- package/lib/utils.d.ts +3 -0
- package/lib/utils.js +118 -8
- package/lib/utils.js.map +1 -1
- package/migrations/index.js.map +1 -1
- package/migrations/migrations_index._auto-generated_.js.map +1 -1
- package/package.json +1 -1
- package/tmp-environment.json +33 -0
- package/websql/README.md +24 -24
- package/websql/fesm2022/tnp-core.mjs +118 -0
- package/websql/fesm2022/tnp-core.mjs.map +1 -1
- package/websql/lib/helpers.d.ts +3 -0
- package/websql/lib/utils.d.ts +3 -0
- package/websql/package.json +1 -1
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.
|
@@ -2133,6 +2133,7 @@ var UtilsProcess;
|
|
2133
2133
|
return (void 0);
|
2134
2134
|
};
|
2135
2135
|
//#endregion
|
2136
|
+
//#region utils process / get current process and child processes usage
|
2136
2137
|
/**
|
2137
2138
|
* Get CPU and memory usage for a single PID.
|
2138
2139
|
*/
|
@@ -2160,6 +2161,8 @@ var UtilsProcess;
|
|
2160
2161
|
/* */
|
2161
2162
|
return (void 0);
|
2162
2163
|
};
|
2164
|
+
//#endregion
|
2165
|
+
//#region utils process / get child PIDs
|
2163
2166
|
/**
|
2164
2167
|
* Return a list of direct child PIDs for the given PID on a Unix-like system.
|
2165
2168
|
* Uses `ps -o pid= --ppid <pid>` to find child processes.
|
@@ -2182,6 +2185,8 @@ var UtilsProcess;
|
|
2182
2185
|
/* */
|
2183
2186
|
return (void 0);
|
2184
2187
|
}
|
2188
|
+
//#endregion
|
2189
|
+
//#region utils process / get child PIDs on Windows
|
2185
2190
|
/**
|
2186
2191
|
* Return a list of direct child PIDs for the given PID on Windows.
|
2187
2192
|
* Uses `wmic process where (ParentProcessId=<pid>) get ProcessId` to find child processes.
|
@@ -2205,6 +2210,8 @@ var UtilsProcess;
|
|
2205
2210
|
/* */
|
2206
2211
|
return (void 0);
|
2207
2212
|
}
|
2213
|
+
//#endregion
|
2214
|
+
//#region utils process / get child PIDs once
|
2208
2215
|
/**
|
2209
2216
|
* Cross-platform function to list *direct* child PIDs of a given PID.
|
2210
2217
|
* Uses the appropriate command depending on `process.platform`.
|
@@ -2219,6 +2226,8 @@ var UtilsProcess;
|
|
2219
2226
|
return (void 0);
|
2220
2227
|
}
|
2221
2228
|
UtilsProcess.getChildPidsOnce = getChildPidsOnce;
|
2229
|
+
//#endregion
|
2230
|
+
//#region utils process / get current process and child usage
|
2222
2231
|
/**
|
2223
2232
|
* Get CPU and memory usage for the current process (the Node.js process itself),
|
2224
2233
|
* plus any child processes spawned by it.
|
@@ -2251,6 +2260,72 @@ var UtilsProcess;
|
|
2251
2260
|
/* */
|
2252
2261
|
return (void 0);
|
2253
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
|
2254
2329
|
})(UtilsProcess || (UtilsProcess = {}));
|
2255
2330
|
//#endregion
|
2256
2331
|
//#region utils os
|
@@ -2579,6 +2654,33 @@ var UtilsOs;
|
|
2579
2654
|
return (void 0);
|
2580
2655
|
};
|
2581
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
|
+
/* */
|
2676
|
+
/* */
|
2677
|
+
/* */
|
2678
|
+
/* */
|
2679
|
+
/* */
|
2680
|
+
/* */
|
2681
|
+
return (void 0);
|
2682
|
+
};
|
2683
|
+
//#endregion
|
2582
2684
|
UtilsOs.openFolderInVSCode = (folderPath) => {
|
2583
2685
|
/* */
|
2584
2686
|
/* */
|
@@ -2704,6 +2806,17 @@ var UtilsTerminal;
|
|
2704
2806
|
});
|
2705
2807
|
};
|
2706
2808
|
//#endregion
|
2809
|
+
//#region wait
|
2810
|
+
UtilsTerminal.waitMiliseconds = (miliseconds) => {
|
2811
|
+
// Helpers.taskStarted(`Waiting ${miliseconds} miliseconds...`);
|
2812
|
+
return new Promise((resolve, reject) => {
|
2813
|
+
setTimeout(() => {
|
2814
|
+
// Helpers.taskDone(`Done waiting ${miliseconds} miliseconds`);
|
2815
|
+
resolve(void 0);
|
2816
|
+
}, miliseconds);
|
2817
|
+
});
|
2818
|
+
};
|
2819
|
+
//#endregion
|
2707
2820
|
//#region clear
|
2708
2821
|
UtilsTerminal.clearConsole = () => {
|
2709
2822
|
/* */
|
@@ -3290,6 +3403,7 @@ var UtilsJson;
|
|
3290
3403
|
//#endregion
|
3291
3404
|
})(UtilsJson || (UtilsJson = {}));
|
3292
3405
|
//#endregion
|
3406
|
+
//#region utils yaml
|
3293
3407
|
var UtilsYaml;
|
3294
3408
|
(function (UtilsYaml) {
|
3295
3409
|
UtilsYaml.yamlToJson = (yamlString) => {
|
@@ -3347,6 +3461,7 @@ var UtilsYaml;
|
|
3347
3461
|
};
|
3348
3462
|
//#endregion
|
3349
3463
|
})(UtilsYaml || (UtilsYaml = {}));
|
3464
|
+
//#endregion
|
3350
3465
|
|
3351
3466
|
class HelpersIsomorphic {
|
3352
3467
|
/**
|
@@ -5114,6 +5229,9 @@ class HelpersCore extends HelpersMessages {
|
|
5114
5229
|
/* */
|
5115
5230
|
//#endregion
|
5116
5231
|
//#region methods / kill process by port
|
5232
|
+
/**
|
5233
|
+
* @deprecated use UtilsProcess.killProcessOnPort
|
5234
|
+
*/
|
5117
5235
|
async killProcessByPort(portOrPortsToKill, options) {
|
5118
5236
|
/* */
|
5119
5237
|
/* */
|