tnp-helpers 16.100.11 → 16.100.13
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/assets/shared/shared_folder_info.txt +1 -1
- package/browser/esm2022/lib/base/base-project.mjs +92 -13
- package/browser/esm2022/lib/base/core-project.mjs +61 -2
- package/browser/esm2022/lib/models.mjs +3 -2
- package/browser/fesm2022/tnp-helpers.mjs +152 -14
- package/browser/fesm2022/tnp-helpers.mjs.map +1 -1
- package/browser/lib/base/base-project.d.ts +31 -5
- package/browser/lib/base/core-project.d.ts +38 -13
- package/browser/lib/models.d.ts +3 -1
- package/client/esm2022/lib/base/base-project.mjs +92 -13
- package/client/esm2022/lib/base/core-project.mjs +61 -2
- package/client/esm2022/lib/models.mjs +3 -2
- package/client/fesm2022/tnp-helpers.mjs +152 -14
- package/client/fesm2022/tnp-helpers.mjs.map +1 -1
- package/client/lib/base/base-project.d.ts +31 -5
- package/client/lib/base/core-project.d.ts +38 -13
- package/client/lib/models.d.ts +3 -1
- package/client/package.json +13 -13
- package/lib/base/base-command-line.backend.d.ts +11 -0
- package/lib/base/base-command-line.backend.js +80 -11
- package/lib/base/base-command-line.backend.js.map +1 -1
- package/lib/base/base-project.d.ts +31 -9
- package/lib/base/base-project.js +248 -115
- package/lib/base/base-project.js.map +1 -1
- package/lib/base/base-start-config.backend.d.ts +4 -1
- package/lib/base/base-start-config.backend.js +26 -13
- package/lib/base/base-start-config.backend.js.map +1 -1
- package/lib/base/commit-data.js +1 -1
- package/lib/base/commit-data.js.map +1 -1
- package/lib/base/core-project.d.ts +37 -12
- package/lib/base/core-project.js +102 -2
- package/lib/base/core-project.js.map +1 -1
- package/lib/helpers/for-backend/helpers-console-gui.d.ts +1 -1
- package/lib/helpers/for-backend/helpers-console-gui.js +6 -2
- package/lib/helpers/for-backend/helpers-console-gui.js.map +1 -1
- package/lib/helpers/for-backend/helpers-file-folders.backend.js +1 -1
- package/lib/helpers/for-backend/helpers-file-folders.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-process.backend.d.ts +1 -1
- package/lib/helpers/for-browser/angular.helper.js +3 -3
- package/lib/models.d.ts +4 -2
- package/lib/models.js +3 -0
- package/lib/models.js.map +1 -1
- package/lib/old/base-component.js +3 -3
- package/lib/old/base-formly-component.js +3 -3
- package/lib/old/dual-component-ctrl.js +3 -3
- package/package.json +4 -4
- package/tmp-environment.json +16 -16
- package/websql/esm2022/lib/base/base-project.mjs +87 -13
- package/websql/esm2022/lib/base/core-project.mjs +61 -2
- package/websql/esm2022/lib/models.mjs +3 -2
- package/websql/fesm2022/tnp-helpers.mjs +147 -14
- package/websql/fesm2022/tnp-helpers.mjs.map +1 -1
- package/websql/lib/base/base-project.d.ts +31 -5
- package/websql/lib/base/core-project.d.ts +38 -13
- package/websql/lib/models.d.ts +3 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as core from 'tnp-core/browser';
|
|
1
2
|
import { _, CoreHelpers, crossPlatformPath, path } from 'tnp-core/browser';
|
|
2
3
|
import { Subject } from 'rxjs';
|
|
3
4
|
import * as fuzzy from 'fuzzy';
|
|
@@ -1314,16 +1315,21 @@ class BaseProject {
|
|
|
1314
1315
|
return result;
|
|
1315
1316
|
}
|
|
1316
1317
|
get embeddedProject() {
|
|
1318
|
+
const cacheKey = 'embeddedProject' + _.kebabCase(this.location);
|
|
1319
|
+
if (!_.isUndefined(this.globalCache[cacheKey])) {
|
|
1320
|
+
return this.globalCache[cacheKey];
|
|
1321
|
+
}
|
|
1317
1322
|
const nearsetProj = this.ins.nearestTo(crossPlatformPath([this.location, '..']));
|
|
1318
1323
|
const linkedPorj = nearsetProj.linkedProjects.find(l => {
|
|
1319
1324
|
return this.location === crossPlatformPath([nearsetProj.location, l.relativeClonePath]);
|
|
1320
1325
|
});
|
|
1321
|
-
if (!linkedPorj) {
|
|
1326
|
+
if (!linkedPorj || !linkedPorj.internalRealtiveProjectPath) {
|
|
1322
1327
|
return;
|
|
1323
1328
|
}
|
|
1324
1329
|
const pathToEmbededProj = crossPlatformPath([nearsetProj.location, linkedPorj.relativeClonePath, linkedPorj.internalRealtiveProjectPath || '']);
|
|
1325
1330
|
const embdedresult = this.ins.From(pathToEmbededProj);
|
|
1326
|
-
|
|
1331
|
+
this.globalCache[cacheKey] = embdedresult;
|
|
1332
|
+
return this.globalCache[cacheKey];
|
|
1327
1333
|
}
|
|
1328
1334
|
get projectsDbLocation() {
|
|
1329
1335
|
/* */
|
|
@@ -1353,6 +1359,10 @@ class BaseProject {
|
|
|
1353
1359
|
/* */
|
|
1354
1360
|
return (void 0);
|
|
1355
1361
|
}
|
|
1362
|
+
static { this.cache = {}; }
|
|
1363
|
+
get globalCache() {
|
|
1364
|
+
return BaseProject.cache;
|
|
1365
|
+
}
|
|
1356
1366
|
// @ts-ignore
|
|
1357
1367
|
constructor(
|
|
1358
1368
|
/**
|
|
@@ -1382,13 +1392,44 @@ class BaseProject {
|
|
|
1382
1392
|
get isMonorepo() {
|
|
1383
1393
|
return false;
|
|
1384
1394
|
}
|
|
1395
|
+
orderCoreProjects(coreProjects) {
|
|
1396
|
+
const projectMap = new Map();
|
|
1397
|
+
for (const project of coreProjects) {
|
|
1398
|
+
projectMap.set(project, []);
|
|
1399
|
+
}
|
|
1400
|
+
for (const project of coreProjects) {
|
|
1401
|
+
if (!projectMap.has(project.extends)) {
|
|
1402
|
+
projectMap.set(project.extends, []);
|
|
1403
|
+
}
|
|
1404
|
+
projectMap.get(project.extends).push(project);
|
|
1405
|
+
}
|
|
1406
|
+
const orderedProjects = [];
|
|
1407
|
+
const visited = new Set();
|
|
1408
|
+
const visit = (project) => {
|
|
1409
|
+
if (!visited.has(project)) {
|
|
1410
|
+
visited.add(project);
|
|
1411
|
+
const dependencies = projectMap.get(project);
|
|
1412
|
+
if (dependencies) {
|
|
1413
|
+
for (const dep of dependencies) {
|
|
1414
|
+
visit(dep);
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
orderedProjects.push(project);
|
|
1418
|
+
}
|
|
1419
|
+
};
|
|
1420
|
+
for (const project of coreProjects) {
|
|
1421
|
+
visit(project);
|
|
1422
|
+
}
|
|
1423
|
+
return orderedProjects.reverse();
|
|
1424
|
+
}
|
|
1385
1425
|
get core() {
|
|
1386
|
-
if (this.cache['core']) {
|
|
1426
|
+
if (!_.isUndefined(this.cache['core'])) {
|
|
1387
1427
|
return this.cache['core'];
|
|
1388
1428
|
}
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1429
|
+
let coreProjects = CoreProject.coreProjects.filter(p => p.recognizedFn(this));
|
|
1430
|
+
coreProjects = this.orderCoreProjects(coreProjects);
|
|
1431
|
+
this.cache['core'] = _.first(coreProjects);
|
|
1432
|
+
return this.cache['core'];
|
|
1392
1433
|
}
|
|
1393
1434
|
addLinkedProject(linkedProj) {
|
|
1394
1435
|
const linkedProject = _.isString(linkedProj) ? LinkedProject.fromName(linkedProj) : linkedProj;
|
|
@@ -1415,6 +1456,9 @@ class BaseProject {
|
|
|
1415
1456
|
/* */
|
|
1416
1457
|
/* */
|
|
1417
1458
|
/* */
|
|
1459
|
+
/* */
|
|
1460
|
+
/* */
|
|
1461
|
+
/* */
|
|
1418
1462
|
return (void 0);
|
|
1419
1463
|
}
|
|
1420
1464
|
get linkedProjectsConfigPath() {
|
|
@@ -1710,11 +1754,35 @@ class BaseProject {
|
|
|
1710
1754
|
/* */
|
|
1711
1755
|
/* */
|
|
1712
1756
|
/* */
|
|
1757
|
+
/* */
|
|
1758
|
+
/* */
|
|
1759
|
+
/* */
|
|
1760
|
+
/* */
|
|
1761
|
+
/* */
|
|
1762
|
+
/* */
|
|
1763
|
+
/* */
|
|
1764
|
+
/* */
|
|
1765
|
+
return (void 0);
|
|
1766
|
+
}
|
|
1767
|
+
deleteNodeModules() {
|
|
1768
|
+
this.remove(config.folder.node_modules);
|
|
1769
|
+
}
|
|
1770
|
+
reinstalNodeModules(options) {
|
|
1713
1771
|
/* */
|
|
1714
1772
|
/* */
|
|
1715
1773
|
/* */
|
|
1716
1774
|
return (void 0);
|
|
1717
1775
|
}
|
|
1776
|
+
makeSureNodeModulesInstalled(options) {
|
|
1777
|
+
if (this.nodeModulesEmpty()) {
|
|
1778
|
+
this.reinstalNodeModules(options);
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
nodeModulesEmpty() {
|
|
1782
|
+
/* */
|
|
1783
|
+
/* */
|
|
1784
|
+
return (void 0);
|
|
1785
|
+
}
|
|
1718
1786
|
/**
|
|
1719
1787
|
* same has project.hasFile();
|
|
1720
1788
|
*/
|
|
@@ -1725,7 +1793,14 @@ class BaseProject {
|
|
|
1725
1793
|
* same as project.pathExists();
|
|
1726
1794
|
*/
|
|
1727
1795
|
hasFile(relativePath) {
|
|
1728
|
-
|
|
1796
|
+
/* */
|
|
1797
|
+
/* */
|
|
1798
|
+
return (void 0);
|
|
1799
|
+
}
|
|
1800
|
+
hasFolder(relativePath) {
|
|
1801
|
+
/* */
|
|
1802
|
+
/* */
|
|
1803
|
+
return (void 0);
|
|
1729
1804
|
}
|
|
1730
1805
|
/**
|
|
1731
1806
|
* same as project.pathhasFileExists();
|
|
@@ -1763,6 +1838,7 @@ class BaseProject {
|
|
|
1763
1838
|
* use output from or more preciese crafted api
|
|
1764
1839
|
*/
|
|
1765
1840
|
run(command, options) {
|
|
1841
|
+
let opt;
|
|
1766
1842
|
/* */
|
|
1767
1843
|
/* */
|
|
1768
1844
|
/* */
|
|
@@ -1777,8 +1853,7 @@ class BaseProject {
|
|
|
1777
1853
|
/* */
|
|
1778
1854
|
/* */
|
|
1779
1855
|
/* */
|
|
1780
|
-
|
|
1781
|
-
return (void 0);
|
|
1856
|
+
return Helpers.run(command, opt);
|
|
1782
1857
|
}
|
|
1783
1858
|
/**
|
|
1784
1859
|
* same as run but async
|
|
@@ -2103,6 +2178,7 @@ class BaseProject {
|
|
|
2103
2178
|
/* */
|
|
2104
2179
|
/* */
|
|
2105
2180
|
/* */
|
|
2181
|
+
/* */
|
|
2106
2182
|
return (void 0);
|
|
2107
2183
|
}
|
|
2108
2184
|
_beforeAnyActionOnGitRoot() {
|
|
@@ -2540,6 +2616,8 @@ class BaseProject {
|
|
|
2540
2616
|
|
|
2541
2617
|
name: ${proj?.name}
|
|
2542
2618
|
type: ${proj?.type}
|
|
2619
|
+
core project name: '${proj?.core?.name}'
|
|
2620
|
+
embedded project: ${proj?.embeddedProject?.genericName || '< none >'}
|
|
2543
2621
|
children (${proj?.children.length}): ${(!proj || !proj.children.length) ? '< none >' : ''}
|
|
2544
2622
|
${proj?.children.map(c => '+' + c.genericName).join('\n')}
|
|
2545
2623
|
` +
|
|
@@ -2789,9 +2867,11 @@ ${(this.linkedProjects || []).map(c => '- ' + c.relativeClonePath).join('\n')}
|
|
|
2789
2867
|
/* */
|
|
2790
2868
|
return (void 0);
|
|
2791
2869
|
}
|
|
2792
|
-
startNpmTask(taskName) {
|
|
2793
|
-
|
|
2794
|
-
|
|
2870
|
+
startNpmTask(taskName, additionalArguments) {
|
|
2871
|
+
if (_.isObject(additionalArguments)) {
|
|
2872
|
+
additionalArguments = Object.keys(additionalArguments).map(k => `--${k} ${additionalArguments[k]}`).join(' ');
|
|
2873
|
+
}
|
|
2874
|
+
return this.run(`npm run ${taskName} ${additionalArguments ? (' -- ' + additionalArguments) : ''}`, { output: true });
|
|
2795
2875
|
}
|
|
2796
2876
|
}
|
|
2797
2877
|
;
|
|
@@ -3062,11 +3142,26 @@ class CoreProject {
|
|
|
3062
3142
|
static { this.coreProjects = []; }
|
|
3063
3143
|
static from(options) {
|
|
3064
3144
|
const proj = _.merge(new CoreProject(), _.cloneDeep(options));
|
|
3145
|
+
const methodsToCheck = [
|
|
3146
|
+
...CLASS.getMethodsNames(CoreProject),
|
|
3147
|
+
...CLASS.getMethodsNames(proj.extends || {}),
|
|
3148
|
+
];
|
|
3149
|
+
for (const commandName of methodsToCheck) {
|
|
3150
|
+
proj[commandName] = proj[commandName] || proj?.extends[commandName] || (() => {
|
|
3151
|
+
Helpers.error(`${_.upperFirst(_.startCase(commandName))} not defined for ${proj.name}`);
|
|
3152
|
+
});
|
|
3153
|
+
}
|
|
3065
3154
|
this.coreProjects.push(proj);
|
|
3066
3155
|
return proj;
|
|
3067
3156
|
}
|
|
3157
|
+
constructor() {
|
|
3158
|
+
/**
|
|
3159
|
+
* project environments
|
|
3160
|
+
*/
|
|
3161
|
+
this.environments = [];
|
|
3162
|
+
}
|
|
3068
3163
|
/**
|
|
3069
|
-
* core porject name
|
|
3164
|
+
* core porject name from repo basename
|
|
3070
3165
|
*/
|
|
3071
3166
|
get name() {
|
|
3072
3167
|
return path.basename(this.url).replace(/\.git$/, '');
|
|
@@ -3084,6 +3179,48 @@ class CoreProject {
|
|
|
3084
3179
|
return (this.urlHttp ? this.urlHttp : this.urlSSH) || '';
|
|
3085
3180
|
}
|
|
3086
3181
|
}
|
|
3182
|
+
const CoreTypescriptProject = CoreProject.from({
|
|
3183
|
+
branches: ['master', 'develop'],
|
|
3184
|
+
urlHttp: 'https://github.com/microsoft/TypeScript',
|
|
3185
|
+
environments: [],
|
|
3186
|
+
recognizedFn: (project) => {
|
|
3187
|
+
/* */
|
|
3188
|
+
/* */
|
|
3189
|
+
/* */
|
|
3190
|
+
return (void 0);
|
|
3191
|
+
},
|
|
3192
|
+
async startCommand({ project }) {
|
|
3193
|
+
/* */
|
|
3194
|
+
/* */
|
|
3195
|
+
/* */
|
|
3196
|
+
/* */
|
|
3197
|
+
return (void 0);
|
|
3198
|
+
},
|
|
3199
|
+
async buildCommand({ project, watch }) {
|
|
3200
|
+
/* */
|
|
3201
|
+
/* */
|
|
3202
|
+
/* */
|
|
3203
|
+
return (void 0);
|
|
3204
|
+
}
|
|
3205
|
+
});
|
|
3206
|
+
const CoreAngularProject = CoreProject.from({
|
|
3207
|
+
extends: CoreTypescriptProject,
|
|
3208
|
+
branches: ['master', 'develop'],
|
|
3209
|
+
urlHttp: 'https://github.com/angular/angular-cli',
|
|
3210
|
+
environments: [],
|
|
3211
|
+
recognizedFn: (project) => {
|
|
3212
|
+
return project.hasFile('angular.json');
|
|
3213
|
+
},
|
|
3214
|
+
async startCommand({ project }) {
|
|
3215
|
+
project.makeSureNodeModulesInstalled();
|
|
3216
|
+
const port = await project.assignFreePort(4200);
|
|
3217
|
+
project.run(`npm-run ng serve --port ${port}`).sync();
|
|
3218
|
+
},
|
|
3219
|
+
async buildCommand({ project }) {
|
|
3220
|
+
project.makeSureNodeModulesInstalled();
|
|
3221
|
+
project.run(`npm-run ng build`).sync();
|
|
3222
|
+
}
|
|
3223
|
+
});
|
|
3087
3224
|
;
|
|
3088
3225
|
({}); // @--end-of-file-for-module=tnp-helpers lib/base/core-project.ts
|
|
3089
3226
|
|
|
@@ -3171,6 +3308,7 @@ class LinkedPorjectsConfig {
|
|
|
3171
3308
|
;
|
|
3172
3309
|
({}); // @--end-of-file-for-module=tnp-helpers lib/base/index.ts
|
|
3173
3310
|
|
|
3311
|
+
const BaseProjectTypeArr = core.CoreModels.BaseProjectTypeArr;
|
|
3174
3312
|
({}); // @--end-of-file-for-module=tnp-helpers lib/models.ts
|
|
3175
3313
|
|
|
3176
3314
|
/**
|
|
@@ -3184,5 +3322,5 @@ const Helpers = HelpersFiredev.Instance;
|
|
|
3184
3322
|
* Generated bundle index. Do not edit.
|
|
3185
3323
|
*/
|
|
3186
3324
|
|
|
3187
|
-
export { BaseFeatureForProject, BaseProject, BaseProjectResolver, CommitData, CoreProject, Helpers, HelpersAngular, LinkedPorjectsConfig, LinkedProject, Validators };
|
|
3325
|
+
export { BaseFeatureForProject, BaseProject, BaseProjectResolver, BaseProjectTypeArr, CommitData, CoreAngularProject, CoreProject, CoreTypescriptProject, Helpers, HelpersAngular, LinkedPorjectsConfig, LinkedProject, Validators };
|
|
3188
3326
|
//# sourceMappingURL=tnp-helpers.mjs.map
|