tnp-helpers 16.100.10 → 16.100.12
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 +94 -14
- package/browser/esm2022/lib/base/core-project.mjs +61 -2
- package/browser/esm2022/lib/models.mjs +3 -2
- package/browser/fesm2022/tnp-helpers.mjs +154 -15
- package/browser/fesm2022/tnp-helpers.mjs.map +1 -1
- package/browser/lib/base/base-project.d.ts +34 -8
- 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 +94 -14
- package/client/esm2022/lib/base/core-project.mjs +61 -2
- package/client/esm2022/lib/models.mjs +3 -2
- package/client/fesm2022/tnp-helpers.mjs +154 -15
- package/client/fesm2022/tnp-helpers.mjs.map +1 -1
- package/client/lib/base/base-project.d.ts +34 -8
- package/client/lib/base/core-project.d.ts +38 -13
- package/client/lib/models.d.ts +3 -1
- package/client/package.json +9 -9
- 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 +33 -11
- package/lib/base/base-project.js +250 -116
- 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/config-database.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-process.backend.d.ts +7 -0
- package/lib/helpers/for-backend/helpers-process.backend.js +30 -1
- package/lib/helpers/for-backend/helpers-process.backend.js.map +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 +12 -12
- package/websql/esm2022/lib/base/base-project.mjs +89 -14
- package/websql/esm2022/lib/base/core-project.mjs +61 -2
- package/websql/esm2022/lib/models.mjs +3 -2
- package/websql/fesm2022/tnp-helpers.mjs +149 -15
- package/websql/fesm2022/tnp-helpers.mjs.map +1 -1
- package/websql/lib/base/base-project.d.ts +34 -8
- 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() {
|
|
@@ -1462,7 +1506,8 @@ class BaseProject {
|
|
|
1462
1506
|
return this.getLinkedProjectsConfig().projects || [];
|
|
1463
1507
|
}
|
|
1464
1508
|
get detectedLinkedProjects() {
|
|
1465
|
-
const detectedLinkedProjects = LinkedProject.detect(this.location, true
|
|
1509
|
+
const detectedLinkedProjects = LinkedProject.detect(this.location, true // TOOD fix recrusive
|
|
1510
|
+
);
|
|
1466
1511
|
return detectedLinkedProjects;
|
|
1467
1512
|
}
|
|
1468
1513
|
get linkedProjectsPrefix() {
|
|
@@ -1709,11 +1754,35 @@ class BaseProject {
|
|
|
1709
1754
|
/* */
|
|
1710
1755
|
/* */
|
|
1711
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) {
|
|
1712
1771
|
/* */
|
|
1713
1772
|
/* */
|
|
1714
1773
|
/* */
|
|
1715
1774
|
return (void 0);
|
|
1716
1775
|
}
|
|
1776
|
+
makeSureNodeModulesInstalled(options) {
|
|
1777
|
+
if (this.nodeModulesEmpty()) {
|
|
1778
|
+
this.reinstalNodeModules(options);
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
nodeModulesEmpty() {
|
|
1782
|
+
/* */
|
|
1783
|
+
/* */
|
|
1784
|
+
return (void 0);
|
|
1785
|
+
}
|
|
1717
1786
|
/**
|
|
1718
1787
|
* same has project.hasFile();
|
|
1719
1788
|
*/
|
|
@@ -1724,7 +1793,14 @@ class BaseProject {
|
|
|
1724
1793
|
* same as project.pathExists();
|
|
1725
1794
|
*/
|
|
1726
1795
|
hasFile(relativePath) {
|
|
1727
|
-
|
|
1796
|
+
/* */
|
|
1797
|
+
/* */
|
|
1798
|
+
return (void 0);
|
|
1799
|
+
}
|
|
1800
|
+
hasFolder(relativePath) {
|
|
1801
|
+
/* */
|
|
1802
|
+
/* */
|
|
1803
|
+
return (void 0);
|
|
1728
1804
|
}
|
|
1729
1805
|
/**
|
|
1730
1806
|
* same as project.pathhasFileExists();
|
|
@@ -1762,6 +1838,7 @@ class BaseProject {
|
|
|
1762
1838
|
* use output from or more preciese crafted api
|
|
1763
1839
|
*/
|
|
1764
1840
|
run(command, options) {
|
|
1841
|
+
let opt;
|
|
1765
1842
|
/* */
|
|
1766
1843
|
/* */
|
|
1767
1844
|
/* */
|
|
@@ -1776,8 +1853,7 @@ class BaseProject {
|
|
|
1776
1853
|
/* */
|
|
1777
1854
|
/* */
|
|
1778
1855
|
/* */
|
|
1779
|
-
|
|
1780
|
-
return (void 0);
|
|
1856
|
+
return Helpers.run(command, opt);
|
|
1781
1857
|
}
|
|
1782
1858
|
/**
|
|
1783
1859
|
* same as run but async
|
|
@@ -2102,6 +2178,7 @@ class BaseProject {
|
|
|
2102
2178
|
/* */
|
|
2103
2179
|
/* */
|
|
2104
2180
|
/* */
|
|
2181
|
+
/* */
|
|
2105
2182
|
return (void 0);
|
|
2106
2183
|
}
|
|
2107
2184
|
_beforeAnyActionOnGitRoot() {
|
|
@@ -2539,6 +2616,8 @@ class BaseProject {
|
|
|
2539
2616
|
|
|
2540
2617
|
name: ${proj?.name}
|
|
2541
2618
|
type: ${proj?.type}
|
|
2619
|
+
core project name: '${proj?.core?.name}'
|
|
2620
|
+
embedded project: ${proj?.embeddedProject?.genericName || '< none >'}
|
|
2542
2621
|
children (${proj?.children.length}): ${(!proj || !proj.children.length) ? '< none >' : ''}
|
|
2543
2622
|
${proj?.children.map(c => '+' + c.genericName).join('\n')}
|
|
2544
2623
|
` +
|
|
@@ -2788,9 +2867,11 @@ ${(this.linkedProjects || []).map(c => '- ' + c.relativeClonePath).join('\n')}
|
|
|
2788
2867
|
/* */
|
|
2789
2868
|
return (void 0);
|
|
2790
2869
|
}
|
|
2791
|
-
startNpmTask(taskName) {
|
|
2792
|
-
|
|
2793
|
-
|
|
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 });
|
|
2794
2875
|
}
|
|
2795
2876
|
}
|
|
2796
2877
|
;
|
|
@@ -3061,11 +3142,26 @@ class CoreProject {
|
|
|
3061
3142
|
static { this.coreProjects = []; }
|
|
3062
3143
|
static from(options) {
|
|
3063
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
|
+
}
|
|
3064
3154
|
this.coreProjects.push(proj);
|
|
3065
3155
|
return proj;
|
|
3066
3156
|
}
|
|
3157
|
+
constructor() {
|
|
3158
|
+
/**
|
|
3159
|
+
* project environments
|
|
3160
|
+
*/
|
|
3161
|
+
this.environments = [];
|
|
3162
|
+
}
|
|
3067
3163
|
/**
|
|
3068
|
-
* core porject name
|
|
3164
|
+
* core porject name from repo basename
|
|
3069
3165
|
*/
|
|
3070
3166
|
get name() {
|
|
3071
3167
|
return path.basename(this.url).replace(/\.git$/, '');
|
|
@@ -3083,6 +3179,48 @@ class CoreProject {
|
|
|
3083
3179
|
return (this.urlHttp ? this.urlHttp : this.urlSSH) || '';
|
|
3084
3180
|
}
|
|
3085
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
|
+
});
|
|
3086
3224
|
;
|
|
3087
3225
|
({}); // @--end-of-file-for-module=tnp-helpers lib/base/core-project.ts
|
|
3088
3226
|
|
|
@@ -3170,6 +3308,7 @@ class LinkedPorjectsConfig {
|
|
|
3170
3308
|
;
|
|
3171
3309
|
({}); // @--end-of-file-for-module=tnp-helpers lib/base/index.ts
|
|
3172
3310
|
|
|
3311
|
+
const BaseProjectTypeArr = core.CoreModels.BaseProjectTypeArr;
|
|
3173
3312
|
({}); // @--end-of-file-for-module=tnp-helpers lib/models.ts
|
|
3174
3313
|
|
|
3175
3314
|
/**
|
|
@@ -3183,5 +3322,5 @@ const Helpers = HelpersFiredev.Instance;
|
|
|
3183
3322
|
* Generated bundle index. Do not edit.
|
|
3184
3323
|
*/
|
|
3185
3324
|
|
|
3186
|
-
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 };
|
|
3187
3326
|
//# sourceMappingURL=tnp-helpers.mjs.map
|