@nu-art/build-and-install 0.204.3 → 0.204.4
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 +10 -5
- package/console/Console_PackagesView.d.ts +8 -0
- package/console/Console_PackagesView.js +65 -0
- package/core/package/consts.d.ts +10 -1
- package/core/package/consts.js +2 -3
- package/core/package/generate.d.ts +15 -211
- package/core/package/generate.js +110 -27
- package/core/params/params.d.ts +3 -2
- package/core/params/params.js +14 -3
- package/core/types/package/package.d.ts +41 -19
- package/core/types/package/package.js +2 -1
- package/defaults/consts.d.ts +2 -0
- package/defaults/consts.js +4 -1
- package/logic/ProjectManager.d.ts +4 -0
- package/logic/ProjectManager.js +61 -5
- package/package.json +3 -1
- package/phases/phases.d.ts +2 -1
- package/phases/phases.js +140 -37
- package/project-manager.js +1 -1
- package/screen/ProjectScreen.d.ts +27 -0
- package/screen/ProjectScreen.js +178 -0
|
@@ -1,16 +1,41 @@
|
|
|
1
1
|
export declare const PackageType_InfraLib: "infra-lib";
|
|
2
2
|
export declare const PackageType_ProjectLib: "project-lib";
|
|
3
3
|
export declare const PackageType_FirebaseHostingApp: "firebase-hosting-app";
|
|
4
|
+
export declare const PackageType_FirebaseHostingAndFunctionApp: "firebase-app";
|
|
4
5
|
export declare const PackageType_FirebaseFunctionsApp: "firebase-functions-app";
|
|
5
6
|
export declare const PackageType_Sourceless: "sourceless";
|
|
6
7
|
export declare const PackageTypes: readonly ["infra-lib", "project-lib", "firebase-hosting-app", "firebase-functions-app", "sourceless"];
|
|
7
8
|
export declare const PackageTypesWithOutput: ("infra-lib" | "project-lib" | "firebase-hosting-app" | "firebase-functions-app")[];
|
|
8
9
|
export type PackageType = typeof PackageTypes[number];
|
|
9
|
-
export type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
export type FirebaseEnvConfig<Env extends string> = {
|
|
11
|
+
env: Env;
|
|
12
|
+
isLocal?: boolean;
|
|
13
|
+
projectId: string;
|
|
14
|
+
name: string;
|
|
15
|
+
backend: {
|
|
16
|
+
url: string;
|
|
17
|
+
minLogLevel?: 'Verbose' | 'Debug' | 'Info' | 'Warning' | 'Error';
|
|
18
|
+
compress?: boolean;
|
|
19
|
+
timeout?: number;
|
|
20
|
+
};
|
|
21
|
+
firebase: {
|
|
22
|
+
listener?: {
|
|
23
|
+
config: {
|
|
24
|
+
apiKey: string;
|
|
25
|
+
authDomain: string;
|
|
26
|
+
databaseURL: string;
|
|
27
|
+
projectId: string;
|
|
28
|
+
storageBucket: string;
|
|
29
|
+
messagingSenderId: string;
|
|
30
|
+
appId: string;
|
|
31
|
+
measurementId: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
13
34
|
};
|
|
35
|
+
};
|
|
36
|
+
export type FirebasePackageConfig<Env extends string = string> = {
|
|
37
|
+
envs: FirebaseEnvConfig<Env>[];
|
|
38
|
+
name: string;
|
|
14
39
|
debugPort: number;
|
|
15
40
|
basePort: number;
|
|
16
41
|
pathToFirebaseConfig: string;
|
|
@@ -36,30 +61,27 @@ export type Package_Base = {
|
|
|
36
61
|
export type Package_Sourceless = Package_Base & {
|
|
37
62
|
type: typeof PackageType_Sourceless;
|
|
38
63
|
};
|
|
39
|
-
export type
|
|
40
|
-
type: typeof PackageType_FirebaseHostingApp;
|
|
64
|
+
export type Package_WithSources = Package_Base & {
|
|
41
65
|
output: string;
|
|
42
66
|
customTsConfig?: boolean;
|
|
43
67
|
sources?: string[];
|
|
68
|
+
};
|
|
69
|
+
export type Package_FirebaseBase = Package_WithSources & {
|
|
44
70
|
envConfig: FirebasePackageConfig;
|
|
45
71
|
};
|
|
46
|
-
export type
|
|
72
|
+
export type Package_FirebaseHostingApp = Package_FirebaseBase & {
|
|
73
|
+
type: typeof PackageType_FirebaseHostingApp;
|
|
74
|
+
};
|
|
75
|
+
export type Package_FirebaseFunctionsApp = Package_FirebaseBase & {
|
|
47
76
|
type: typeof PackageType_FirebaseFunctionsApp;
|
|
48
|
-
output: string;
|
|
49
|
-
customTsConfig?: boolean;
|
|
50
|
-
sources?: string[];
|
|
51
|
-
envConfig: FirebasePackageConfig;
|
|
52
77
|
};
|
|
53
|
-
export type
|
|
78
|
+
export type Package_FirebaseHostingAndFunctionApp = Package_FirebaseBase & {
|
|
79
|
+
type: typeof PackageType_FirebaseHostingAndFunctionApp;
|
|
80
|
+
};
|
|
81
|
+
export type Package_InfraLib = Package_WithSources & {
|
|
54
82
|
type: typeof PackageType_InfraLib;
|
|
55
|
-
output: string;
|
|
56
|
-
customTsConfig?: boolean;
|
|
57
|
-
sources?: string[];
|
|
58
83
|
};
|
|
59
|
-
export type Package_ProjectLib =
|
|
84
|
+
export type Package_ProjectLib = Package_WithSources & {
|
|
60
85
|
type: typeof PackageType_ProjectLib;
|
|
61
|
-
output: string;
|
|
62
|
-
customTsConfig?: boolean;
|
|
63
|
-
sources?: string[];
|
|
64
86
|
};
|
|
65
87
|
export type Package = Package_Sourceless | Package_FirebaseHostingApp | Package_FirebaseFunctionsApp | Package_InfraLib | Package_ProjectLib;
|
|
@@ -1,9 +1,10 @@
|
|
|
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_FirebaseHostingApp = exports.PackageType_ProjectLib = exports.PackageType_InfraLib = void 0;
|
|
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;
|
|
4
4
|
exports.PackageType_InfraLib = 'infra-lib';
|
|
5
5
|
exports.PackageType_ProjectLib = 'project-lib';
|
|
6
6
|
exports.PackageType_FirebaseHostingApp = 'firebase-hosting-app';
|
|
7
|
+
exports.PackageType_FirebaseHostingAndFunctionApp = 'firebase-app';
|
|
7
8
|
exports.PackageType_FirebaseFunctionsApp = 'firebase-functions-app';
|
|
8
9
|
exports.PackageType_Sourceless = 'sourceless';
|
|
9
10
|
exports.PackageTypes = [exports.PackageType_InfraLib, exports.PackageType_ProjectLib, exports.PackageType_FirebaseHostingApp, exports.PackageType_FirebaseFunctionsApp, exports.PackageType_Sourceless];
|
package/defaults/consts.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export declare const Default_Files: {
|
|
|
15
15
|
};
|
|
16
16
|
export declare const Const_FirebaseConfigKeys: (keyof typeof Default_Files['firebaseConfig'])[];
|
|
17
17
|
export declare const Default_OutputFiles: {
|
|
18
|
+
output: string;
|
|
19
|
+
outputLogs: string;
|
|
18
20
|
runningStatus: string;
|
|
19
21
|
};
|
|
20
22
|
export declare const MemKey_DefaultFiles: MemKey<{
|
package/defaults/consts.js
CHANGED
|
@@ -27,8 +27,11 @@ exports.Const_FirebaseConfigKeys = [
|
|
|
27
27
|
'firestoreRules',
|
|
28
28
|
'storageRules',
|
|
29
29
|
];
|
|
30
|
+
const Default_OutputPath = './.trash';
|
|
30
31
|
exports.Default_OutputFiles = {
|
|
31
|
-
|
|
32
|
+
output: Default_OutputPath,
|
|
33
|
+
outputLogs: `${Default_OutputPath}/logs`,
|
|
34
|
+
runningStatus: `${Default_OutputPath}/running-status.json`
|
|
32
35
|
};
|
|
33
36
|
exports.MemKey_DefaultFiles = new MemStorage_1.MemKey('default-files');
|
|
34
37
|
exports.MemKey_RunningStatus = new MemStorage_1.MemKey('running-status');
|
|
@@ -32,7 +32,11 @@ export declare class ProjectManager extends Logger {
|
|
|
32
32
|
private dryRun;
|
|
33
33
|
private terminate;
|
|
34
34
|
private prevRunningStatus?;
|
|
35
|
+
private readonly projectScreen;
|
|
36
|
+
private logger?;
|
|
35
37
|
constructor();
|
|
38
|
+
showAllLogs(): void;
|
|
39
|
+
showPrettyLogs(): void;
|
|
36
40
|
private loadPackage;
|
|
37
41
|
registerPhase(phase: BuildPhase): void;
|
|
38
42
|
updateRunningStatus: (runningStatus?: RunningStatus) => Promise<void>;
|
package/logic/ProjectManager.js
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
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
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.ProjectManager = exports.PackageBuildPhaseType_Project = exports.PackageBuildPhaseType_PackageWithOutput = exports.PackageBuildPhaseType_Package = void 0;
|
|
4
27
|
const ts_common_1 = require("@nu-art/ts-common");
|
|
@@ -6,11 +29,12 @@ const params_1 = require("../core/params/params");
|
|
|
6
29
|
const tools_1 = require("@nu-art/commando/core/tools");
|
|
7
30
|
const map_project_packages_1 = require("./map-project-packages");
|
|
8
31
|
const consts_1 = require("../core/consts");
|
|
9
|
-
const fs = require("fs");
|
|
32
|
+
const fs = __importStar(require("fs"));
|
|
10
33
|
const fs_1 = require("fs");
|
|
11
34
|
const consts_2 = require("../defaults/consts");
|
|
12
35
|
const MemStorage_1 = require("@nu-art/ts-common/mem-storage/MemStorage");
|
|
13
36
|
const project_manager_1 = require("../project-manager");
|
|
37
|
+
const ProjectScreen_1 = require("../screen/ProjectScreen");
|
|
14
38
|
exports.PackageBuildPhaseType_Package = 'package';
|
|
15
39
|
exports.PackageBuildPhaseType_PackageWithOutput = 'package-with-output';
|
|
16
40
|
exports.PackageBuildPhaseType_Project = 'project';
|
|
@@ -24,6 +48,7 @@ function resolveAllMandatoryPhases(phase) {
|
|
|
24
48
|
}
|
|
25
49
|
return (0, ts_common_1.filterDuplicates)(result, result => result.name);
|
|
26
50
|
}
|
|
51
|
+
ts_common_1.DebugFlag.DefaultLogLevel = ts_common_1.LogLevel.Verbose;
|
|
27
52
|
class ProjectManager extends ts_common_1.Logger {
|
|
28
53
|
constructor() {
|
|
29
54
|
super();
|
|
@@ -31,11 +56,27 @@ class ProjectManager extends ts_common_1.Logger {
|
|
|
31
56
|
this.dryRun = params_1.RuntimeParams.dryRun;
|
|
32
57
|
this.terminate = false;
|
|
33
58
|
this.updateRunningStatus = async (runningStatus = consts_2.MemKey_RunningStatus.get(undefined)) => {
|
|
34
|
-
if (runningStatus)
|
|
35
|
-
return
|
|
59
|
+
if (!runningStatus)
|
|
60
|
+
return;
|
|
61
|
+
if (!fs.existsSync(consts_2.Default_OutputFiles.output))
|
|
62
|
+
await fs_1.promises.mkdir(consts_2.Default_OutputFiles.output, { recursive: true });
|
|
63
|
+
await fs_1.promises.writeFile(consts_2.Default_OutputFiles.runningStatus, (0, ts_common_1.__stringify)(runningStatus, true));
|
|
36
64
|
};
|
|
37
|
-
|
|
38
|
-
this.
|
|
65
|
+
this.projectScreen = new ProjectScreen_1.ProjectScreen([]);
|
|
66
|
+
params_1.RuntimeParams.allLogs ? this.showAllLogs() : this.showPrettyLogs();
|
|
67
|
+
}
|
|
68
|
+
showAllLogs() {
|
|
69
|
+
var _a;
|
|
70
|
+
if (this.logger)
|
|
71
|
+
ts_common_1.BeLogged.removeConsole(this.logger);
|
|
72
|
+
(_a = this.projectScreen) === null || _a === void 0 ? void 0 : _a.disable();
|
|
73
|
+
ts_common_1.BeLogged.addClient(this.logger = ts_common_1.LogClient_Terminal);
|
|
74
|
+
}
|
|
75
|
+
showPrettyLogs() {
|
|
76
|
+
if (this.logger)
|
|
77
|
+
ts_common_1.BeLogged.removeConsole(this.logger);
|
|
78
|
+
this.projectScreen.enable();
|
|
79
|
+
ts_common_1.BeLogged.addClient(this.logger = this.projectScreen.logClient);
|
|
39
80
|
}
|
|
40
81
|
loadPackage() {
|
|
41
82
|
const pathToConfig = (0, tools_1.convertToFullPath)('./.config/project-config.ts');
|
|
@@ -75,6 +116,7 @@ class ProjectManager extends ts_common_1.Logger {
|
|
|
75
116
|
this.logDebug('Scheduling phases: ', phasesToRun.map(mapToName));
|
|
76
117
|
if (phasesToRun[0].type === 'project')
|
|
77
118
|
return async () => {
|
|
119
|
+
var _a;
|
|
78
120
|
if (this.terminate)
|
|
79
121
|
return this.logInfo(`Skipping project phases:`, phasesToRun.map(mapToName));
|
|
80
122
|
let didRun = false;
|
|
@@ -93,6 +135,8 @@ class ProjectManager extends ts_common_1.Logger {
|
|
|
93
135
|
this.logVerbose('Skipping duo continue');
|
|
94
136
|
continue;
|
|
95
137
|
}
|
|
138
|
+
//Update project screen
|
|
139
|
+
(_a = this.projectScreen) === null || _a === void 0 ? void 0 : _a.updateRunningPhase(phase.name);
|
|
96
140
|
if (this.dryRun) {
|
|
97
141
|
await (0, ts_common_1.sleep)(200);
|
|
98
142
|
}
|
|
@@ -115,6 +159,7 @@ class ProjectManager extends ts_common_1.Logger {
|
|
|
115
159
|
delete this.prevRunningStatus;
|
|
116
160
|
let didPrintPackages = false;
|
|
117
161
|
const values = (0, ts_common_1.flatArray)(packages.map(async (pkg) => {
|
|
162
|
+
var _a, _b, _c;
|
|
118
163
|
for (const phase of phasesToRun) {
|
|
119
164
|
if (ProjectManager.isAborted())
|
|
120
165
|
return;
|
|
@@ -133,9 +178,17 @@ class ProjectManager extends ts_common_1.Logger {
|
|
|
133
178
|
}
|
|
134
179
|
didRun = true;
|
|
135
180
|
this.logDebug(` - ${pkg.name}:${phase.name}`);
|
|
181
|
+
//Update project screen
|
|
182
|
+
(_a = this.projectScreen) === null || _a === void 0 ? void 0 : _a.updateRunningPhase(phase.name);
|
|
136
183
|
// if prev running status still exists skip execution
|
|
137
184
|
if (this.prevRunningStatus && !phase.isMandatory) {
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
// skip packages indexes
|
|
188
|
+
const packageDependencyIndex = (_c = (_b = this.prevRunningStatus) === null || _b === void 0 ? void 0 : _b.packageDependencyIndex) !== null && _c !== void 0 ? _c : 0;
|
|
189
|
+
if (packageDependencyIndex > i) {
|
|
138
190
|
this.logVerbose('Skipping duo continue');
|
|
191
|
+
this.projectScreen.updateOrCreatePackage(pkg.name, 'Skipped');
|
|
139
192
|
continue;
|
|
140
193
|
}
|
|
141
194
|
if (this.dryRun) {
|
|
@@ -173,6 +226,8 @@ class ProjectManager extends ts_common_1.Logger {
|
|
|
173
226
|
consts_2.MemKey_DefaultFiles.set(consts_2.Default_Files);
|
|
174
227
|
// Set default value to memKey
|
|
175
228
|
consts_2.MemKey_RunningStatus.set({ phaseKey: '' });
|
|
229
|
+
//Set project screen
|
|
230
|
+
ProjectScreen_1.MemKey_ProjectScreen.set(this.projectScreen);
|
|
176
231
|
const listener = async (status) => {
|
|
177
232
|
this.logDebug('SIGINT - running status:', status);
|
|
178
233
|
await this.updateRunningStatus();
|
|
@@ -200,6 +255,7 @@ class ProjectManager extends ts_common_1.Logger {
|
|
|
200
255
|
catch (e) {
|
|
201
256
|
this.logError(e);
|
|
202
257
|
}
|
|
258
|
+
ProjectScreen_1.MemKey_ProjectScreen.get().endRun();
|
|
203
259
|
process.off('SIGINT', listener);
|
|
204
260
|
await this.updateRunningStatus();
|
|
205
261
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nu-art/build-and-install",
|
|
3
|
-
"version": "0.204.
|
|
3
|
+
"version": "0.204.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"TacB0sS",
|
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"chokidar": "^3.6.0",
|
|
35
|
+
"neo-blessed": "^0.2.0",
|
|
36
|
+
"glob": "^10.3.14",
|
|
35
37
|
"@nu-art/ts-common": "~0.204.0",
|
|
36
38
|
"@nu-art/commando": "~0.204.0"
|
|
37
39
|
},
|
package/phases/phases.d.ts
CHANGED
|
@@ -17,7 +17,8 @@ export declare const Phase_InstallPackages: BuildPhase;
|
|
|
17
17
|
export declare const Phase_Clean: BuildPhase;
|
|
18
18
|
export declare const Phase_Lint: BuildPhase;
|
|
19
19
|
export declare const Phase_Debug: BuildPhase;
|
|
20
|
-
export declare const
|
|
20
|
+
export declare const Phase_PrepareCompile: BuildPhase;
|
|
21
|
+
export declare const Phase_PreCompile: BuildPhase;
|
|
21
22
|
export declare const Phase_Compile: BuildPhase;
|
|
22
23
|
export declare const Phase_CompileWatch: BuildPhase;
|
|
23
24
|
export declare const Phase_Launch: BuildPhase;
|