tnp-helpers 16.5.16 → 16.5.19
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-feature-for-project.mjs +8 -0
- package/browser/esm2022/lib/base/base-project-resolver.mjs +204 -0
- package/browser/esm2022/lib/base/base-project.mjs +1007 -0
- package/browser/esm2022/lib/base/commit-data.mjs +145 -0
- package/browser/esm2022/lib/base/index.mjs +11 -0
- package/browser/esm2022/lib/base/translate.mjs +42 -0
- package/browser/esm2022/lib/helpers.mjs +6 -3
- package/browser/esm2022/lib/index.mjs +2 -3
- package/browser/esm2022/lib/models.mjs +1 -1
- package/browser/fesm2022/tnp-helpers.mjs +860 -84
- package/browser/fesm2022/tnp-helpers.mjs.map +1 -1
- package/browser/lib/base/base-feature-for-project.d.ts +6 -0
- package/{client/lib → browser/lib/base}/base-project-resolver.d.ts +4 -7
- package/browser/lib/base/base-project.d.ts +287 -0
- package/browser/lib/base/commit-data.d.ts +31 -0
- package/browser/lib/base/index.d.ts +5 -0
- package/browser/lib/base/translate.d.ts +2 -0
- package/browser/lib/index.d.ts +2 -3
- package/browser/lib/models.d.ts +1 -1
- package/client/esm2022/lib/base/base-feature-for-project.mjs +8 -0
- package/client/esm2022/lib/base/base-project-resolver.mjs +204 -0
- package/client/esm2022/lib/base/base-project.mjs +1007 -0
- package/client/esm2022/lib/base/commit-data.mjs +145 -0
- package/client/esm2022/lib/base/index.mjs +11 -0
- package/client/esm2022/lib/base/translate.mjs +42 -0
- package/client/esm2022/lib/helpers.mjs +6 -3
- package/client/esm2022/lib/index.mjs +2 -3
- package/client/esm2022/lib/models.mjs +1 -1
- package/client/fesm2022/tnp-helpers.mjs +860 -84
- package/client/fesm2022/tnp-helpers.mjs.map +1 -1
- package/client/lib/base/base-feature-for-project.d.ts +6 -0
- package/{browser/lib → client/lib/base}/base-project-resolver.d.ts +4 -7
- package/client/lib/base/base-project.d.ts +287 -0
- package/client/lib/base/commit-data.d.ts +31 -0
- package/client/lib/base/index.d.ts +5 -0
- package/client/lib/base/translate.d.ts +2 -0
- package/client/lib/index.d.ts +2 -3
- package/client/lib/models.d.ts +1 -1
- package/client/package.json +37 -34
- package/lib/base/base-command-line.backend.d.ts +79 -0
- package/lib/base/base-command-line.backend.js +674 -0
- package/lib/base/base-command-line.backend.js.map +1 -0
- package/lib/base/base-feature-for-project.d.ts +5 -0
- package/lib/base/base-feature-for-project.js +11 -0
- package/lib/base/base-feature-for-project.js.map +1 -0
- package/lib/{base-project-resolver.d.ts → base/base-project-resolver.d.ts} +4 -7
- package/lib/{base-project-resolver.js → base/base-project-resolver.js} +33 -28
- package/lib/base/base-project-resolver.js.map +1 -0
- package/lib/base/base-project.d.ts +297 -0
- package/lib/base/base-project.js +1451 -0
- package/lib/base/base-project.js.map +1 -0
- package/lib/base/base-start-config.backend.d.ts +35 -0
- package/lib/base/base-start-config.backend.js +126 -0
- package/lib/base/base-start-config.backend.js.map +1 -0
- package/lib/base/command-line-feature.backend.d.ts +32 -0
- package/lib/base/command-line-feature.backend.js +89 -0
- package/lib/base/command-line-feature.backend.js.map +1 -0
- package/lib/base/commit-data.d.ts +30 -0
- package/lib/base/commit-data.js +200 -0
- package/lib/base/commit-data.js.map +1 -0
- package/lib/base/index.d.ts +7 -0
- package/lib/base/index.js +13 -0
- package/lib/base/index.js.map +1 -0
- package/lib/base/translate.d.ts +1 -0
- package/lib/base/translate.js +80 -0
- package/lib/base/translate.js.map +1 -0
- package/lib/for-backend/helpers-cli-tool.backend.d.ts +42 -22
- package/lib/for-backend/helpers-cli-tool.backend.js +129 -180
- package/lib/for-backend/helpers-cli-tool.backend.js.map +1 -1
- package/lib/for-backend/helpers-file-folders.backend.d.ts +2 -8
- package/lib/for-backend/helpers-file-folders.backend.js +4 -14
- package/lib/for-backend/helpers-file-folders.backend.js.map +1 -1
- package/lib/for-backend/helpers-git.backend.d.ts +48 -12
- package/lib/for-backend/helpers-git.backend.js +227 -142
- package/lib/for-backend/helpers-git.backend.js.map +1 -1
- package/lib/for-backend/helpers-process.backend.d.ts +5 -11
- package/lib/for-backend/helpers-process.backend.js +77 -39
- package/lib/for-backend/helpers-process.backend.js.map +1 -1
- package/lib/for-backend/helpers-vscode.backend.d.ts +3 -3
- package/lib/for-backend/helpers-vscode.backend.js.map +1 -1
- package/lib/for-browser/angular.helper.js +3 -3
- package/lib/helpers.d.ts +2 -3
- package/lib/helpers.js +5 -2
- package/lib/helpers.js.map +1 -1
- package/lib/index.d.ts +2 -3
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib/models.d.ts +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 +8 -5
- package/package.json_tnp.json5 +4 -1
- package/tmp-environment.json +41 -45
- package/websql/esm2022/lib/base/base-feature-for-project.mjs +8 -0
- package/websql/esm2022/lib/base/base-project-resolver.mjs +203 -0
- package/websql/esm2022/lib/base/base-project.mjs +994 -0
- package/websql/esm2022/lib/base/commit-data.mjs +145 -0
- package/websql/esm2022/lib/base/index.mjs +11 -0
- package/websql/esm2022/lib/base/translate.mjs +42 -0
- package/websql/esm2022/lib/helpers.mjs +6 -3
- package/websql/esm2022/lib/index.mjs +2 -3
- package/websql/esm2022/lib/models.mjs +1 -1
- package/websql/fesm2022/tnp-helpers.mjs +861 -85
- package/websql/fesm2022/tnp-helpers.mjs.map +1 -1
- package/websql/lib/base/base-feature-for-project.d.ts +6 -0
- package/websql/lib/{base-project-resolver.d.ts → base/base-project-resolver.d.ts} +4 -7
- package/websql/lib/base/base-project.d.ts +287 -0
- package/websql/lib/base/commit-data.d.ts +31 -0
- package/websql/lib/base/index.d.ts +5 -0
- package/websql/lib/base/translate.d.ts +2 -0
- package/websql/lib/index.d.ts +2 -3
- package/websql/lib/models.d.ts +1 -1
- package/browser/esm2022/lib/base-project-resolver.mjs +0 -223
- package/browser/esm2022/lib/base-project.mjs +0 -374
- package/browser/lib/base-project.d.ts +0 -94
- package/client/esm2022/lib/base-project-resolver.mjs +0 -223
- package/client/esm2022/lib/base-project.mjs +0 -374
- package/client/lib/base-project.d.ts +0 -94
- package/lib/base-project-resolver.js.map +0 -1
- package/lib/base-project.d.ts +0 -103
- package/lib/base-project.js +0 -482
- package/lib/base-project.js.map +0 -1
- package/lib/git-project.d.ts +0 -57
- package/lib/git-project.js +0 -224
- package/lib/git-project.js.map +0 -1
- package/websql/esm2022/lib/base-project-resolver.mjs +0 -222
- package/websql/esm2022/lib/base-project.mjs +0 -361
- package/websql/lib/base-project.d.ts +0 -94
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import { Models } from 'tnp-models/browser';
|
|
3
|
-
import { BaseProjectResolver } from './base-project-resolver';
|
|
4
|
-
export declare abstract class BaseProject<T extends BaseProject = any> {
|
|
5
|
-
readonly location: string;
|
|
6
|
-
static ins: BaseProjectResolver<BaseProject<any>>;
|
|
7
|
-
static sortGroupOfProject<T extends BaseProject<any> = BaseProject<any>>(projects: T[], resoveDepsArray: (proj: T) => string[], projNameToCompare: (proj: T) => string): T[];
|
|
8
|
-
cache: any;
|
|
9
|
-
constructor(location: string);
|
|
10
|
-
abstract readonly ins: BaseProjectResolver<T>;
|
|
11
|
-
/**
|
|
12
|
-
* doesn't need to be real path -> can be link
|
|
13
|
-
*/
|
|
14
|
-
get basename(): string;
|
|
15
|
-
get name(): string;
|
|
16
|
-
readonly type: string;
|
|
17
|
-
get version(): string;
|
|
18
|
-
/**
|
|
19
|
-
* npm dependencies
|
|
20
|
-
*/
|
|
21
|
-
get dependencies(): Models.npm.DependenciesFromPackageJsonStyle;
|
|
22
|
-
/**
|
|
23
|
-
* peerDependencies dependencies
|
|
24
|
-
*/
|
|
25
|
-
get peerDependencies(): Models.npm.DependenciesFromPackageJsonStyle;
|
|
26
|
-
/**
|
|
27
|
-
* devDependencies dependencies
|
|
28
|
-
*/
|
|
29
|
-
get devDependencies(): Models.npm.DependenciesFromPackageJsonStyle;
|
|
30
|
-
/**
|
|
31
|
-
* resolutions dependencies
|
|
32
|
-
*/
|
|
33
|
-
get resolutions(): any;
|
|
34
|
-
/**
|
|
35
|
-
* object with all deps from package json
|
|
36
|
-
*/
|
|
37
|
-
get allDependencies(): {
|
|
38
|
-
[packageName: string]: string;
|
|
39
|
-
};
|
|
40
|
-
get tnp(): Models.npm.TnpData & Models.npm.TnpIPackageJSONOverride;
|
|
41
|
-
get firedev(): Models.npm.TnpData & Models.npm.TnpIPackageJSONOverride;
|
|
42
|
-
protected readonly packageJSON: Models.npm.IPackageJSON;
|
|
43
|
-
/**
|
|
44
|
-
* only available after executing *this.assignFreePort()*
|
|
45
|
-
*/
|
|
46
|
-
readonly port: string;
|
|
47
|
-
/**
|
|
48
|
-
* alias to getAllChildren
|
|
49
|
-
*/
|
|
50
|
-
get children(): T[];
|
|
51
|
-
child(nameOrBasename: string, errors?: boolean): T;
|
|
52
|
-
get parent(): T;
|
|
53
|
-
get grandpa(): T;
|
|
54
|
-
get genericName(): any;
|
|
55
|
-
/**
|
|
56
|
-
* try run but continue when it fails
|
|
57
|
-
* @param command
|
|
58
|
-
* @param options
|
|
59
|
-
* @returns
|
|
60
|
-
*/
|
|
61
|
-
tryRunSync(command: string): void;
|
|
62
|
-
/**
|
|
63
|
-
* same has project.hasFile();
|
|
64
|
-
*/
|
|
65
|
-
pathExists(relativePath: string | string[]): boolean;
|
|
66
|
-
/**
|
|
67
|
-
* same as project.pathExists();
|
|
68
|
-
*/
|
|
69
|
-
hasFile(relativePath: string | string[]): boolean;
|
|
70
|
-
/**
|
|
71
|
-
* same as project.pathhasFileExists();
|
|
72
|
-
* but with path.resolve
|
|
73
|
-
*/
|
|
74
|
-
containsFile(fileRelativeToProjectPath: string): any;
|
|
75
|
-
/**
|
|
76
|
-
* absolute path:
|
|
77
|
-
* concated project location with relative path
|
|
78
|
-
*/
|
|
79
|
-
pathFor(relativePath: string | string[]): any;
|
|
80
|
-
writeJson(relativePath: string, json: object): any;
|
|
81
|
-
run(command: string): any;
|
|
82
|
-
outputFrom(command: string): any;
|
|
83
|
-
removeFile(fileRelativeToProjectPath: string): any;
|
|
84
|
-
remove(relativePath: string, exactPath?: boolean): any;
|
|
85
|
-
linkNodeModulesTo(proj: Partial<BaseProject>): any;
|
|
86
|
-
reinstallNodeModules(forcerRemoveNodeModules?: boolean): any;
|
|
87
|
-
assignFreePort(startFrom?: number, howManyFreePortsAfterThatPort?: number): Promise<number>;
|
|
88
|
-
filterOnlyCopy(basePathFoldersOnlyToInclude: string[]): any;
|
|
89
|
-
removeItself(): void;
|
|
90
|
-
filterDontCopy(basePathFoldersTosSkip: string[]): any;
|
|
91
|
-
defineProperty<T>(variableName: keyof T, classFn: Function): any;
|
|
92
|
-
protected getAllChildren(): any;
|
|
93
|
-
protected getFoldersForPossibleProjectChildren(): string[];
|
|
94
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-project-resolver.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;;AACA,qCAIkB;AAClB,kBAAkB;AAClB,+CAA6C;AAApC,6GAAA,YAAY,OAAA;AACrB,mCAA8B;AAC9B,YAAY;AACZ,iCAAkC;AAClC,qCAAmD;AACnD,yCAAoC;AACpC,qCAA6B;AAK7B;IASE,6BAAsB,OAAY;QAAZ,YAAO,GAAP,OAAO,CAAK;QAPf,oBAAe,GAAG,KAAK,CAAC;QACjC,aAAQ,GAAQ,EAAE,CAAC;QAC7B;;;WAGG;QACO,mBAAc,GAAa,EAAE,CAAC;IACF,CAAC;IACvC,sBAAI,6CAAY;aAAhB;YACE,qBAAqB;YACrB,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YAC9B,sHAAsH;YACtH,YAAY;QACd,CAAC;;;OAAA;IAED,sBAAI,wCAAO;aAAX;YACE,sBAAsB;YACtB,IAAM,OAAO,GAAG,CAAC,IAAI,C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I,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACxB;QACD,IAAI,QAAQ,GAAG,YAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,QAAQ,EAAE;YACZ,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACvC,IAAM,KAAK,GAAG,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAnB,CAAmB,CAAC,CAAC;YACrE,IAAI,KAAK,EAAE,EAAE,aAAa;gBACxB,cAAc,GAAG,KAAK,CAAC;aACxB;SACF;QACD,OAAO,cAAc,CAAC;QACtB,YAAY;IACd,CAAC;IAIH,0BAAC;AAAD,CAAC,AAhPD,IAgPC;AAhPY,kDAAmB"}
|
package/lib/base-project.d.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { RunOptions } from 'tnp-core';
|
|
3
|
-
export { ChildProcess } from 'child_process';
|
|
4
|
-
import { ProjectGit } from './git-project';
|
|
5
|
-
import { CommandOutputOptions } from 'tnp-core';
|
|
6
|
-
import { Models } from 'tnp-models';
|
|
7
|
-
import { BaseProjectResolver } from './base-project-resolver';
|
|
8
|
-
export declare abstract class BaseProject<T extends BaseProject = any> extends ProjectGit {
|
|
9
|
-
readonly location: string;
|
|
10
|
-
static ins: BaseProjectResolver<BaseProject<any>>;
|
|
11
|
-
static sortGroupOfProject<T extends BaseProject<any> = BaseProject<any>>(projects: T[], resoveDepsArray: (proj: T) => string[], projNameToCompare: (proj: T) => string): T[];
|
|
12
|
-
cache: any;
|
|
13
|
-
constructor(location: string);
|
|
14
|
-
abstract readonly ins: BaseProjectResolver<T>;
|
|
15
|
-
/**
|
|
16
|
-
* doesn't need to be real path -> can be link
|
|
17
|
-
*/
|
|
18
|
-
get basename(): string;
|
|
19
|
-
get name(): string;
|
|
20
|
-
readonly type: string;
|
|
21
|
-
get version(): string;
|
|
22
|
-
/**
|
|
23
|
-
* npm dependencies
|
|
24
|
-
*/
|
|
25
|
-
get dependencies(): Models.npm.DependenciesFromPackageJsonStyle;
|
|
26
|
-
/**
|
|
27
|
-
* peerDependencies dependencies
|
|
28
|
-
*/
|
|
29
|
-
get peerDependencies(): Models.npm.DependenciesFromPackageJsonStyle;
|
|
30
|
-
/**
|
|
31
|
-
* devDependencies dependencies
|
|
32
|
-
*/
|
|
33
|
-
get devDependencies(): Models.npm.DependenciesFromPackageJsonStyle;
|
|
34
|
-
/**
|
|
35
|
-
* resolutions dependencies
|
|
36
|
-
*/
|
|
37
|
-
get resolutions(): any;
|
|
38
|
-
/**
|
|
39
|
-
* object with all deps from package json
|
|
40
|
-
*/
|
|
41
|
-
get allDependencies(): {
|
|
42
|
-
[packageName: string]: string;
|
|
43
|
-
};
|
|
44
|
-
get tnp(): Models.npm.TnpData & Models.npm.TnpIPackageJSONOverride;
|
|
45
|
-
get firedev(): Models.npm.TnpData & Models.npm.TnpIPackageJSONOverride;
|
|
46
|
-
protected readonly packageJSON: Models.npm.IPackageJSON;
|
|
47
|
-
/**
|
|
48
|
-
* only available after executing *this.assignFreePort()*
|
|
49
|
-
*/
|
|
50
|
-
readonly port: string;
|
|
51
|
-
/**
|
|
52
|
-
* alias to getAllChildren
|
|
53
|
-
*/
|
|
54
|
-
get children(): T[];
|
|
55
|
-
child(nameOrBasename: string, errors?: boolean): T;
|
|
56
|
-
get parent(): T;
|
|
57
|
-
get grandpa(): T;
|
|
58
|
-
get genericName(): string;
|
|
59
|
-
/**
|
|
60
|
-
* try run but continue when it fails
|
|
61
|
-
* @param command
|
|
62
|
-
* @param options
|
|
63
|
-
* @returns
|
|
64
|
-
*/
|
|
65
|
-
tryRunSync(command: string, options?: Omit<RunOptions, 'cwd'>): void;
|
|
66
|
-
/**
|
|
67
|
-
* same has project.hasFile();
|
|
68
|
-
*/
|
|
69
|
-
pathExists(relativePath: string | string[]): boolean;
|
|
70
|
-
/**
|
|
71
|
-
* same as project.pathExists();
|
|
72
|
-
*/
|
|
73
|
-
hasFile(relativePath: string | string[]): boolean;
|
|
74
|
-
/**
|
|
75
|
-
* same as project.pathhasFileExists();
|
|
76
|
-
* but with path.resolve
|
|
77
|
-
*/
|
|
78
|
-
containsFile(fileRelativeToProjectPath: string): boolean;
|
|
79
|
-
/**
|
|
80
|
-
* absolute path:
|
|
81
|
-
* concated project location with relative path
|
|
82
|
-
*/
|
|
83
|
-
pathFor(relativePath: string | string[]): string;
|
|
84
|
-
writeJson(relativePath: string, json: object): void;
|
|
85
|
-
run(command: string, options?: Omit<RunOptions, 'cwd'>): {
|
|
86
|
-
sync(): string;
|
|
87
|
-
async(detach?: boolean, mockFun?: (stdoutCallback: (dataForStdout: any) => any, stdErrcCallback: (dataForStder: any) => any, shouldProcesBeDead?: () => boolean) => number | Promise<number>): import("child_process").ChildProcess;
|
|
88
|
-
asyncAsPromise(): any;
|
|
89
|
-
unitlOutputContains(stdoutMsg: string | string[], stderMsg?: string | string[], timeout?: number): Promise<any>;
|
|
90
|
-
};
|
|
91
|
-
outputFrom(command: string, options?: CommandOutputOptions): string;
|
|
92
|
-
removeFile(fileRelativeToProjectPath: string): void;
|
|
93
|
-
remove(relativePath: string, exactPath?: boolean): void;
|
|
94
|
-
linkNodeModulesTo(proj: Partial<BaseProject>): void;
|
|
95
|
-
reinstallNodeModules(forcerRemoveNodeModules?: boolean): void;
|
|
96
|
-
assignFreePort(startFrom?: number, howManyFreePortsAfterThatPort?: number): Promise<number>;
|
|
97
|
-
filterOnlyCopy(basePathFoldersOnlyToInclude: string[]): (src: string, dest: string) => boolean;
|
|
98
|
-
removeItself(): void;
|
|
99
|
-
filterDontCopy(basePathFoldersTosSkip: string[]): (src: string, dest: string) => boolean;
|
|
100
|
-
defineProperty<T>(variableName: keyof T, classFn: Function): void;
|
|
101
|
-
protected getAllChildren(): T[];
|
|
102
|
-
protected getFoldersForPossibleProjectChildren(): string[];
|
|
103
|
-
}
|
package/lib/base-project.js
DELETED
|
@@ -1,482 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseProject = exports.ChildProcess = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
//#region import
|
|
6
|
-
//#region @backend
|
|
7
|
-
var tnp_core_1 = require("tnp-core");
|
|
8
|
-
var child_process_1 = require("child_process");
|
|
9
|
-
Object.defineProperty(exports, "ChildProcess", { enumerable: true, get: function () { return child_process_1.ChildProcess; } });
|
|
10
|
-
var git_project_1 = require("./git-project");
|
|
11
|
-
//#endregion
|
|
12
|
-
var tnp_cli_1 = require("tnp-cli");
|
|
13
|
-
var tnp_core_2 = require("tnp-core");
|
|
14
|
-
var tnp_config_1 = require("tnp-config");
|
|
15
|
-
var tnp_core_3 = require("tnp-core");
|
|
16
|
-
var helpers_1 = require("./helpers");
|
|
17
|
-
var base_project_resolver_1 = require("./base-project-resolver");
|
|
18
|
-
var typescript_class_helpers_1 = require("typescript-class-helpers");
|
|
19
|
-
var Helpers = helpers_1.HelpersFiredev.Instance;
|
|
20
|
-
//#endregion
|
|
21
|
-
var takenPorts = [];
|
|
22
|
-
var BaseProject = exports.BaseProject = /** @class */ (function (_super) {
|
|
23
|
-
tslib_1.__extends(BaseProject, _super);
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
function BaseProject(location) {
|
|
26
|
-
var _this = this;
|
|
27
|
-
_this.location = location;
|
|
28
|
-
//#endregion
|
|
29
|
-
//#endregion
|
|
30
|
-
_this.cache = {};
|
|
31
|
-
return _this;
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region static / sort group of projects
|
|
35
|
-
BaseProject.sortGroupOfProject = function (projects, resoveDepsArray, projNameToCompare) {
|
|
36
|
-
var visited = {};
|
|
37
|
-
var stack = {};
|
|
38
|
-
var result = [];
|
|
39
|
-
var visit = function (project) {
|
|
40
|
-
if (stack[projNameToCompare(project)]) {
|
|
41
|
-
// Circular dependency detected
|
|
42
|
-
Helpers.error("Circular dependency detected involving project: ".concat(projNameToCompare(project)));
|
|
43
|
-
}
|
|
44
|
-
if (!visited[projNameToCompare(project)]) {
|
|
45
|
-
visited[projNameToCompare(project)] = true;
|
|
46
|
-
stack[projNameToCompare(project)] = true;
|
|
47
|
-
var depsResolved = resoveDepsArray(project);
|
|
48
|
-
depsResolved.forEach(function (dependency) {
|
|
49
|
-
var dependentProject = projects.find(function (p) {
|
|
50
|
-
// console.log(`comparing :"${projNameToCompare(p)}" and "${dependency}"`)
|
|
51
|
-
return projNameToCompare(p) === dependency;
|
|
52
|
-
});
|
|
53
|
-
if (dependentProject) {
|
|
54
|
-
visit(dependentProject);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
stack[projNameToCompare(project)] = false;
|
|
58
|
-
result.push(project);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
projects.forEach(function (project) { return visit(project); });
|
|
62
|
-
return result;
|
|
63
|
-
// return result.reverse(); // Reverse the result to get the correct order
|
|
64
|
-
};
|
|
65
|
-
Object.defineProperty(BaseProject.prototype, "basename", {
|
|
66
|
-
/**
|
|
67
|
-
* doesn't need to be real path -> can be link
|
|
68
|
-
*/
|
|
69
|
-
get: function () {
|
|
70
|
-
//#region @websqlFunc
|
|
71
|
-
return tnp_core_2.path.basename(this.location);
|
|
72
|
-
//#endregion
|
|
73
|
-
},
|
|
74
|
-
enumerable: false,
|
|
75
|
-
configurable: true
|
|
76
|
-
});
|
|
77
|
-
Object.defineProperty(BaseProject.prototype, "name", {
|
|
78
|
-
get: function () {
|
|
79
|
-
var _a;
|
|
80
|
-
return (_a = this.packageJSON) === null || _a === void 0 ? void 0 : _a.name;
|
|
81
|
-
},
|
|
82
|
-
enumerable: false,
|
|
83
|
-
configurable: true
|
|
84
|
-
});
|
|
85
|
-
Object.defineProperty(BaseProject.prototype, "version", {
|
|
86
|
-
get: function () {
|
|
87
|
-
var _a;
|
|
88
|
-
return (_a = this.packageJSON) === null || _a === void 0 ? void 0 : _a.version;
|
|
89
|
-
},
|
|
90
|
-
enumerable: false,
|
|
91
|
-
configurable: true
|
|
92
|
-
});
|
|
93
|
-
Object.defineProperty(BaseProject.prototype, "dependencies", {
|
|
94
|
-
/**
|
|
95
|
-
* npm dependencies
|
|
96
|
-
*/
|
|
97
|
-
get: function () {
|
|
98
|
-
return (this.packageJSON ? this.packageJSON.dependencies : {}) || {};
|
|
99
|
-
},
|
|
100
|
-
enumerable: false,
|
|
101
|
-
configurable: true
|
|
102
|
-
});
|
|
103
|
-
Object.defineProperty(BaseProject.prototype, "peerDependencies", {
|
|
104
|
-
/**
|
|
105
|
-
* peerDependencies dependencies
|
|
106
|
-
*/
|
|
107
|
-
get: function () {
|
|
108
|
-
return (this.packageJSON ? this.packageJSON.peerDependencies : {}) || {};
|
|
109
|
-
},
|
|
110
|
-
enumerable: false,
|
|
111
|
-
configurable: true
|
|
112
|
-
});
|
|
113
|
-
Object.defineProperty(BaseProject.prototype, "devDependencies", {
|
|
114
|
-
/**
|
|
115
|
-
* devDependencies dependencies
|
|
116
|
-
*/
|
|
117
|
-
get: function () {
|
|
118
|
-
return (this.packageJSON ? this.packageJSON.devDependencies : {}) || {};
|
|
119
|
-
},
|
|
120
|
-
enumerable: false,
|
|
121
|
-
configurable: true
|
|
122
|
-
});
|
|
123
|
-
Object.defineProperty(BaseProject.prototype, "resolutions", {
|
|
124
|
-
/**
|
|
125
|
-
* resolutions dependencies
|
|
126
|
-
*/
|
|
127
|
-
get: function () {
|
|
128
|
-
return (this.packageJSON ? this.packageJSON['resolutions'] : {}) || {};
|
|
129
|
-
},
|
|
130
|
-
enumerable: false,
|
|
131
|
-
configurable: true
|
|
132
|
-
});
|
|
133
|
-
Object.defineProperty(BaseProject.prototype, "allDependencies", {
|
|
134
|
-
/**
|
|
135
|
-
* object with all deps from package json
|
|
136
|
-
*/
|
|
137
|
-
get: function () {
|
|
138
|
-
return tnp_core_3._.merge(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, this.devDependencies), this.peerDependencies), this.dependencies), this.resolutions));
|
|
139
|
-
},
|
|
140
|
-
enumerable: false,
|
|
141
|
-
configurable: true
|
|
142
|
-
});
|
|
143
|
-
Object.defineProperty(BaseProject.prototype, "tnp", {
|
|
144
|
-
get: function () {
|
|
145
|
-
var _a;
|
|
146
|
-
return (_a = this.packageJSON) === null || _a === void 0 ? void 0 : _a.tnp;
|
|
147
|
-
},
|
|
148
|
-
enumerable: false,
|
|
149
|
-
configurable: true
|
|
150
|
-
});
|
|
151
|
-
Object.defineProperty(BaseProject.prototype, "firedev", {
|
|
152
|
-
get: function () {
|
|
153
|
-
var _a;
|
|
154
|
-
return (_a = this.packageJSON) === null || _a === void 0 ? void 0 : _a.firedev;
|
|
155
|
-
},
|
|
156
|
-
enumerable: false,
|
|
157
|
-
configurable: true
|
|
158
|
-
});
|
|
159
|
-
Object.defineProperty(BaseProject.prototype, "children", {
|
|
160
|
-
/**
|
|
161
|
-
* alias to getAllChildren
|
|
162
|
-
*/
|
|
163
|
-
get: function () {
|
|
164
|
-
//#region @websqlFunc
|
|
165
|
-
return this.getAllChildren();
|
|
166
|
-
//#endregion
|
|
167
|
-
},
|
|
168
|
-
enumerable: false,
|
|
169
|
-
configurable: true
|
|
170
|
-
});
|
|
171
|
-
BaseProject.prototype.child = function (nameOrBasename, errors) {
|
|
172
|
-
if (errors === void 0) { errors = true; }
|
|
173
|
-
//#region @websqlFunc
|
|
174
|
-
var c = this.children.find(function (c) { return c.name === nameOrBasename || c.basename === nameOrBasename; });
|
|
175
|
-
if (errors && !c) {
|
|
176
|
-
Helpers.warn("Project doesnt contain child with name or basename: ".concat(nameOrBasename));
|
|
177
|
-
}
|
|
178
|
-
return c;
|
|
179
|
-
//#endregion
|
|
180
|
-
};
|
|
181
|
-
Object.defineProperty(BaseProject.prototype, "parent", {
|
|
182
|
-
get: function () {
|
|
183
|
-
//#region @websqlFunc
|
|
184
|
-
if (!tnp_core_3._.isString(this.location) || this.location.trim() === '') {
|
|
185
|
-
return void 0;
|
|
186
|
-
}
|
|
187
|
-
return this.ins.From(tnp_core_2.path.join(this.location, '..'));
|
|
188
|
-
//#endregion
|
|
189
|
-
},
|
|
190
|
-
enumerable: false,
|
|
191
|
-
configurable: true
|
|
192
|
-
});
|
|
193
|
-
Object.defineProperty(BaseProject.prototype, "grandpa", {
|
|
194
|
-
get: function () {
|
|
195
|
-
//#region @websqlFunc
|
|
196
|
-
if (!tnp_core_3._.isString(this.location) || this.location.trim() === '') {
|
|
197
|
-
return void 0;
|
|
198
|
-
}
|
|
199
|
-
var grandpa = this.ins.From(tnp_core_2.path.join(this.location, '..', '..'));
|
|
200
|
-
return grandpa;
|
|
201
|
-
//#endregion
|
|
202
|
-
},
|
|
203
|
-
enumerable: false,
|
|
204
|
-
configurable: true
|
|
205
|
-
});
|
|
206
|
-
Object.defineProperty(BaseProject.prototype, "genericName", {
|
|
207
|
-
get: function () {
|
|
208
|
-
//#region @websqlFunc
|
|
209
|
-
var parent = this.parent;
|
|
210
|
-
return [
|
|
211
|
-
parent ? tnp_core_2.path.basename(tnp_core_2.path.dirname(parent.location)) : void 0,
|
|
212
|
-
parent ? parent.basename : tnp_core_2.path.basename(this.location),
|
|
213
|
-
this.basename,
|
|
214
|
-
//#region @backend
|
|
215
|
-
"(".concat(tnp_cli_1.CLI.chalk.bold(this.name), ")"),
|
|
216
|
-
//#endregion
|
|
217
|
-
]
|
|
218
|
-
.filter(function (f) { return !!f; })
|
|
219
|
-
.join('/');
|
|
220
|
-
//#endregion
|
|
221
|
-
},
|
|
222
|
-
enumerable: false,
|
|
223
|
-
configurable: true
|
|
224
|
-
});
|
|
225
|
-
/**
|
|
226
|
-
* try run but continue when it fails
|
|
227
|
-
* @param command
|
|
228
|
-
* @param options
|
|
229
|
-
* @returns
|
|
230
|
-
*/
|
|
231
|
-
BaseProject.prototype.tryRunSync = function (command
|
|
232
|
-
//#region @backend
|
|
233
|
-
, options
|
|
234
|
-
//#endregion
|
|
235
|
-
) {
|
|
236
|
-
//#region @backendFunc
|
|
237
|
-
try {
|
|
238
|
-
this.run(command, options).sync();
|
|
239
|
-
}
|
|
240
|
-
catch (error) {
|
|
241
|
-
Helpers.warn("Not able to execute: ".concat(command));
|
|
242
|
-
}
|
|
243
|
-
//#endregion
|
|
244
|
-
};
|
|
245
|
-
/**
|
|
246
|
-
* same has project.hasFile();
|
|
247
|
-
*/
|
|
248
|
-
BaseProject.prototype.pathExists = function (relativePath) {
|
|
249
|
-
return this.hasFile(relativePath);
|
|
250
|
-
};
|
|
251
|
-
/**
|
|
252
|
-
* same as project.pathExists();
|
|
253
|
-
*/
|
|
254
|
-
BaseProject.prototype.hasFile = function (relativePath) {
|
|
255
|
-
return Helpers.exists(this.pathFor(relativePath));
|
|
256
|
-
};
|
|
257
|
-
/**
|
|
258
|
-
* same as project.pathhasFileExists();
|
|
259
|
-
* but with path.resolve
|
|
260
|
-
*/
|
|
261
|
-
BaseProject.prototype.containsFile = function (fileRelativeToProjectPath) {
|
|
262
|
-
var fullPath = tnp_core_2.path.resolve(tnp_core_2.path.join(this.location, fileRelativeToProjectPath));
|
|
263
|
-
return Helpers.exists(fullPath);
|
|
264
|
-
};
|
|
265
|
-
/**
|
|
266
|
-
* absolute path:
|
|
267
|
-
* concated project location with relative path
|
|
268
|
-
*/
|
|
269
|
-
BaseProject.prototype.pathFor = function (relativePath) {
|
|
270
|
-
//#region @backendFunc
|
|
271
|
-
if (Array.isArray(relativePath)) {
|
|
272
|
-
relativePath = relativePath.join('/');
|
|
273
|
-
}
|
|
274
|
-
if (tnp_core_2.path.isAbsolute(relativePath)) {
|
|
275
|
-
Helpers.error("Cannot join relative path with absolute: ".concat(relativePath));
|
|
276
|
-
}
|
|
277
|
-
return (0, tnp_core_2.crossPlatformPath)(tnp_core_2.path.join(this.location, relativePath));
|
|
278
|
-
//#endregion
|
|
279
|
-
};
|
|
280
|
-
BaseProject.prototype.writeJson = function (relativePath, json) {
|
|
281
|
-
//#region @backendFunc
|
|
282
|
-
if (tnp_core_2.path.isAbsolute(relativePath)) {
|
|
283
|
-
Helpers.error("Cannot join relative path with absolute: ".concat(relativePath));
|
|
284
|
-
}
|
|
285
|
-
Helpers.writeJson((0, tnp_core_2.crossPlatformPath)([this.location, relativePath]), json);
|
|
286
|
-
//#endregion
|
|
287
|
-
};
|
|
288
|
-
BaseProject.prototype.run = function (command
|
|
289
|
-
//#region @backend
|
|
290
|
-
, options
|
|
291
|
-
//#endregion
|
|
292
|
-
) {
|
|
293
|
-
//#region @backendFunc
|
|
294
|
-
var opt = options;
|
|
295
|
-
if (!opt) {
|
|
296
|
-
opt = {};
|
|
297
|
-
}
|
|
298
|
-
if (!opt.cwd) {
|
|
299
|
-
opt.cwd = this.location;
|
|
300
|
-
}
|
|
301
|
-
return Helpers.run(command, opt);
|
|
302
|
-
//#endregion
|
|
303
|
-
};
|
|
304
|
-
BaseProject.prototype.outputFrom = function (command
|
|
305
|
-
//#region @backend
|
|
306
|
-
, options
|
|
307
|
-
//#endregion
|
|
308
|
-
) {
|
|
309
|
-
//#region @backendFunc
|
|
310
|
-
return Helpers.commnadOutputAsString(command, this.location, options);
|
|
311
|
-
//#endregion
|
|
312
|
-
};
|
|
313
|
-
BaseProject.prototype.removeFile = function (fileRelativeToProjectPath) {
|
|
314
|
-
//#region @backendFunc
|
|
315
|
-
var fullPath = tnp_core_2.path.resolve(tnp_core_2.path.join(this.location, fileRelativeToProjectPath));
|
|
316
|
-
return Helpers.removeFileIfExists(fullPath);
|
|
317
|
-
//#endregion
|
|
318
|
-
};
|
|
319
|
-
BaseProject.prototype.remove = function (relativePath, exactPath) {
|
|
320
|
-
if (exactPath === void 0) { exactPath = true; }
|
|
321
|
-
//#region @backendFunc
|
|
322
|
-
return Helpers.remove([this.location, relativePath], exactPath);
|
|
323
|
-
//#endregion
|
|
324
|
-
};
|
|
325
|
-
BaseProject.prototype.linkNodeModulesTo = function (proj) {
|
|
326
|
-
//#region @backendFunc
|
|
327
|
-
var source = this.pathFor(tnp_config_1.config.folder.node_modules);
|
|
328
|
-
var dest = proj.pathFor(tnp_config_1.config.folder.node_modules);
|
|
329
|
-
Helpers.remove(dest, true);
|
|
330
|
-
Helpers.createSymLink(source, dest);
|
|
331
|
-
//#endregion
|
|
332
|
-
};
|
|
333
|
-
BaseProject.prototype.reinstallNodeModules = function (forcerRemoveNodeModules) {
|
|
334
|
-
if (forcerRemoveNodeModules === void 0) { forcerRemoveNodeModules = false; }
|
|
335
|
-
//#region @backendFunc
|
|
336
|
-
Helpers.taskStarted("Reinstalling node_modules in ".concat(this.genericName));
|
|
337
|
-
var source = this.pathFor(tnp_config_1.config.folder.node_modules);
|
|
338
|
-
if (forcerRemoveNodeModules) {
|
|
339
|
-
Helpers.remove(source, true);
|
|
340
|
-
}
|
|
341
|
-
this.run('yarn install').sync();
|
|
342
|
-
Helpers.taskDone("Reinstalling done for ".concat(this.genericName));
|
|
343
|
-
//#endregion
|
|
344
|
-
};
|
|
345
|
-
BaseProject.prototype.assignFreePort = function (startFrom, howManyFreePortsAfterThatPort) {
|
|
346
|
-
if (startFrom === void 0) { startFrom = 4200; }
|
|
347
|
-
if (howManyFreePortsAfterThatPort === void 0) { howManyFreePortsAfterThatPort = 0; }
|
|
348
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
349
|
-
var max, i, port, err_1;
|
|
350
|
-
return tslib_1.__generator(this, function (_a) {
|
|
351
|
-
switch (_a.label) {
|
|
352
|
-
case 0:
|
|
353
|
-
//#region @backendFunc
|
|
354
|
-
if (tnp_core_3._.isNumber(this.port) && this.port >= startFrom) {
|
|
355
|
-
return [2 /*return*/, startFrom];
|
|
356
|
-
}
|
|
357
|
-
max = 2000;
|
|
358
|
-
i = 0;
|
|
359
|
-
while (takenPorts.includes(startFrom)) {
|
|
360
|
-
startFrom += (1 + howManyFreePortsAfterThatPort);
|
|
361
|
-
}
|
|
362
|
-
_a.label = 1;
|
|
363
|
-
case 1:
|
|
364
|
-
if (!true) return [3 /*break*/, 6];
|
|
365
|
-
_a.label = 2;
|
|
366
|
-
case 2:
|
|
367
|
-
_a.trys.push([2, 4, , 5]);
|
|
368
|
-
return [4 /*yield*/, tnp_core_1.portfinder.getPortPromise({ port: startFrom })];
|
|
369
|
-
case 3:
|
|
370
|
-
port = _a.sent();
|
|
371
|
-
takenPorts.push(port);
|
|
372
|
-
// @ts-ignore
|
|
373
|
-
this.port = port;
|
|
374
|
-
return [2 /*return*/, port];
|
|
375
|
-
case 4:
|
|
376
|
-
err_1 = _a.sent();
|
|
377
|
-
console.log(err_1);
|
|
378
|
-
Helpers.warn("Trying to assign port :".concat(startFrom, " but already in use."), false);
|
|
379
|
-
return [3 /*break*/, 5];
|
|
380
|
-
case 5:
|
|
381
|
-
startFrom += 1;
|
|
382
|
-
if (i++ === max) {
|
|
383
|
-
Helpers.error("[firedev-helpers]] failed to assign free port after ".concat(max, " trys..."));
|
|
384
|
-
}
|
|
385
|
-
return [3 /*break*/, 1];
|
|
386
|
-
case 6: return [2 /*return*/];
|
|
387
|
-
}
|
|
388
|
-
});
|
|
389
|
-
});
|
|
390
|
-
};
|
|
391
|
-
BaseProject.prototype.filterOnlyCopy = function (basePathFoldersOnlyToInclude) {
|
|
392
|
-
//#region @backendFunc
|
|
393
|
-
var projectOrBasepath = this;
|
|
394
|
-
return Helpers.filterOnlyCopy(basePathFoldersOnlyToInclude, projectOrBasepath.location);
|
|
395
|
-
//#endregion
|
|
396
|
-
};
|
|
397
|
-
BaseProject.prototype.removeItself = function () {
|
|
398
|
-
//#region @backend
|
|
399
|
-
this.ins.remove(this);
|
|
400
|
-
//#endregion
|
|
401
|
-
};
|
|
402
|
-
BaseProject.prototype.filterDontCopy = function (basePathFoldersTosSkip) {
|
|
403
|
-
//#region @backendFunc
|
|
404
|
-
var projectOrBasepath = this;
|
|
405
|
-
return Helpers.filterDontCopy(basePathFoldersTosSkip, projectOrBasepath.location);
|
|
406
|
-
//#endregion
|
|
407
|
-
};
|
|
408
|
-
BaseProject.prototype.defineProperty = function (variableName, classFn) {
|
|
409
|
-
//#region @backendFunc
|
|
410
|
-
var that = this;
|
|
411
|
-
var className = typescript_class_helpers_1.CLASS.getName(classFn);
|
|
412
|
-
// @ts-ignore
|
|
413
|
-
var prefixedName = "__".concat(variableName);
|
|
414
|
-
Object.defineProperty(this, variableName, {
|
|
415
|
-
get: function () {
|
|
416
|
-
if (!that[prefixedName]) {
|
|
417
|
-
if (className === 'CopyManager') {
|
|
418
|
-
var CopyMangerClass = typescript_class_helpers_1.CLASS.getBy('CopyManager'); // TODO @LAST
|
|
419
|
-
that[prefixedName] = CopyMangerClass.for(this);
|
|
420
|
-
}
|
|
421
|
-
else {
|
|
422
|
-
if (typeof classFn === 'function') {
|
|
423
|
-
that[prefixedName] = new classFn(that);
|
|
424
|
-
}
|
|
425
|
-
else {
|
|
426
|
-
Helpers.warn("[firedev-helpers] Cannot create dynamic instance of class \"".concat(tnp_core_3._.kebabCase(prefixedName.replace('__', '')), "\"."));
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
return that[prefixedName];
|
|
431
|
-
},
|
|
432
|
-
set: function (v) {
|
|
433
|
-
that[prefixedName] = v;
|
|
434
|
-
},
|
|
435
|
-
});
|
|
436
|
-
//#endregion
|
|
437
|
-
};
|
|
438
|
-
//#region methods / get all childrens
|
|
439
|
-
BaseProject.prototype.getAllChildren = function () {
|
|
440
|
-
var _this = this;
|
|
441
|
-
//#region @backendFunc
|
|
442
|
-
var subdirectories = this.getFoldersForPossibleProjectChildren();
|
|
443
|
-
var res = subdirectories
|
|
444
|
-
.map(function (dir) {
|
|
445
|
-
// console.log('child:', dir)
|
|
446
|
-
return _this.ins.From(dir);
|
|
447
|
-
})
|
|
448
|
-
.filter(function (c) { return !!c; });
|
|
449
|
-
return res;
|
|
450
|
-
//#endregion
|
|
451
|
-
};
|
|
452
|
-
//#endregion
|
|
453
|
-
//#region methods / get folder for possible project chhildrens
|
|
454
|
-
BaseProject.prototype.getFoldersForPossibleProjectChildren = function () {
|
|
455
|
-
//#region @backendFunc
|
|
456
|
-
var isDirectory = function (source) { return tnp_core_1.fse.lstatSync(source).isDirectory(); };
|
|
457
|
-
var getDirectories = function (source) {
|
|
458
|
-
return tnp_core_1.fse.readdirSync(source).map(function (name) { return tnp_core_2.path.join(source, name); }).filter(isDirectory);
|
|
459
|
-
};
|
|
460
|
-
var subdirectories = getDirectories(this.location)
|
|
461
|
-
.filter(function (f) {
|
|
462
|
-
var folderName = tnp_core_2.path.basename(f);
|
|
463
|
-
return Helpers.checkIfNameAllowedForFiredevProj(folderName);
|
|
464
|
-
});
|
|
465
|
-
// if (this.isTnp' && fse.existsSync(path.join(this.location, '../firedev-projects'))) {
|
|
466
|
-
// subdirectories = subdirectories.concat(getDirectories(path.join(this.location, '../firedev-projects'))
|
|
467
|
-
// .filter(f => {
|
|
468
|
-
// const folderName = path.basename(f);
|
|
469
|
-
// return Helpers.checkIfNameAllowedForFiredevProj(folderName);
|
|
470
|
-
// }))
|
|
471
|
-
// }'
|
|
472
|
-
return subdirectories;
|
|
473
|
-
//#endregion
|
|
474
|
-
};
|
|
475
|
-
//#region static
|
|
476
|
-
//#region static / instance of resovle
|
|
477
|
-
BaseProject.ins = new base_project_resolver_1.BaseProjectResolver(BaseProject);
|
|
478
|
-
return BaseProject;
|
|
479
|
-
}(git_project_1.ProjectGit
|
|
480
|
-
//#endregion
|
|
481
|
-
));
|
|
482
|
-
//# sourceMappingURL=base-project.js.map
|