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/websql';
|
|
1
2
|
import { _, CoreHelpers, crossPlatformPath, path } from 'tnp-core/websql';
|
|
2
3
|
import { Subject } from 'rxjs';
|
|
3
4
|
import * as fuzzy from 'fuzzy';
|
|
@@ -1307,16 +1308,21 @@ class BaseProject {
|
|
|
1307
1308
|
return result;
|
|
1308
1309
|
}
|
|
1309
1310
|
get embeddedProject() {
|
|
1311
|
+
const cacheKey = 'embeddedProject' + _.kebabCase(this.location);
|
|
1312
|
+
if (!_.isUndefined(this.globalCache[cacheKey])) {
|
|
1313
|
+
return this.globalCache[cacheKey];
|
|
1314
|
+
}
|
|
1310
1315
|
const nearsetProj = this.ins.nearestTo(crossPlatformPath([this.location, '..']));
|
|
1311
1316
|
const linkedPorj = nearsetProj.linkedProjects.find(l => {
|
|
1312
1317
|
return this.location === crossPlatformPath([nearsetProj.location, l.relativeClonePath]);
|
|
1313
1318
|
});
|
|
1314
|
-
if (!linkedPorj) {
|
|
1319
|
+
if (!linkedPorj || !linkedPorj.internalRealtiveProjectPath) {
|
|
1315
1320
|
return;
|
|
1316
1321
|
}
|
|
1317
1322
|
const pathToEmbededProj = crossPlatformPath([nearsetProj.location, linkedPorj.relativeClonePath, linkedPorj.internalRealtiveProjectPath || '']);
|
|
1318
1323
|
const embdedresult = this.ins.From(pathToEmbededProj);
|
|
1319
|
-
|
|
1324
|
+
this.globalCache[cacheKey] = embdedresult;
|
|
1325
|
+
return this.globalCache[cacheKey];
|
|
1320
1326
|
}
|
|
1321
1327
|
get projectsDbLocation() {
|
|
1322
1328
|
/* */
|
|
@@ -1346,6 +1352,10 @@ class BaseProject {
|
|
|
1346
1352
|
/* */
|
|
1347
1353
|
return (void 0);
|
|
1348
1354
|
}
|
|
1355
|
+
static { this.cache = {}; }
|
|
1356
|
+
get globalCache() {
|
|
1357
|
+
return BaseProject.cache;
|
|
1358
|
+
}
|
|
1349
1359
|
// @ts-ignore
|
|
1350
1360
|
constructor(
|
|
1351
1361
|
/**
|
|
@@ -1375,13 +1385,44 @@ class BaseProject {
|
|
|
1375
1385
|
get isMonorepo() {
|
|
1376
1386
|
return false;
|
|
1377
1387
|
}
|
|
1388
|
+
orderCoreProjects(coreProjects) {
|
|
1389
|
+
const projectMap = new Map();
|
|
1390
|
+
for (const project of coreProjects) {
|
|
1391
|
+
projectMap.set(project, []);
|
|
1392
|
+
}
|
|
1393
|
+
for (const project of coreProjects) {
|
|
1394
|
+
if (!projectMap.has(project.extends)) {
|
|
1395
|
+
projectMap.set(project.extends, []);
|
|
1396
|
+
}
|
|
1397
|
+
projectMap.get(project.extends).push(project);
|
|
1398
|
+
}
|
|
1399
|
+
const orderedProjects = [];
|
|
1400
|
+
const visited = new Set();
|
|
1401
|
+
const visit = (project) => {
|
|
1402
|
+
if (!visited.has(project)) {
|
|
1403
|
+
visited.add(project);
|
|
1404
|
+
const dependencies = projectMap.get(project);
|
|
1405
|
+
if (dependencies) {
|
|
1406
|
+
for (const dep of dependencies) {
|
|
1407
|
+
visit(dep);
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
orderedProjects.push(project);
|
|
1411
|
+
}
|
|
1412
|
+
};
|
|
1413
|
+
for (const project of coreProjects) {
|
|
1414
|
+
visit(project);
|
|
1415
|
+
}
|
|
1416
|
+
return orderedProjects.reverse();
|
|
1417
|
+
}
|
|
1378
1418
|
get core() {
|
|
1379
|
-
if (this.cache['core']) {
|
|
1419
|
+
if (!_.isUndefined(this.cache['core'])) {
|
|
1380
1420
|
return this.cache['core'];
|
|
1381
1421
|
}
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1422
|
+
let coreProjects = CoreProject.coreProjects.filter(p => p.recognizedFn(this));
|
|
1423
|
+
coreProjects = this.orderCoreProjects(coreProjects);
|
|
1424
|
+
this.cache['core'] = _.first(coreProjects);
|
|
1425
|
+
return this.cache['core'];
|
|
1385
1426
|
}
|
|
1386
1427
|
addLinkedProject(linkedProj) {
|
|
1387
1428
|
const linkedProject = _.isString(linkedProj) ? LinkedProject.fromName(linkedProj) : linkedProj;
|
|
@@ -1408,6 +1449,9 @@ class BaseProject {
|
|
|
1408
1449
|
/* */
|
|
1409
1450
|
/* */
|
|
1410
1451
|
/* */
|
|
1452
|
+
/* */
|
|
1453
|
+
/* */
|
|
1454
|
+
/* */
|
|
1411
1455
|
return (void 0);
|
|
1412
1456
|
}
|
|
1413
1457
|
get linkedProjectsConfigPath() {
|
|
@@ -1695,6 +1739,25 @@ class BaseProject {
|
|
|
1695
1739
|
.filter(f => !!f)
|
|
1696
1740
|
.join('/');
|
|
1697
1741
|
}
|
|
1742
|
+
deleteNodeModules() {
|
|
1743
|
+
this.remove(config.folder.node_modules);
|
|
1744
|
+
}
|
|
1745
|
+
reinstalNodeModules(options) {
|
|
1746
|
+
/* */
|
|
1747
|
+
/* */
|
|
1748
|
+
/* */
|
|
1749
|
+
return (void 0);
|
|
1750
|
+
}
|
|
1751
|
+
makeSureNodeModulesInstalled(options) {
|
|
1752
|
+
if (this.nodeModulesEmpty()) {
|
|
1753
|
+
this.reinstalNodeModules(options);
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
nodeModulesEmpty() {
|
|
1757
|
+
/* */
|
|
1758
|
+
/* */
|
|
1759
|
+
return (void 0);
|
|
1760
|
+
}
|
|
1698
1761
|
/**
|
|
1699
1762
|
* same has project.hasFile();
|
|
1700
1763
|
*/
|
|
@@ -1705,7 +1768,14 @@ class BaseProject {
|
|
|
1705
1768
|
* same as project.pathExists();
|
|
1706
1769
|
*/
|
|
1707
1770
|
hasFile(relativePath) {
|
|
1708
|
-
|
|
1771
|
+
/* */
|
|
1772
|
+
/* */
|
|
1773
|
+
return (void 0);
|
|
1774
|
+
}
|
|
1775
|
+
hasFolder(relativePath) {
|
|
1776
|
+
/* */
|
|
1777
|
+
/* */
|
|
1778
|
+
return (void 0);
|
|
1709
1779
|
}
|
|
1710
1780
|
/**
|
|
1711
1781
|
* same as project.pathhasFileExists();
|
|
@@ -1743,6 +1813,7 @@ class BaseProject {
|
|
|
1743
1813
|
* use output from or more preciese crafted api
|
|
1744
1814
|
*/
|
|
1745
1815
|
run(command, options) {
|
|
1816
|
+
let opt;
|
|
1746
1817
|
/* */
|
|
1747
1818
|
/* */
|
|
1748
1819
|
/* */
|
|
@@ -1757,8 +1828,7 @@ class BaseProject {
|
|
|
1757
1828
|
/* */
|
|
1758
1829
|
/* */
|
|
1759
1830
|
/* */
|
|
1760
|
-
|
|
1761
|
-
return (void 0);
|
|
1831
|
+
return Helpers.run(command, opt);
|
|
1762
1832
|
}
|
|
1763
1833
|
/**
|
|
1764
1834
|
* same as run but async
|
|
@@ -2083,6 +2153,7 @@ class BaseProject {
|
|
|
2083
2153
|
/* */
|
|
2084
2154
|
/* */
|
|
2085
2155
|
/* */
|
|
2156
|
+
/* */
|
|
2086
2157
|
return (void 0);
|
|
2087
2158
|
}
|
|
2088
2159
|
_beforeAnyActionOnGitRoot() {
|
|
@@ -2520,6 +2591,8 @@ class BaseProject {
|
|
|
2520
2591
|
|
|
2521
2592
|
name: ${proj?.name}
|
|
2522
2593
|
type: ${proj?.type}
|
|
2594
|
+
core project name: '${proj?.core?.name}'
|
|
2595
|
+
embedded project: ${proj?.embeddedProject?.genericName || '< none >'}
|
|
2523
2596
|
children (${proj?.children.length}): ${(!proj || !proj.children.length) ? '< none >' : ''}
|
|
2524
2597
|
${proj?.children.map(c => '+' + c.genericName).join('\n')}
|
|
2525
2598
|
` +
|
|
@@ -2769,9 +2842,11 @@ ${(this.linkedProjects || []).map(c => '- ' + c.relativeClonePath).join('\n')}
|
|
|
2769
2842
|
/* */
|
|
2770
2843
|
return (void 0);
|
|
2771
2844
|
}
|
|
2772
|
-
startNpmTask(taskName) {
|
|
2773
|
-
|
|
2774
|
-
|
|
2845
|
+
startNpmTask(taskName, additionalArguments) {
|
|
2846
|
+
if (_.isObject(additionalArguments)) {
|
|
2847
|
+
additionalArguments = Object.keys(additionalArguments).map(k => `--${k} ${additionalArguments[k]}`).join(' ');
|
|
2848
|
+
}
|
|
2849
|
+
return this.run(`npm run ${taskName} ${additionalArguments ? (' -- ' + additionalArguments) : ''}`, { output: true });
|
|
2775
2850
|
}
|
|
2776
2851
|
}
|
|
2777
2852
|
;
|
|
@@ -3042,11 +3117,26 @@ class CoreProject {
|
|
|
3042
3117
|
static { this.coreProjects = []; }
|
|
3043
3118
|
static from(options) {
|
|
3044
3119
|
const proj = _.merge(new CoreProject(), _.cloneDeep(options));
|
|
3120
|
+
const methodsToCheck = [
|
|
3121
|
+
...CLASS.getMethodsNames(CoreProject),
|
|
3122
|
+
...CLASS.getMethodsNames(proj.extends || {}),
|
|
3123
|
+
];
|
|
3124
|
+
for (const commandName of methodsToCheck) {
|
|
3125
|
+
proj[commandName] = proj[commandName] || proj?.extends[commandName] || (() => {
|
|
3126
|
+
Helpers.error(`${_.upperFirst(_.startCase(commandName))} not defined for ${proj.name}`);
|
|
3127
|
+
});
|
|
3128
|
+
}
|
|
3045
3129
|
this.coreProjects.push(proj);
|
|
3046
3130
|
return proj;
|
|
3047
3131
|
}
|
|
3132
|
+
constructor() {
|
|
3133
|
+
/**
|
|
3134
|
+
* project environments
|
|
3135
|
+
*/
|
|
3136
|
+
this.environments = [];
|
|
3137
|
+
}
|
|
3048
3138
|
/**
|
|
3049
|
-
* core porject name
|
|
3139
|
+
* core porject name from repo basename
|
|
3050
3140
|
*/
|
|
3051
3141
|
get name() {
|
|
3052
3142
|
return path.basename(this.url).replace(/\.git$/, '');
|
|
@@ -3064,6 +3154,48 @@ class CoreProject {
|
|
|
3064
3154
|
return (this.urlHttp ? this.urlHttp : this.urlSSH) || '';
|
|
3065
3155
|
}
|
|
3066
3156
|
}
|
|
3157
|
+
const CoreTypescriptProject = CoreProject.from({
|
|
3158
|
+
branches: ['master', 'develop'],
|
|
3159
|
+
urlHttp: 'https://github.com/microsoft/TypeScript',
|
|
3160
|
+
environments: [],
|
|
3161
|
+
recognizedFn: (project) => {
|
|
3162
|
+
/* */
|
|
3163
|
+
/* */
|
|
3164
|
+
/* */
|
|
3165
|
+
return (void 0);
|
|
3166
|
+
},
|
|
3167
|
+
async startCommand({ project }) {
|
|
3168
|
+
/* */
|
|
3169
|
+
/* */
|
|
3170
|
+
/* */
|
|
3171
|
+
/* */
|
|
3172
|
+
return (void 0);
|
|
3173
|
+
},
|
|
3174
|
+
async buildCommand({ project, watch }) {
|
|
3175
|
+
/* */
|
|
3176
|
+
/* */
|
|
3177
|
+
/* */
|
|
3178
|
+
return (void 0);
|
|
3179
|
+
}
|
|
3180
|
+
});
|
|
3181
|
+
const CoreAngularProject = CoreProject.from({
|
|
3182
|
+
extends: CoreTypescriptProject,
|
|
3183
|
+
branches: ['master', 'develop'],
|
|
3184
|
+
urlHttp: 'https://github.com/angular/angular-cli',
|
|
3185
|
+
environments: [],
|
|
3186
|
+
recognizedFn: (project) => {
|
|
3187
|
+
return project.hasFile('angular.json');
|
|
3188
|
+
},
|
|
3189
|
+
async startCommand({ project }) {
|
|
3190
|
+
project.makeSureNodeModulesInstalled();
|
|
3191
|
+
const port = await project.assignFreePort(4200);
|
|
3192
|
+
project.run(`npm-run ng serve --port ${port}`).sync();
|
|
3193
|
+
},
|
|
3194
|
+
async buildCommand({ project }) {
|
|
3195
|
+
project.makeSureNodeModulesInstalled();
|
|
3196
|
+
project.run(`npm-run ng build`).sync();
|
|
3197
|
+
}
|
|
3198
|
+
});
|
|
3067
3199
|
;
|
|
3068
3200
|
({}); // @--end-of-file-for-module=tnp-helpers lib/base/core-project.ts
|
|
3069
3201
|
|
|
@@ -3151,6 +3283,7 @@ class LinkedPorjectsConfig {
|
|
|
3151
3283
|
;
|
|
3152
3284
|
({}); // @--end-of-file-for-module=tnp-helpers lib/base/index.ts
|
|
3153
3285
|
|
|
3286
|
+
const BaseProjectTypeArr = core.CoreModels.BaseProjectTypeArr;
|
|
3154
3287
|
({}); // @--end-of-file-for-module=tnp-helpers lib/models.ts
|
|
3155
3288
|
|
|
3156
3289
|
/**
|
|
@@ -3164,5 +3297,5 @@ const Helpers = HelpersFiredev.Instance;
|
|
|
3164
3297
|
* Generated bundle index. Do not edit.
|
|
3165
3298
|
*/
|
|
3166
3299
|
|
|
3167
|
-
export { BaseFeatureForProject, BaseProject, BaseProjectResolver, CommitData, CoreProject, Helpers, HelpersAngular, LinkedPorjectsConfig, LinkedProject, Validators };
|
|
3300
|
+
export { BaseFeatureForProject, BaseProject, BaseProjectResolver, BaseProjectTypeArr, CommitData, CoreAngularProject, CoreProject, CoreTypescriptProject, Helpers, HelpersAngular, LinkedPorjectsConfig, LinkedProject, Validators };
|
|
3168
3301
|
//# sourceMappingURL=tnp-helpers.mjs.map
|