@nu-art/build-and-install 0.204.9 → 0.204.11
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/logic/ProjectManager.js +1 -7
- package/package.json +1 -1
- package/phases/phases.js +41 -12
package/logic/ProjectManager.js
CHANGED
|
@@ -160,7 +160,7 @@ class ProjectManager extends ts_common_1.Logger {
|
|
|
160
160
|
delete this.prevRunningStatus;
|
|
161
161
|
let didPrintPackages = false;
|
|
162
162
|
const values = (0, ts_common_1.flatArray)(packages.map(async (pkg) => {
|
|
163
|
-
var _a
|
|
163
|
+
var _a;
|
|
164
164
|
for (const phase of phasesToRun) {
|
|
165
165
|
if (ProjectManager.isAborted())
|
|
166
166
|
return;
|
|
@@ -183,13 +183,7 @@ class ProjectManager extends ts_common_1.Logger {
|
|
|
183
183
|
(_a = this.projectScreen) === null || _a === void 0 ? void 0 : _a.updateRunningPhase(phase.name);
|
|
184
184
|
// if prev running status still exists skip execution
|
|
185
185
|
if (this.prevRunningStatus && !phase.isMandatory) {
|
|
186
|
-
continue;
|
|
187
|
-
}
|
|
188
|
-
// skip packages indexes
|
|
189
|
-
const packageDependencyIndex = (_c = (_b = this.prevRunningStatus) === null || _b === void 0 ? void 0 : _b.packageDependencyIndex) !== null && _c !== void 0 ? _c : 0;
|
|
190
|
-
if (packageDependencyIndex > i) {
|
|
191
186
|
this.logVerbose('Skipping duo continue');
|
|
192
|
-
this.projectScreen.updateOrCreatePackage(pkg.name, 'Skipped');
|
|
193
187
|
continue;
|
|
194
188
|
}
|
|
195
189
|
if (this.dryRun) {
|
package/package.json
CHANGED
package/phases/phases.js
CHANGED
|
@@ -48,6 +48,7 @@ const CONST_ProjectVersionKey = 'APP_VERSION';
|
|
|
48
48
|
const CONST_ProjectDependencyKey = 'APP_VERSION_DEPENDENCY';
|
|
49
49
|
const CONST_TS_Config = `tsconfig.json`;
|
|
50
50
|
const CONST_RunningRoot = process.cwd();
|
|
51
|
+
const CONST_VersionApp = 'version-app.json';
|
|
51
52
|
const pathToProjectTS_Config = (0, tools_1.convertToFullPath)(`./.config/${CONST_TS_Config}`);
|
|
52
53
|
const pathToProjectEslint = (0, tools_1.convertToFullPath)('./.config/.eslintrc.js');
|
|
53
54
|
const runInDebug = false;
|
|
@@ -387,11 +388,12 @@ exports.Phase_PrepareCompile = {
|
|
|
387
388
|
compileActions[sourceFolder] = async () => {
|
|
388
389
|
const pathToLocalTsConfig = `${sourceFolder}/${CONST_TS_Config}`;
|
|
389
390
|
projectScreen.updateOrCreatePackage(pkg.name, 'Compiling');
|
|
391
|
+
const counter = timeCounter();
|
|
390
392
|
const commando = nvm_1.NVM.createCommando();
|
|
391
393
|
await commando
|
|
392
394
|
.append(`tsc -p "${pathToLocalTsConfig}" --rootDir "${sourceFolder}" --outDir "${pkg.output}"`)
|
|
393
395
|
.execute();
|
|
394
|
-
projectScreen.updateOrCreatePackage(pkg.name,
|
|
396
|
+
projectScreen.updateOrCreatePackage(pkg.name, `Compiled (${counter.format('mm:ss.zzz')})`);
|
|
395
397
|
};
|
|
396
398
|
}
|
|
397
399
|
};
|
|
@@ -444,6 +446,9 @@ exports.Phase_Compile = {
|
|
|
444
446
|
const folder = 'main';
|
|
445
447
|
const sourceFolder = `${pkg.path}/src/${folder}`;
|
|
446
448
|
const pathToLocalTsConfig = `${sourceFolder}/${CONST_TS_Config}`;
|
|
449
|
+
const pathToVersionAppJSON = `${CONST_RunningRoot}/${CONST_VersionApp}`;
|
|
450
|
+
//copy version-app.json file
|
|
451
|
+
const versionAppJSON = await fs_1.promises.readFile(pathToVersionAppJSON, { encoding: 'utf-8' });
|
|
447
452
|
// only read if exists
|
|
448
453
|
let inPackageTsConfig = '';
|
|
449
454
|
if (fs.existsSync(pathToLocalTsConfig))
|
|
@@ -455,7 +460,9 @@ exports.Phase_Compile = {
|
|
|
455
460
|
}
|
|
456
461
|
// --- HERE ---
|
|
457
462
|
await fs_1.promises.writeFile(`${pkg.output}/${consts_1.CONST_PackageJSON}`, JSON.stringify(pkg.packageJsonOutput, null, 2), { encoding: 'utf-8' });
|
|
458
|
-
if (pkg.type
|
|
463
|
+
if (pkg.type === types_1.PackageType_FirebaseFunctionsApp || pkg.type === types_1.PackageType_FirebaseHostingApp)
|
|
464
|
+
await fs_1.promises.writeFile(`${sourceFolder}/${CONST_VersionApp}`, versionAppJSON, { encoding: 'utf-8' });
|
|
465
|
+
if (pkg.type === 'firebase-functions-app') {
|
|
459
466
|
pkg.packageJsonRuntime.main = pkg.packageJsonRuntime.main.replace('dist/', '');
|
|
460
467
|
pkg.packageJsonRuntime.types = pkg.packageJsonRuntime.types.replace('dist/', '');
|
|
461
468
|
await fs_1.promises.writeFile(`${pkg.output}/${consts_1.CONST_PackageJSON}`, JSON.stringify(pkg.packageJsonRuntime, null, 2), { encoding: 'utf-8' });
|
|
@@ -579,17 +586,15 @@ exports.Phase_Launch = {
|
|
|
579
586
|
filter: async (pkg) => { var _a; return !!((_a = pkg.name.match(new RegExp(params_1.RuntimeParams.launch))) === null || _a === void 0 ? void 0 : _a[0]) && (pkg.type === 'firebase-functions-app' || pkg.type === 'firebase-hosting-app'); },
|
|
580
587
|
action: async (pkg) => {
|
|
581
588
|
const projectScreen = ProjectScreen_1.MemKey_ProjectScreen.get();
|
|
582
|
-
projectScreen.updateOrCreatePackage(pkg.name, '
|
|
589
|
+
projectScreen.updateOrCreatePackage(pkg.name, 'Launching...');
|
|
583
590
|
if (pkg.type === 'firebase-functions-app') {
|
|
584
591
|
await (0, ts_common_1.sleep)(1000 * counter++);
|
|
585
592
|
const allPorts = Array.from({ length: 10 }, (_, i) => `${pkg.envConfig.basePort + i}`);
|
|
586
593
|
const command = nvm_1.NVM.createInteractiveCommando(basic_1.Cli_Basic)
|
|
587
594
|
.cd(pkg.path).debug()
|
|
588
595
|
.append(`nvm use`)
|
|
589
|
-
.append(`echo RUNNING PACKAGE1 ${pkg.name}`)
|
|
590
596
|
.append(`array=($(lsof -ti:${allPorts.join(',')}))`)
|
|
591
|
-
.append(`((\${#array[@]} > 0)) && kill -9 "\${array[@]}"`)
|
|
592
|
-
.append(`echo RUNNING PACKAGE2 ${pkg.name}`);
|
|
597
|
+
.append(`((\${#array[@]} > 0)) && kill -9 "\${array[@]}"`);
|
|
593
598
|
command.append(`firebase emulators:start --export-on-exit --import=.trash/data ${runInDebug ? `--inspect-functions ${pkg.envConfig.ssl}` : ''}`);
|
|
594
599
|
return command
|
|
595
600
|
.execute();
|
|
@@ -597,11 +602,12 @@ exports.Phase_Launch = {
|
|
|
597
602
|
if (pkg.type === 'firebase-hosting-app')
|
|
598
603
|
return nvm_1.NVM.createInteractiveCommando(basic_1.Cli_Basic)
|
|
599
604
|
.cd(pkg.path)
|
|
605
|
+
.append(`array=($(lsof -ti:${[pkg.envConfig.basePort - 1].join(',')}))`)
|
|
606
|
+
.append(`((\${#array[@]} > 0)) && kill -9 "\${array[@]}"`)
|
|
600
607
|
.append(`nvm use`)
|
|
601
|
-
.append(`pwd`)
|
|
602
608
|
.append(`npm run start`)
|
|
603
609
|
.execute();
|
|
604
|
-
projectScreen.updateOrCreatePackage(pkg.name, '
|
|
610
|
+
projectScreen.updateOrCreatePackage(pkg.name, 'Died');
|
|
605
611
|
}
|
|
606
612
|
};
|
|
607
613
|
exports.Phase_DeployFrontend = {
|
|
@@ -617,12 +623,13 @@ exports.Phase_DeployFrontend = {
|
|
|
617
623
|
const projectScreen = ProjectScreen_1.MemKey_ProjectScreen.get();
|
|
618
624
|
if (pkg.type !== 'firebase-hosting-app')
|
|
619
625
|
throw new ts_common_1.BadImplementationException(`Somehow got a non firebase hosting package here: ${(0, ts_common_1.__stringify)(pkg)}`);
|
|
620
|
-
projectScreen.updateOrCreatePackage(pkg.name, 'Deploying
|
|
626
|
+
projectScreen.updateOrCreatePackage(pkg.name, 'Deploying');
|
|
627
|
+
const counter = timeCounter();
|
|
621
628
|
await nvm_1.NVM.createCommando(basic_1.Cli_Basic)
|
|
622
629
|
.cd(pkg.path)
|
|
623
630
|
.append(`firebase deploy --only hosting`)
|
|
624
631
|
.execute();
|
|
625
|
-
projectScreen.updateOrCreatePackage(pkg.name,
|
|
632
|
+
projectScreen.updateOrCreatePackage(pkg.name, `Deployed (${counter.format('mm:ss.zzz')})`);
|
|
626
633
|
}
|
|
627
634
|
};
|
|
628
635
|
exports.Phase_DeployBackend = {
|
|
@@ -635,11 +642,33 @@ exports.Phase_DeployBackend = {
|
|
|
635
642
|
const projectScreen = ProjectScreen_1.MemKey_ProjectScreen.get();
|
|
636
643
|
if (pkg.type !== 'firebase-functions-app')
|
|
637
644
|
throw new ts_common_1.BadImplementationException(`Somehow got a non firebase functions package here: ${(0, ts_common_1.__stringify)(pkg)}`);
|
|
638
|
-
projectScreen.updateOrCreatePackage(pkg.name, 'Deploying
|
|
645
|
+
projectScreen.updateOrCreatePackage(pkg.name, 'Deploying...');
|
|
646
|
+
const counter = timeCounter();
|
|
639
647
|
await nvm_1.NVM.createCommando(basic_1.Cli_Basic)
|
|
640
648
|
.cd(pkg.path)
|
|
641
649
|
.append(`firebase --debug deploy --only functions --force`)
|
|
642
650
|
.execute();
|
|
643
|
-
projectScreen.updateOrCreatePackage(pkg.name,
|
|
651
|
+
projectScreen.updateOrCreatePackage(pkg.name, `Deployed (${counter.format('mm:ss.zzz')})`);
|
|
644
652
|
}
|
|
645
653
|
};
|
|
654
|
+
function timeCounter() {
|
|
655
|
+
const started = (0, ts_common_1.currentTimeMillis)();
|
|
656
|
+
return {
|
|
657
|
+
dt: () => (0, ts_common_1.currentTimeMillis)() - started,
|
|
658
|
+
format: (format) => {
|
|
659
|
+
let dt = (0, ts_common_1.currentTimeMillis)() - started;
|
|
660
|
+
const hours = Math.floor(dt / ts_common_1.Hour);
|
|
661
|
+
dt -= hours * ts_common_1.Hour;
|
|
662
|
+
const minutes = Math.floor(dt / ts_common_1.Minute);
|
|
663
|
+
dt -= minutes * ts_common_1.Minute;
|
|
664
|
+
const seconds = Math.floor(dt / ts_common_1.Second);
|
|
665
|
+
dt -= seconds * ts_common_1.Second;
|
|
666
|
+
const millis = dt;
|
|
667
|
+
return format
|
|
668
|
+
.replace('hh', String(hours).padStart(2, '0'))
|
|
669
|
+
.replace('mm', String(minutes).padStart(2, '0'))
|
|
670
|
+
.replace('ss', String(seconds).padStart(2, '0'))
|
|
671
|
+
.replace('zzz', String(millis).padStart(3, '0'));
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
}
|