@nu-art/build-and-install 0.204.42 → 0.204.44
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/build-and-install.js +1 -0
- package/core/params/params.d.ts +3 -2
- package/core/params/params.js +10 -2
- package/core/types/package/package.d.ts +7 -2
- package/core/types/package/package.js +3 -2
- package/logic/command-executors/CommandExecutor_FirebaseFunction.d.ts +5 -0
- package/logic/command-executors/CommandExecutor_FirebaseFunction.js +11 -2
- package/logic/command-executors/CommandExecutor_Python.d.ts +17 -0
- package/logic/command-executors/CommandExecutor_Python.js +66 -0
- package/logic/map-project-packages.js +6 -3
- package/package.json +1 -1
- package/phases/phases.d.ts +1 -0
- package/phases/phases.js +83 -14
- package/v2/ProjectManagerV2.d.ts +1 -9
- package/v2/phase-runner/PhaseRunner.d.ts +16 -0
- package/v2/phase-runner/PhaseRunner.js +49 -0
- package/v2/phase-runner/types.d.ts +12 -0
- package/v2/phase-runner/types.js +2 -0
- package/v2/test/test.d.ts +3 -7
- package/v2/test/test.js +2 -2
- package/v2/unit/core/BaseUnit.d.ts +12 -0
- package/v2/unit/core/BaseUnit.js +29 -0
- package/v2/unit/core/Unit_Python.d.ts +5 -0
- package/v2/unit/core/Unit_Python.js +11 -0
- package/v2/unit/core/Unit_Typescript.d.ts +30 -0
- package/v2/unit/core/Unit_Typescript.js +86 -0
- package/v2/unit/core/Unit_TypescriptLib.d.ts +11 -0
- package/v2/unit/core/Unit_TypescriptLib.js +59 -0
- package/v2/unit/core/Unit_TypescriptProject.d.ts +5 -0
- package/v2/unit/core/Unit_TypescriptProject.js +9 -0
- package/v2/unit/core/index.d.ts +4 -0
- package/v2/unit/core/index.js +20 -0
- package/v2/unit/core/types.d.ts +13 -0
- package/v2/unit/core/types.js +23 -0
package/build-and-install.js
CHANGED
|
@@ -19,6 +19,7 @@ projectManager.registerPhase(phases_1.Phase_PrintEnv);
|
|
|
19
19
|
projectManager.registerPhase(phases_1.Phase_PackagePurge);
|
|
20
20
|
projectManager.registerPhase(phases_1.Phase_InstallGlobals);
|
|
21
21
|
projectManager.registerPhase(phases_1.Phase_InstallPackages);
|
|
22
|
+
projectManager.registerPhase(phases_1.Phase_InstallPythonPackages);
|
|
22
23
|
projectManager.registerPhase(phases_1.Phase_Clean);
|
|
23
24
|
projectManager.registerPhase(phases_1.Phase_Lint);
|
|
24
25
|
projectManager.registerPhase(phases_1.Phase_PrepareCompile);
|
package/core/params/params.d.ts
CHANGED
|
@@ -33,5 +33,6 @@ export declare const BaiParam_Debug: BaseCliParam<'debug', boolean>;
|
|
|
33
33
|
export declare const BaiParam_QuickDeploy: BaseCliParam<'quickDeploy', boolean>;
|
|
34
34
|
export declare const BaiParam_Publish: BaseCliParam<'publish', string>;
|
|
35
35
|
export declare const BaiParam_AllLogs: BaseCliParam<'allLogs', boolean>;
|
|
36
|
-
export declare const
|
|
37
|
-
export declare const
|
|
36
|
+
export declare const BaiParam_EncounterManager: BaseCliParam<'encounterManager', boolean>;
|
|
37
|
+
export declare const AllBaiParams: (BaseCliParam<"help", boolean> | BaseCliParam<"dependencyTree", boolean> | BaseCliParam<"checkCyclicImports", boolean> | BaseCliParam<"printEnv", boolean> | BaseCliParam<"continue", boolean> | BaseCliParam<"environment", string> | BaseCliParam<"setup", boolean> | BaseCliParam<"install", boolean> | BaseCliParam<"installPackages", boolean> | BaseCliParam<"installGlobals", boolean> | BaseCliParam<"clean", boolean> | BaseCliParam<"purge", boolean> | BaseCliParam<"generate", boolean> | BaseCliParam<"generateDocs", boolean> | BaseCliParam<"noBuild", boolean> | BaseCliParam<"dryRun", boolean> | BaseCliParam<"runWithThunderstorm", boolean> | BaseCliParam<"withCommando", boolean> | BaseCliParam<"noThunderstorm", boolean> | BaseCliParam<"lint", boolean> | BaseCliParam<"watch", boolean> | BaseCliParam<"test", string> | BaseCliParam<"launch", string> | BaseCliParam<"launchFrontend", boolean> | BaseCliParam<"launchBackend", boolean> | BaseCliParam<"debugBackend", boolean> | BaseCliParam<"deploy", string> | BaseCliParam<"deployBackend", boolean> | BaseCliParam<"deployFrontend", boolean> | BaseCliParam<"noGit", boolean> | BaseCliParam<"debug", boolean> | BaseCliParam<"publish", string> | BaseCliParam<"allLogs", boolean> | BaseCliParam<"encounterManager", boolean>)[];
|
|
38
|
+
export declare const RuntimeParams: import("@nu-art/commando/cli/cli-params").CliParams<(BaseCliParam<"help", boolean> | BaseCliParam<"dependencyTree", boolean> | BaseCliParam<"checkCyclicImports", boolean> | BaseCliParam<"printEnv", boolean> | BaseCliParam<"continue", boolean> | BaseCliParam<"environment", string> | BaseCliParam<"setup", boolean> | BaseCliParam<"install", boolean> | BaseCliParam<"installPackages", boolean> | BaseCliParam<"installGlobals", boolean> | BaseCliParam<"clean", boolean> | BaseCliParam<"purge", boolean> | BaseCliParam<"generate", boolean> | BaseCliParam<"generateDocs", boolean> | BaseCliParam<"noBuild", boolean> | BaseCliParam<"dryRun", boolean> | BaseCliParam<"runWithThunderstorm", boolean> | BaseCliParam<"withCommando", boolean> | BaseCliParam<"noThunderstorm", boolean> | BaseCliParam<"lint", boolean> | BaseCliParam<"watch", boolean> | BaseCliParam<"test", string> | BaseCliParam<"launch", string> | BaseCliParam<"launchFrontend", boolean> | BaseCliParam<"launchBackend", boolean> | BaseCliParam<"debugBackend", boolean> | BaseCliParam<"deploy", string> | BaseCliParam<"deployBackend", boolean> | BaseCliParam<"deployFrontend", boolean> | BaseCliParam<"noGit", boolean> | BaseCliParam<"debug", boolean> | BaseCliParam<"publish", string> | BaseCliParam<"allLogs", boolean> | BaseCliParam<"encounterManager", boolean>)[]>;
|
package/core/params/params.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RuntimeParams = exports.AllBaiParams = exports.BaiParam_AllLogs = exports.BaiParam_Publish = exports.BaiParam_QuickDeploy = exports.BaiParam_Debug = exports.BaiParam_NoGit = exports.BaiParam_DeployFrontend = exports.BaiParam_DeployBackend = exports.BaiParam_Deploy = exports.BaiParam_DebugBackend = exports.BaiParam_LaunchBackend = exports.BaiParam_LaunchFrontend = exports.BaiParam_Launch = exports.BaiParam_Test = exports.BaiParam_Watch = exports.BaiParam_Lint = exports.BaiParam_NoThunderstorm = exports.BaiParam_WithCommando = exports.BaiParam_RunWithThunderstorm = exports.BaiParam_DryRun = exports.BaiParam_NoBuild = exports.BaiParam_GenerateDocs = exports.BaiParam_Generate = exports.BaiParam_Purge = exports.BaiParam_Clean = exports.BaiParam_InstallGlobals = exports.BaiParam_InstallPackages = exports.BaiParam_Install = exports.BaiParam_Setup = exports.BaiParam_SetEnv = exports.BaiParam_continue = exports.BaiParam_PrintEnv = exports.BaiParam_CheckCyclicImports = exports.BaiParam_DependencyTree = exports.BaiParam_Help = void 0;
|
|
3
|
+
exports.RuntimeParams = exports.AllBaiParams = exports.BaiParam_EncounterManager = exports.BaiParam_AllLogs = exports.BaiParam_Publish = exports.BaiParam_QuickDeploy = exports.BaiParam_Debug = exports.BaiParam_NoGit = exports.BaiParam_DeployFrontend = exports.BaiParam_DeployBackend = exports.BaiParam_Deploy = exports.BaiParam_DebugBackend = exports.BaiParam_LaunchBackend = exports.BaiParam_LaunchFrontend = exports.BaiParam_Launch = exports.BaiParam_Test = exports.BaiParam_Watch = exports.BaiParam_Lint = exports.BaiParam_NoThunderstorm = exports.BaiParam_WithCommando = exports.BaiParam_RunWithThunderstorm = exports.BaiParam_DryRun = exports.BaiParam_NoBuild = exports.BaiParam_GenerateDocs = exports.BaiParam_Generate = exports.BaiParam_Purge = exports.BaiParam_Clean = exports.BaiParam_InstallGlobals = exports.BaiParam_InstallPackages = exports.BaiParam_Install = exports.BaiParam_Setup = exports.BaiParam_SetEnv = exports.BaiParam_continue = exports.BaiParam_PrintEnv = exports.BaiParam_CheckCyclicImports = exports.BaiParam_DependencyTree = exports.BaiParam_Help = void 0;
|
|
4
4
|
const cli_params_1 = require("@nu-art/commando/cli/cli-params");
|
|
5
5
|
exports.BaiParam_Help = {
|
|
6
6
|
keys: ['--help', '-h'],
|
|
@@ -246,6 +246,13 @@ exports.BaiParam_AllLogs = {
|
|
|
246
246
|
group: 'Other',
|
|
247
247
|
description: 'will disable ui and show verbose logs for bai run',
|
|
248
248
|
};
|
|
249
|
+
exports.BaiParam_EncounterManager = {
|
|
250
|
+
keys: ['-em', '--encounter-manager'],
|
|
251
|
+
keyName: 'encounterManager',
|
|
252
|
+
type: 'boolean',
|
|
253
|
+
group: 'Other',
|
|
254
|
+
description: 'Will install encounter manager shit',
|
|
255
|
+
};
|
|
249
256
|
exports.AllBaiParams = [
|
|
250
257
|
exports.BaiParam_Help,
|
|
251
258
|
exports.BaiParam_DependencyTree,
|
|
@@ -279,7 +286,8 @@ exports.AllBaiParams = [
|
|
|
279
286
|
exports.BaiParam_NoGit,
|
|
280
287
|
exports.BaiParam_Debug,
|
|
281
288
|
exports.BaiParam_Publish,
|
|
282
|
-
exports.BaiParam_AllLogs
|
|
289
|
+
exports.BaiParam_AllLogs,
|
|
290
|
+
exports.BaiParam_EncounterManager
|
|
283
291
|
];
|
|
284
292
|
const params = cli_params_1.CLIParams_Resolver.create(...exports.AllBaiParams).resolveParamValue();
|
|
285
293
|
exports.RuntimeParams = params;
|
|
@@ -4,7 +4,8 @@ export declare const PackageType_FirebaseHostingApp: "firebase-hosting-app";
|
|
|
4
4
|
export declare const PackageType_FirebaseHostingAndFunctionApp: "firebase-app";
|
|
5
5
|
export declare const PackageType_FirebaseFunctionsApp: "firebase-functions-app";
|
|
6
6
|
export declare const PackageType_Sourceless: "sourceless";
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const PackageType_Python: "python";
|
|
8
|
+
export declare const PackageTypes: readonly ["infra-lib", "project-lib", "firebase-hosting-app", "firebase-functions-app", "sourceless", "python"];
|
|
8
9
|
export declare const PackageTypesWithOutput: ("infra-lib" | "project-lib" | "firebase-hosting-app" | "firebase-functions-app")[];
|
|
9
10
|
export type PackageType = typeof PackageTypes[number];
|
|
10
11
|
export type FirebaseEnvConfig<Env extends string> = {
|
|
@@ -62,6 +63,10 @@ export type Package_Base = {
|
|
|
62
63
|
export type Package_Sourceless = Package_Base & {
|
|
63
64
|
type: typeof PackageType_Sourceless;
|
|
64
65
|
};
|
|
66
|
+
export type Package_Python = Package_Base & {
|
|
67
|
+
type: typeof PackageType_Python;
|
|
68
|
+
path: string;
|
|
69
|
+
};
|
|
65
70
|
export type Package_WithSources = Package_Base & {
|
|
66
71
|
output: string;
|
|
67
72
|
customTsConfig?: boolean;
|
|
@@ -85,4 +90,4 @@ export type Package_InfraLib = Package_WithSources & {
|
|
|
85
90
|
export type Package_ProjectLib = Package_WithSources & {
|
|
86
91
|
type: typeof PackageType_ProjectLib;
|
|
87
92
|
};
|
|
88
|
-
export type Package = Package_Sourceless | Package_FirebaseHostingApp | Package_FirebaseFunctionsApp | Package_InfraLib | Package_ProjectLib;
|
|
93
|
+
export type Package = Package_Sourceless | Package_FirebaseHostingApp | Package_FirebaseFunctionsApp | Package_InfraLib | Package_ProjectLib | Package_Python;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PackageTypesWithOutput = exports.PackageTypes = exports.PackageType_Sourceless = exports.PackageType_FirebaseFunctionsApp = exports.PackageType_FirebaseHostingAndFunctionApp = exports.PackageType_FirebaseHostingApp = exports.PackageType_ProjectLib = exports.PackageType_InfraLib = void 0;
|
|
3
|
+
exports.PackageTypesWithOutput = exports.PackageTypes = exports.PackageType_Python = exports.PackageType_Sourceless = exports.PackageType_FirebaseFunctionsApp = exports.PackageType_FirebaseHostingAndFunctionApp = exports.PackageType_FirebaseHostingApp = exports.PackageType_ProjectLib = exports.PackageType_InfraLib = void 0;
|
|
4
4
|
exports.PackageType_InfraLib = 'infra-lib';
|
|
5
5
|
exports.PackageType_ProjectLib = 'project-lib';
|
|
6
6
|
exports.PackageType_FirebaseHostingApp = 'firebase-hosting-app';
|
|
7
7
|
exports.PackageType_FirebaseHostingAndFunctionApp = 'firebase-app';
|
|
8
8
|
exports.PackageType_FirebaseFunctionsApp = 'firebase-functions-app';
|
|
9
9
|
exports.PackageType_Sourceless = 'sourceless';
|
|
10
|
-
exports.
|
|
10
|
+
exports.PackageType_Python = 'python';
|
|
11
|
+
exports.PackageTypes = [exports.PackageType_InfraLib, exports.PackageType_ProjectLib, exports.PackageType_FirebaseHostingApp, exports.PackageType_FirebaseFunctionsApp, exports.PackageType_Sourceless, exports.PackageType_Python];
|
|
11
12
|
exports.PackageTypesWithOutput = [exports.PackageType_InfraLib, exports.PackageType_ProjectLib, exports.PackageType_FirebaseHostingApp, exports.PackageType_FirebaseFunctionsApp];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Package_FirebaseFunctionsApp } from '../../core/types';
|
|
2
|
+
type OnReadyCallback = (pkg: Package_FirebaseFunctionsApp) => Promise<void>;
|
|
2
3
|
export declare class CommandExecutor_FirebaseFunction {
|
|
3
4
|
static staggerCount: number;
|
|
4
5
|
private readonly PROXY_PID_LOG;
|
|
@@ -9,13 +10,17 @@ export declare class CommandExecutor_FirebaseFunction {
|
|
|
9
10
|
private readonly commandos;
|
|
10
11
|
private listeners;
|
|
11
12
|
private debugMode?;
|
|
13
|
+
private onReadyCallbacks;
|
|
12
14
|
constructor(pkg: Package_FirebaseFunctionsApp);
|
|
13
15
|
private initListeners;
|
|
14
16
|
private clearPorts;
|
|
15
17
|
private runProxy;
|
|
16
18
|
private runEmulator;
|
|
17
19
|
private getPID;
|
|
20
|
+
private onReady;
|
|
18
21
|
execute(): Promise<this>;
|
|
19
22
|
kill(): Promise<void>;
|
|
20
23
|
setDebug(debug: boolean): void;
|
|
24
|
+
addOnReadyCallback(cb: OnReadyCallback): void;
|
|
21
25
|
}
|
|
26
|
+
export {};
|
|
@@ -11,6 +11,7 @@ class CommandExecutor_FirebaseFunction {
|
|
|
11
11
|
this.PROXY_KILL_LOG = '_PROXY_KILLED_';
|
|
12
12
|
this.EMULATOR_PID_LOG = '_EMULATOR_PID_';
|
|
13
13
|
this.EMULATOR_KILL_LOG = '_EMULATOR_KILLED_';
|
|
14
|
+
this.onReadyCallbacks = [];
|
|
14
15
|
this.pkg = pkg;
|
|
15
16
|
this.commandos = {
|
|
16
17
|
emulator: nvm_1.NVM.createInteractiveCommando(basic_1.Cli_Basic),
|
|
@@ -28,12 +29,14 @@ class CommandExecutor_FirebaseFunction {
|
|
|
28
29
|
emulator: {
|
|
29
30
|
pid: new cli_1.CommandoCLIKeyValueListener(new RegExp(`${this.EMULATOR_PID_LOG}=(\\d+)`)),
|
|
30
31
|
kill: new cli_1.CommandoCLIListener(() => this.commandos.emulator.close(), this.EMULATOR_KILL_LOG),
|
|
31
|
-
}
|
|
32
|
+
},
|
|
33
|
+
onReady: new cli_1.CommandoCLIListener(() => this.onReady(), new RegExp('.*Emulator Hub running.*')),
|
|
32
34
|
};
|
|
33
35
|
this.listeners.proxy.kill.listen(this.commandos.proxy);
|
|
34
36
|
this.listeners.proxy.pid.listen(this.commandos.proxy);
|
|
35
37
|
this.listeners.emulator.kill.listen(this.commandos.emulator);
|
|
36
38
|
this.listeners.emulator.pid.listen(this.commandos.emulator);
|
|
39
|
+
this.listeners.onReady.listen(this.commandos.emulator);
|
|
37
40
|
}
|
|
38
41
|
async clearPorts() {
|
|
39
42
|
const allPorts = Array.from({ length: 10 }, (_, i) => `${this.pkg.envConfig.basePort + i}`);
|
|
@@ -71,9 +74,12 @@ class CommandExecutor_FirebaseFunction {
|
|
|
71
74
|
const pid = Number(listener.getValue());
|
|
72
75
|
return isNaN(pid) ? undefined : pid;
|
|
73
76
|
}
|
|
77
|
+
async onReady() {
|
|
78
|
+
await Promise.all(this.onReadyCallbacks.map(cb => cb(this.pkg)));
|
|
79
|
+
}
|
|
74
80
|
//######################### Functions #########################
|
|
75
81
|
async execute() {
|
|
76
|
-
await (0, ts_common_1.sleep)(ts_common_1.Second * CommandExecutor_FirebaseFunction.staggerCount++);
|
|
82
|
+
await (0, ts_common_1.sleep)(2 * ts_common_1.Second * CommandExecutor_FirebaseFunction.staggerCount++);
|
|
77
83
|
await this.clearPorts();
|
|
78
84
|
await this.runProxy();
|
|
79
85
|
await this.runEmulator();
|
|
@@ -88,6 +94,9 @@ class CommandExecutor_FirebaseFunction {
|
|
|
88
94
|
setDebug(debug) {
|
|
89
95
|
this.debugMode = debug;
|
|
90
96
|
}
|
|
97
|
+
addOnReadyCallback(cb) {
|
|
98
|
+
this.onReadyCallbacks.push(cb);
|
|
99
|
+
}
|
|
91
100
|
}
|
|
92
101
|
CommandExecutor_FirebaseFunction.staggerCount = 0;
|
|
93
102
|
exports.CommandExecutor_FirebaseFunction = CommandExecutor_FirebaseFunction;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Package_Python } from '../../core/types';
|
|
2
|
+
export declare class CommandExecutor_Python {
|
|
3
|
+
private readonly APP_PID_LOG;
|
|
4
|
+
private readonly APP_KILL_LOG;
|
|
5
|
+
private readonly pkg;
|
|
6
|
+
private readonly commando;
|
|
7
|
+
private listeners;
|
|
8
|
+
constructor(pkg: Package_Python);
|
|
9
|
+
private initListeners;
|
|
10
|
+
private getPID;
|
|
11
|
+
private enterVenv;
|
|
12
|
+
private setPythonPath;
|
|
13
|
+
private runApp;
|
|
14
|
+
private clearPorts;
|
|
15
|
+
execute(): Promise<void>;
|
|
16
|
+
kill(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommandExecutor_Python = void 0;
|
|
4
|
+
const cli_1 = require("@nu-art/commando/core/cli");
|
|
5
|
+
const basic_1 = require("@nu-art/commando/cli/basic");
|
|
6
|
+
const tools_1 = require("@nu-art/commando/core/tools");
|
|
7
|
+
class CommandExecutor_Python {
|
|
8
|
+
constructor(pkg) {
|
|
9
|
+
this.APP_PID_LOG = '_APP_PID_';
|
|
10
|
+
this.APP_KILL_LOG = '_APP_KILLED_';
|
|
11
|
+
this.pkg = pkg;
|
|
12
|
+
this.commando = cli_1.CommandoInteractive.create(basic_1.Cli_Basic)
|
|
13
|
+
.setUID(this.pkg.name)
|
|
14
|
+
.cd((0, tools_1.convertToFullPath)(this.pkg.path))
|
|
15
|
+
.debug();
|
|
16
|
+
this.initListeners();
|
|
17
|
+
}
|
|
18
|
+
//######################### Inner Logic #########################
|
|
19
|
+
initListeners() {
|
|
20
|
+
this.listeners = {
|
|
21
|
+
pid: new cli_1.CommandoCLIKeyValueListener(new RegExp(`${this.APP_PID_LOG}=(\\d+)`)),
|
|
22
|
+
kill: new cli_1.CommandoCLIListener(() => this.commando.close(), this.APP_KILL_LOG),
|
|
23
|
+
};
|
|
24
|
+
this.listeners.pid.listen(this.commando);
|
|
25
|
+
this.listeners.kill.listen(this.commando);
|
|
26
|
+
}
|
|
27
|
+
getPID() {
|
|
28
|
+
const pid = Number(this.listeners.pid.getValue());
|
|
29
|
+
return isNaN(pid) ? undefined : pid;
|
|
30
|
+
}
|
|
31
|
+
async enterVenv() {
|
|
32
|
+
await this.commando.append('source venv/bin/activate').execute();
|
|
33
|
+
}
|
|
34
|
+
async setPythonPath() {
|
|
35
|
+
await this.commando.append('export PYTHONPATH=.').execute();
|
|
36
|
+
}
|
|
37
|
+
async runApp() {
|
|
38
|
+
await this.commando
|
|
39
|
+
.append('python3 app/src/run.py --env=local &')
|
|
40
|
+
.append('pid=$!')
|
|
41
|
+
.append(`echo "${this.APP_PID_LOG}=\${pid}"`)
|
|
42
|
+
.append(`wait \$pid`)
|
|
43
|
+
.append(`echo "${this.APP_KILL_LOG} \${pid}"`)
|
|
44
|
+
.execute();
|
|
45
|
+
}
|
|
46
|
+
async clearPorts() {
|
|
47
|
+
const emPort = 4450;
|
|
48
|
+
await this.commando
|
|
49
|
+
.append(`array=($(lsof -ti:${[emPort].join(',')}))`)
|
|
50
|
+
.append(`((\${#array[@]} > 0)) && kill -9 "\${array[@]}"`)
|
|
51
|
+
.append('echo ')
|
|
52
|
+
.execute();
|
|
53
|
+
}
|
|
54
|
+
//######################### Functions #########################
|
|
55
|
+
async execute() {
|
|
56
|
+
await this.clearPorts();
|
|
57
|
+
await this.enterVenv();
|
|
58
|
+
await this.setPythonPath();
|
|
59
|
+
await this.runApp();
|
|
60
|
+
}
|
|
61
|
+
async kill() {
|
|
62
|
+
const appPid = this.getPID();
|
|
63
|
+
await this.commando.gracefullyKill(appPid);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.CommandExecutor_Python = CommandExecutor_Python;
|
|
@@ -48,6 +48,8 @@ function getRuntimePackageBaseDetails(basePackage) {
|
|
|
48
48
|
case types_1.PackageType_FirebaseFunctionsApp:
|
|
49
49
|
case types_1.PackageType_FirebaseHostingApp:
|
|
50
50
|
return getRuntimePackageBaseDetails_Firebase(basePackage);
|
|
51
|
+
default:
|
|
52
|
+
throw new ts_common_1.ImplementationMissingException(`Missin runtime package converter for package of type ${basePackage.type}`);
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
55
|
function convertPackageJSONTemplateToPackJSON_Value(template, value) {
|
|
@@ -72,10 +74,11 @@ function convertToRuntimePackage(basePackage, project) {
|
|
|
72
74
|
}
|
|
73
75
|
exports.convertToRuntimePackage = convertToRuntimePackage;
|
|
74
76
|
function mapProjectPackages(projectConfig) {
|
|
75
|
-
const packages = projectConfig.packages.map(basePackage => convertToRuntimePackage(basePackage, projectConfig));
|
|
77
|
+
const packages = projectConfig.packages.filter(pkg => pkg.type !== types_1.PackageType_Python).map(basePackage => convertToRuntimePackage(basePackage, projectConfig));
|
|
78
|
+
const pythonPackages = projectConfig.packages.filter(pkg => pkg.type === types_1.PackageType_Python);
|
|
76
79
|
const packagesDependency = groupPackagesByDependencyLevel(packages);
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
packagesDependency.push(pythonPackages);
|
|
81
|
+
return Object.assign(Object.assign({}, projectConfig), { packages: [...packages, ...pythonPackages], packagesDependency, packageMap: (0, ts_common_1.arrayToMap)(packages, p => p.packageJsonTemplate.name) });
|
|
79
82
|
}
|
|
80
83
|
exports.mapProjectPackages = mapProjectPackages;
|
|
81
84
|
function groupPackagesByDependencyLevel(packages) {
|
package/package.json
CHANGED
package/phases/phases.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare const Phase_PrintEnv: BuildPhase;
|
|
|
12
12
|
export declare const Phase_PackagePurge: BuildPhase;
|
|
13
13
|
export declare const Phase_InstallGlobals: BuildPhase;
|
|
14
14
|
export declare const Phase_InstallPackages: BuildPhase;
|
|
15
|
+
export declare const Phase_InstallPythonPackages: BuildPhase;
|
|
15
16
|
export declare const Phase_Clean: BuildPhase;
|
|
16
17
|
export declare const Phase_Lint: BuildPhase;
|
|
17
18
|
export declare const Phase_Debug: BuildPhase;
|
package/phases/phases.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Phase_DeployBackend = exports.Phase_DeployFrontend = exports.Phase_Launch = exports.Phase_CompileWatch = exports.Phase_Compile = exports.Phase_PreCompile = exports.Phase_PrepareCompile = exports.Phase_Debug = exports.Phase_Lint = exports.Phase_Clean = exports.Phase_InstallPackages = exports.Phase_InstallGlobals = exports.Phase_PackagePurge = exports.Phase_PrintEnv = exports.Phase_CheckCyclicImports = exports.Phase_PrintDependencyTree = exports.Phase_ResolvePackages = exports.Phase_ResolveEnv = exports.Phase_ResolveTemplate = exports.Phase_PrepareParams = exports.Phase_SetupProject = exports.Phase_SetWithThunderstorm = exports.Phase_PrintHelp = void 0;
|
|
26
|
+
exports.Phase_DeployBackend = exports.Phase_DeployFrontend = exports.Phase_Launch = exports.Phase_CompileWatch = exports.Phase_Compile = exports.Phase_PreCompile = exports.Phase_PrepareCompile = exports.Phase_Debug = exports.Phase_Lint = exports.Phase_Clean = exports.Phase_InstallPythonPackages = exports.Phase_InstallPackages = exports.Phase_InstallGlobals = exports.Phase_PackagePurge = exports.Phase_PrintEnv = exports.Phase_CheckCyclicImports = exports.Phase_PrintDependencyTree = exports.Phase_ResolvePackages = exports.Phase_ResolveEnv = exports.Phase_ResolveTemplate = exports.Phase_PrepareParams = exports.Phase_SetupProject = exports.Phase_SetWithThunderstorm = exports.Phase_PrintHelp = void 0;
|
|
27
27
|
const ProjectManager_1 = require("../logic/ProjectManager");
|
|
28
28
|
const map_project_packages_1 = require("../logic/map-project-packages");
|
|
29
29
|
const fs = __importStar(require("fs"));
|
|
@@ -44,6 +44,7 @@ const ProjectScreen_1 = require("../screen/ProjectScreen");
|
|
|
44
44
|
const cli_1 = require("@nu-art/commando/core/cli");
|
|
45
45
|
const RunningProcessLogs_1 = require("../screen/RunningProcessLogs");
|
|
46
46
|
const command_executors_1 = require("../logic/command-executors");
|
|
47
|
+
const CommandExecutor_Python_1 = require("../logic/command-executors/CommandExecutor_Python");
|
|
47
48
|
const CONST_ThunderstormVersionKey = 'THUNDERSTORM_SDK_VERSION';
|
|
48
49
|
const CONST_ThunderstormDependencyKey = 'THUNDERSTORM_DEPENDENCY_VERSION';
|
|
49
50
|
const CONST_ProjectVersionKey = 'APP_VERSION';
|
|
@@ -117,6 +118,7 @@ exports.Phase_PrepareParams = {
|
|
|
117
118
|
isMandatory: true,
|
|
118
119
|
breakAfterPhase: true,
|
|
119
120
|
mandatoryPhases: [exports.Phase_SetupProject, exports.Phase_SetWithThunderstorm],
|
|
121
|
+
filter: async (pkg) => pkg.type !== types_1.PackageType_Python,
|
|
120
122
|
action: async (pkg) => {
|
|
121
123
|
const packages = consts_1.MemKey_Packages.get();
|
|
122
124
|
const projectScreen = ProjectScreen_1.MemKey_ProjectScreen.get();
|
|
@@ -138,6 +140,8 @@ exports.Phase_ResolveTemplate = {
|
|
|
138
140
|
isMandatory: true,
|
|
139
141
|
mandatoryPhases: [exports.Phase_PrepareParams, exports.Phase_SetupProject, exports.Phase_SetWithThunderstorm],
|
|
140
142
|
action: async (pkg) => {
|
|
143
|
+
if (pkg.type === types_1.PackageType_Python)
|
|
144
|
+
return;
|
|
141
145
|
const packages = consts_1.MemKey_Packages.get();
|
|
142
146
|
const projectScreen = ProjectScreen_1.MemKey_ProjectScreen.get();
|
|
143
147
|
projectScreen.updateOrCreatePackage(pkg.name, 'Resolving Templates');
|
|
@@ -253,6 +257,8 @@ exports.Phase_CheckCyclicImports = {
|
|
|
253
257
|
mandatoryPhases: [exports.Phase_ResolveEnv],
|
|
254
258
|
filter: async (pkg) => params_1.RuntimeParams.checkCyclicImports,
|
|
255
259
|
action: async (pkg) => {
|
|
260
|
+
if (pkg.type === types_1.PackageType_Python)
|
|
261
|
+
return;
|
|
256
262
|
if (!pkg.output)
|
|
257
263
|
return;
|
|
258
264
|
return nvm_1.NVM.createCommando(basic_1.Cli_Basic)
|
|
@@ -280,8 +286,10 @@ exports.Phase_PackagePurge = {
|
|
|
280
286
|
type: ProjectManager_1.PackageBuildPhaseType_PackageWithOutput,
|
|
281
287
|
name: 'package-purge',
|
|
282
288
|
mandatoryPhases: [exports.Phase_ResolveEnv],
|
|
283
|
-
filter: async (pkg) => fs.existsSync(pkg.output) && params_1.RuntimeParams.purge,
|
|
289
|
+
filter: async (pkg) => pkg.type !== types_1.PackageType_Python && fs.existsSync(pkg.output) && params_1.RuntimeParams.purge,
|
|
284
290
|
action: async (pkg) => {
|
|
291
|
+
if (pkg.type === types_1.PackageType_Python)
|
|
292
|
+
return;
|
|
285
293
|
const projectScreen = ProjectScreen_1.MemKey_ProjectScreen.get();
|
|
286
294
|
//Update cli ui
|
|
287
295
|
projectScreen.updateOrCreatePackage(pkg.name, 'Purging');
|
|
@@ -320,12 +328,30 @@ exports.Phase_InstallPackages = {
|
|
|
320
328
|
await pnpm_1.PNPM.installPackages(nvm_1.NVM.createCommando());
|
|
321
329
|
}
|
|
322
330
|
};
|
|
331
|
+
exports.Phase_InstallPythonPackages = {
|
|
332
|
+
type: 'package',
|
|
333
|
+
name: 'install-python-packages',
|
|
334
|
+
filter: async (pkg) => params_1.RuntimeParams.encounterManager && pkg.type === types_1.PackageType_Python,
|
|
335
|
+
action: async (pkg) => {
|
|
336
|
+
if (pkg.type !== types_1.PackageType_Python)
|
|
337
|
+
return;
|
|
338
|
+
await nvm_1.NVM.createCommando(basic_1.Cli_Basic)
|
|
339
|
+
.cd((0, tools_1.convertToFullPath)(pkg.path))
|
|
340
|
+
.append('echo installing python')
|
|
341
|
+
.append('python3 -m venv venv')
|
|
342
|
+
.append('source venv/bin/activate')
|
|
343
|
+
.append('pip3 install -r requirements.txt')
|
|
344
|
+
.execute();
|
|
345
|
+
}
|
|
346
|
+
};
|
|
323
347
|
exports.Phase_Clean = {
|
|
324
348
|
type: ProjectManager_1.PackageBuildPhaseType_PackageWithOutput,
|
|
325
349
|
name: 'clean',
|
|
326
350
|
mandatoryPhases: [exports.Phase_ResolveEnv],
|
|
327
351
|
filter: async (pkg) => params_1.RuntimeParams.clean,
|
|
328
352
|
action: async (pkg) => {
|
|
353
|
+
if (pkg.type === types_1.PackageType_Python)
|
|
354
|
+
return;
|
|
329
355
|
const projectScreen = ProjectScreen_1.MemKey_ProjectScreen.get();
|
|
330
356
|
projectScreen.updateOrCreatePackage(pkg.name, 'Cleaning');
|
|
331
357
|
if (!fs.existsSync(pkg.output))
|
|
@@ -339,6 +365,8 @@ exports.Phase_Lint = {
|
|
|
339
365
|
mandatoryPhases: [exports.Phase_ResolveEnv],
|
|
340
366
|
filter: async (pkg) => params_1.RuntimeParams.lint && pkg.type !== 'sourceless',
|
|
341
367
|
action: async (pkg) => {
|
|
368
|
+
if (pkg.type === types_1.PackageType_Python)
|
|
369
|
+
return;
|
|
342
370
|
const projectScreen = ProjectScreen_1.MemKey_ProjectScreen.get();
|
|
343
371
|
projectScreen.updateOrCreatePackage(pkg.name, 'Linting');
|
|
344
372
|
const folder = 'main';
|
|
@@ -370,9 +398,9 @@ exports.Phase_PrepareCompile = {
|
|
|
370
398
|
name: 'prepare-compile',
|
|
371
399
|
isMandatory: true,
|
|
372
400
|
mandatoryPhases: [exports.Phase_ResolveEnv],
|
|
373
|
-
filter: async (pkg) => pkg.type !== 'sourceless' && !params_1.RuntimeParams.noBuild,
|
|
401
|
+
filter: async (pkg) => pkg.type !== 'sourceless' && pkg.type !== types_1.PackageType_Python && !params_1.RuntimeParams.noBuild,
|
|
374
402
|
action: async (pkg) => {
|
|
375
|
-
if (pkg.type === 'sourceless')
|
|
403
|
+
if (pkg.type === 'sourceless' || pkg.type === types_1.PackageType_Python)
|
|
376
404
|
return;
|
|
377
405
|
const folder = 'main';
|
|
378
406
|
const sourceFolder = `${pkg.path}/src/${folder}`;
|
|
@@ -433,6 +461,8 @@ exports.Phase_PreCompile = {
|
|
|
433
461
|
return fs.existsSync(`${pkg.path}/prebuild.sh`);
|
|
434
462
|
},
|
|
435
463
|
action: async (pkg) => {
|
|
464
|
+
if (pkg.type === types_1.PackageType_Python)
|
|
465
|
+
return;
|
|
436
466
|
return nvm_1.NVM.createCommando(basic_1.Cli_Basic)
|
|
437
467
|
.cd(pkg.path)
|
|
438
468
|
.append(`bash ${pkg.path}/prebuild.sh`).execute();
|
|
@@ -446,7 +476,7 @@ exports.Phase_Compile = {
|
|
|
446
476
|
action: async (pkg) => {
|
|
447
477
|
var _a;
|
|
448
478
|
const packages = consts_1.MemKey_Packages.get();
|
|
449
|
-
if (pkg.type === 'sourceless')
|
|
479
|
+
if (pkg.type === 'sourceless' || pkg.type === types_1.PackageType_Python)
|
|
450
480
|
return;
|
|
451
481
|
const folder = 'main';
|
|
452
482
|
const sourceFolder = `${pkg.path}/src/${folder}`;
|
|
@@ -481,11 +511,15 @@ exports.Phase_Compile = {
|
|
|
481
511
|
}), __pkg => __pkg.name);
|
|
482
512
|
if (runTimePackages) {
|
|
483
513
|
for (const rtPack of runTimePackages) {
|
|
514
|
+
if (rtPack.type === types_1.PackageType_Python)
|
|
515
|
+
return;
|
|
516
|
+
// @ts-ignore
|
|
484
517
|
if (!rtPack.output)
|
|
485
518
|
continue;
|
|
486
519
|
const pkgOutputFolderAsDependency = `${pkg.output}/.dependencies/${rtPack.name}/`;
|
|
487
520
|
await nvm_1.NVM.createCommando()
|
|
488
521
|
.append(`mkdir -p ${pkgOutputFolderAsDependency}`)
|
|
522
|
+
// @ts-ignore
|
|
489
523
|
.append(`rsync -a --delete ${rtPack.output}/ ${pkg.output}/.dependencies/${rtPack.name}/`)
|
|
490
524
|
.execute();
|
|
491
525
|
await fs_1.promises.writeFile(`${pkgOutputFolderAsDependency}/${consts_1.CONST_PackageJSON}`, JSON.stringify(rtPack.packageJsonRuntime, null, 2), { encoding: 'utf-8' });
|
|
@@ -518,12 +552,12 @@ exports.Phase_CompileWatch = {
|
|
|
518
552
|
return console.error(`couldn't find lib to run for path: ${libPath}...\nListening on: ${(0, ts_common_1.__stringify)(sourcesPaths, true)}`);
|
|
519
553
|
const rtPackages = consts_1.MemKey_Packages.get();
|
|
520
554
|
const pkg = (0, ts_common_1.flatArray)(rtPackages.packagesDependency).find(pkg => {
|
|
521
|
-
return path.startsWith(pkg.path) && pkg.type !== 'sourceless';
|
|
555
|
+
return path.startsWith(pkg.path) && pkg.type !== 'sourceless' && pkg.type !== types_1.PackageType_Python;
|
|
522
556
|
});
|
|
523
557
|
if (deleteDist && pkg && 'output' in pkg)
|
|
524
558
|
await fs_1.promises.rmdir(pkg.output);
|
|
525
559
|
const packageIndex = rtPackages.packagesDependency.findIndex(packages => {
|
|
526
|
-
return packages.some(pkg => path.startsWith(pkg.path) && pkg.type !== 'sourceless');
|
|
560
|
+
return packages.some(pkg => path.startsWith(pkg.path) && pkg.type !== 'sourceless' && pkg.type !== types_1.PackageType_Python);
|
|
527
561
|
});
|
|
528
562
|
try {
|
|
529
563
|
if (controller)
|
|
@@ -582,13 +616,14 @@ exports.Phase_CompileWatch = {
|
|
|
582
616
|
});
|
|
583
617
|
}
|
|
584
618
|
};
|
|
619
|
+
const executorMap = {};
|
|
585
620
|
let runningAppsLogs;
|
|
586
621
|
exports.Phase_Launch = {
|
|
587
622
|
type: 'package',
|
|
588
623
|
name: 'launch',
|
|
589
624
|
terminatingPhase: true,
|
|
590
625
|
mandatoryPhases: [exports.Phase_ResolveEnv],
|
|
591
|
-
filter: async (pkg) => { var _a; return !!((_a = pkg.name.match(new RegExp(params_1.RuntimeParams.launch))) === null || _a === void 0 ? void 0 : _a[0]) && (pkg.type === 'firebase-functions-app' || pkg.type === 'firebase-hosting-app'); },
|
|
626
|
+
filter: async (pkg) => { var _a; return !!((_a = pkg.name.match(new RegExp(params_1.RuntimeParams.launch))) === null || _a === void 0 ? void 0 : _a[0]) && (pkg.type === 'firebase-functions-app' || pkg.type === 'firebase-hosting-app' || pkg.type === types_1.PackageType_Python); },
|
|
592
627
|
action: async (pkg) => {
|
|
593
628
|
const projectManager = project_manager_1.MemKey_ProjectManager.get();
|
|
594
629
|
const projectScreen = ProjectScreen_1.MemKey_ProjectScreen.get();
|
|
@@ -611,20 +646,54 @@ exports.Phase_Launch = {
|
|
|
611
646
|
ts_common_1.BeLogged.addClient(logClient);
|
|
612
647
|
projectScreen.updateOrCreatePackage(pkg.name, 'Launching...');
|
|
613
648
|
if (pkg.type === 'firebase-functions-app') {
|
|
614
|
-
runningAppsLogs.registerApp(pkg.name, logClient);
|
|
649
|
+
runningAppsLogs === null || runningAppsLogs === void 0 ? void 0 : runningAppsLogs.registerApp(pkg.name, logClient);
|
|
615
650
|
const executor = await new command_executors_1.CommandExecutor_FirebaseFunction(pkg).execute();
|
|
616
|
-
|
|
651
|
+
executorMap[pkg.name] = executor;
|
|
652
|
+
runningAppsLogs === null || runningAppsLogs === void 0 ? void 0 : runningAppsLogs.addOnTerminateCallback(async () => {
|
|
617
653
|
await executor.kill();
|
|
618
|
-
runningAppsLogs.unregisterApp(pkg.name);
|
|
654
|
+
runningAppsLogs === null || runningAppsLogs === void 0 ? void 0 : runningAppsLogs.unregisterApp(pkg.name);
|
|
619
655
|
});
|
|
620
656
|
return;
|
|
621
657
|
}
|
|
622
658
|
if (pkg.type === 'firebase-hosting-app') {
|
|
623
|
-
runningAppsLogs.registerApp(pkg.name, logClient);
|
|
659
|
+
runningAppsLogs === null || runningAppsLogs === void 0 ? void 0 : runningAppsLogs.registerApp(pkg.name, logClient);
|
|
624
660
|
const executor = await new command_executors_1.CommandExecutor_FirebaseHosting(pkg).execute();
|
|
625
|
-
runningAppsLogs.addOnTerminateCallback(async () => {
|
|
661
|
+
runningAppsLogs === null || runningAppsLogs === void 0 ? void 0 : runningAppsLogs.addOnTerminateCallback(async () => {
|
|
626
662
|
await executor.kill();
|
|
627
|
-
runningAppsLogs.unregisterApp(pkg.name);
|
|
663
|
+
runningAppsLogs === null || runningAppsLogs === void 0 ? void 0 : runningAppsLogs.unregisterApp(pkg.name);
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
if (pkg.type === types_1.PackageType_Python) {
|
|
667
|
+
runningAppsLogs === null || runningAppsLogs === void 0 ? void 0 : runningAppsLogs.registerApp(pkg.name, logClient);
|
|
668
|
+
logClient.log(pkg.name, ts_common_1.LogLevel.Info, true, ['Awaiting Advisor & KM BE launch']);
|
|
669
|
+
const advisorExecutor = executorMap['advisor-backend'];
|
|
670
|
+
const kmExecutor = executorMap['km-backend'];
|
|
671
|
+
if (!advisorExecutor)
|
|
672
|
+
logClient.log(pkg.name, ts_common_1.LogLevel.Error, true, ['Advisor BE executor not registered yet']);
|
|
673
|
+
if (!kmExecutor)
|
|
674
|
+
logClient.log(pkg.name, ts_common_1.LogLevel.Error, true, ['KM BE executor not registered yet']);
|
|
675
|
+
let advisorUp = false;
|
|
676
|
+
let kmUp = false;
|
|
677
|
+
const startPython = async () => {
|
|
678
|
+
logClient.log(pkg.name, ts_common_1.LogLevel.Info, true, ['Advisor & KM BE launched, Starting!']);
|
|
679
|
+
const executor = new CommandExecutor_Python_1.CommandExecutor_Python(pkg);
|
|
680
|
+
runningAppsLogs === null || runningAppsLogs === void 0 ? void 0 : runningAppsLogs.addOnTerminateCallback(async () => {
|
|
681
|
+
await executor.kill();
|
|
682
|
+
runningAppsLogs === null || runningAppsLogs === void 0 ? void 0 : runningAppsLogs.unregisterApp(pkg.name);
|
|
683
|
+
});
|
|
684
|
+
await executor.execute();
|
|
685
|
+
};
|
|
686
|
+
advisorExecutor === null || advisorExecutor === void 0 ? void 0 : advisorExecutor.addOnReadyCallback(async () => {
|
|
687
|
+
advisorUp = true;
|
|
688
|
+
if (!kmUp)
|
|
689
|
+
return logClient.log(pkg.name, ts_common_1.LogLevel.Info, true, ['Advisor launched, waiting for KM']);
|
|
690
|
+
await startPython();
|
|
691
|
+
});
|
|
692
|
+
kmExecutor === null || kmExecutor === void 0 ? void 0 : kmExecutor.addOnReadyCallback(async () => {
|
|
693
|
+
kmUp = true;
|
|
694
|
+
if (!advisorUp)
|
|
695
|
+
return logClient.log(pkg.name, ts_common_1.LogLevel.Info, true, ['KM launched, waiting for Advisor']);
|
|
696
|
+
await startPython();
|
|
628
697
|
});
|
|
629
698
|
}
|
|
630
699
|
projectScreen.updateOrCreatePackage(pkg.name, 'Died');
|
package/v2/ProjectManagerV2.d.ts
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type PhasesImplementor<Phases extends Phase<string>[]> = {
|
|
3
|
-
[K in Phases[number]['method']]?: AsyncVoidFunction;
|
|
4
|
-
};
|
|
5
|
-
export type Phase<PhaseMethod extends string> = {
|
|
6
|
-
name?: string;
|
|
7
|
-
method: PhaseMethod;
|
|
8
|
-
filter?: () => Promise<boolean>;
|
|
9
|
-
};
|
|
1
|
+
import { Phase, PhasesImplementor } from "./phase-runner/types";
|
|
10
2
|
export declare class ProjectManagerV2<Phases extends Phase<string>[]> {
|
|
11
3
|
private manageables;
|
|
12
4
|
phases: Phase<string>[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Phase } from './types';
|
|
2
|
+
import { UnitPhaseImplementor } from '../unit/core/types';
|
|
3
|
+
import { BaseUnit } from '../unit/core/BaseUnit';
|
|
4
|
+
type Unit<P extends Phase<string>[]> = BaseUnit & UnitPhaseImplementor<P>;
|
|
5
|
+
export declare class PhaseRunner<P extends Phase<string>[]> extends BaseUnit {
|
|
6
|
+
private readonly phases;
|
|
7
|
+
private units;
|
|
8
|
+
constructor(phases: P);
|
|
9
|
+
registerUnits(units: Unit<P> | Unit<P>[]): void;
|
|
10
|
+
private getUnitsForPhase;
|
|
11
|
+
private initUnits;
|
|
12
|
+
private executePhase;
|
|
13
|
+
execute(): Promise<void>;
|
|
14
|
+
private executeImpl;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PhaseRunner = void 0;
|
|
4
|
+
const ts_common_1 = require("@nu-art/ts-common");
|
|
5
|
+
const BaseUnit_1 = require("../unit/core/BaseUnit");
|
|
6
|
+
class PhaseRunner extends BaseUnit_1.BaseUnit {
|
|
7
|
+
constructor(phases) {
|
|
8
|
+
super({ label: 'Phase Runner', key: 'phase-runner' });
|
|
9
|
+
this.units = [];
|
|
10
|
+
this.phases = phases;
|
|
11
|
+
}
|
|
12
|
+
//######################### Unit Logic #########################
|
|
13
|
+
registerUnits(units) {
|
|
14
|
+
(0, ts_common_1.asArray)(units).forEach(unit => this.units.push(unit));
|
|
15
|
+
}
|
|
16
|
+
getUnitsForPhase(phase) {
|
|
17
|
+
return this.units.filter(unit => (0, ts_common_1.exists)(unit[phase.method]));
|
|
18
|
+
}
|
|
19
|
+
async initUnits() {
|
|
20
|
+
return Promise.all(this.units.map(unit => {
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
unit.init();
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
//######################### Phase Logic #########################
|
|
26
|
+
async executePhase(phase) {
|
|
27
|
+
const willExecutePhase = (0, ts_common_1.exists)(phase.filter) && !phase.filter();
|
|
28
|
+
if (!willExecutePhase)
|
|
29
|
+
return this.logInfo(`Will not execute phase: ${phase.name}, did not pass filter`);
|
|
30
|
+
const units = this.getUnitsForPhase(phase);
|
|
31
|
+
if (!units.length)
|
|
32
|
+
return this.logInfo(`Will not execute phase: ${phase.name}, no units to execute`);
|
|
33
|
+
this.logInfo(`Executing phase: ${phase.name} for ${units.length} units`);
|
|
34
|
+
for (const unit of units) {
|
|
35
|
+
await unit[phase.method]();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//######################### Public Functions #########################
|
|
39
|
+
async execute() {
|
|
40
|
+
await this.initUnits();
|
|
41
|
+
await this.executeImpl();
|
|
42
|
+
}
|
|
43
|
+
async executeImpl() {
|
|
44
|
+
for (const phase of this.phases) {
|
|
45
|
+
await this.executePhase(phase);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.PhaseRunner = PhaseRunner;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AsyncVoidFunction } from '@nu-art/ts-common';
|
|
2
|
+
export type Phase<PhaseMethod extends string> = {
|
|
3
|
+
name: string;
|
|
4
|
+
method: PhaseMethod;
|
|
5
|
+
filter?: () => (Promise<boolean> | boolean);
|
|
6
|
+
};
|
|
7
|
+
export type PhaseImplementor<P extends Phase<string>[]> = {
|
|
8
|
+
[K in P[number]['method']]: AsyncVoidFunction;
|
|
9
|
+
};
|
|
10
|
+
export type PhasesImplementor<Phases extends Phase<string>[]> = {
|
|
11
|
+
[K in Phases[number]['method']]?: AsyncVoidFunction;
|
|
12
|
+
};
|
package/v2/test/test.d.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import { Phase } from '../ProjectManagerV2';
|
|
2
1
|
import { BasePackage } from '../BasePackage';
|
|
3
|
-
import {
|
|
2
|
+
import { Phase, PhaseImplementor } from '../phase-runner/types';
|
|
4
3
|
declare const Phase_I: Phase<'install'>;
|
|
5
4
|
declare const Phase_C: Phase<'copyPackageJson'>;
|
|
6
|
-
|
|
7
|
-
[K in P['method']]: AsyncVoidFunction;
|
|
8
|
-
};
|
|
9
|
-
export declare abstract class Package_Python extends BasePackage implements PhaseImplementor<typeof Phase_I> {
|
|
5
|
+
export declare abstract class Package_Python extends BasePackage implements PhaseImplementor<[typeof Phase_I]> {
|
|
10
6
|
install(): Promise<void>;
|
|
11
7
|
}
|
|
12
|
-
declare abstract class Package_Typescript extends BasePackage implements PhaseImplementor<typeof Phase_C> {
|
|
8
|
+
declare abstract class Package_Typescript extends BasePackage implements PhaseImplementor<[typeof Phase_C]> {
|
|
13
9
|
copyPackageJson(): Promise<void>;
|
|
14
10
|
}
|
|
15
11
|
export declare class Package_Root extends Package_Typescript {
|
package/v2/test/test.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Package_Root = exports.Package_Python = void 0;
|
|
4
|
-
const ProjectManagerV2_1 = require("../ProjectManagerV2");
|
|
5
4
|
const BasePackage_1 = require("../BasePackage");
|
|
6
5
|
const params_1 = require("../../core/params/params");
|
|
7
6
|
const cli_1 = require("@nu-art/commando/core/cli");
|
|
7
|
+
const ProjectManagerV2_1 = require("../ProjectManagerV2");
|
|
8
8
|
const Phase_A = {
|
|
9
9
|
name: 'Compile',
|
|
10
10
|
method: 'compile',
|
|
@@ -13,7 +13,7 @@ const Phase_A = {
|
|
|
13
13
|
const Phase_I = {
|
|
14
14
|
name: 'Compile',
|
|
15
15
|
method: 'install',
|
|
16
|
-
filter: async () =>
|
|
16
|
+
filter: async () => params_1.RuntimeParams.install
|
|
17
17
|
};
|
|
18
18
|
const Phase_C = {
|
|
19
19
|
name: 'Copy Package Json',
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Logger } from '@nu-art/ts-common';
|
|
2
|
+
type _Config<Config> = {
|
|
3
|
+
key: string;
|
|
4
|
+
label: string;
|
|
5
|
+
} & Config;
|
|
6
|
+
export declare class BaseUnit<Config extends {} = {}, C extends _Config<Config> = _Config<Config>> extends Logger {
|
|
7
|
+
readonly config: Readonly<C>;
|
|
8
|
+
constructor(config: C);
|
|
9
|
+
protected init(): Promise<void>;
|
|
10
|
+
private initLogClient;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseUnit = void 0;
|
|
4
|
+
const ts_common_1 = require("@nu-art/ts-common");
|
|
5
|
+
class BaseUnit extends ts_common_1.Logger {
|
|
6
|
+
constructor(config) {
|
|
7
|
+
super(config.key);
|
|
8
|
+
this.config = Object.freeze(config);
|
|
9
|
+
this.initLogClient();
|
|
10
|
+
}
|
|
11
|
+
async init() {
|
|
12
|
+
//Inheritor classes should define their own init
|
|
13
|
+
}
|
|
14
|
+
//######################### Internal Logic #########################
|
|
15
|
+
initLogClient() {
|
|
16
|
+
const logClient = new ts_common_1.LogClient_MemBuffer(this.tag);
|
|
17
|
+
logClient.setForTerminal();
|
|
18
|
+
logClient.setComposer((tag, level) => {
|
|
19
|
+
ts_common_1._logger_finalDate.setTime(Date.now() - ts_common_1._logger_timezoneOffset);
|
|
20
|
+
const date = ts_common_1._logger_finalDate.toISOString().replace(/T/, '_').replace(/Z/, '').substring(0, 23).split('_')[1];
|
|
21
|
+
return `${date} ${(0, ts_common_1._logger_getPrefix)(level)}: `;
|
|
22
|
+
});
|
|
23
|
+
logClient.setFilter((level, tag) => {
|
|
24
|
+
return tag === this.tag;
|
|
25
|
+
});
|
|
26
|
+
ts_common_1.BeLogged.addClient(logClient);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.BaseUnit = BaseUnit;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Unit_Python = void 0;
|
|
4
|
+
const BaseUnit_1 = require("./BaseUnit");
|
|
5
|
+
const cli_1 = require("@nu-art/commando/core/cli");
|
|
6
|
+
class Unit_Python extends BaseUnit_1.BaseUnit {
|
|
7
|
+
async install() {
|
|
8
|
+
await cli_1.Commando.create().append('pip install -r requirements.txt').execute();
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.Unit_Python = Unit_Python;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BaseUnit } from './BaseUnit';
|
|
2
|
+
import { Phase_CopyPackageJSON, UnitPhaseImplementor } from './types';
|
|
3
|
+
type PackageJSONTargetKey = 'root' | 'dist' | 'dependency';
|
|
4
|
+
type _Config<Config> = {
|
|
5
|
+
pathToPackage: string;
|
|
6
|
+
} & Config;
|
|
7
|
+
export declare class Unit_Typescript<Config extends {} = {}, C extends _Config<Config> = _Config<Config>> extends BaseUnit<C> implements UnitPhaseImplementor<[Phase_CopyPackageJSON]> {
|
|
8
|
+
private convertTemplatePackageJSON;
|
|
9
|
+
/**
|
|
10
|
+
* Converts a template __package.json file into a usable package.json for the unit root
|
|
11
|
+
* @param template
|
|
12
|
+
* @private
|
|
13
|
+
*/
|
|
14
|
+
private convertPJForRoot;
|
|
15
|
+
/**
|
|
16
|
+
* Converts a template __package.json file into a usable package.json for the unit dist
|
|
17
|
+
* @param template
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
private convertPJForDist;
|
|
21
|
+
/**
|
|
22
|
+
* Converts a template __package.json file into a usable package.json for the unit
|
|
23
|
+
* as it will be in a .dependencies of a deployable unit
|
|
24
|
+
* @param template
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
private convertPJForDependency;
|
|
28
|
+
copyPackageJson(targetKey?: PackageJSONTargetKey): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Unit_Typescript = void 0;
|
|
4
|
+
const BaseUnit_1 = require("./BaseUnit");
|
|
5
|
+
const tools_1 = require("@nu-art/commando/core/tools");
|
|
6
|
+
const consts_1 = require("../../../core/consts");
|
|
7
|
+
const ts_common_1 = require("@nu-art/ts-common");
|
|
8
|
+
const map_project_packages_1 = require("../../../logic/map-project-packages");
|
|
9
|
+
const fs_1 = require("fs");
|
|
10
|
+
const targetKeyPathMap = {
|
|
11
|
+
'root': '',
|
|
12
|
+
'dist': '/dist',
|
|
13
|
+
'dependency': '', //TODO: Fill this in
|
|
14
|
+
};
|
|
15
|
+
class Unit_Typescript extends BaseUnit_1.BaseUnit {
|
|
16
|
+
//######################### Internal Logic #########################
|
|
17
|
+
convertTemplatePackageJSON(targetKey, template) {
|
|
18
|
+
switch (targetKey) {
|
|
19
|
+
case 'root':
|
|
20
|
+
return this.convertPJForRoot(template);
|
|
21
|
+
case 'dist':
|
|
22
|
+
return this.convertPJForDist(template);
|
|
23
|
+
case 'dependency':
|
|
24
|
+
return this.convertPJForDependency(template);
|
|
25
|
+
default:
|
|
26
|
+
throw new ts_common_1.ImplementationMissingException(`No implementation for targetKey ${targetKey}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Converts a template __package.json file into a usable package.json for the unit root
|
|
31
|
+
* @param template
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
convertPJForRoot(template) {
|
|
35
|
+
var _a, _b;
|
|
36
|
+
//Get the package params for replacing in the template package json
|
|
37
|
+
const params = (_b = (_a = consts_1.MemKey_Packages.get()) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {};
|
|
38
|
+
//Convert template to actual package.json
|
|
39
|
+
return (0, map_project_packages_1.convertPackageJSONTemplateToPackJSON_Value)(template, (value, key) => params[key] ? 'workspace:*' : params[value]);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Converts a template __package.json file into a usable package.json for the unit dist
|
|
43
|
+
* @param template
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
convertPJForDist(template) {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
//Get the package params for replacing in the template package json
|
|
49
|
+
const params = (_b = (_a = consts_1.MemKey_Packages.get()) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {};
|
|
50
|
+
const converted = this.convertPJForRoot(template);
|
|
51
|
+
params[converted.name] = converted.version;
|
|
52
|
+
params[`${converted.name}_path`] = `file:.dependencies/${this.config.key}`; //Not sure about this one
|
|
53
|
+
//Convert template to actual package.json
|
|
54
|
+
return (0, map_project_packages_1.convertPackageJSONTemplateToPackJSON_Value)(template, (value, key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : params[value]; });
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Converts a template __package.json file into a usable package.json for the unit
|
|
58
|
+
* as it will be in a .dependencies of a deployable unit
|
|
59
|
+
* @param template
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
62
|
+
convertPJForDependency(template) {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
//Get the package params for replacing in the template package json
|
|
65
|
+
const params = (_b = (_a = consts_1.MemKey_Packages.get()) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {};
|
|
66
|
+
const converted = this.convertPJForRoot(template);
|
|
67
|
+
params[converted.name] = converted.version;
|
|
68
|
+
params[`${converted.name}_path`] = `file:.dependencies/${this.config.key}`; //Not sure about this one
|
|
69
|
+
//Convert template to actual package.json
|
|
70
|
+
return (0, map_project_packages_1.convertPackageJSONTemplateToPackJSON_Value)(template, (value, key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : params[value]; });
|
|
71
|
+
}
|
|
72
|
+
//######################### Phase Implementations #########################
|
|
73
|
+
async copyPackageJson(targetKey = 'root') {
|
|
74
|
+
//Find paths
|
|
75
|
+
const unitRootPath = (0, tools_1.convertToFullPath)(this.config.pathToPackage);
|
|
76
|
+
const templatePath = `${unitRootPath}/${consts_1.CONST_PackageJSONTemplate}`;
|
|
77
|
+
const targetPath = `${unitRootPath + targetKeyPathMap[targetKey]}/${consts_1.CONST_PackageJSON}`;
|
|
78
|
+
//Get the template __package.json file
|
|
79
|
+
const template = JSON.parse(await fs_1.promises.readFile(templatePath, 'utf-8'));
|
|
80
|
+
//Get converted package.json content
|
|
81
|
+
const packageJSON = this.convertTemplatePackageJSON(targetKey, template);
|
|
82
|
+
//Create the package.json file in target location
|
|
83
|
+
await fs_1.promises.writeFile(targetPath, JSON.stringify(packageJSON, null, 2), { encoding: 'utf-8' });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.Unit_Typescript = Unit_Typescript;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Unit_Typescript } from './Unit_Typescript';
|
|
2
|
+
import { Phase_Compile, Phase_PreCompile, UnitPhaseImplementor } from './types';
|
|
3
|
+
type _Config<Config> = {
|
|
4
|
+
customTSConfig?: boolean;
|
|
5
|
+
} & Config;
|
|
6
|
+
export declare class Unit_TypescriptLib<Config extends {} = {}, C extends _Config<Config> = _Config<Config>> extends Unit_Typescript<C> implements UnitPhaseImplementor<[Phase_PreCompile, Phase_Compile]> {
|
|
7
|
+
private resolveTSConfig;
|
|
8
|
+
preCompile(): Promise<void>;
|
|
9
|
+
compile(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Unit_TypescriptLib = void 0;
|
|
27
|
+
const nvm_1 = require("@nu-art/commando/cli/nvm");
|
|
28
|
+
const Unit_Typescript_1 = require("./Unit_Typescript");
|
|
29
|
+
const fs = __importStar(require("fs"));
|
|
30
|
+
const basic_1 = require("@nu-art/commando/cli/basic");
|
|
31
|
+
const ts_common_1 = require("@nu-art/ts-common");
|
|
32
|
+
class Unit_TypescriptLib extends Unit_Typescript_1.Unit_Typescript {
|
|
33
|
+
//######################### Internal Logic #########################
|
|
34
|
+
async resolveTSConfig() {
|
|
35
|
+
const pathToUnitTSConfig = `${this.config.pathToPackage}/src/main/tsconfig.json`;
|
|
36
|
+
// const pathToProjectTSConfig = '';
|
|
37
|
+
//If set to use a custom ts config
|
|
38
|
+
if (this.config.customTSConfig) {
|
|
39
|
+
//If ts config file does not exist in the main folder
|
|
40
|
+
if (!fs.existsSync(pathToUnitTSConfig))
|
|
41
|
+
throw new ts_common_1.BadImplementationException(`Unit ${this.config.label} missing tsconfig.json file in /src/main`);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
//Copy project ts config file into the unit main folder
|
|
45
|
+
}
|
|
46
|
+
//######################### Phase Implementations #########################
|
|
47
|
+
async preCompile() {
|
|
48
|
+
if (!fs.existsSync(`${this.config.pathToPackage}/prebuild.sh`))
|
|
49
|
+
return;
|
|
50
|
+
await nvm_1.NVM.createCommando(basic_1.Cli_Basic)
|
|
51
|
+
.cd(this.config.pathToPackage)
|
|
52
|
+
.append('bash prebuild.sh')
|
|
53
|
+
.execute();
|
|
54
|
+
}
|
|
55
|
+
async compile() {
|
|
56
|
+
await this.resolveTSConfig();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.Unit_TypescriptLib = Unit_TypescriptLib;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Unit_TypescriptProject = void 0;
|
|
4
|
+
const Unit_Typescript_1 = require("./Unit_Typescript");
|
|
5
|
+
class Unit_TypescriptProject extends Unit_Typescript_1.Unit_Typescript {
|
|
6
|
+
async install() {
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.Unit_TypescriptProject = Unit_TypescriptProject;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
18
|
+
__exportStar(require("./BaseUnit"), exports);
|
|
19
|
+
__exportStar(require("./Unit_Python"), exports);
|
|
20
|
+
__exportStar(require("./Unit_Typescript"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AsyncVoidFunction } from '@nu-art/ts-common';
|
|
2
|
+
import { Phase } from '../../phase-runner/types';
|
|
3
|
+
export type UnitPhaseImplementor<P extends Phase<string>[]> = {
|
|
4
|
+
[K in P[number]['method']]: AsyncVoidFunction;
|
|
5
|
+
};
|
|
6
|
+
export type Phase_Install = typeof phase_Install;
|
|
7
|
+
export declare const phase_Install: Phase<'install'>;
|
|
8
|
+
export type Phase_CopyPackageJSON = typeof phase_CopyPackageJSON;
|
|
9
|
+
export declare const phase_CopyPackageJSON: Phase<'copyPackageJson'>;
|
|
10
|
+
export type Phase_PreCompile = typeof phase_PreCompile;
|
|
11
|
+
export declare const phase_PreCompile: Phase<'preCompile'>;
|
|
12
|
+
export type Phase_Compile = typeof phase_Compile;
|
|
13
|
+
export declare const phase_Compile: Phase<'compile'>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.phase_Compile = exports.phase_PreCompile = exports.phase_CopyPackageJSON = exports.phase_Install = void 0;
|
|
4
|
+
const params_1 = require("../../../core/params/params");
|
|
5
|
+
exports.phase_Install = {
|
|
6
|
+
name: 'Install',
|
|
7
|
+
method: 'install',
|
|
8
|
+
filter: () => params_1.RuntimeParams.install,
|
|
9
|
+
};
|
|
10
|
+
exports.phase_CopyPackageJSON = {
|
|
11
|
+
name: 'Copy Package JSON',
|
|
12
|
+
method: 'copyPackageJson',
|
|
13
|
+
};
|
|
14
|
+
exports.phase_PreCompile = {
|
|
15
|
+
name: 'Pre Compile',
|
|
16
|
+
method: 'preCompile',
|
|
17
|
+
filter: () => !params_1.RuntimeParams.noBuild,
|
|
18
|
+
};
|
|
19
|
+
exports.phase_Compile = {
|
|
20
|
+
name: 'Compile',
|
|
21
|
+
method: 'compile',
|
|
22
|
+
filter: () => !params_1.RuntimeParams.noBuild,
|
|
23
|
+
};
|