@nu-art/build-and-install 0.204.95 → 0.204.97
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 +5 -3
- package/package.json +1 -1
- package/v2/phase-runner/PhaseRunner.d.ts +5 -1
- package/v2/phase-runner/PhaseRunner.js +52 -30
- package/v2/screens/BAIScreenManager.js +0 -1
- package/v2/screens/BAIScreen_UnitList.js +13 -0
- package/v2/unit/core/BaseUnit.d.ts +3 -2
- package/v2/unit/core/BaseUnit.js +7 -2
- package/v2/unit/core/Unit_TypescriptLib.d.ts +0 -1
- package/v2/unit/core/Unit_TypescriptLib.js +43 -41
- package/v2/unit/firebase-units/Unit_FirebaseFunctionsApp.js +29 -14
- package/v2/unit/firebase-units/Unit_FirebaseHostingApp.js +13 -6
package/build-and-install.js
CHANGED
|
@@ -11,12 +11,14 @@ if (params_1.RuntimeParams.runWithThunderstorm)
|
|
|
11
11
|
runner
|
|
12
12
|
.execute()
|
|
13
13
|
.then(() => {
|
|
14
|
-
ts_common_1.StaticLogger.logInfo('completed');
|
|
15
14
|
process.on('SIGINT', () => {
|
|
16
|
-
console.log('
|
|
15
|
+
console.log('completed');
|
|
17
16
|
return process.exit(0);
|
|
18
17
|
});
|
|
19
18
|
})
|
|
20
19
|
.catch(err => {
|
|
21
|
-
|
|
20
|
+
process.on('SIGINT', () => {
|
|
21
|
+
console.log('Failed with error: ', err);
|
|
22
|
+
return process.exit(1);
|
|
23
|
+
});
|
|
22
24
|
});
|
package/package.json
CHANGED
|
@@ -6,7 +6,8 @@ export declare class PhaseRunner extends BaseUnit implements UnitPhaseImplemento
|
|
|
6
6
|
private readonly phases;
|
|
7
7
|
private readonly units;
|
|
8
8
|
private unitDependencyTree;
|
|
9
|
-
private readonly
|
|
9
|
+
private readonly projectPath;
|
|
10
|
+
private projectConfig;
|
|
10
11
|
private killed?;
|
|
11
12
|
private runningStatus;
|
|
12
13
|
private phaseFilter;
|
|
@@ -16,6 +17,9 @@ export declare class PhaseRunner extends BaseUnit implements UnitPhaseImplemento
|
|
|
16
17
|
*/
|
|
17
18
|
private killCounter;
|
|
18
19
|
private static KILL_THRESHOLD;
|
|
20
|
+
static instance: PhaseRunner;
|
|
21
|
+
private readonly screenManager;
|
|
22
|
+
private defaultFileRoutes;
|
|
19
23
|
constructor(projectPath: RelativePath);
|
|
20
24
|
protected init(): Promise<void>;
|
|
21
25
|
private filterUnits;
|
|
@@ -73,10 +73,14 @@ class PhaseRunner extends core_1.BaseUnit {
|
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
75
|
this.getPhases = () => [...this.phases];
|
|
76
|
+
if ((0, ts_common_1.exists)(PhaseRunner.instance))
|
|
77
|
+
throw new ts_common_1.MUSTNeverHappenException('phase runner instance must be unique');
|
|
78
|
+
Error.stackTraceLimit = 50;
|
|
76
79
|
this.addToClassStack(PhaseRunner);
|
|
80
|
+
this.screenManager = new BAIScreenManager_1.BAIScreenManager();
|
|
77
81
|
this.phases = [];
|
|
78
82
|
this.units = [this];
|
|
79
|
-
this.
|
|
83
|
+
this.projectPath = (0, tools_1.convertToFullPath)(projectPath);
|
|
80
84
|
this.phaseFilter = this.phaseFilters[types_1.PhaseRunnerMode_Normal];
|
|
81
85
|
this.setMinLevel(ts_common_1.LogLevel.Info);
|
|
82
86
|
console.log('RuntimeParams.debug', params_1.RuntimeParams.debug);
|
|
@@ -87,28 +91,36 @@ class PhaseRunner extends core_1.BaseUnit {
|
|
|
87
91
|
}
|
|
88
92
|
//######################### Initialization #########################
|
|
89
93
|
async init() {
|
|
90
|
-
|
|
91
|
-
//Set phase runner to MemKey, so it can be referenced in the runtime
|
|
94
|
+
var _a;
|
|
92
95
|
consts_2.MemKey_PhaseRunner.set(this);
|
|
93
|
-
|
|
94
|
-
new BAIScreenManager_1.BAIScreenManager();
|
|
95
|
-
//Load project for use in the phase runner
|
|
96
|
-
await this.loadProject();
|
|
97
|
-
//Filter specific units
|
|
98
|
-
this.filterUnits();
|
|
99
|
-
this.logDebug('Runtime params:', params_1.RuntimeParams);
|
|
100
|
-
//Set runner params
|
|
96
|
+
BAIScreenManager_1.MemKey_BAIScreenManager.set(this.screenManager);
|
|
101
97
|
const runnerParams = {
|
|
102
98
|
rootPath: process.cwd(),
|
|
103
99
|
configPath: process.cwd() + '/.config',
|
|
104
100
|
};
|
|
105
101
|
RunnerParams_1.MemKey_RunnerParams.set(runnerParams);
|
|
102
|
+
if (this.projectConfig) {
|
|
103
|
+
const projectParams = this.prepareProjectParams();
|
|
104
|
+
RunnerParams_1.MemKey_ProjectConfig.set(Object.assign(Object.assign({}, this.projectConfig), { params: projectParams }));
|
|
105
|
+
}
|
|
106
|
+
if (this.defaultFileRoutes)
|
|
107
|
+
consts_1.MemKey_DefaultFiles.set(this.defaultFileRoutes);
|
|
108
|
+
if (PhaseRunner.instance) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
PhaseRunner.instance = this;
|
|
112
|
+
//Load project for use in the phase runner
|
|
113
|
+
(_a = this.projectConfig) !== null && _a !== void 0 ? _a : (this.projectConfig = await this.loadProject());
|
|
114
|
+
//Filter specific units
|
|
115
|
+
this.filterUnits();
|
|
116
|
+
this.logDebug('Runtime params:', params_1.RuntimeParams);
|
|
117
|
+
//Set runner params
|
|
106
118
|
//Set Project Params
|
|
107
119
|
const projectParams = this.prepareProjectParams();
|
|
108
|
-
RunnerParams_1.MemKey_ProjectConfig.set(Object.assign(Object.assign({}, this.
|
|
120
|
+
RunnerParams_1.MemKey_ProjectConfig.set(Object.assign(Object.assign({}, this.projectConfig), { params: projectParams }));
|
|
109
121
|
//Set Default File Routes
|
|
110
|
-
|
|
111
|
-
consts_1.MemKey_DefaultFiles.set(defaultFileRoutes);
|
|
122
|
+
this.defaultFileRoutes = this.prepareDefaultFileRouts();
|
|
123
|
+
consts_1.MemKey_DefaultFiles.set(this.defaultFileRoutes);
|
|
112
124
|
//Load running status
|
|
113
125
|
await this.loadRunningStatus();
|
|
114
126
|
//Print init results
|
|
@@ -136,20 +148,20 @@ class PhaseRunner extends core_1.BaseUnit {
|
|
|
136
148
|
PhaseRunnerDispatcher_1.dispatcher_UnitChange.dispatch(this.units);
|
|
137
149
|
}
|
|
138
150
|
async loadProject() {
|
|
139
|
-
if (!fs_1.default.existsSync(this.
|
|
140
|
-
throw new ts_common_1.ImplementationMissingException(`Missing project config file, could not find in path: ${this.
|
|
141
|
-
const projectConfigCB = require(this.
|
|
151
|
+
if (!fs_1.default.existsSync(this.projectPath))
|
|
152
|
+
throw new ts_common_1.ImplementationMissingException(`Missing project config file, could not find in path: ${this.projectPath}`);
|
|
153
|
+
const projectConfigCB = require(this.projectPath).default;
|
|
142
154
|
if (typeof projectConfigCB !== 'function')
|
|
143
155
|
throw new ts_common_1.BadImplementationException('Config file must be an asynchronous function returning a ProjectConfigV2 object');
|
|
144
|
-
|
|
156
|
+
return projectConfigCB();
|
|
145
157
|
}
|
|
146
158
|
prepareProjectParams() {
|
|
147
159
|
var _a;
|
|
148
|
-
const params = (_a = this.
|
|
149
|
-
params[CONST_ThunderstormVersionKey] = this.
|
|
150
|
-
params[CONST_ThunderstormDependencyKey] = this.
|
|
151
|
-
params[CONST_ProjectVersionKey] = this.
|
|
152
|
-
params[CONST_ProjectDependencyKey] = this.
|
|
160
|
+
const params = (_a = this.projectConfig.params) !== null && _a !== void 0 ? _a : {};
|
|
161
|
+
params[CONST_ThunderstormVersionKey] = this.projectConfig.thunderstormVersion;
|
|
162
|
+
params[CONST_ThunderstormDependencyKey] = this.projectConfig.thunderstormVersion;
|
|
163
|
+
params[CONST_ProjectVersionKey] = this.projectConfig.projectVersion;
|
|
164
|
+
params[CONST_ProjectDependencyKey] = this.projectConfig.projectVersion;
|
|
153
165
|
return params;
|
|
154
166
|
}
|
|
155
167
|
prepareDefaultFileRouts() {
|
|
@@ -376,13 +388,23 @@ class PhaseRunner extends core_1.BaseUnit {
|
|
|
376
388
|
//######################### Public Functions #########################
|
|
377
389
|
async execute() {
|
|
378
390
|
return new MemStorage_1.MemStorage().init(async () => {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
391
|
+
try {
|
|
392
|
+
process.on('SIGINT', () => {
|
|
393
|
+
this.killRunner();
|
|
394
|
+
});
|
|
395
|
+
await this.init();
|
|
396
|
+
await this.buildUnitDependencyTree();
|
|
397
|
+
await this.executeImpl();
|
|
398
|
+
this.killed = true;
|
|
399
|
+
this.logInfo('Completed successfully');
|
|
400
|
+
if (params_1.RuntimeParams.closeOnExit)
|
|
401
|
+
process.exit(0);
|
|
402
|
+
}
|
|
403
|
+
catch (error) {
|
|
404
|
+
// this.logError('Finished with Errors: ', error);
|
|
405
|
+
if (params_1.RuntimeParams.closeOnExit)
|
|
406
|
+
process.exit(1);
|
|
407
|
+
}
|
|
386
408
|
});
|
|
387
409
|
}
|
|
388
410
|
async killRunner() {
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BAIScreen_UnitList = void 0;
|
|
4
4
|
const BAIScreen_1 = require("./BAIScreen");
|
|
5
5
|
const consts_1 = require("../phase-runner/consts");
|
|
6
|
+
const PhaseRunner_1 = require("../phase-runner/PhaseRunner");
|
|
7
|
+
const params_1 = require("../../core/params/params");
|
|
6
8
|
class BAIScreen_UnitList extends BAIScreen_1.BAIScreen {
|
|
7
9
|
//######################### Lifecycle #########################
|
|
8
10
|
constructor() {
|
|
@@ -22,6 +24,7 @@ class BAIScreen_UnitList extends BAIScreen_1.BAIScreen {
|
|
|
22
24
|
this.container.screen.render();
|
|
23
25
|
}
|
|
24
26
|
__onUnitsChange(data) {
|
|
27
|
+
this.destroyUnitListWidget();
|
|
25
28
|
this.createUnitListWidget();
|
|
26
29
|
this.renderUnitList();
|
|
27
30
|
}
|
|
@@ -65,8 +68,18 @@ class BAIScreen_UnitList extends BAIScreen_1.BAIScreen {
|
|
|
65
68
|
fg: 'blue',
|
|
66
69
|
},
|
|
67
70
|
align: 'center',
|
|
71
|
+
label: 'phase',
|
|
72
|
+
mouse: true
|
|
68
73
|
};
|
|
69
74
|
this.phaseWidget = this.createWidget('text', props);
|
|
75
|
+
this.phaseWidget.on('mouse', (event) => {
|
|
76
|
+
if (event.button === 'left' && event.action === 'mousedown') {
|
|
77
|
+
params_1.RuntimeParams.continue = true;
|
|
78
|
+
PhaseRunner_1.PhaseRunner.instance.execute().then(() => this.logInfo('Completed')).catch((e) => {
|
|
79
|
+
this.logError('Error: ', e);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
70
83
|
}
|
|
71
84
|
createUnitListWidget() {
|
|
72
85
|
this.units = consts_1.MemKey_PhaseRunner.get().getUnits();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AsyncVoidFunction, Constructor, Logger } from '@nu-art/ts-common';
|
|
1
|
+
import { AsyncVoidFunction, Constructor, Logger, LogLevel } from '@nu-art/ts-common';
|
|
2
2
|
import { RunnerParamKey } from '../../phase-runner/RunnerParams';
|
|
3
3
|
import { CommandoInteractive } from '@nu-art/commando/shell';
|
|
4
4
|
import { BaseCommando } from '@nu-art/commando/shell/core/BaseCommando';
|
|
@@ -29,7 +29,8 @@ export declare class BaseUnit<C extends BaseUnit_Config = BaseUnit_Config, RTC e
|
|
|
29
29
|
protected init(setInitialized?: boolean): Promise<void>;
|
|
30
30
|
protected getRunnerParam(key: RunnerParamKey): string | undefined;
|
|
31
31
|
private initLogClient;
|
|
32
|
-
protected
|
|
32
|
+
protected setErrorStatus(status: string, error: Error): void;
|
|
33
|
+
protected setStatus(status: string, type?: 'start' | 'end', logLevel?: LogLevel): void;
|
|
33
34
|
protected addToClassStack: (cls: Function) => void;
|
|
34
35
|
isInstanceOf: (cls: Function) => boolean;
|
|
35
36
|
getStatus(): string;
|
package/v2/unit/core/BaseUnit.js
CHANGED
|
@@ -63,6 +63,7 @@ class BaseUnit extends ts_common_1.Logger {
|
|
|
63
63
|
}
|
|
64
64
|
initLogClient() {
|
|
65
65
|
this.logger = new ts_common_1.LogClient_MemBuffer(this.tag);
|
|
66
|
+
this.logger.keepLogsNaturalColors();
|
|
66
67
|
this.logger.setComposer((tag, level) => {
|
|
67
68
|
ts_common_1._logger_finalDate.setTime(Date.now() - ts_common_1._logger_timezoneOffset);
|
|
68
69
|
const date = ts_common_1._logger_finalDate.toISOString().replace(/T/, '_').replace(/Z/, '').substring(0, 23).split('_')[1];
|
|
@@ -73,7 +74,11 @@ class BaseUnit extends ts_common_1.Logger {
|
|
|
73
74
|
});
|
|
74
75
|
ts_common_1.BeLogged.addClient(this.logger);
|
|
75
76
|
}
|
|
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) {
|
|
77
82
|
let operationDuration = '';
|
|
78
83
|
if (type === 'start')
|
|
79
84
|
this.timeCounter = timeCounter();
|
|
@@ -84,7 +89,7 @@ class BaseUnit extends ts_common_1.Logger {
|
|
|
84
89
|
operationDuration = ` (${this.timeCounter.format('mm:ss')})`;
|
|
85
90
|
delete this.timeCounter;
|
|
86
91
|
}
|
|
87
|
-
this.
|
|
92
|
+
this.log(logLevel, false, [`Unit status update: ${this.unitStatus} => ${status}${operationDuration}`]);
|
|
88
93
|
this.unitStatus = `${status}${operationDuration}`;
|
|
89
94
|
PhaseRunnerDispatcher_1.dispatcher_UnitStatusChange.dispatch(this);
|
|
90
95
|
}
|
|
@@ -20,7 +20,6 @@ export declare class Unit_TypescriptLib<C extends Unit_TypescriptLib_Config = Un
|
|
|
20
20
|
Phase_Purge,
|
|
21
21
|
Phase_Lint
|
|
22
22
|
]>, OnWatchEvent {
|
|
23
|
-
private compilationError;
|
|
24
23
|
private debounceWatch?;
|
|
25
24
|
constructor(config: Unit_TypescriptLib<C, RTC>['config']);
|
|
26
25
|
__onWatchEvent(type: WatchEventType, path?: string): Promise<void>;
|
|
@@ -36,7 +36,7 @@ const consts_2 = require("../consts");
|
|
|
36
36
|
const CliError_1 = require("@nu-art/commando/shell/core/CliError");
|
|
37
37
|
const nvm_1 = require("@nu-art/commando/shell/plugins/nvm");
|
|
38
38
|
const basic_1 = require("@nu-art/commando/shell/plugins/basic");
|
|
39
|
-
const extensionsToLint = ['
|
|
39
|
+
const extensionsToLint = ['ts', 'tsx'];
|
|
40
40
|
const assetExtensions = [
|
|
41
41
|
'json',
|
|
42
42
|
'scss',
|
|
@@ -50,7 +50,6 @@ const assetExtensions = [
|
|
|
50
50
|
class Unit_TypescriptLib extends Unit_Typescript_1.Unit_Typescript {
|
|
51
51
|
constructor(config) {
|
|
52
52
|
super(config);
|
|
53
|
-
this.compilationError = false;
|
|
54
53
|
this.addToClassStack(Unit_TypescriptLib);
|
|
55
54
|
runner_dispatchers_1.dispatcher_WatchEvent.addListener(this);
|
|
56
55
|
}
|
|
@@ -59,7 +58,7 @@ class Unit_TypescriptLib extends Unit_Typescript_1.Unit_Typescript {
|
|
|
59
58
|
return this.setStatus('Watching');
|
|
60
59
|
if (this.debounceWatch)
|
|
61
60
|
delete this.debounceWatch;
|
|
62
|
-
this.debounceWatch = (0, ts_common_1.debounce)(() => this.handleWatchChange(path, [consts_2.WatchEvent_RemoveFile, consts_2.WatchEvent_RemoveDir].includes(type)), ts_common_1.Second *
|
|
61
|
+
this.debounceWatch = (0, ts_common_1.debounce)(() => this.handleWatchChange(path, [consts_2.WatchEvent_RemoveFile, consts_2.WatchEvent_RemoveDir].includes(type)), ts_common_1.Second * 2, ts_common_1.Second * 10);
|
|
63
62
|
this.debounceWatch();
|
|
64
63
|
}
|
|
65
64
|
async init(setInitialized = true) {
|
|
@@ -102,27 +101,19 @@ class Unit_TypescriptLib extends Unit_Typescript_1.Unit_Typescript {
|
|
|
102
101
|
async compileImpl() {
|
|
103
102
|
const pathToCompile = `${this.runtime.pathTo.pkg}/src/main`;
|
|
104
103
|
const pathToTSConfig = `${pathToCompile}/tsconfig.json`;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
//In order to finish compile when running watch we just log the error instead of throwing it
|
|
119
|
-
if (params_1.RuntimeParams.watch) {
|
|
120
|
-
// set compilation error status on error
|
|
121
|
-
this.compilationError = true;
|
|
122
|
-
return this.logError(e);
|
|
123
|
-
}
|
|
124
|
-
throw e;
|
|
125
|
-
}
|
|
104
|
+
const commando = this.allocateCommando(nvm_1.Commando_NVM, basic_1.Commando_Basic)
|
|
105
|
+
.cd(this.runtime.pathTo.pkg)
|
|
106
|
+
.append(`tsc -p "${pathToTSConfig}" --rootDir "${pathToCompile}" --outDir "${this.runtime.pathTo.output}"`)
|
|
107
|
+
.setLogLevelFilter((log, std) => {
|
|
108
|
+
return ts_common_1.LogLevel.Error;
|
|
109
|
+
})
|
|
110
|
+
.addLogProcessor((log) => !log.includes('Now using node') && !log.includes('.nvmrc\' with version'));
|
|
111
|
+
await this.executeAsyncCommando(commando, (stdout, stderr, exitCode) => {
|
|
112
|
+
if (stderr.length)
|
|
113
|
+
this.logError(stderr);
|
|
114
|
+
if (exitCode > 0)
|
|
115
|
+
throw new CliError_1.CommandoException(`Error compiling`, stdout, stderr, exitCode);
|
|
116
|
+
});
|
|
126
117
|
}
|
|
127
118
|
async copyAssetsToOutput() {
|
|
128
119
|
const command = `find . \\( -name ${assetExtensions.map(suffix => `'*.${suffix}'`)
|
|
@@ -144,14 +135,19 @@ class Unit_TypescriptLib extends Unit_Typescript_1.Unit_Typescript {
|
|
|
144
135
|
// ignore if path doesn't related to unit
|
|
145
136
|
if (!path.startsWith(this.config.pathToPackage))
|
|
146
137
|
return;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
138
|
+
try {
|
|
139
|
+
this.setStatus('Compiling', 'start');
|
|
140
|
+
// check if dist folder must be cleared
|
|
141
|
+
if (shouldRemoveDist)
|
|
142
|
+
await this.removeSpecificFileFromDist(path);
|
|
143
|
+
// perform all watch actions
|
|
144
|
+
await this.compileImpl();
|
|
145
|
+
await this.copyAssetsToOutput();
|
|
146
|
+
this.setStatus(`Compiled and Watching`, 'end');
|
|
147
|
+
}
|
|
148
|
+
catch (e) {
|
|
149
|
+
this.setStatus(`Watching with error`, e);
|
|
150
|
+
}
|
|
155
151
|
// dispatch unit post compile
|
|
156
152
|
runner_dispatchers_1.dispatcher_UnitWatchCompile.dispatch(this);
|
|
157
153
|
}
|
|
@@ -188,13 +184,19 @@ class Unit_TypescriptLib extends Unit_Typescript_1.Unit_Typescript {
|
|
|
188
184
|
.execute();
|
|
189
185
|
}
|
|
190
186
|
async compile() {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
187
|
+
try {
|
|
188
|
+
this.setStatus('Compiling', 'start');
|
|
189
|
+
await this.resolveTSConfig();
|
|
190
|
+
await this.clearOutputDir();
|
|
191
|
+
await this.compileImpl();
|
|
192
|
+
await this.copyAssetsToOutput();
|
|
193
|
+
await this.copyPackageJSONToOutput();
|
|
194
|
+
this.setStatus(`Compiled`, 'end');
|
|
195
|
+
}
|
|
196
|
+
catch (e) {
|
|
197
|
+
this.setErrorStatus('Compilation Error', e);
|
|
198
|
+
throw e;
|
|
199
|
+
}
|
|
198
200
|
}
|
|
199
201
|
async purge() {
|
|
200
202
|
await fs_1.promises.rm(this.runtime.pathTo.output, { recursive: true, force: true });
|
|
@@ -220,8 +222,8 @@ class Unit_TypescriptLib extends Unit_Typescript_1.Unit_Typescript {
|
|
|
220
222
|
.execute();
|
|
221
223
|
}
|
|
222
224
|
async lint() {
|
|
223
|
-
const pathToProjectESLint = RunnerParams_1.MemKey_RunnerParams.get()[RunnerParams_1.RunnerParamKey_ConfigPath]
|
|
224
|
-
const pathToLint = this.runtime.pathTo.pkg
|
|
225
|
+
const pathToProjectESLint = `${RunnerParams_1.MemKey_RunnerParams.get()[RunnerParams_1.RunnerParamKey_ConfigPath]}/eslint.config.cjs`;
|
|
226
|
+
const pathToLint = `${this.runtime.pathTo.pkg}src/main`;
|
|
225
227
|
const extensions = extensionsToLint.map(ext => `--ext ${ext}`).join(' ');
|
|
226
228
|
await this.allocateCommando(nvm_1.Commando_NVM)
|
|
227
229
|
.append(`eslint --config ${pathToProjectESLint} ${extensions} ${pathToLint}`)
|
|
@@ -16,10 +16,17 @@ class Unit_FirebaseFunctionsApp extends core_1.Unit_TypescriptLib {
|
|
|
16
16
|
async __onUnitWatchCompiled(unit) {
|
|
17
17
|
if (this.runtime.unitDependencyNames.includes(unit.runtime.dependencyName)) {
|
|
18
18
|
this.setStatus('Compiling', 'start');
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
try {
|
|
20
|
+
await this.compileImpl();
|
|
21
|
+
await this.copyAssetsToOutput();
|
|
22
|
+
await this.createDependenciesDir();
|
|
23
|
+
this.setStatus('Compiled', 'end');
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
this.setErrorStatus('Compilation Error', e);
|
|
27
|
+
this.logError(e);
|
|
28
|
+
// throw e;
|
|
29
|
+
}
|
|
23
30
|
}
|
|
24
31
|
}
|
|
25
32
|
constructor(config) {
|
|
@@ -37,14 +44,20 @@ class Unit_FirebaseFunctionsApp extends core_1.Unit_TypescriptLib {
|
|
|
37
44
|
}
|
|
38
45
|
async compile() {
|
|
39
46
|
this.setStatus('Compiling', 'start');
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
try {
|
|
48
|
+
await this.resolveTSConfig();
|
|
49
|
+
await this.clearOutputDir();
|
|
50
|
+
await this.createAppVersionFile();
|
|
51
|
+
await this.compileImpl();
|
|
52
|
+
await this.copyAssetsToOutput();
|
|
53
|
+
await this.createDependenciesDir();
|
|
54
|
+
await this.copyPackageJSONToOutput();
|
|
55
|
+
this.setStatus('Compiled', 'end');
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
this.setErrorStatus('Compilation Error', e);
|
|
59
|
+
throw e;
|
|
60
|
+
}
|
|
48
61
|
}
|
|
49
62
|
async launch() {
|
|
50
63
|
this.setStatus('Launching');
|
|
@@ -245,7 +258,8 @@ class Unit_FirebaseFunctionsApp extends core_1.Unit_TypescriptLib {
|
|
|
245
258
|
const commando = this.allocateCommando(nvm_1.Commando_NVM).applyNVM()
|
|
246
259
|
.cd(this.runtime.pathTo.pkg)
|
|
247
260
|
.append('ts-node src/main/proxy.ts');
|
|
248
|
-
|
|
261
|
+
await this.executeAsyncCommando(commando);
|
|
262
|
+
this.logWarning('PROXY TERMINATED');
|
|
249
263
|
}
|
|
250
264
|
async runEmulator() {
|
|
251
265
|
const commando = this.allocateCommando(nvm_1.Commando_NVM).applyNVM()
|
|
@@ -253,7 +267,8 @@ class Unit_FirebaseFunctionsApp extends core_1.Unit_TypescriptLib {
|
|
|
253
267
|
.cd(this.runtime.pathTo.pkg)
|
|
254
268
|
.onLog(/.*Emulator Hub running.*/, () => this.setStatus('Launch Complete'))
|
|
255
269
|
.append(`firebase emulators:start --export-on-exit --import=.trash/data ${params_1.RuntimeParams.debugBackend ? `--inspect-functions ${this.config.firebaseConfig.debugPort}` : ''}`);
|
|
256
|
-
|
|
270
|
+
await this.executeAsyncCommando(commando);
|
|
271
|
+
this.logWarning('EMULATORS TERMINATED');
|
|
257
272
|
}
|
|
258
273
|
//######################### Deploy Logic #########################
|
|
259
274
|
async deployImpl() {
|
|
@@ -31,11 +31,17 @@ class Unit_FirebaseHostingApp extends core_1.Unit_TypescriptLib {
|
|
|
31
31
|
}
|
|
32
32
|
async compile() {
|
|
33
33
|
this.setStatus('Compiling', 'start');
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
try {
|
|
35
|
+
await this.resolveTSConfig();
|
|
36
|
+
await this.clearOutputDir();
|
|
37
|
+
await this.createAppVersionFile();
|
|
38
|
+
await this.compileImpl();
|
|
39
|
+
this.setStatus('Compiled', 'end');
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
this.setErrorStatus('Compilation Error', e);
|
|
43
|
+
throw e;
|
|
44
|
+
}
|
|
39
45
|
}
|
|
40
46
|
async launch() {
|
|
41
47
|
this.setStatus('Launching');
|
|
@@ -118,7 +124,8 @@ class Unit_FirebaseHostingApp extends core_1.Unit_TypescriptLib {
|
|
|
118
124
|
.append(`((\${#array[@]} > 0)) && kill -9 "\${array[@]}"`)
|
|
119
125
|
.append('echo ')
|
|
120
126
|
.append('npm run start');
|
|
121
|
-
|
|
127
|
+
await this.executeAsyncCommando(commando);
|
|
128
|
+
this.logWarning('HOSTING TERMINATED');
|
|
122
129
|
}
|
|
123
130
|
//######################### Deploy Logic #########################
|
|
124
131
|
async deployImpl() {
|