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/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() {
|
|
@@ -1455,7 +1499,8 @@ class BaseProject {
|
|
|
1455
1499
|
return this.getLinkedProjectsConfig().projects || [];
|
|
1456
1500
|
}
|
|
1457
1501
|
get detectedLinkedProjects() {
|
|
1458
|
-
const detectedLinkedProjects = LinkedProject.detect(this.location, true
|
|
1502
|
+
const detectedLinkedProjects = LinkedProject.detect(this.location, true // TOOD fix recrusive
|
|
1503
|
+
);
|
|
1459
1504
|
return detectedLinkedProjects;
|
|
1460
1505
|
}
|
|
1461
1506
|
get linkedProjectsPrefix() {
|
|
@@ -1694,6 +1739,25 @@ class BaseProject {
|
|
|
1694
1739
|
.filter(f => !!f)
|
|
1695
1740
|
.join('/');
|
|
1696
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
|
+
}
|
|
1697
1761
|
/**
|
|
1698
1762
|
* same has project.hasFile();
|
|
1699
1763
|
*/
|
|
@@ -1704,7 +1768,14 @@ class BaseProject {
|
|
|
1704
1768
|
* same as project.pathExists();
|
|
1705
1769
|
*/
|
|
1706
1770
|
hasFile(relativePath) {
|
|
1707
|
-
|
|
1771
|
+
/* */
|
|
1772
|
+
/* */
|
|
1773
|
+
return (void 0);
|
|
1774
|
+
}
|
|
1775
|
+
hasFolder(relativePath) {
|
|
1776
|
+
/* */
|
|
1777
|
+
/* */
|
|
1778
|
+
return (void 0);
|
|
1708
1779
|
}
|
|
1709
1780
|
/**
|
|
1710
1781
|
* same as project.pathhasFileExists();
|
|
@@ -1742,6 +1813,7 @@ class BaseProject {
|
|
|
1742
1813
|
* use output from or more preciese crafted api
|
|
1743
1814
|
*/
|
|
1744
1815
|
run(command, options) {
|
|
1816
|
+
let opt;
|
|
1745
1817
|
/* */
|
|
1746
1818
|
/* */
|
|
1747
1819
|
/* */
|
|
@@ -1756,8 +1828,7 @@ class BaseProject {
|
|
|
1756
1828
|
/* */
|
|
1757
1829
|
/* */
|
|
1758
1830
|
/* */
|
|
1759
|
-
|
|
1760
|
-
return (void 0);
|
|
1831
|
+
return Helpers.run(command, opt);
|
|
1761
1832
|
}
|
|
1762
1833
|
/**
|
|
1763
1834
|
* same as run but async
|
|
@@ -2082,6 +2153,7 @@ class BaseProject {
|
|
|
2082
2153
|
/* */
|
|
2083
2154
|
/* */
|
|
2084
2155
|
/* */
|
|
2156
|
+
/* */
|
|
2085
2157
|
return (void 0);
|
|
2086
2158
|
}
|
|
2087
2159
|
_beforeAnyActionOnGitRoot() {
|
|
@@ -2519,6 +2591,8 @@ class BaseProject {
|
|
|
2519
2591
|
|
|
2520
2592
|
name: ${proj?.name}
|
|
2521
2593
|
type: ${proj?.type}
|
|
2594
|
+
core project name: '${proj?.core?.name}'
|
|
2595
|
+
embedded project: ${proj?.embeddedProject?.genericName || '< none >'}
|
|
2522
2596
|
children (${proj?.children.length}): ${(!proj || !proj.children.length) ? '< none >' : ''}
|
|
2523
2597
|
${proj?.children.map(c => '+' + c.genericName).join('\n')}
|
|
2524
2598
|
` +
|
|
@@ -2768,9 +2842,11 @@ ${(this.linkedProjects || []).map(c => '- ' + c.relativeClonePath).join('\n')}
|
|
|
2768
2842
|
/* */
|
|
2769
2843
|
return (void 0);
|
|
2770
2844
|
}
|
|
2771
|
-
startNpmTask(taskName) {
|
|
2772
|
-
|
|
2773
|
-
|
|
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 });
|
|
2774
2850
|
}
|
|
2775
2851
|
}
|
|
2776
2852
|
;
|
|
@@ -3041,11 +3117,26 @@ class CoreProject {
|
|
|
3041
3117
|
static { this.coreProjects = []; }
|
|
3042
3118
|
static from(options) {
|
|
3043
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
|
+
}
|
|
3044
3129
|
this.coreProjects.push(proj);
|
|
3045
3130
|
return proj;
|
|
3046
3131
|
}
|
|
3132
|
+
constructor() {
|
|
3133
|
+
/**
|
|
3134
|
+
* project environments
|
|
3135
|
+
*/
|
|
3136
|
+
this.environments = [];
|
|
3137
|
+
}
|
|
3047
3138
|
/**
|
|
3048
|
-
* core porject name
|
|
3139
|
+
* core porject name from repo basename
|
|
3049
3140
|
*/
|
|
3050
3141
|
get name() {
|
|
3051
3142
|
return path.basename(this.url).replace(/\.git$/, '');
|
|
@@ -3063,6 +3154,48 @@ class CoreProject {
|
|
|
3063
3154
|
return (this.urlHttp ? this.urlHttp : this.urlSSH) || '';
|
|
3064
3155
|
}
|
|
3065
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
|
+
});
|
|
3066
3199
|
;
|
|
3067
3200
|
({}); // @--end-of-file-for-module=tnp-helpers lib/base/core-project.ts
|
|
3068
3201
|
|
|
@@ -3150,6 +3283,7 @@ class LinkedPorjectsConfig {
|
|
|
3150
3283
|
;
|
|
3151
3284
|
({}); // @--end-of-file-for-module=tnp-helpers lib/base/index.ts
|
|
3152
3285
|
|
|
3286
|
+
const BaseProjectTypeArr = core.CoreModels.BaseProjectTypeArr;
|
|
3153
3287
|
({}); // @--end-of-file-for-module=tnp-helpers lib/models.ts
|
|
3154
3288
|
|
|
3155
3289
|
/**
|
|
@@ -3163,5 +3297,5 @@ const Helpers = HelpersFiredev.Instance;
|
|
|
3163
3297
|
* Generated bundle index. Do not edit.
|
|
3164
3298
|
*/
|
|
3165
3299
|
|
|
3166
|
-
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 };
|
|
3167
3301
|
//# sourceMappingURL=tnp-helpers.mjs.map
|