@nu-art/build-and-install 0.300.8 → 0.400.0
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-v3.d.ts +29 -0
- package/build-and-install-v3.js +132 -0
- package/build-and-install-v3.js.map +1 -0
- package/build-and-install.js +18 -24
- package/build-and-install.js.map +1 -0
- package/core/consts.d.ts +7 -2
- package/core/consts.js +12 -9
- package/core/consts.js.map +1 -0
- package/core/exceptions/PhaseAggregatedException.d.ts +5 -0
- package/core/exceptions/PhaseAggregatedException.js +9 -0
- package/core/exceptions/PhaseAggregatedException.js.map +1 -0
- package/core/package/consts.d.ts +1 -1
- package/core/package/consts.js +7 -9
- package/core/package/consts.js.map +1 -0
- package/core/params/params.d.ts +18 -19
- package/core/params/params.js +142 -178
- package/core/params/params.js.map +1 -0
- package/core/types/configs/firebasejson.js +2 -2
- package/core/types/configs/firebasejson.js.map +1 -0
- package/core/types/configs/firebaserc.js +2 -2
- package/core/types/configs/firebaserc.js.map +1 -0
- package/core/types/configs/index.d.ts +3 -3
- package/core/types/configs/index.js +4 -19
- package/core/types/configs/index.js.map +1 -0
- package/core/types/configs/package-json.d.ts +2 -1
- package/core/types/configs/package-json.js +2 -2
- package/core/types/configs/package-json.js.map +1 -0
- package/core/types/core.js +2 -2
- package/core/types/core.js.map +1 -0
- package/core/types/index.d.ts +4 -4
- package/core/types/index.js +5 -20
- package/core/types/index.js.map +1 -0
- package/core/types/package/index.d.ts +2 -2
- package/core/types/package/index.js +3 -18
- package/core/types/package/index.js.map +1 -0
- package/core/types/package/package.d.ts +10 -14
- package/core/types/package/package.js +15 -12
- package/core/types/package/package.js.map +1 -0
- package/core/types/package/runtime-package.d.ts +2 -2
- package/core/types/package/runtime-package.js +2 -2
- package/core/types/package/runtime-package.js.map +1 -0
- package/core/types/project-config.d.ts +31 -2
- package/core/types/project-config.js +2 -2
- package/core/types/project-config.js.map +1 -0
- package/defaults/backend-proxy/proxy._ts +3 -1
- package/defaults/consts.d.ts +0 -7
- package/defaults/consts.js +10 -10
- package/defaults/consts.js.map +1 -0
- package/{v2/phase-runner → old}/PhaseRunnerDispatcher.d.ts +4 -4
- package/old/PhaseRunnerDispatcher.js +33 -0
- package/old/PhaseRunnerDispatcher.js.map +1 -0
- package/{v2/unit → old}/runner-dispatchers.d.ts +3 -3
- package/old/runner-dispatchers.js +4 -0
- package/old/runner-dispatchers.js.map +1 -0
- package/package.json +20 -15
- package/v3/PhaseManager.d.ts +26 -0
- package/v3/PhaseManager.js +144 -0
- package/v3/PhaseManager.js.map +1 -0
- package/v3/RunningStatusHandler.d.ts +16 -0
- package/v3/RunningStatusHandler.js +57 -0
- package/v3/RunningStatusHandler.js.map +1 -0
- package/v3/UnitsDependencyMapper/UnitsDependencyMapper.d.ts +52 -0
- package/v3/UnitsDependencyMapper/UnitsDependencyMapper.js +287 -0
- package/v3/UnitsDependencyMapper/UnitsDependencyMapper.js.map +1 -0
- package/v3/UnitsMapper/UnitsMapper.d.ts +21 -0
- package/v3/UnitsMapper/UnitsMapper.js +60 -0
- package/v3/UnitsMapper/UnitsMapper.js.map +1 -0
- package/v3/UnitsMapper/resolvers/UnitMapper_Base.d.ts +23 -0
- package/v3/UnitsMapper/resolvers/UnitMapper_Base.js +17 -0
- package/v3/UnitsMapper/resolvers/UnitMapper_Base.js.map +1 -0
- package/v3/UnitsMapper/resolvers/UnitMapper_FirebaseFunction.d.ts +62 -0
- package/v3/UnitsMapper/resolvers/UnitMapper_FirebaseFunction.js +56 -0
- package/v3/UnitsMapper/resolvers/UnitMapper_FirebaseFunction.js.map +1 -0
- package/v3/UnitsMapper/resolvers/UnitMapper_FirebaseHosting.d.ts +38 -0
- package/v3/UnitsMapper/resolvers/UnitMapper_FirebaseHosting.js +49 -0
- package/v3/UnitsMapper/resolvers/UnitMapper_FirebaseHosting.js.map +1 -0
- package/v3/UnitsMapper/resolvers/UnitMapper_Node.d.ts +30 -0
- package/v3/UnitsMapper/resolvers/UnitMapper_Node.js +59 -0
- package/v3/UnitsMapper/resolvers/UnitMapper_Node.js.map +1 -0
- package/v3/UnitsMapper/resolvers/UnitMapper_NodeLib.d.ts +25 -0
- package/v3/UnitsMapper/resolvers/UnitMapper_NodeLib.js +29 -0
- package/v3/UnitsMapper/resolvers/UnitMapper_NodeLib.js.map +1 -0
- package/v3/UnitsMapper/resolvers/UnitMapper_NodeProject.d.ts +24 -0
- package/v3/UnitsMapper/resolvers/UnitMapper_NodeProject.js +23 -0
- package/v3/UnitsMapper/resolvers/UnitMapper_NodeProject.js.map +1 -0
- package/v3/UnitsMapper/resolvers/index.d.ts +4 -0
- package/v3/UnitsMapper/resolvers/index.js +5 -0
- package/v3/UnitsMapper/resolvers/index.js.map +1 -0
- package/v3/UnitsMapper/types.d.ts +24 -0
- package/v3/UnitsMapper/types.js +2 -0
- package/v3/UnitsMapper/types.js.map +1 -0
- package/v3/core/FileSystemUtils.d.ts +34 -0
- package/v3/core/FileSystemUtils.js +152 -0
- package/v3/core/FileSystemUtils.js.map +1 -0
- package/v3/core/FilesCache.d.ts +7 -0
- package/v3/core/FilesCache.js +34 -0
- package/v3/core/FilesCache.js.map +1 -0
- package/v3/core/Unit_HelpPrinter.d.ts +16 -0
- package/v3/core/Unit_HelpPrinter.js +48 -0
- package/v3/core/Unit_HelpPrinter.js.map +1 -0
- package/v3/core/types.d.ts +17 -0
- package/v3/core/types.js +6 -0
- package/v3/core/types.js.map +1 -0
- package/v3/phase/consts.d.ts +52 -0
- package/v3/phase/consts.js +127 -0
- package/v3/phase/consts.js.map +1 -0
- package/v3/phase/index.d.ts +2 -0
- package/v3/phase/index.js +3 -0
- package/v3/phase/index.js.map +1 -0
- package/v3/phase/types.d.ts +9 -0
- package/v3/phase/types.js +2 -0
- package/v3/phase/types.js.map +1 -0
- package/v3/units/BaseUnit.d.ts +46 -0
- package/v3/units/BaseUnit.js +120 -0
- package/v3/units/BaseUnit.js.map +1 -0
- package/v3/units/ProjectUnit.d.ts +18 -0
- package/v3/units/ProjectUnit.js +12 -0
- package/v3/units/ProjectUnit.js.map +1 -0
- package/v3/units/Unit_NodeProject.d.ts +32 -0
- package/v3/units/Unit_NodeProject.js +244 -0
- package/v3/units/Unit_NodeProject.js.map +1 -0
- package/v3/units/Unit_PackageJson.d.ts +19 -0
- package/v3/units/Unit_PackageJson.js +42 -0
- package/v3/units/Unit_PackageJson.js.map +1 -0
- package/v3/units/Unit_TypescriptLib.d.ts +45 -0
- package/v3/units/Unit_TypescriptLib.js +373 -0
- package/v3/units/Unit_TypescriptLib.js.map +1 -0
- package/v3/units/firebase/Unit_FirebaseFunctionsApp.d.ts +62 -0
- package/v3/units/firebase/Unit_FirebaseFunctionsApp.js +281 -0
- package/v3/units/firebase/Unit_FirebaseFunctionsApp.js.map +1 -0
- package/v3/units/firebase/Unit_FirebaseHostingApp.d.ts +49 -0
- package/v3/units/firebase/Unit_FirebaseHostingApp.js +100 -0
- package/v3/units/firebase/Unit_FirebaseHostingApp.js.map +1 -0
- package/v3/units/index.d.ts +5 -0
- package/v3/units/index.js +6 -0
- package/v3/units/index.js.map +1 -0
- package/core/params/types.d.ts +0 -51
- package/core/params/types.js +0 -2
- package/tsconfig.json +0 -23
- package/v2/phase/consts.d.ts +0 -53
- package/v2/phase/consts.js +0 -151
- package/v2/phase/index.d.ts +0 -2
- package/v2/phase/index.js +0 -18
- package/v2/phase/types.d.ts +0 -12
- package/v2/phase/types.js +0 -2
- package/v2/phase-runner/PhaseRunner.d.ts +0 -69
- package/v2/phase-runner/PhaseRunner.js +0 -472
- package/v2/phase-runner/PhaseRunnerDispatcher.js +0 -37
- package/v2/phase-runner/RunnerParams.d.ts +0 -12
- package/v2/phase-runner/RunnerParams.js +0 -9
- package/v2/phase-runner/consts.d.ts +0 -7
- package/v2/phase-runner/consts.js +0 -9
- package/v2/phase-runner/kaki.d.ts +0 -0
- package/v2/phase-runner/kaki.js +0 -1
- package/v2/phase-runner/types.d.ts +0 -13
- package/v2/phase-runner/types.js +0 -6
- package/v2/project/types.d.ts +0 -8
- package/v2/project/types.js +0 -2
- package/v2/screens/BAIScreen.d.ts +0 -22
- package/v2/screens/BAIScreen.js +0 -82
- package/v2/screens/BAIScreenManager.d.ts +0 -28
- package/v2/screens/BAIScreenManager.js +0 -77
- package/v2/screens/BAIScreen_Launch.d.ts +0 -28
- package/v2/screens/BAIScreen_Launch.js +0 -173
- package/v2/screens/BAIScreen_UnitList.d.ts +0 -36
- package/v2/screens/BAIScreen_UnitList.js +0 -203
- package/v2/unit/consts.d.ts +0 -6
- package/v2/unit/consts.js +0 -8
- package/v2/unit/core/BaseUnit.d.ts +0 -39
- package/v2/unit/core/BaseUnit.js +0 -138
- package/v2/unit/core/Unit_Python.d.ts +0 -16
- package/v2/unit/core/Unit_Python.js +0 -26
- package/v2/unit/core/Unit_Typescript.d.ts +0 -49
- package/v2/unit/core/Unit_Typescript.js +0 -143
- package/v2/unit/core/Unit_TypescriptLib.d.ts +0 -48
- package/v2/unit/core/Unit_TypescriptLib.js +0 -226
- package/v2/unit/core/Unit_TypescriptProject.d.ts +0 -31
- package/v2/unit/core/Unit_TypescriptProject.js +0 -194
- package/v2/unit/core/index.d.ts +0 -5
- package/v2/unit/core/index.js +0 -21
- package/v2/unit/firebase-units/Unit_FirebaseFunctionsApp.d.ts +0 -35
- package/v2/unit/firebase-units/Unit_FirebaseFunctionsApp.js +0 -309
- package/v2/unit/firebase-units/Unit_FirebaseHostingApp.d.ts +0 -24
- package/v2/unit/firebase-units/Unit_FirebaseHostingApp.js +0 -138
- package/v2/unit/firebase-units/consts.d.ts +0 -2
- package/v2/unit/firebase-units/consts.js +0 -9
- package/v2/unit/firebase-units/index.d.ts +0 -2
- package/v2/unit/firebase-units/index.js +0 -18
- package/v2/unit/runner-dispatchers.js +0 -6
- package/v2/unit/thunderstorm.d.ts +0 -171
- package/v2/unit/thunderstorm.js +0 -199
- package/v2/unit/tools/tools.d.ts +0 -2
- package/v2/unit/tools/tools.js +0 -15
- package/v2/unit/types.d.ts +0 -8
- package/v2/unit/types.js +0 -2
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { AsyncVoidFunction, Constructor, LogClient_MemBuffer, Logger, LogLevel } from '@nu-art/ts-common';
|
|
2
|
-
import { RunnerParamKey } from '../../phase-runner/RunnerParams';
|
|
3
|
-
import { CommandoInteractive } from '@nu-art/commando/shell';
|
|
4
|
-
import { BaseCommando } from '@nu-art/commando/shell/core/BaseCommando';
|
|
5
|
-
import { MergeTypes } from '@nu-art/commando/shell/core/class-merger';
|
|
6
|
-
import { Commando_Basic } from '@nu-art/commando/shell/plugins/basic';
|
|
7
|
-
export type BaseUnit_Config = {
|
|
8
|
-
key: string;
|
|
9
|
-
label: string;
|
|
10
|
-
filter?: () => boolean | Promise<boolean>;
|
|
11
|
-
};
|
|
12
|
-
export type BaseUnit_RuntimeConfig = {
|
|
13
|
-
dependencyName: string;
|
|
14
|
-
unitDependencyNames: string[];
|
|
15
|
-
};
|
|
16
|
-
export declare class BaseUnit<C extends BaseUnit_Config = BaseUnit_Config, RTC extends BaseUnit_RuntimeConfig = BaseUnit_RuntimeConfig> extends Logger {
|
|
17
|
-
readonly config: Readonly<C>;
|
|
18
|
-
readonly runtime: RTC;
|
|
19
|
-
private unitStatus;
|
|
20
|
-
protected logger: LogClient_MemBuffer;
|
|
21
|
-
private classStack;
|
|
22
|
-
private processTerminator;
|
|
23
|
-
private timeCounter?;
|
|
24
|
-
constructor(config: C);
|
|
25
|
-
registerTerminatable(terminatable: AsyncVoidFunction): void;
|
|
26
|
-
unregisterTerminatable(terminatable: AsyncVoidFunction): void;
|
|
27
|
-
allocateCommando<T extends Constructor<any>[]>(...plugins: T): MergeTypes<[...T]> & CommandoInteractive & BaseCommando & Commando_Basic;
|
|
28
|
-
executeAsyncCommando<T>(commando: CommandoInteractive, callback?: (stdout: string, stderr: string, exitCode: number) => T): Promise<T>;
|
|
29
|
-
protected init(setInitialized?: boolean): Promise<void>;
|
|
30
|
-
protected getRunnerParam(key: RunnerParamKey): string | undefined;
|
|
31
|
-
private initLogClient;
|
|
32
|
-
protected setErrorStatus(status: string, error: Error): void;
|
|
33
|
-
protected setStatus(status: string, type?: 'start' | 'end', logLevel?: LogLevel): void;
|
|
34
|
-
protected addToClassStack: (cls: Function) => void;
|
|
35
|
-
isInstanceOf: (cls: Function) => boolean;
|
|
36
|
-
getStatus(): string;
|
|
37
|
-
kill(): Promise<void>;
|
|
38
|
-
getLogs(): string;
|
|
39
|
-
}
|
package/v2/unit/core/BaseUnit.js
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
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
|
-
const RunnerParams_1 = require("../../phase-runner/RunnerParams");
|
|
6
|
-
const PhaseRunnerDispatcher_1 = require("../../phase-runner/PhaseRunnerDispatcher");
|
|
7
|
-
const shell_1 = require("@nu-art/commando/shell");
|
|
8
|
-
const basic_1 = require("@nu-art/commando/shell/plugins/basic");
|
|
9
|
-
class BaseUnit extends ts_common_1.Logger {
|
|
10
|
-
constructor(config) {
|
|
11
|
-
super(config.key);
|
|
12
|
-
this.unitStatus = 'Pending Initialization';
|
|
13
|
-
this.processTerminator = [];
|
|
14
|
-
//######################### Class Stack Logic #########################
|
|
15
|
-
this.addToClassStack = (cls) => {
|
|
16
|
-
this.classStack.add(cls.name);
|
|
17
|
-
};
|
|
18
|
-
this.isInstanceOf = (cls) => {
|
|
19
|
-
return this.classStack.has(cls.name);
|
|
20
|
-
};
|
|
21
|
-
this.config = Object.freeze(config);
|
|
22
|
-
this.runtime = {
|
|
23
|
-
dependencyName: this.config.key,
|
|
24
|
-
unitDependencyNames: [],
|
|
25
|
-
};
|
|
26
|
-
this.classStack = new Set();
|
|
27
|
-
this.addToClassStack(BaseUnit);
|
|
28
|
-
this.initLogClient();
|
|
29
|
-
}
|
|
30
|
-
registerTerminatable(terminatable) {
|
|
31
|
-
this.processTerminator.push(terminatable);
|
|
32
|
-
}
|
|
33
|
-
unregisterTerminatable(terminatable) {
|
|
34
|
-
(0, ts_common_1.removeItemFromArray)(this.processTerminator, terminatable);
|
|
35
|
-
}
|
|
36
|
-
allocateCommando(...plugins) {
|
|
37
|
-
const commando = shell_1.CommandoInteractive.create(...plugins, basic_1.Commando_Basic);
|
|
38
|
-
commando.setUID(this.config.key);
|
|
39
|
-
return commando;
|
|
40
|
-
}
|
|
41
|
-
async executeAsyncCommando(commando, callback) {
|
|
42
|
-
let pid;
|
|
43
|
-
const terminatable = () => commando.gracefullyKill(pid);
|
|
44
|
-
try {
|
|
45
|
-
this.registerTerminatable(terminatable);
|
|
46
|
-
return await commando.executeAsync(_pid => pid = _pid, callback);
|
|
47
|
-
}
|
|
48
|
-
finally {
|
|
49
|
-
this.unregisterTerminatable(terminatable);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
async init(setInitialized = true) {
|
|
53
|
-
this.setStatus('Initializing');
|
|
54
|
-
//Register the unit to PhaseRunnerEvent dispatcher
|
|
55
|
-
PhaseRunnerDispatcher_1.dispatcher_PhaseChange.addListener(this);
|
|
56
|
-
PhaseRunnerDispatcher_1.dispatcher_UnitStatusChange.addListener(this);
|
|
57
|
-
if (setInitialized)
|
|
58
|
-
this.setStatus('Initialized');
|
|
59
|
-
}
|
|
60
|
-
//######################### Internal Logic #########################
|
|
61
|
-
getRunnerParam(key) {
|
|
62
|
-
return RunnerParams_1.MemKey_RunnerParams.get({})[key];
|
|
63
|
-
}
|
|
64
|
-
initLogClient() {
|
|
65
|
-
this.logger = new ts_common_1.LogClient_MemBuffer(this.tag);
|
|
66
|
-
this.logger.keepLogsNaturalColors();
|
|
67
|
-
this.logger.setComposer((tag, level) => {
|
|
68
|
-
ts_common_1._logger_finalDate.setTime(Date.now() - ts_common_1._logger_timezoneOffset);
|
|
69
|
-
const date = ts_common_1._logger_finalDate.toISOString().replace(/T/, '_').replace(/Z/, '').substring(0, 23).split('_')[1];
|
|
70
|
-
return `${date} ${(0, ts_common_1._logger_getPrefix)(level)}: `;
|
|
71
|
-
});
|
|
72
|
-
this.logger.setFilter((level, tag) => {
|
|
73
|
-
return tag === this.tag;
|
|
74
|
-
});
|
|
75
|
-
ts_common_1.BeLogged.addClient(this.logger);
|
|
76
|
-
}
|
|
77
|
-
setErrorStatus(status, error) {
|
|
78
|
-
this.setStatus(status, 'end', ts_common_1.LogLevel.Error);
|
|
79
|
-
this.logError(error);
|
|
80
|
-
}
|
|
81
|
-
setStatus(status, type, logLevel = ts_common_1.LogLevel.Info) {
|
|
82
|
-
let operationDuration = '';
|
|
83
|
-
if (type === 'start')
|
|
84
|
-
this.timeCounter = timeCounter();
|
|
85
|
-
if (type === 'end')
|
|
86
|
-
if (!(0, ts_common_1.exists)(this.timeCounter))
|
|
87
|
-
this.logError(`Got end status: '${status}' - while current status '${this.unitStatus}' was not a start`);
|
|
88
|
-
else {
|
|
89
|
-
operationDuration = ` (${this.timeCounter.format('mm:ss')})`;
|
|
90
|
-
delete this.timeCounter;
|
|
91
|
-
}
|
|
92
|
-
this.log(logLevel, false, [`Unit status update: ${this.unitStatus} => ${status}${operationDuration}`]);
|
|
93
|
-
this.unitStatus = `${status}${operationDuration}`;
|
|
94
|
-
PhaseRunnerDispatcher_1.dispatcher_UnitStatusChange.dispatch(this);
|
|
95
|
-
}
|
|
96
|
-
//######################### Public Functions #########################
|
|
97
|
-
getStatus() {
|
|
98
|
-
return this.unitStatus;
|
|
99
|
-
}
|
|
100
|
-
async kill() {
|
|
101
|
-
if (!this.processTerminator.length)
|
|
102
|
-
return this.setStatus('Killed');
|
|
103
|
-
const processTerminator = [...this.processTerminator];
|
|
104
|
-
this.processTerminator.length = 0;
|
|
105
|
-
this.setStatus('Killing');
|
|
106
|
-
try {
|
|
107
|
-
await Promise.all(processTerminator.map(toTerminate => toTerminate()));
|
|
108
|
-
}
|
|
109
|
-
finally {
|
|
110
|
-
this.setStatus('Killed');
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
getLogs() {
|
|
114
|
-
return this.logger.buffers[0];
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
exports.BaseUnit = BaseUnit;
|
|
118
|
-
function timeCounter() {
|
|
119
|
-
const started = (0, ts_common_1.currentTimeMillis)();
|
|
120
|
-
return {
|
|
121
|
-
dt: () => (0, ts_common_1.currentTimeMillis)() - started,
|
|
122
|
-
format: (format) => {
|
|
123
|
-
let dt = (0, ts_common_1.currentTimeMillis)() - started;
|
|
124
|
-
const hours = Math.floor(dt / ts_common_1.Hour);
|
|
125
|
-
dt -= hours * ts_common_1.Hour;
|
|
126
|
-
const minutes = Math.floor(dt / ts_common_1.Minute);
|
|
127
|
-
dt -= minutes * ts_common_1.Minute;
|
|
128
|
-
const seconds = Math.floor(dt / ts_common_1.Second);
|
|
129
|
-
dt -= seconds * ts_common_1.Second;
|
|
130
|
-
const millis = dt;
|
|
131
|
-
return format
|
|
132
|
-
.replace('hh', String(hours).padStart(2, '0'))
|
|
133
|
-
.replace('mm', String(minutes).padStart(2, '0'))
|
|
134
|
-
.replace('ss', String(seconds).padStart(2, '0'))
|
|
135
|
-
.replace('zzz', String(millis).padStart(3, '0'));
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Phase_Install } from '../../phase';
|
|
2
|
-
import { UnitPhaseImplementor } from '../types';
|
|
3
|
-
import { BaseUnit, BaseUnit_Config, BaseUnit_RuntimeConfig } from './BaseUnit';
|
|
4
|
-
export type Unit_Python_Config = BaseUnit_Config & {
|
|
5
|
-
pathToPackage: string;
|
|
6
|
-
};
|
|
7
|
-
export type Unit_Python_RuntimeConfig = BaseUnit_RuntimeConfig & {
|
|
8
|
-
pathTo: {
|
|
9
|
-
pkg: string;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export declare class Unit_Python<C extends Unit_Python_Config = Unit_Python_Config, RTC extends Unit_Python_RuntimeConfig = Unit_Python_RuntimeConfig> extends BaseUnit<C, RTC> implements UnitPhaseImplementor<[Phase_Install]> {
|
|
13
|
-
constructor(config: Unit_Python<C, RTC>['config']);
|
|
14
|
-
protected init(): Promise<void>;
|
|
15
|
-
install(): Promise<void>;
|
|
16
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Unit_Python = void 0;
|
|
4
|
-
const BaseUnit_1 = require("./BaseUnit");
|
|
5
|
-
const tools_1 = require("@nu-art/commando/shell/tools");
|
|
6
|
-
const python_1 = require("@nu-art/commando/shell/plugins/python");
|
|
7
|
-
class Unit_Python extends BaseUnit_1.BaseUnit {
|
|
8
|
-
constructor(config) {
|
|
9
|
-
super(config);
|
|
10
|
-
this.addToClassStack(Unit_Python);
|
|
11
|
-
}
|
|
12
|
-
async init() {
|
|
13
|
-
await super.init();
|
|
14
|
-
this.runtime.pathTo = {
|
|
15
|
-
pkg: (0, tools_1.convertToFullPath)(this.config.pathToPackage),
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
//######################### Phase Implementation #########################
|
|
19
|
-
async install() {
|
|
20
|
-
const commando = await this.allocateCommando(python_1.Commando_Python3)
|
|
21
|
-
.cd(this.runtime.pathTo.pkg)
|
|
22
|
-
.installVenv();
|
|
23
|
-
await commando.sourceVenv().installRequirements();
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
exports.Unit_Python = Unit_Python;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { BaseUnit, BaseUnit_Config, BaseUnit_RuntimeConfig } from './BaseUnit';
|
|
2
|
-
import { PackageJson } from '../../../core/types';
|
|
3
|
-
import { AbsolutePath, RelativePath } from '@nu-art/ts-common';
|
|
4
|
-
import { Phase_CopyPackageJSON } from '../../phase';
|
|
5
|
-
import { UnitPhaseImplementor } from '../types';
|
|
6
|
-
declare const PackageJsonTargetKeys: readonly ["template", "root", "dist"];
|
|
7
|
-
type PackageJsonTargetKey = typeof PackageJsonTargetKeys[number];
|
|
8
|
-
export type Unit_Typescript_Config = BaseUnit_Config & {
|
|
9
|
-
pathToPackage: RelativePath;
|
|
10
|
-
};
|
|
11
|
-
export type Unit_Typescript_RuntimeConfig = BaseUnit_RuntimeConfig & {
|
|
12
|
-
pathTo: {
|
|
13
|
-
pkg: AbsolutePath;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export declare class Unit_Typescript<C extends Unit_Typescript_Config = Unit_Typescript_Config, RTC extends Unit_Typescript_RuntimeConfig = Unit_Typescript_RuntimeConfig> extends BaseUnit<C, RTC> implements UnitPhaseImplementor<[Phase_CopyPackageJSON]> {
|
|
17
|
-
readonly packageJson: {
|
|
18
|
-
[k in PackageJsonTargetKey]: PackageJson;
|
|
19
|
-
};
|
|
20
|
-
constructor(config: C);
|
|
21
|
-
protected init(setInitialized?: boolean): Promise<void>;
|
|
22
|
-
private loadTemplatePackageJSON;
|
|
23
|
-
/**
|
|
24
|
-
* Create a packageJson object for each target key
|
|
25
|
-
* @private
|
|
26
|
-
*/
|
|
27
|
-
private populatePackageJson;
|
|
28
|
-
/**
|
|
29
|
-
* Execute template to packageJson object conversion based on target key
|
|
30
|
-
* @param targetKey
|
|
31
|
-
* @param template
|
|
32
|
-
* @private
|
|
33
|
-
*/
|
|
34
|
-
private convertTemplatePackageJSON;
|
|
35
|
-
/**
|
|
36
|
-
* Converts a template __package.json file into a usable package.json for the unit root
|
|
37
|
-
* @param template
|
|
38
|
-
* @private
|
|
39
|
-
*/
|
|
40
|
-
private convertPJForRoot;
|
|
41
|
-
/**
|
|
42
|
-
* Converts a template __package.json file into a usable package.json for the unit dist
|
|
43
|
-
* @param template
|
|
44
|
-
* @private
|
|
45
|
-
*/
|
|
46
|
-
private convertPJForDist;
|
|
47
|
-
copyPackageJson(): Promise<void>;
|
|
48
|
-
}
|
|
49
|
-
export {};
|
|
@@ -1,143 +0,0 @@
|
|
|
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_Typescript = void 0;
|
|
27
|
-
const BaseUnit_1 = require("./BaseUnit");
|
|
28
|
-
const consts_1 = require("../../../core/consts");
|
|
29
|
-
const ts_common_1 = require("@nu-art/ts-common");
|
|
30
|
-
const fs = __importStar(require("fs"));
|
|
31
|
-
const fs_1 = require("fs");
|
|
32
|
-
const RunnerParams_1 = require("../../phase-runner/RunnerParams");
|
|
33
|
-
const tools_1 = require("@nu-art/commando/shell/tools");
|
|
34
|
-
const tools_2 = require("../tools/tools");
|
|
35
|
-
const PackageJsonTargetKey_Template = 'template';
|
|
36
|
-
const PackageJsonTargetKey_Root = 'root';
|
|
37
|
-
const PackageJsonTargetKey_Dist = 'dist';
|
|
38
|
-
const PackageJsonTargetKeys = [PackageJsonTargetKey_Template, PackageJsonTargetKey_Root, PackageJsonTargetKey_Dist];
|
|
39
|
-
class Unit_Typescript extends BaseUnit_1.BaseUnit {
|
|
40
|
-
constructor(config) {
|
|
41
|
-
super(config);
|
|
42
|
-
this.packageJson = {};
|
|
43
|
-
this.addToClassStack(Unit_Typescript);
|
|
44
|
-
}
|
|
45
|
-
async init(setInitialized = true) {
|
|
46
|
-
var _a;
|
|
47
|
-
await super.init(false);
|
|
48
|
-
this.runtime.pathTo = {
|
|
49
|
-
pkg: (0, tools_1.convertToFullPath)(this.config.pathToPackage),
|
|
50
|
-
};
|
|
51
|
-
await this.loadTemplatePackageJSON();
|
|
52
|
-
this.runtime.dependencyName = this.packageJson.template.name;
|
|
53
|
-
this.runtime.unitDependencyNames = (0, ts_common_1._keys)((_a = this.packageJson.template.dependencies) !== null && _a !== void 0 ? _a : {});
|
|
54
|
-
if (setInitialized)
|
|
55
|
-
this.setStatus('Initialized');
|
|
56
|
-
}
|
|
57
|
-
//######################### Internal Logic #########################
|
|
58
|
-
async loadTemplatePackageJSON() {
|
|
59
|
-
const unitRootPath = this.runtime.pathTo.pkg;
|
|
60
|
-
const templatePath = `${unitRootPath}/${consts_1.CONST_PackageJSONTemplate}`;
|
|
61
|
-
if (!fs.existsSync(templatePath))
|
|
62
|
-
throw new ts_common_1.BadImplementationException(`Missing __package.json file in root for unit ${this.config.label}`);
|
|
63
|
-
try {
|
|
64
|
-
this.packageJson.template = JSON.parse(await fs_1.promises.readFile(templatePath, 'utf-8'));
|
|
65
|
-
}
|
|
66
|
-
catch (e) {
|
|
67
|
-
throw new ts_common_1.BadImplementationException(`There is an issue in the __package.json file in root for unit ${this.config.label}`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Create a packageJson object for each target key
|
|
72
|
-
* @private
|
|
73
|
-
*/
|
|
74
|
-
async populatePackageJson() {
|
|
75
|
-
if (!this.packageJson.template)
|
|
76
|
-
await this.loadTemplatePackageJSON();
|
|
77
|
-
PackageJsonTargetKeys.forEach(key => this.packageJson[key] = this.convertTemplatePackageJSON(key, this.packageJson.template));
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Execute template to packageJson object conversion based on target key
|
|
81
|
-
* @param targetKey
|
|
82
|
-
* @param template
|
|
83
|
-
* @private
|
|
84
|
-
*/
|
|
85
|
-
convertTemplatePackageJSON(targetKey, template) {
|
|
86
|
-
switch (targetKey) {
|
|
87
|
-
case PackageJsonTargetKey_Template:
|
|
88
|
-
return template;
|
|
89
|
-
case PackageJsonTargetKey_Root:
|
|
90
|
-
return this.convertPJForRoot(template);
|
|
91
|
-
case PackageJsonTargetKey_Dist:
|
|
92
|
-
return this.convertPJForDist(template);
|
|
93
|
-
default:
|
|
94
|
-
throw new ts_common_1.ImplementationMissingException(`No implementation for targetKey ${targetKey}`);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Converts a template __package.json file into a usable package.json for the unit root
|
|
99
|
-
* @param template
|
|
100
|
-
* @private
|
|
101
|
-
*/
|
|
102
|
-
convertPJForRoot(template) {
|
|
103
|
-
//Get the package params for replacing in the template package json
|
|
104
|
-
const projectConfig = RunnerParams_1.MemKey_ProjectConfig.get();
|
|
105
|
-
//Convert template to actual package.json
|
|
106
|
-
const converted = (0, tools_2.convertPackageJSONTemplateToPackJSON_Value)(template, (value, key) => projectConfig.params[key] ? 'workspace:*' : projectConfig.params[value]);
|
|
107
|
-
//Set dynamic params for this pkg
|
|
108
|
-
projectConfig.params[converted.name] = converted.version;
|
|
109
|
-
projectConfig.params[`${converted.name}_path`] = `file:.dependencies/${this.config.key}`; //Not sure about this one
|
|
110
|
-
RunnerParams_1.MemKey_ProjectConfig.set(projectConfig);
|
|
111
|
-
return converted;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Converts a template __package.json file into a usable package.json for the unit dist
|
|
115
|
-
* @param template
|
|
116
|
-
* @private
|
|
117
|
-
*/
|
|
118
|
-
convertPJForDist(template) {
|
|
119
|
-
//Get the package params for replacing in the template package json
|
|
120
|
-
const params = RunnerParams_1.MemKey_ProjectConfig.get().params;
|
|
121
|
-
//if main prop exists on pkg json clear the dist from its ref
|
|
122
|
-
if (template.main)
|
|
123
|
-
template.main = template.main.replace('dist/', '');
|
|
124
|
-
//if types prop exists on pkg json clear the dist from its ref
|
|
125
|
-
if (template.types)
|
|
126
|
-
template.types = template.types.replace('dist/', '');
|
|
127
|
-
//Convert template to actual package.json
|
|
128
|
-
return (0, tools_2.convertPackageJSONTemplateToPackJSON_Value)(template, (value, key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : params[value]; });
|
|
129
|
-
}
|
|
130
|
-
//######################### Phase Implementations #########################
|
|
131
|
-
async copyPackageJson() {
|
|
132
|
-
this.setStatus('Resolving PackageJSON');
|
|
133
|
-
//Populate packageJson objects
|
|
134
|
-
await this.populatePackageJson();
|
|
135
|
-
//Get path
|
|
136
|
-
const unitRootPath = this.runtime.pathTo.pkg;
|
|
137
|
-
const targetPath = `${unitRootPath}/${consts_1.CONST_PackageJSON}`;
|
|
138
|
-
//Create the package.json file in target location
|
|
139
|
-
await fs_1.promises.writeFile(targetPath, JSON.stringify(this.packageJson.root, null, 2), { encoding: 'utf-8' });
|
|
140
|
-
this.setStatus('PackageJSON resolved');
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
exports.Unit_Typescript = Unit_Typescript;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Unit_Typescript, Unit_Typescript_Config, Unit_Typescript_RuntimeConfig } from './Unit_Typescript';
|
|
2
|
-
import { UnitPhaseImplementor } from '../types';
|
|
3
|
-
import { Phase_CheckCyclicImports, Phase_Compile, Phase_Lint, Phase_PreCompile, Phase_PrintDependencyTree, Phase_Purge } from '../../phase';
|
|
4
|
-
import { OnWatchReady } from '../runner-dispatchers';
|
|
5
|
-
export type Unit_TypescriptLib_Config = Unit_Typescript_Config & {
|
|
6
|
-
customTSConfig?: boolean;
|
|
7
|
-
output: string;
|
|
8
|
-
};
|
|
9
|
-
export type Unit_TypescriptLib_RuntimeConfig = Unit_Typescript_RuntimeConfig & {
|
|
10
|
-
pathTo: {
|
|
11
|
-
pkg: string;
|
|
12
|
-
output: string;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export declare class Unit_TypescriptLib<C extends Unit_TypescriptLib_Config = Unit_TypescriptLib_Config, RTC extends Unit_TypescriptLib_RuntimeConfig = Unit_TypescriptLib_RuntimeConfig> extends Unit_Typescript<C, RTC> implements UnitPhaseImplementor<[
|
|
16
|
-
Phase_PreCompile,
|
|
17
|
-
Phase_Compile,
|
|
18
|
-
Phase_PrintDependencyTree,
|
|
19
|
-
Phase_CheckCyclicImports,
|
|
20
|
-
Phase_Purge,
|
|
21
|
-
Phase_Lint
|
|
22
|
-
]>, OnWatchReady {
|
|
23
|
-
constructor(config: Unit_TypescriptLib<C, RTC>['config']);
|
|
24
|
-
__onWatchReady(): Promise<void>;
|
|
25
|
-
protected init(setInitialized?: boolean): Promise<void>;
|
|
26
|
-
protected resolveTSConfig(): Promise<void>;
|
|
27
|
-
protected clearOutputDir(): Promise<void>;
|
|
28
|
-
protected compileImpl(): Promise<void>;
|
|
29
|
-
protected copyAssetsToOutput(): Promise<void>;
|
|
30
|
-
protected copyPackageJSONToOutput(): Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* Watch compile actions, use this to perform all necessary compile actions for watch.
|
|
33
|
-
* watch compile is a subset of the general watch action
|
|
34
|
-
*/
|
|
35
|
-
watchCompile(): Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* Remove the deleted file/folder from the dist folder on watch remove file event
|
|
38
|
-
* @param path The path of the currently removed file/folder
|
|
39
|
-
* @private
|
|
40
|
-
*/
|
|
41
|
-
removeSpecificFileFromDist(path: string): Promise<void>;
|
|
42
|
-
preCompile(): Promise<void>;
|
|
43
|
-
compile(): Promise<void>;
|
|
44
|
-
purge(): Promise<void>;
|
|
45
|
-
printDependencyTree(): Promise<void>;
|
|
46
|
-
checkCyclicImports(): Promise<void>;
|
|
47
|
-
lint(): Promise<void>;
|
|
48
|
-
}
|