@nu-art/build-and-install 0.204.2 → 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 +5 -3
- package/core/params/params.js +26 -7
- 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 +144 -42
- package/project-manager.js +1 -1
- package/screen/ProjectScreen.d.ts +27 -0
- package/screen/ProjectScreen.js +178 -0
package/build-and-install.js
CHANGED
|
@@ -18,18 +18,23 @@ projectManager.registerPhase(phases_1.Phase_PrintDependencyTree);
|
|
|
18
18
|
projectManager.registerPhase(phases_1.Phase_CheckCyclicImports);
|
|
19
19
|
projectManager.registerPhase(phases_1.Phase_PrintEnv);
|
|
20
20
|
projectManager.registerPhase(phases_1.Phase_PackagePurge);
|
|
21
|
-
projectManager.registerPhase(phases_1.Phase_Clean);
|
|
22
21
|
projectManager.registerPhase(phases_1.Phase_InstallGlobals);
|
|
23
22
|
projectManager.registerPhase(phases_1.Phase_InstallPnpm);
|
|
24
23
|
projectManager.registerPhase(phases_1.Phase_InstallPackages);
|
|
24
|
+
projectManager.registerPhase(phases_1.Phase_Clean);
|
|
25
25
|
projectManager.registerPhase(phases_1.Phase_Lint);
|
|
26
|
-
projectManager.registerPhase(phases_1.
|
|
26
|
+
projectManager.registerPhase(phases_1.Phase_PrepareCompile);
|
|
27
|
+
projectManager.registerPhase(phases_1.Phase_PreCompile);
|
|
27
28
|
projectManager.registerPhase(phases_1.Phase_Compile);
|
|
28
29
|
projectManager.registerPhase(phases_1.Phase_CompileWatch);
|
|
29
30
|
projectManager.registerPhase(phases_1.Phase_Launch);
|
|
30
31
|
projectManager.registerPhase(phases_1.Phase_DeployFrontend);
|
|
31
32
|
projectManager.registerPhase(phases_1.Phase_DeployBackend);
|
|
32
|
-
|
|
33
|
+
projectManager.registerPhase(phases_1.Phase_Debug);
|
|
33
34
|
projectManager.execute()
|
|
34
|
-
.then(() =>
|
|
35
|
-
|
|
35
|
+
.then(() => {
|
|
36
|
+
ts_common_1.StaticLogger.logInfo('completed');
|
|
37
|
+
})
|
|
38
|
+
.catch(err => {
|
|
39
|
+
ts_common_1.StaticLogger.logError('Failed with error: ', err);
|
|
40
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
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.Console_PackagesView = void 0;
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
const blessed = __importStar(require("neo-blessed"));
|
|
29
|
+
class Console_PackagesView {
|
|
30
|
+
// private readonly testBox1: blessed.Widgets.BoxElement;
|
|
31
|
+
// private readonly testBox2: blessed.Widgets.BoxElement;
|
|
32
|
+
// private readonly packageTable: blessed.Widgets.TableElement;
|
|
33
|
+
constructor(title) {
|
|
34
|
+
this.render = () => {
|
|
35
|
+
this.renderTitle();
|
|
36
|
+
this.screen.render();
|
|
37
|
+
};
|
|
38
|
+
this.title = title;
|
|
39
|
+
this.screen = blessed.screen({
|
|
40
|
+
smartCSR: true,
|
|
41
|
+
title: 'Build and install',
|
|
42
|
+
});
|
|
43
|
+
// Create the UI components
|
|
44
|
+
this.titleView = blessed.box({
|
|
45
|
+
parent: this.screen,
|
|
46
|
+
top: 1,
|
|
47
|
+
left: 'center',
|
|
48
|
+
width: '30%',
|
|
49
|
+
height: 3,
|
|
50
|
+
border: { type: 'line' },
|
|
51
|
+
content: '',
|
|
52
|
+
tags: true,
|
|
53
|
+
style: {
|
|
54
|
+
border: { fg: 'green' },
|
|
55
|
+
fg: 'black',
|
|
56
|
+
},
|
|
57
|
+
valign: 'middle',
|
|
58
|
+
align: 'center'
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
renderTitle() {
|
|
62
|
+
this.titleView.setContent(this.title);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.Console_PackagesView = Console_PackagesView;
|
package/core/package/consts.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FirebasePackageConfig } from '../types';
|
|
2
2
|
export type DefaultType_ProjectEnvs = 'local' | 'dev' | 'staging' | 'prod';
|
|
3
|
+
export declare const Default_ProjectEnvs: ("local" | "dev" | "staging" | "prod")[];
|
|
3
4
|
export declare const Default_FunctionsIgnoreFiles: string[];
|
|
4
5
|
export declare const Default_HostingConfig: {
|
|
5
6
|
public: string;
|
|
@@ -8,4 +9,12 @@ export declare const Default_HostingConfig: {
|
|
|
8
9
|
destination: string;
|
|
9
10
|
}[];
|
|
10
11
|
};
|
|
11
|
-
|
|
12
|
+
type SharedConfig = {
|
|
13
|
+
pathToFirebaseConfig: FirebasePackageConfig['pathToFirebaseConfig'];
|
|
14
|
+
functions: {
|
|
15
|
+
ignore: NonNullable<FirebasePackageConfig['functions']>['ignore'];
|
|
16
|
+
};
|
|
17
|
+
hosting: FirebasePackageConfig['hosting'];
|
|
18
|
+
};
|
|
19
|
+
export declare const Default_FirebaseProjectConfig: SharedConfig;
|
|
20
|
+
export {};
|
package/core/package/consts.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Default_FirebaseProjectConfig = exports.Default_HostingConfig = exports.Default_FunctionsIgnoreFiles = void 0;
|
|
3
|
+
exports.Default_FirebaseProjectConfig = exports.Default_HostingConfig = exports.Default_FunctionsIgnoreFiles = exports.Default_ProjectEnvs = void 0;
|
|
4
4
|
const EnvName_local = 'local';
|
|
5
5
|
const EnvName_dev = 'dev';
|
|
6
6
|
const EnvName_staging = 'staging';
|
|
7
7
|
const EnvName_prod = 'prod';
|
|
8
|
-
|
|
8
|
+
exports.Default_ProjectEnvs = [
|
|
9
9
|
EnvName_local,
|
|
10
10
|
EnvName_dev,
|
|
11
11
|
EnvName_staging,
|
|
@@ -35,7 +35,6 @@ exports.Default_HostingConfig = {
|
|
|
35
35
|
]
|
|
36
36
|
};
|
|
37
37
|
exports.Default_FirebaseProjectConfig = {
|
|
38
|
-
envs: Default_ProjectEnvs,
|
|
39
38
|
pathToFirebaseConfig: '.firebase_config',
|
|
40
39
|
functions: {
|
|
41
40
|
ignore: exports.Default_FunctionsIgnoreFiles,
|
|
@@ -1,218 +1,22 @@
|
|
|
1
|
-
import { Package_FirebaseFunctionsApp, Package_FirebaseHostingApp } from '../types';
|
|
2
|
-
export declare function
|
|
1
|
+
import { Package_FirebaseFunctionsApp, Package_FirebaseHostingAndFunctionApp, Package_FirebaseHostingApp } from '../types';
|
|
2
|
+
export declare function createFirebaseHostingConfig<Env extends string>(pkg: Package_FirebaseHostingApp, env: Env): {
|
|
3
3
|
projects: {
|
|
4
4
|
default: string;
|
|
5
5
|
};
|
|
6
6
|
};
|
|
7
|
-
export declare function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
public: string;
|
|
12
|
-
rewrites: {
|
|
13
|
-
source: string;
|
|
14
|
-
destination: string;
|
|
15
|
-
}[];
|
|
16
|
-
} | undefined;
|
|
17
|
-
};
|
|
18
|
-
export declare function createFirebaseFunctionsJSON<Env extends string>(pkg: Package_FirebaseFunctionsApp, env: Env): {
|
|
19
|
-
database: {
|
|
20
|
-
rules: string;
|
|
21
|
-
};
|
|
22
|
-
firestore: {
|
|
23
|
-
rules: string;
|
|
24
|
-
indexes: string;
|
|
25
|
-
};
|
|
26
|
-
storage: {
|
|
27
|
-
rules: string;
|
|
28
|
-
};
|
|
29
|
-
remoteconfig: {
|
|
30
|
-
template: string;
|
|
31
|
-
};
|
|
32
|
-
functions: {
|
|
33
|
-
ignore: string[] | undefined;
|
|
34
|
-
source: string;
|
|
35
|
-
predeploy: string[];
|
|
36
|
-
};
|
|
37
|
-
emulators: {
|
|
38
|
-
functions: {
|
|
39
|
-
port: number;
|
|
40
|
-
};
|
|
41
|
-
database: {
|
|
42
|
-
port: number;
|
|
43
|
-
};
|
|
44
|
-
firestore: {
|
|
45
|
-
port: number;
|
|
46
|
-
websocketPort: number;
|
|
47
|
-
};
|
|
48
|
-
pubsub: {
|
|
49
|
-
port: number;
|
|
50
|
-
};
|
|
51
|
-
storage: {
|
|
52
|
-
port: number;
|
|
53
|
-
};
|
|
54
|
-
auth: {
|
|
55
|
-
port: number;
|
|
56
|
-
};
|
|
57
|
-
ui: {
|
|
58
|
-
port: number;
|
|
59
|
-
enabled: boolean;
|
|
60
|
-
};
|
|
61
|
-
hub: {
|
|
62
|
-
port: number;
|
|
63
|
-
};
|
|
64
|
-
logging: {
|
|
65
|
-
port: number;
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
} | {
|
|
69
|
-
functions: {
|
|
70
|
-
source: string;
|
|
71
|
-
ignore: string[] | undefined;
|
|
72
|
-
predeploy?: undefined;
|
|
7
|
+
export declare function createFirebaseFunctionConfig<Env extends string>(pkg: Package_FirebaseHostingApp, env: Env): void;
|
|
8
|
+
export declare function createFirebaseRC<Env extends string>(pkg: Package_FirebaseHostingApp | Package_FirebaseFunctionsApp, env: Env): {
|
|
9
|
+
projects: {
|
|
10
|
+
default: string;
|
|
73
11
|
};
|
|
74
|
-
database?: undefined;
|
|
75
|
-
firestore?: undefined;
|
|
76
|
-
storage?: undefined;
|
|
77
|
-
remoteconfig?: undefined;
|
|
78
|
-
emulators?: undefined;
|
|
79
12
|
};
|
|
80
|
-
export declare function
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
rules: string;
|
|
90
|
-
};
|
|
91
|
-
remoteconfig: {
|
|
92
|
-
template: string;
|
|
93
|
-
};
|
|
94
|
-
functions: {
|
|
95
|
-
ignore: string[] | undefined;
|
|
96
|
-
source: string;
|
|
97
|
-
predeploy: string[];
|
|
98
|
-
};
|
|
99
|
-
emulators: {
|
|
100
|
-
functions: {
|
|
101
|
-
port: number;
|
|
102
|
-
};
|
|
103
|
-
database: {
|
|
104
|
-
port: number;
|
|
105
|
-
};
|
|
106
|
-
firestore: {
|
|
107
|
-
port: number;
|
|
108
|
-
websocketPort: number;
|
|
109
|
-
};
|
|
110
|
-
pubsub: {
|
|
111
|
-
port: number;
|
|
112
|
-
};
|
|
113
|
-
storage: {
|
|
114
|
-
port: number;
|
|
115
|
-
};
|
|
116
|
-
auth: {
|
|
117
|
-
port: number;
|
|
118
|
-
};
|
|
119
|
-
ui: {
|
|
120
|
-
port: number;
|
|
121
|
-
enabled: boolean;
|
|
122
|
-
};
|
|
123
|
-
hub: {
|
|
124
|
-
port: number;
|
|
125
|
-
};
|
|
126
|
-
logging: {
|
|
127
|
-
port: number;
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
hosting?: undefined;
|
|
131
|
-
} | {
|
|
132
|
-
functions: {
|
|
133
|
-
source: string;
|
|
134
|
-
ignore: string[] | undefined;
|
|
135
|
-
predeploy?: undefined;
|
|
136
|
-
};
|
|
137
|
-
database?: undefined;
|
|
138
|
-
firestore?: undefined;
|
|
139
|
-
storage?: undefined;
|
|
140
|
-
remoteconfig?: undefined;
|
|
141
|
-
emulators?: undefined;
|
|
142
|
-
hosting?: undefined;
|
|
143
|
-
} | {
|
|
144
|
-
database: {
|
|
145
|
-
rules: string;
|
|
146
|
-
};
|
|
147
|
-
firestore: {
|
|
148
|
-
rules: string;
|
|
149
|
-
indexes: string;
|
|
150
|
-
};
|
|
151
|
-
storage: {
|
|
152
|
-
rules: string;
|
|
153
|
-
};
|
|
154
|
-
remoteconfig: {
|
|
155
|
-
template: string;
|
|
156
|
-
};
|
|
157
|
-
functions: {
|
|
158
|
-
ignore: string[] | undefined;
|
|
159
|
-
source: string;
|
|
160
|
-
predeploy: string[];
|
|
161
|
-
};
|
|
162
|
-
emulators: {
|
|
163
|
-
functions: {
|
|
164
|
-
port: number;
|
|
165
|
-
};
|
|
166
|
-
database: {
|
|
167
|
-
port: number;
|
|
168
|
-
};
|
|
169
|
-
firestore: {
|
|
170
|
-
port: number;
|
|
171
|
-
websocketPort: number;
|
|
172
|
-
};
|
|
173
|
-
pubsub: {
|
|
174
|
-
port: number;
|
|
175
|
-
};
|
|
176
|
-
storage: {
|
|
177
|
-
port: number;
|
|
178
|
-
};
|
|
179
|
-
auth: {
|
|
180
|
-
port: number;
|
|
181
|
-
};
|
|
182
|
-
ui: {
|
|
183
|
-
port: number;
|
|
184
|
-
enabled: boolean;
|
|
185
|
-
};
|
|
186
|
-
hub: {
|
|
187
|
-
port: number;
|
|
188
|
-
};
|
|
189
|
-
logging: {
|
|
190
|
-
port: number;
|
|
191
|
-
};
|
|
192
|
-
};
|
|
193
|
-
hosting: {
|
|
194
|
-
public: string;
|
|
195
|
-
rewrites: {
|
|
196
|
-
source: string;
|
|
197
|
-
destination: string;
|
|
198
|
-
}[];
|
|
199
|
-
} | undefined;
|
|
200
|
-
} | {
|
|
201
|
-
functions: {
|
|
202
|
-
source: string;
|
|
203
|
-
ignore: string[] | undefined;
|
|
204
|
-
predeploy?: undefined;
|
|
205
|
-
};
|
|
206
|
-
database?: undefined;
|
|
207
|
-
firestore?: undefined;
|
|
208
|
-
storage?: undefined;
|
|
209
|
-
remoteconfig?: undefined;
|
|
210
|
-
emulators?: undefined;
|
|
211
|
-
hosting: {
|
|
212
|
-
public: string;
|
|
213
|
-
rewrites: {
|
|
214
|
-
source: string;
|
|
215
|
-
destination: string;
|
|
216
|
-
}[];
|
|
217
|
-
} | undefined;
|
|
13
|
+
export declare function writeToFile_HostingFirebaseJSON<Env extends string>(pkg: Package_FirebaseHostingApp | Package_FirebaseHostingAndFunctionApp, env: Env): Promise<void>;
|
|
14
|
+
export declare function writeToFile_HostingFirebaseConfigJSON<Env extends string>(pkg: Package_FirebaseHostingApp | Package_FirebaseHostingAndFunctionApp, env: Env): Promise<void>;
|
|
15
|
+
export declare function writeToFile_functionFirebaseConfigJSON<Env extends string>(pkg: Package_FirebaseFunctionsApp | Package_FirebaseHostingAndFunctionApp, env: Env): Promise<void>;
|
|
16
|
+
export declare function writeToFile_FunctionFirebaseJSON<Env extends string>(pkg: Package_FirebaseFunctionsApp | Package_FirebaseHostingAndFunctionApp, env: Env): Promise<void>;
|
|
17
|
+
export declare function createFirebaseFullJSON<Env extends string>(pkg: Package_FirebaseHostingAndFunctionApp, env: Env): {
|
|
18
|
+
then<TResult1 = void, TResult2 = never>(onfulfilled?: ((value: void) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
|
|
19
|
+
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined): Promise<void | TResult>;
|
|
20
|
+
finally(onfinally?: (() => void) | null | undefined): Promise<void>;
|
|
21
|
+
[Symbol.toStringTag]: string;
|
|
218
22
|
};
|
package/core/package/generate.js
CHANGED
|
@@ -1,26 +1,97 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createFirebaseFullJSON = exports.
|
|
3
|
+
exports.createFirebaseFullJSON = exports.writeToFile_FunctionFirebaseJSON = exports.writeToFile_functionFirebaseConfigJSON = exports.writeToFile_HostingFirebaseConfigJSON = exports.writeToFile_HostingFirebaseJSON = exports.createFirebaseRC = exports.createFirebaseFunctionConfig = exports.createFirebaseHostingConfig = void 0;
|
|
4
|
+
const ts_common_1 = require("@nu-art/ts-common");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const consts_1 = require("../consts");
|
|
7
|
+
function createFirebaseHostingConfig(pkg, env) {
|
|
8
|
+
const envConfig = pkg.envConfig.envs.find(_env => _env.env === env);
|
|
9
|
+
if (!envConfig)
|
|
10
|
+
throw new ts_common_1.BadImplementationException(`Could not find env: ${env}`);
|
|
11
|
+
return {
|
|
12
|
+
projects: {
|
|
13
|
+
default: envConfig.projectId,
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
exports.createFirebaseHostingConfig = createFirebaseHostingConfig;
|
|
18
|
+
function createFirebaseFunctionConfig(pkg, env) {
|
|
19
|
+
const envConfig = pkg.envConfig.envs.find(_env => _env.env === env);
|
|
20
|
+
if (!envConfig)
|
|
21
|
+
throw new ts_common_1.BadImplementationException(`Could not find env: ${env}`);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
exports.createFirebaseFunctionConfig = createFirebaseFunctionConfig;
|
|
4
25
|
function createFirebaseRC(pkg, env) {
|
|
26
|
+
const envConfig = pkg.envConfig.envs.find(_env => _env.env === env);
|
|
27
|
+
if (!envConfig)
|
|
28
|
+
throw new ts_common_1.BadImplementationException(`Could not find env: ${env}`);
|
|
5
29
|
return {
|
|
6
30
|
projects: {
|
|
7
|
-
default:
|
|
31
|
+
default: envConfig.projectId,
|
|
8
32
|
}
|
|
9
33
|
};
|
|
10
34
|
}
|
|
11
35
|
exports.createFirebaseRC = createFirebaseRC;
|
|
12
|
-
function
|
|
13
|
-
if (
|
|
36
|
+
function getHostingConfig(pkg, envConfig) {
|
|
37
|
+
if (envConfig.isLocal)
|
|
14
38
|
return {};
|
|
15
39
|
return {
|
|
16
40
|
hosting: pkg.envConfig.hosting
|
|
17
41
|
};
|
|
18
42
|
}
|
|
19
|
-
|
|
20
|
-
|
|
43
|
+
async function writeToFile_HostingFirebaseJSON(pkg, env) {
|
|
44
|
+
const envConfig = pkg.envConfig.envs.find(_env => _env.env === env);
|
|
45
|
+
if (!envConfig)
|
|
46
|
+
throw new ts_common_1.BadImplementationException(`Could not find env: ${env}`);
|
|
47
|
+
const fileContent = getHostingConfig(pkg, envConfig);
|
|
48
|
+
await fs_1.promises.writeFile(`${pkg.path}/${consts_1.CONST_FirebaseJSON}`, JSON.stringify(fileContent, null, 2), { encoding: 'utf-8' });
|
|
49
|
+
}
|
|
50
|
+
exports.writeToFile_HostingFirebaseJSON = writeToFile_HostingFirebaseJSON;
|
|
51
|
+
async function writeToFile_HostingFirebaseConfigJSON(pkg, env) {
|
|
52
|
+
var _a;
|
|
53
|
+
const envConfig = pkg.envConfig.envs.find(_env => _env.env === env);
|
|
54
|
+
if (!envConfig)
|
|
55
|
+
throw new ts_common_1.BadImplementationException(`Could not find env: ${env}`);
|
|
56
|
+
const emulatorConfig = {
|
|
57
|
+
hostname: 'localhost',
|
|
58
|
+
port: pkg.envConfig.basePort + 2,
|
|
59
|
+
};
|
|
60
|
+
const feConfig = {
|
|
61
|
+
ModuleFE_Thunderstorm: {
|
|
62
|
+
appName: `${pkg.name} - (${env})`
|
|
63
|
+
},
|
|
64
|
+
ModuleFE_XHR: {
|
|
65
|
+
origin: envConfig.isLocal ? `https://localhost:${pkg.envConfig.basePort + 1}` : envConfig.backend.url,
|
|
66
|
+
timeout: envConfig.backend.timeout || 30000,
|
|
67
|
+
compress: envConfig.backend.compress || false,
|
|
68
|
+
minLogLevel: envConfig.backend.minLogLevel || false,
|
|
69
|
+
},
|
|
70
|
+
ModuleFE_FirebaseListener: {
|
|
71
|
+
emulatorConfig: envConfig.isLocal ? emulatorConfig : undefined,
|
|
72
|
+
firebaseConfig: (_a = envConfig.firebase.listener) === null || _a === void 0 ? void 0 : _a.config
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const fileContent = `export const config = ${JSON.stringify(feConfig, null, 2)};`;
|
|
76
|
+
await fs_1.promises.writeFile(`${pkg.path}/src/main/config.ts`, fileContent, { encoding: 'utf-8' });
|
|
77
|
+
}
|
|
78
|
+
exports.writeToFile_HostingFirebaseConfigJSON = writeToFile_HostingFirebaseConfigJSON;
|
|
79
|
+
async function writeToFile_functionFirebaseConfigJSON(pkg, env) {
|
|
80
|
+
const envConfig = pkg.envConfig.envs.find(_env => _env.env === env);
|
|
81
|
+
if (!envConfig)
|
|
82
|
+
throw new ts_common_1.BadImplementationException(`Could not find env: ${env}`);
|
|
83
|
+
const beConfig = {
|
|
84
|
+
name: envConfig.env
|
|
85
|
+
};
|
|
86
|
+
const fileContent = `${envConfig.isLocal ? '// @ts-ignore\nprocess.env[\'NODE_TLS_REJECT_UNAUTHORIZED\'] = 0;\n' : ''}
|
|
87
|
+
export const Environment = ${JSON.stringify(beConfig)};`;
|
|
88
|
+
await fs_1.promises.writeFile(`${pkg.path}/src/main/config.ts`, fileContent, { encoding: 'utf-8' });
|
|
89
|
+
}
|
|
90
|
+
exports.writeToFile_functionFirebaseConfigJSON = writeToFile_functionFirebaseConfigJSON;
|
|
91
|
+
function getFunctionConfig(pkg, envConfig) {
|
|
21
92
|
var _a, _b;
|
|
22
|
-
if (
|
|
23
|
-
|
|
93
|
+
if (envConfig.isLocal) {
|
|
94
|
+
const port = pkg.envConfig.basePort;
|
|
24
95
|
return {
|
|
25
96
|
database: {
|
|
26
97
|
rules: `${pkg.envConfig.pathToFirebaseConfig}/database.rules.json`
|
|
@@ -43,32 +114,44 @@ function createFirebaseFunctionsJSON(pkg, env) {
|
|
|
43
114
|
]
|
|
44
115
|
},
|
|
45
116
|
emulators: {
|
|
46
|
-
functions: { port: port
|
|
47
|
-
database: { port: port
|
|
117
|
+
functions: { port: port + 1 },
|
|
118
|
+
database: { port: port + 2 },
|
|
48
119
|
firestore: {
|
|
49
|
-
port: port
|
|
50
|
-
websocketPort: port
|
|
120
|
+
port: port + 3,
|
|
121
|
+
websocketPort: port + 4
|
|
51
122
|
},
|
|
52
|
-
pubsub: { port: port
|
|
53
|
-
storage: { port: port
|
|
54
|
-
auth: { port: port
|
|
55
|
-
ui: { port: port
|
|
56
|
-
hub: { port: port
|
|
57
|
-
logging: { port: port
|
|
123
|
+
pubsub: { port: port + 5 },
|
|
124
|
+
storage: { port: port + 6 },
|
|
125
|
+
auth: { port: port + 7 },
|
|
126
|
+
ui: { port: port + 8, enabled: true },
|
|
127
|
+
hub: { port: port + 9 },
|
|
128
|
+
logging: { port: port + 10 }
|
|
58
129
|
}
|
|
59
130
|
};
|
|
60
131
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
132
|
+
else {
|
|
133
|
+
return {
|
|
134
|
+
functions: {
|
|
135
|
+
source: pkg.output.replace(`${pkg.path}/`, ''),
|
|
136
|
+
ignore: (_b = pkg.envConfig.functions) === null || _b === void 0 ? void 0 : _b.ignore
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
async function writeToFile_FunctionFirebaseJSON(pkg, env) {
|
|
142
|
+
const envConfig = pkg.envConfig.envs.find(_env => _env.env === env);
|
|
143
|
+
if (!envConfig)
|
|
144
|
+
throw new ts_common_1.BadImplementationException(`Could not find env: ${env}`);
|
|
145
|
+
const fileContent = getFunctionConfig(pkg, envConfig);
|
|
146
|
+
await fs_1.promises.writeFile(`${pkg.path}/${consts_1.CONST_FirebaseJSON}`, JSON.stringify(fileContent, null, 2), { encoding: 'utf-8' });
|
|
67
147
|
}
|
|
68
|
-
exports.
|
|
148
|
+
exports.writeToFile_FunctionFirebaseJSON = writeToFile_FunctionFirebaseJSON;
|
|
69
149
|
function createFirebaseFullJSON(pkg, env) {
|
|
70
|
-
const
|
|
71
|
-
|
|
150
|
+
const envConfig = pkg.envConfig.envs.find(_env => _env.env === env);
|
|
151
|
+
if (!envConfig)
|
|
152
|
+
throw new ts_common_1.BadImplementationException(`Could not find env: ${env}`);
|
|
153
|
+
const hosting = writeToFile_HostingFirebaseJSON(pkg, env);
|
|
154
|
+
const functions = writeToFile_FunctionFirebaseJSON(pkg, env);
|
|
72
155
|
return Object.assign(Object.assign({}, hosting), functions);
|
|
73
156
|
}
|
|
74
157
|
exports.createFirebaseFullJSON = createFirebaseFullJSON;
|
package/core/params/params.d.ts
CHANGED
|
@@ -15,7 +15,8 @@ export declare const BaiParam_Generate: BaseCliParam<'generate', boolean>;
|
|
|
15
15
|
export declare const BaiParam_GenerateDocs: BaseCliParam<'generateDocs', boolean>;
|
|
16
16
|
export declare const BaiParam_NoBuild: BaseCliParam<'noBuild', boolean>;
|
|
17
17
|
export declare const BaiParam_DryRun: BaseCliParam<'dryRun', boolean>;
|
|
18
|
-
export declare const
|
|
18
|
+
export declare const BaiParam_RunWithThunderstorm: BaseCliParam<'runWithThunderstorm', boolean>;
|
|
19
|
+
export declare const BaiParam_WithCommando: BaseCliParam<'withCommando', boolean>;
|
|
19
20
|
export declare const BaiParam_NoThunderstorm: BaseCliParam<'noThunderstorm', boolean>;
|
|
20
21
|
export declare const BaiParam_Lint: BaseCliParam<'lint', boolean>;
|
|
21
22
|
export declare const BaiParam_Watch: BaseCliParam<'watch', boolean>;
|
|
@@ -31,5 +32,6 @@ export declare const BaiParam_NoGit: BaseCliParam<'noGit', boolean>;
|
|
|
31
32
|
export declare const BaiParam_Debug: BaseCliParam<'debug', boolean>;
|
|
32
33
|
export declare const BaiParam_QuickDeploy: BaseCliParam<'quickDeploy', boolean>;
|
|
33
34
|
export declare const BaiParam_Publish: BaseCliParam<'publish', string>;
|
|
34
|
-
export declare const
|
|
35
|
-
export declare const
|
|
35
|
+
export declare const BaiParam_AllLogs: BaseCliParam<'allLogs', boolean>;
|
|
36
|
+
export declare const AllBaiParams: (BaseCliParam<"help", boolean> | BaseCliParam<"dependencyTree", boolean> | BaseCliParam<"checkCyclicImports", boolean> | BaseCliParam<"printEnv", boolean> | BaseCliParam<"continue", boolean> | BaseCliParam<"setEnv", 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<"quickDeploy", boolean> | BaseCliParam<"publish", string> | BaseCliParam<"allLogs", boolean>)[];
|
|
37
|
+
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<"setEnv", 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<"quickDeploy", boolean> | BaseCliParam<"publish", string> | BaseCliParam<"allLogs", 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_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.
|
|
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;
|
|
4
4
|
const cli_params_1 = require("@nu-art/commando/cli/cli-params");
|
|
5
5
|
exports.BaiParam_Help = {
|
|
6
6
|
keys: ['--help', '-h'],
|
|
@@ -116,13 +116,20 @@ exports.BaiParam_DryRun = {
|
|
|
116
116
|
type: 'boolean',
|
|
117
117
|
description: 'Do not perform any phase impl, only log the process'
|
|
118
118
|
};
|
|
119
|
-
exports.
|
|
120
|
-
keys: ['--thunderstorm
|
|
121
|
-
keyName: '
|
|
119
|
+
exports.BaiParam_RunWithThunderstorm = {
|
|
120
|
+
keys: ['--with-thunderstorm', '-th'],
|
|
121
|
+
keyName: 'runWithThunderstorm',
|
|
122
122
|
type: 'boolean',
|
|
123
123
|
group: 'Build',
|
|
124
124
|
description: 'Will link the output folder of the libraries of thunderstorm that exists under the give path \nMUST have ThunderstormHome env variable defined and point to the Thunderstorm sample project'
|
|
125
125
|
};
|
|
126
|
+
exports.BaiParam_WithCommando = {
|
|
127
|
+
keys: ['--with-commando', '-wc'],
|
|
128
|
+
keyName: 'withCommando',
|
|
129
|
+
type: 'boolean',
|
|
130
|
+
group: 'Build',
|
|
131
|
+
description: 'Build with local commando from ts'
|
|
132
|
+
};
|
|
126
133
|
exports.BaiParam_NoThunderstorm = {
|
|
127
134
|
keys: ['--no-thunderstorm', '-nth'],
|
|
128
135
|
keyName: 'noThunderstorm',
|
|
@@ -232,6 +239,13 @@ exports.BaiParam_Publish = {
|
|
|
232
239
|
description: 'Will publish thunderstorm && promote thunderstorm version \nenum options: patch | minor | major \nDefault Param: patch',
|
|
233
240
|
defaultValue: 'patch'
|
|
234
241
|
};
|
|
242
|
+
exports.BaiParam_AllLogs = {
|
|
243
|
+
keys: ['--all-logs', '-al'],
|
|
244
|
+
keyName: 'allLogs',
|
|
245
|
+
type: 'boolean',
|
|
246
|
+
group: 'Other',
|
|
247
|
+
description: 'will disable ui and show verbose logs for bai run',
|
|
248
|
+
};
|
|
235
249
|
exports.AllBaiParams = [
|
|
236
250
|
exports.BaiParam_Help,
|
|
237
251
|
exports.BaiParam_DependencyTree,
|
|
@@ -249,7 +263,8 @@ exports.AllBaiParams = [
|
|
|
249
263
|
exports.BaiParam_GenerateDocs,
|
|
250
264
|
exports.BaiParam_NoBuild,
|
|
251
265
|
exports.BaiParam_DryRun,
|
|
252
|
-
exports.
|
|
266
|
+
exports.BaiParam_RunWithThunderstorm,
|
|
267
|
+
exports.BaiParam_WithCommando,
|
|
253
268
|
exports.BaiParam_NoThunderstorm,
|
|
254
269
|
exports.BaiParam_Lint,
|
|
255
270
|
exports.BaiParam_Watch,
|
|
@@ -264,6 +279,10 @@ exports.AllBaiParams = [
|
|
|
264
279
|
exports.BaiParam_NoGit,
|
|
265
280
|
exports.BaiParam_Debug,
|
|
266
281
|
exports.BaiParam_QuickDeploy,
|
|
267
|
-
exports.BaiParam_Publish,
|
|
282
|
+
exports.BaiParam_Publish,
|
|
283
|
+
exports.BaiParam_AllLogs
|
|
268
284
|
];
|
|
269
|
-
|
|
285
|
+
const params = cli_params_1.CLIParams_Resolver.create(...exports.AllBaiParams).resolveParamValue();
|
|
286
|
+
if (!params.setEnv)
|
|
287
|
+
params.setEnv = 'local';
|
|
288
|
+
exports.RuntimeParams = params;
|