@nu-art/build-and-install 0.204.87 → 0.204.89

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.
@@ -12,9 +12,13 @@ runner
12
12
  .execute()
13
13
  .then(() => {
14
14
  ts_common_1.StaticLogger.logInfo('completed');
15
+ process.on('SIGINT', () => {
16
+ console.log('DEADEDAEDAEDAEDAEDAD');
17
+ return process.exit(0);
18
+ });
15
19
  //TODO: make it an array of non exit params
16
20
  if (!params_1.RuntimeParams.launch && !params_1.RuntimeParams.watch)
17
- process.exit(0);
21
+ return process.exit(0);
18
22
  })
19
23
  .catch(err => {
20
24
  ts_common_1.StaticLogger.logError('Failed with error: ', err);
@@ -1,4 +1,4 @@
1
- import { BaseCliParam } from '@nu-art/commando/cli/cli-params';
1
+ import { BaseCliParam } from '@nu-art/commando/cli-params/types';
2
2
  export declare const BaiParam_Help: BaseCliParam<'help', boolean>;
3
3
  export declare const BaiParam_DependencyTree: BaseCliParam<'dependencyTree', boolean>;
4
4
  export declare const BaiParam_CheckCyclicImports: BaseCliParam<'checkCyclicImports', boolean>;
@@ -30,6 +30,7 @@ export declare const BaiParam_DeployBackend: BaseCliParam<'deployBackend', strin
30
30
  export declare const BaiParam_DeployFrontend: BaseCliParam<'deployFrontend', string>;
31
31
  export declare const BaiParam_NoGit: BaseCliParam<'noGit', boolean>;
32
32
  export declare const BaiParam_Debug: BaseCliParam<'debug', boolean>;
33
+ export declare const BaiParam_Verbose: BaseCliParam<'verbose', boolean>;
33
34
  export declare const BaiParam_QuickDeploy: BaseCliParam<'quickDeploy', boolean>;
34
35
  export declare const BaiParam_Publish: BaseCliParam<'publish', string>;
35
36
  export declare const BaiParam_AllLogs: BaseCliParam<'allLogs', boolean>;
@@ -37,5 +38,5 @@ export declare const BaiParam_CloseScreenOnExit: BaseCliParam<'closeOnExit', boo
37
38
  export declare const BaiParam_EncounterManager: BaseCliParam<'encounterManager', boolean>;
38
39
  export declare const BaiParam_EncounterManagerListen: BaseCliParam<'encounterManagerListen', boolean>;
39
40
  export declare const BaiParam_UsePackage: BaseCliParam<'usePackage', string[]>;
40
- export declare const AllBaiParams: (BaseCliParam<"help", boolean> | BaseCliParam<"dependencyTree", boolean> | BaseCliParam<"checkCyclicImports", boolean> | BaseCliParam<"printEnv", boolean> | BaseCliParam<"continue", boolean> | BaseCliParam<"environment", 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", string> | BaseCliParam<"deployFrontend", string> | BaseCliParam<"noGit", boolean> | BaseCliParam<"debug", boolean> | BaseCliParam<"publish", string> | BaseCliParam<"allLogs", boolean> | BaseCliParam<"closeOnExit", boolean> | BaseCliParam<"encounterManager", boolean> | BaseCliParam<"encounterManagerListen", boolean> | BaseCliParam<"usePackage", string[]>)[];
41
- 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<"environment", 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", string> | BaseCliParam<"deployFrontend", string> | BaseCliParam<"noGit", boolean> | BaseCliParam<"debug", boolean> | BaseCliParam<"publish", string> | BaseCliParam<"allLogs", boolean> | BaseCliParam<"closeOnExit", boolean> | BaseCliParam<"encounterManager", boolean> | BaseCliParam<"encounterManagerListen", boolean> | BaseCliParam<"usePackage", string[]>)[]>;
41
+ export declare const AllBaiParams: (BaseCliParam<"help", boolean> | BaseCliParam<"dependencyTree", boolean> | BaseCliParam<"checkCyclicImports", boolean> | BaseCliParam<"printEnv", boolean> | BaseCliParam<"continue", boolean> | BaseCliParam<"environment", 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", string> | BaseCliParam<"deployFrontend", string> | BaseCliParam<"noGit", boolean> | BaseCliParam<"debug", boolean> | BaseCliParam<"verbose", boolean> | BaseCliParam<"publish", string> | BaseCliParam<"allLogs", boolean> | BaseCliParam<"closeOnExit", boolean> | BaseCliParam<"encounterManager", boolean> | BaseCliParam<"encounterManagerListen", boolean> | BaseCliParam<"usePackage", string[]>)[];
42
+ export declare const RuntimeParams: import("@nu-art/commando/cli-params/types").CliParams<(BaseCliParam<"help", boolean> | BaseCliParam<"dependencyTree", boolean> | BaseCliParam<"checkCyclicImports", boolean> | BaseCliParam<"printEnv", boolean> | BaseCliParam<"continue", boolean> | BaseCliParam<"environment", 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", string> | BaseCliParam<"deployFrontend", string> | BaseCliParam<"noGit", boolean> | BaseCliParam<"debug", boolean> | BaseCliParam<"verbose", boolean> | BaseCliParam<"publish", string> | BaseCliParam<"allLogs", boolean> | BaseCliParam<"closeOnExit", boolean> | BaseCliParam<"encounterManager", boolean> | BaseCliParam<"encounterManagerListen", boolean> | BaseCliParam<"usePackage", string[]>)[]>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RuntimeParams = exports.AllBaiParams = exports.BaiParam_UsePackage = exports.BaiParam_EncounterManagerListen = exports.BaiParam_EncounterManager = exports.BaiParam_CloseScreenOnExit = 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
- const cli_params_1 = require("@nu-art/commando/cli/cli-params");
3
+ exports.RuntimeParams = exports.AllBaiParams = exports.BaiParam_UsePackage = exports.BaiParam_EncounterManagerListen = exports.BaiParam_EncounterManager = exports.BaiParam_CloseScreenOnExit = exports.BaiParam_AllLogs = exports.BaiParam_Publish = exports.BaiParam_QuickDeploy = exports.BaiParam_Verbose = 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
+ const CLIParamsResolver_1 = require("@nu-art/commando/cli-params/CLIParamsResolver");
5
5
  const ts_common_1 = require("@nu-art/ts-common");
6
6
  //util regex function
7
7
  const regexTemplate = (regexp) => (0, ts_common_1.exists)(regexp) ? `.*${regexp}.*` : '.*';
@@ -229,6 +229,13 @@ exports.BaiParam_Debug = {
229
229
  type: 'boolean',
230
230
  description: 'Will print the parameters the script is running with'
231
231
  };
232
+ exports.BaiParam_Verbose = {
233
+ keys: ['--verbose', '-d'],
234
+ keyName: 'verbose',
235
+ group: 'Other',
236
+ type: 'boolean',
237
+ description: 'Set log level to verbose'
238
+ };
232
239
  exports.BaiParam_QuickDeploy = {
233
240
  keys: ['--quick-deploy', '-qd'],
234
241
  keyName: 'quickDeploy',
@@ -316,11 +323,12 @@ exports.AllBaiParams = [
316
323
  exports.BaiParam_DeployFrontend,
317
324
  exports.BaiParam_NoGit,
318
325
  exports.BaiParam_Debug,
326
+ exports.BaiParam_Verbose,
319
327
  exports.BaiParam_Publish,
320
328
  exports.BaiParam_AllLogs,
321
329
  exports.BaiParam_CloseScreenOnExit,
322
330
  exports.BaiParam_EncounterManager,
323
331
  exports.BaiParam_EncounterManagerListen, exports.BaiParam_UsePackage
324
332
  ];
325
- const params = cli_params_1.CLIParams_Resolver.create(...exports.AllBaiParams).resolveParamValue();
333
+ const params = CLIParamsResolver_1.CLIParamsResolver.create(...exports.AllBaiParams).resolveParamValue();
326
334
  exports.RuntimeParams = params;
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.ProjectManager = exports.PackageBuildPhaseType_Project = exports.PackageBuildPhaseType_PackageWithOutput = exports.PackageBuildPhaseType_Package = void 0;
27
27
  const ts_common_1 = require("@nu-art/ts-common");
28
28
  const params_1 = require("../core/params/params");
29
- const tools_1 = require("@nu-art/commando/core/tools");
29
+ const tools_1 = require("@nu-art/commando/shell/tools");
30
30
  const map_project_packages_1 = require("./map-project-packages");
31
31
  const consts_1 = require("../core/consts");
32
32
  const fs = __importStar(require("fs"));
@@ -8,15 +8,12 @@ export declare class CommandExecutor_FirebaseFunction {
8
8
  private readonly EMULATOR_KILL_LOG;
9
9
  private readonly pkg;
10
10
  private readonly commandos;
11
- private listeners;
12
11
  private onReadyCallbacks;
13
12
  constructor(pkg: Package_FirebaseFunctionsApp);
14
13
  private initListeners;
15
14
  private clearPorts;
16
15
  private runProxy;
17
16
  private runEmulator;
18
- private getPID;
19
- private onReady;
20
17
  execute(): Promise<this>;
21
18
  kill(): Promise<void>;
22
19
  addOnReadyCallback(cb: OnReadyCallback): void;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CommandExecutor_FirebaseFunction = void 0;
4
4
  const nvm_1 = require("@nu-art/commando/cli/nvm");
5
5
  const basic_1 = require("@nu-art/commando/cli/basic");
6
- const cli_1 = require("@nu-art/commando/core/cli");
7
6
  const ts_common_1 = require("@nu-art/ts-common");
8
7
  const params_1 = require("../../core/params/params");
9
8
  class CommandExecutor_FirebaseFunction {
@@ -22,28 +21,11 @@ class CommandExecutor_FirebaseFunction {
22
21
  }
23
22
  //######################### Inner Logic #########################
24
23
  initListeners() {
25
- this.listeners = {
26
- proxy: {
27
- pid: new cli_1.CommandoCLIKeyValueListener(new RegExp(`${this.PROXY_PID_LOG}=(\\d+)`)),
28
- kill: new cli_1.CommandoCLIListener(() => this.commandos.proxy.close(), this.PROXY_KILL_LOG),
29
- },
30
- emulator: {
31
- pid: new cli_1.CommandoCLIKeyValueListener(new RegExp(`${this.EMULATOR_PID_LOG}=(\\d+)`)),
32
- kill: new cli_1.CommandoCLIListener(() => this.commandos.emulator.close(), this.EMULATOR_KILL_LOG),
33
- },
34
- onReady: new cli_1.CommandoCLIListener(() => this.onReady(), new RegExp('.*Emulator Hub running.*')),
35
- };
36
- this.listeners.proxy.kill.listen(this.commandos.proxy);
37
- this.listeners.proxy.pid.listen(this.commandos.proxy);
38
- this.listeners.emulator.kill.listen(this.commandos.emulator);
39
- this.listeners.emulator.pid.listen(this.commandos.emulator);
40
- this.listeners.onReady.listen(this.commandos.emulator);
41
24
  }
42
25
  async clearPorts() {
43
26
  const allPorts = Array.from({ length: 10 }, (_, i) => `${this.pkg.envConfig.basePort + i}`);
44
27
  await nvm_1.NVM.createCommando(basic_1.Cli_Basic)
45
28
  .setUID(this.pkg.name)
46
- .debug()
47
29
  .append(`array=($(lsof -ti:${allPorts.join(',')}))`)
48
30
  .append(`((\${#array[@]} > 0)) && kill -9 "\${array[@]}"`)
49
31
  .append('echo ')
@@ -71,13 +53,6 @@ class CommandExecutor_FirebaseFunction {
71
53
  .append(`echo "${this.EMULATOR_KILL_LOG} \${pid}"`)
72
54
  .execute();
73
55
  }
74
- getPID(listener) {
75
- const pid = Number(listener.getValue());
76
- return isNaN(pid) ? undefined : pid;
77
- }
78
- async onReady() {
79
- await Promise.all(this.onReadyCallbacks.map(cb => cb(this.pkg)));
80
- }
81
56
  //######################### Functions #########################
82
57
  async execute() {
83
58
  await (0, ts_common_1.sleep)(2 * ts_common_1.Second * CommandExecutor_FirebaseFunction.staggerCount++);
@@ -87,10 +62,6 @@ class CommandExecutor_FirebaseFunction {
87
62
  return this;
88
63
  }
89
64
  async kill() {
90
- const emulatorPid = this.getPID(this.listeners.emulator.pid);
91
- const proxyPid = this.getPID(this.listeners.proxy.pid);
92
- await this.commandos.emulator.gracefullyKill(emulatorPid);
93
- await this.commandos.proxy.gracefullyKill(proxyPid);
94
65
  }
95
66
  addOnReadyCallback(cb) {
96
67
  this.onReadyCallbacks.push(cb);
@@ -4,10 +4,8 @@ export declare class CommandExecutor_FirebaseHosting {
4
4
  private readonly APP_KILL_LOG;
5
5
  private readonly pkg;
6
6
  private readonly commando;
7
- private listeners;
8
7
  constructor(pkg: Package_FirebaseHostingApp);
9
8
  private initListeners;
10
- private getPID;
11
9
  private clearPorts;
12
10
  private runApp;
13
11
  execute(): Promise<this>;
@@ -4,7 +4,6 @@ exports.CommandExecutor_FirebaseHosting = void 0;
4
4
  const nvm_1 = require("@nu-art/commando/cli/nvm");
5
5
  const ts_common_1 = require("@nu-art/ts-common");
6
6
  const basic_1 = require("@nu-art/commando/cli/basic");
7
- const cli_1 = require("@nu-art/commando/core/cli");
8
7
  class CommandExecutor_FirebaseHosting {
9
8
  constructor(pkg) {
10
9
  this.APP_PID_LOG = '_APP_PID_';
@@ -17,21 +16,10 @@ class CommandExecutor_FirebaseHosting {
17
16
  }
18
17
  //######################### Inner Logic #########################
19
18
  initListeners() {
20
- this.listeners = {
21
- pid: new cli_1.CommandoCLIKeyValueListener(new RegExp(`${this.APP_PID_LOG}=(\\d+)`)),
22
- kill: new cli_1.CommandoCLIListener(() => this.commando.close(), this.APP_KILL_LOG),
23
- };
24
- this.listeners.pid.listen(this.commando);
25
- this.listeners.kill.listen(this.commando);
26
- }
27
- getPID() {
28
- const pid = Number(this.listeners.pid.getValue());
29
- return isNaN(pid) ? undefined : pid;
30
19
  }
31
20
  async clearPorts() {
32
21
  await nvm_1.NVM.createCommando(basic_1.Cli_Basic)
33
22
  .setUID(this.pkg.name)
34
- .debug()
35
23
  .append(`array=($(lsof -ti:${[this.pkg.envConfig.hostingPort].join(',')}))`)
36
24
  .append(`((\${#array[@]} > 0)) && kill -9 "\${array[@]}"`)
37
25
  .append('echo ')
@@ -55,8 +43,6 @@ class CommandExecutor_FirebaseHosting {
55
43
  return this;
56
44
  }
57
45
  async kill() {
58
- const appPid = this.getPID();
59
- await this.commando.gracefullyKill(appPid);
60
46
  }
61
47
  }
62
48
  exports.CommandExecutor_FirebaseHosting = CommandExecutor_FirebaseHosting;
@@ -4,10 +4,8 @@ export declare class CommandExecutor_Python {
4
4
  private readonly APP_KILL_LOG;
5
5
  private readonly pkg;
6
6
  private readonly commando;
7
- private listeners;
8
7
  constructor(pkg: Package_Python);
9
8
  private initListeners;
10
- private getPID;
11
9
  private enterVenv;
12
10
  private setPythonPath;
13
11
  private runApp;
@@ -1,32 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CommandExecutor_Python = void 0;
4
- const cli_1 = require("@nu-art/commando/core/cli");
5
4
  const basic_1 = require("@nu-art/commando/cli/basic");
6
- const tools_1 = require("@nu-art/commando/core/tools");
5
+ const tools_1 = require("@nu-art/commando/shell/tools");
6
+ const shell_1 = require("@nu-art/commando/shell");
7
7
  class CommandExecutor_Python {
8
8
  constructor(pkg) {
9
9
  this.APP_PID_LOG = '_APP_PID_';
10
10
  this.APP_KILL_LOG = '_APP_KILLED_';
11
11
  this.pkg = pkg;
12
- this.commando = cli_1.CommandoInteractive.create(basic_1.Cli_Basic)
12
+ this.commando = shell_1.CommandoInteractive.create(basic_1.Cli_Basic)
13
13
  .setUID(this.pkg.name)
14
- .cd((0, tools_1.convertToFullPath)(this.pkg.path))
15
- .debug();
14
+ .cd((0, tools_1.convertToFullPath)(this.pkg.path));
16
15
  this.initListeners();
17
16
  }
18
17
  //######################### Inner Logic #########################
19
18
  initListeners() {
20
- this.listeners = {
21
- pid: new cli_1.CommandoCLIKeyValueListener(new RegExp(`${this.APP_PID_LOG}=(\\d+)`)),
22
- kill: new cli_1.CommandoCLIListener(() => this.commando.close(), this.APP_KILL_LOG),
23
- };
24
- this.listeners.pid.listen(this.commando);
25
- this.listeners.kill.listen(this.commando);
26
- }
27
- getPID() {
28
- const pid = Number(this.listeners.pid.getValue());
29
- return isNaN(pid) ? undefined : pid;
30
19
  }
31
20
  async enterVenv() {
32
21
  await this.commando.append('source venv/bin/activate').execute();
@@ -59,8 +48,6 @@ class CommandExecutor_Python {
59
48
  await this.runApp();
60
49
  }
61
50
  async kill() {
62
- const appPid = this.getPID();
63
- await this.commando.gracefullyKill(appPid);
64
51
  }
65
52
  }
66
53
  exports.CommandExecutor_Python = CommandExecutor_Python;
@@ -5,7 +5,7 @@ const consts_1 = require("../core/consts");
5
5
  const fs_1 = require("fs");
6
6
  const types_1 = require("../core/types");
7
7
  const ts_common_1 = require("@nu-art/ts-common");
8
- const tools_1 = require("@nu-art/commando/core/tools");
8
+ const tools_1 = require("@nu-art/commando/shell/tools");
9
9
  function getRuntimePackageBaseDetails_Sourceless(basePackage) {
10
10
  return {
11
11
  name: basePackage.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nu-art/build-and-install",
3
- "version": "0.204.87",
3
+ "version": "0.204.89",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "TacB0sS",
package/phases/phases.js CHANGED
@@ -29,7 +29,7 @@ const map_project_packages_1 = require("../logic/map-project-packages");
29
29
  const fs = __importStar(require("fs"));
30
30
  const fs_1 = require("fs");
31
31
  const consts_1 = require("../core/consts");
32
- const tools_1 = require("@nu-art/commando/core/tools");
32
+ const tools_1 = require("@nu-art/commando/shell/tools");
33
33
  const ts_common_1 = require("@nu-art/ts-common");
34
34
  const types_1 = require("../core/types");
35
35
  const generate_1 = require("../core/package/generate");
@@ -41,10 +41,10 @@ const chokidar = __importStar(require("chokidar"));
41
41
  const consts_2 = require("../defaults/consts");
42
42
  const project_manager_1 = require("../project-manager");
43
43
  const ProjectScreen_1 = require("../screen/ProjectScreen");
44
- const cli_1 = require("@nu-art/commando/core/cli");
45
44
  const RunningProcessLogs_1 = require("../screen/RunningProcessLogs");
46
45
  const command_executors_1 = require("../logic/command-executors");
47
46
  const CommandExecutor_Python_1 = require("../logic/command-executors/CommandExecutor_Python");
47
+ const shell_1 = require("@nu-art/commando/shell");
48
48
  const CONST_ThunderstormVersionKey = 'THUNDERSTORM_SDK_VERSION';
49
49
  const CONST_ThunderstormDependencyKey = 'THUNDERSTORM_DEPENDENCY_VERSION';
50
50
  const CONST_ProjectVersionKey = 'APP_VERSION';
@@ -421,7 +421,7 @@ exports.Phase_PrepareCompile = {
421
421
  '_ts',
422
422
  ];
423
423
  const command = `find . \\( -name ${otherFiles.map(suffix => `'*.${suffix}'`).join(' -o -name ')} \\) | cpio -pdm "${pkg.output}" > /dev/null`;
424
- await cli_1.Commando.create(basic_1.Cli_Basic)
424
+ await shell_1.Commando.create(basic_1.Cli_Basic)
425
425
  .cd(`${pkg.path}/src/main`)
426
426
  .append(command)
427
427
  .execute();
@@ -629,7 +629,6 @@ exports.Phase_Launch = {
629
629
  runningAppsLogs.create();
630
630
  }
631
631
  const logClient = new ts_common_1.LogClient_MemBuffer(pkg.name);
632
- logClient.setForTerminal();
633
632
  logClient.setComposer((tag, level) => {
634
633
  ts_common_1._logger_finalDate.setTime(Date.now() - ts_common_1._logger_timezoneOffset);
635
634
  const date = ts_common_1._logger_finalDate.toISOString().replace(/T/, '_').replace(/Z/, '').substring(0, 23).split('_')[1];
@@ -49,7 +49,6 @@ class ProjectScreen extends ConsoleScreen_1.ConsoleScreen {
49
49
  this.setState({
50
50
  packageData: initialData
51
51
  });
52
- this.logClient.setForTerminal();
53
52
  this.logClient.setComposer((tag, level) => {
54
53
  ts_common_1._logger_finalDate.setTime(Date.now() - ts_common_1._logger_timezoneOffset);
55
54
  const date = ts_common_1._logger_finalDate.toISOString().replace(/T/, '_').replace(/Z/, '').substring(0, 23).split('_')[1];
@@ -13,7 +13,7 @@ export declare const phaseKey_PrintEnv = "print-env";
13
13
  export declare const phase_PrintEnv: Phase<'printEnv'>;
14
14
  export type Phase_Debug = typeof phase_Debug;
15
15
  export declare const phaseKey_Debug = "debug";
16
- export declare const phase_Debug: Phase<'debug'>;
16
+ export declare const phase_Debug: Phase<'printDebug'>;
17
17
  export declare const phases_Terminating: Phase<string>[];
18
18
  export type Phase_Purge = typeof phase_Purge;
19
19
  export declare const phaseKey_Purge = "purge";
@@ -38,8 +38,7 @@ exports.phaseKey_Debug = 'debug';
38
38
  exports.phase_Debug = {
39
39
  key: exports.phaseKey_Debug,
40
40
  name: 'Debug',
41
- method: 'debug',
42
- terminateAfterPhase: true,
41
+ method: 'printDebug',
43
42
  filter: () => params_1.RuntimeParams.debug,
44
43
  };
45
44
  exports.phases_Terminating = [
@@ -47,7 +46,7 @@ exports.phases_Terminating = [
47
46
  exports.phase_PrintDependencyTree,
48
47
  exports.phase_CheckCyclicImports,
49
48
  exports.phase_PrintEnv,
50
- // phase_Debug
49
+ exports.phase_Debug
51
50
  ];
52
51
  exports.phaseKey_Purge = 'purge';
53
52
  exports.phase_Purge = {
@@ -123,6 +122,7 @@ exports.phase_Launch = {
123
122
  name: 'Launch',
124
123
  method: 'launch',
125
124
  filter: () => !!params_1.RuntimeParams.launch,
125
+ dependencyPhaseKeys: [exports.phaseKey_ResolveConfigs],
126
126
  };
127
127
  exports.phases_Launch = [
128
128
  exports.phase_Launch,
@@ -7,6 +7,7 @@ export declare class PhaseRunner extends BaseUnit implements UnitPhaseImplemento
7
7
  private readonly units;
8
8
  private unitDependencyTree;
9
9
  private readonly project;
10
+ private killed?;
10
11
  private runningStatus;
11
12
  private phaseFilter;
12
13
  constructor(projectPath: RelativePath);
@@ -16,7 +17,6 @@ export declare class PhaseRunner extends BaseUnit implements UnitPhaseImplemento
16
17
  private prepareProjectParams;
17
18
  private prepareDefaultFileRouts;
18
19
  private buildUnitDependencyTree;
19
- private printInit;
20
20
  private phaseFilters;
21
21
  private executeImpl;
22
22
  registerUnits(units: BaseUnit | BaseUnit[]): void;
@@ -60,5 +60,5 @@ export declare class PhaseRunner extends BaseUnit implements UnitPhaseImplemento
60
60
  killRunner(): Promise<void>;
61
61
  printHelp(): Promise<void>;
62
62
  printEnv(): Promise<void>;
63
- debug(): Promise<void>;
63
+ printDebug(): Promise<void>;
64
64
  }
@@ -30,15 +30,19 @@ const core_1 = require("../unit/core");
30
30
  const params_1 = require("../../core/params/params");
31
31
  const MemStorage_1 = require("@nu-art/ts-common/mem-storage/MemStorage");
32
32
  const fs_1 = __importStar(require("fs"));
33
- const tools_1 = require("@nu-art/commando/core/tools");
34
33
  const thunderstorm_1 = require("../unit/thunderstorm");
35
34
  const consts_1 = require("../../defaults/consts");
36
35
  const nvm_1 = require("@nu-art/commando/cli/nvm");
37
36
  const basic_1 = require("@nu-art/commando/cli/basic");
38
37
  const PhaseRunnerDispatcher_1 = require("./PhaseRunnerDispatcher");
39
- const consts_2 = require("./consts");
38
+ const tools_1 = require("@nu-art/commando/shell/tools");
40
39
  const types_1 = require("./types");
41
40
  const BAIScreenManager_1 = require("../screens/BAIScreenManager");
41
+ const consts_2 = require("./consts");
42
+ const CONST_ThunderstormVersionKey = 'THUNDERSTORM_SDK_VERSION';
43
+ const CONST_ThunderstormDependencyKey = 'THUNDERSTORM_DEPENDENCY_VERSION';
44
+ const CONST_ProjectVersionKey = 'APP_VERSION';
45
+ const CONST_ProjectDependencyKey = 'APP_VERSION_DEPENDENCY';
42
46
  class PhaseRunner extends core_1.BaseUnit {
43
47
  constructor(projectPath) {
44
48
  super({ label: 'Phase Runner', key: 'phase-runner' });
@@ -70,7 +74,12 @@ class PhaseRunner extends core_1.BaseUnit {
70
74
  this.units = [this];
71
75
  this.project = { path: (0, tools_1.convertToFullPath)(projectPath), config: {} };
72
76
  this.phaseFilter = this.phaseFilters[types_1.PhaseRunnerMode_Normal];
73
- this.setMinLevel(ts_common_1.LogLevel.Verbose);
77
+ this.setMinLevel(ts_common_1.LogLevel.Info);
78
+ console.log('RuntimeParams.debug', params_1.RuntimeParams.debug);
79
+ if (params_1.RuntimeParams.debug)
80
+ this.setMinLevel(ts_common_1.LogLevel.Debug);
81
+ if (params_1.RuntimeParams.verbose)
82
+ this.setMinLevel(ts_common_1.LogLevel.Debug);
74
83
  }
75
84
  //######################### Initialization #########################
76
85
  async init() {
@@ -99,7 +108,6 @@ class PhaseRunner extends core_1.BaseUnit {
99
108
  //Load running status
100
109
  await this.loadRunningStatus();
101
110
  //Print init results
102
- this.printInit();
103
111
  this.setStatus('Initialized');
104
112
  const units = this.units.filter(unit => unit !== this);
105
113
  await Promise.all(units.map(unit => {
@@ -134,10 +142,10 @@ class PhaseRunner extends core_1.BaseUnit {
134
142
  prepareProjectParams() {
135
143
  var _a;
136
144
  const params = (_a = this.project.config.params) !== null && _a !== void 0 ? _a : {};
137
- params[consts_2.CONST_ThunderstormVersionKey] = this.project.config.thunderstormVersion;
138
- params[consts_2.CONST_ThunderstormDependencyKey] = this.project.config.thunderstormVersion;
139
- params[consts_2.CONST_ProjectVersionKey] = this.project.config.projectVersion;
140
- params[consts_2.CONST_ProjectDependencyKey] = this.project.config.projectVersion;
145
+ params[CONST_ThunderstormVersionKey] = this.project.config.thunderstormVersion;
146
+ params[CONST_ThunderstormDependencyKey] = this.project.config.thunderstormVersion;
147
+ params[CONST_ProjectVersionKey] = this.project.config.projectVersion;
148
+ params[CONST_ProjectDependencyKey] = this.project.config.projectVersion;
141
149
  return params;
142
150
  }
143
151
  prepareDefaultFileRouts() {
@@ -189,11 +197,6 @@ class PhaseRunner extends core_1.BaseUnit {
189
197
  const toPrint = dependencyTree.map(row => row.map(unit => unit.config.label));
190
198
  this.logDebug('Unit Dependency Tree:', toPrint);
191
199
  }
192
- printInit() {
193
- this.logDebug('Runner Params:', RunnerParams_1.MemKey_RunnerParams.get());
194
- this.logDebug('Project Config:', RunnerParams_1.MemKey_ProjectConfig.get());
195
- this.logDebug('Default File Routes:', consts_1.MemKey_DefaultFiles.get());
196
- }
197
200
  async executeImpl() {
198
201
  for (const phase of this.phases) {
199
202
  const phaseDidRun = await this.executePhase(phase);
@@ -201,6 +204,7 @@ class PhaseRunner extends core_1.BaseUnit {
201
204
  if (phaseDidRun && phase.terminateAfterPhase)
202
205
  break;
203
206
  }
207
+ this.killed = false;
204
208
  }
205
209
  //######################### Unit Logic #########################
206
210
  registerUnits(units) {
@@ -273,17 +277,21 @@ class PhaseRunner extends core_1.BaseUnit {
273
277
  }
274
278
  const unitsToRun = (0, ts_common_1.flatArray)(units);
275
279
  await Promise.all(unitsToRun.map(unit => unit[phase.method]()));
280
+ if (this.killed)
281
+ return true;
276
282
  return true;
277
283
  }
278
284
  //Run units according to dependency tree
279
285
  for (const row of units) {
286
+ if (this.killed)
287
+ break;
280
288
  const index = units.indexOf(row);
281
289
  const runningStatusRowIndex = (_a = this.runningStatus.packageDependencyIndex) !== null && _a !== void 0 ? _a : 0;
282
290
  //Skip running status holds a larger index for the same phase
283
291
  if ((phaseIndex === runningPhaseIndex) && index < runningStatusRowIndex)
284
292
  continue;
285
- this.logWarning(`Phase Index ${phaseIndex}, Row Index ${index}`);
286
- this.logWarning(`RunningStatus Phase Index: ${runningPhaseIndex}, RunningStatus Row Index: ${runningStatusRowIndex}`);
293
+ // this.logDebug(`Phase Index ${phaseIndex}, Row Index ${index}`);
294
+ // this.logDebug(`RunningStatus Phase Index: ${runningPhaseIndex}, RunningStatus Row Index: ${runningStatusRowIndex}`);
287
295
  if (phaseIndex > runningPhaseIndex) {
288
296
  //Index of the current phase is larger, update the running status
289
297
  this.runningStatus = { phaseKey: phase.key, packageDependencyIndex: 0 };
@@ -329,7 +337,7 @@ class PhaseRunner extends core_1.BaseUnit {
329
337
  }
330
338
  //######################### Running Status #########################
331
339
  async setRunningStatus() {
332
- this.logDebug('Setting Running Status', this.runningStatus);
340
+ this.logVerbose('Setting Running Status', this.runningStatus);
333
341
  if (!fs_1.default.existsSync(consts_1.Default_OutputFiles.output))
334
342
  await fs_1.promises.mkdir(consts_1.Default_OutputFiles.output, { recursive: true });
335
343
  await fs_1.promises.writeFile(consts_1.Default_OutputFiles.runningStatus, (0, ts_common_1.__stringify)(this.runningStatus, true));
@@ -370,10 +378,11 @@ class PhaseRunner extends core_1.BaseUnit {
370
378
  });
371
379
  }
372
380
  async killRunner() {
381
+ this.killed = true;
382
+ await this.setRunningStatus();
373
383
  this.logDebug('Killing units');
374
384
  await Promise.all(this.units.map(unit => unit.kill()));
375
385
  this.logDebug('Units killed');
376
- await this.setRunningStatus();
377
386
  }
378
387
  //######################### Phase Implementation #########################
379
388
  async printHelp() {
@@ -404,11 +413,12 @@ class PhaseRunner extends core_1.BaseUnit {
404
413
  .append('echo "base version:"; bash --version')
405
414
  .execute();
406
415
  }
407
- async debug() {
408
- // const configs = this.units.map(unit => unit.config);
409
- // this.logInfo(JSON.stringify(configs, null, 2));
416
+ async printDebug() {
417
+ this.logDebug('Runner Params:', RunnerParams_1.MemKey_RunnerParams.get());
418
+ this.logDebug('Project Config:', RunnerParams_1.MemKey_ProjectConfig.get());
419
+ this.logDebug('Default File Routes:', consts_1.MemKey_DefaultFiles.get());
410
420
  const dependencyTree = this.unitDependencyTree.map(row => row.map(unit => unit.config.label));
411
- this.logInfo(dependencyTree);
421
+ this.logInfo('Unit Dependencies Tree:', dependencyTree);
412
422
  }
413
423
  }
414
424
  exports.PhaseRunner = PhaseRunner;
@@ -45,7 +45,7 @@ class BAIScreen extends ConsoleContainer_1.ConsoleContainer {
45
45
  //Create the log client
46
46
  this.logClient = new ts_common_1.LogClient_MemBuffer(`${logClientKey}.txt`);
47
47
  //Set for terminal flag
48
- this.logClient.setForTerminal();
48
+ this.logClient.keepLogsNaturalColors();
49
49
  //Set log composer to print logs with timestamps
50
50
  this.logClient.setComposer((tag, level) => {
51
51
  ts_common_1._logger_finalDate.setTime(Date.now() - ts_common_1._logger_timezoneOffset);
@@ -4,6 +4,7 @@ exports.BaseUnit = void 0;
4
4
  const ts_common_1 = require("@nu-art/ts-common");
5
5
  const RunnerParams_1 = require("../../phase-runner/RunnerParams");
6
6
  const PhaseRunnerDispatcher_1 = require("../../phase-runner/PhaseRunnerDispatcher");
7
+ const params_1 = require("../../../core/params/params");
7
8
  class BaseUnit extends ts_common_1.Logger {
8
9
  constructor(config) {
9
10
  super(config.key);
@@ -37,7 +38,6 @@ class BaseUnit extends ts_common_1.Logger {
37
38
  }
38
39
  initLogClient() {
39
40
  this.logger = new ts_common_1.LogClient_MemBuffer(this.tag);
40
- this.logger.setForTerminal();
41
41
  this.logger.setComposer((tag, level) => {
42
42
  ts_common_1._logger_finalDate.setTime(Date.now() - ts_common_1._logger_timezoneOffset);
43
43
  const date = ts_common_1._logger_finalDate.toISOString().replace(/T/, '_').replace(/Z/, '').substring(0, 23).split('_')[1];
@@ -50,6 +50,8 @@ class BaseUnit extends ts_common_1.Logger {
50
50
  }
51
51
  setStatus(status) {
52
52
  this.unitStatus = status;
53
+ if (params_1.RuntimeParams.allLogs)
54
+ this.logInfo(`Unit status update: ${status}`);
53
55
  PhaseRunnerDispatcher_1.dispatcher_UnitStatusChange.dispatch(this);
54
56
  }
55
57
  //######################### Public Functions #########################
@@ -1,8 +1,8 @@
1
1
  import { Phase_Install } from '../../phase';
2
2
  import { UnitPhaseImplementor } from '../types';
3
3
  import { BaseUnit, BaseUnit_Config, BaseUnit_RuntimeConfig } from './BaseUnit';
4
- import { Commando, CommandoInteractive } from '@nu-art/commando/core/cli';
5
4
  import { Cli_Basic } from '@nu-art/commando/cli/basic';
5
+ import { CommandoInteractive } from '@nu-art/commando/shell';
6
6
  export type Unit_Python_Config = BaseUnit_Config & {
7
7
  pathToPackage: string;
8
8
  };
@@ -12,7 +12,7 @@ export type Unit_Python_RuntimeConfig = BaseUnit_RuntimeConfig & {
12
12
  };
13
13
  };
14
14
  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]> {
15
- protected commando: CommandoInteractive & Commando & Cli_Basic;
15
+ protected commando: CommandoInteractive & Cli_Basic;
16
16
  constructor(config: Unit_Python<C, RTC>['config']);
17
17
  protected init(): Promise<void>;
18
18
  private initCommando;
@@ -2,14 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Unit_Python = void 0;
4
4
  const BaseUnit_1 = require("./BaseUnit");
5
- const cli_1 = require("@nu-art/commando/core/cli");
6
- const tools_1 = require("@nu-art/commando/core/tools");
5
+ const tools_1 = require("@nu-art/commando/shell/tools");
7
6
  const basic_1 = require("@nu-art/commando/cli/basic");
7
+ const shell_1 = require("@nu-art/commando/shell");
8
8
  class Unit_Python extends BaseUnit_1.BaseUnit {
9
9
  constructor(config) {
10
10
  super(config);
11
11
  this.addToClassStack(Unit_Python);
12
- this.commando = cli_1.CommandoInteractive.create(basic_1.Cli_Basic);
12
+ this.commando = shell_1.CommandoInteractive.create(basic_1.Cli_Basic);
13
13
  }
14
14
  async init() {
15
15
  await super.init();
@@ -25,13 +25,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.Unit_Typescript = void 0;
27
27
  const BaseUnit_1 = require("./BaseUnit");
28
- const tools_1 = require("@nu-art/commando/core/tools");
29
28
  const consts_1 = require("../../../core/consts");
30
29
  const ts_common_1 = require("@nu-art/ts-common");
31
30
  const map_project_packages_1 = require("../../../logic/map-project-packages");
32
31
  const fs = __importStar(require("fs"));
33
32
  const fs_1 = require("fs");
34
33
  const RunnerParams_1 = require("../../phase-runner/RunnerParams");
34
+ const tools_1 = require("@nu-art/commando/shell/tools");
35
35
  const PackageJsonTargetKey_Template = 'template';
36
36
  const PackageJsonTargetKey_Root = 'root';
37
37
  const PackageJsonTargetKey_Dist = 'dist';
@@ -31,11 +31,12 @@ const fs_1 = require("fs");
31
31
  const basic_1 = require("@nu-art/commando/cli/basic");
32
32
  const ts_common_1 = require("@nu-art/ts-common");
33
33
  const RunnerParams_1 = require("../../phase-runner/RunnerParams");
34
- const cli_1 = require("@nu-art/commando/core/cli");
35
34
  const consts_1 = require("../../../core/consts");
36
35
  const params_1 = require("../../../core/params/params");
37
36
  const runner_dispatchers_1 = require("../runner-dispatchers");
38
37
  const consts_2 = require("../consts");
38
+ const shell_1 = require("@nu-art/commando/shell");
39
+ const CliError_1 = require("@nu-art/commando/shell/core/CliError");
39
40
  const extensionsToLint = ['.ts', '.tsx'];
40
41
  const assetExtensions = [
41
42
  'json',
@@ -101,11 +102,15 @@ class Unit_TypescriptLib extends Unit_Typescript_1.Unit_Typescript {
101
102
  const pathToTSConfig = `${pathToCompile}/tsconfig.json`;
102
103
  try {
103
104
  await nvm_1.NVM
104
- .createCommando(basic_1.Cli_Basic)
105
+ .createInteractiveCommando(basic_1.Cli_Basic)
105
106
  .setUID(this.config.key)
106
107
  .cd(this.runtime.pathTo.pkg)
107
108
  .append(`tsc -p "${pathToTSConfig}" --rootDir "${pathToCompile}" --outDir "${this.runtime.pathTo.output}"`)
108
- .execute();
109
+ .addLogProcessor((log) => !log.includes('Now using node') && !log.includes('.nvmrc\' with version'))
110
+ .execute((stdout, stderr, exitCode) => {
111
+ if (exitCode > 0)
112
+ throw new CliError_1.CommandoException(`Error compiling`, stdout, stderr, exitCode);
113
+ });
109
114
  // set compilation error status on success
110
115
  this.compilationError = false;
111
116
  }
@@ -120,13 +125,14 @@ class Unit_TypescriptLib extends Unit_Typescript_1.Unit_Typescript {
120
125
  }
121
126
  }
122
127
  async copyAssetsToOutput() {
123
- const command = `find . \\( -name ${assetExtensions.map(suffix => `'*.${suffix}'`).join(' -o -name ')} \\) | cpio -pdmuv "${this.runtime.pathTo.output}" > /dev/null 2>&1`;
124
- await cli_1.Commando
128
+ const command = `find . \\( -name ${assetExtensions.map(suffix => `'*.${suffix}'`)
129
+ .join(' -o -name ')} \\) | cpio -pdmuv "${this.runtime.pathTo.output}" > /dev/null 2>&1`;
130
+ await shell_1.Commando
125
131
  .create(basic_1.Cli_Basic)
126
132
  .cd(`${this.runtime.pathTo.pkg}/src/main`)
127
- .setStdErrorValidator(stderr => {
128
- return !stderr.match(/\d+\sblock/);
129
- })
133
+ // .setStdErrorValidator(stderr => {
134
+ // return !stderr.match(/\d+\sblock/);
135
+ // })
130
136
  .append(command)
131
137
  .execute();
132
138
  }
@@ -207,9 +213,9 @@ class Unit_TypescriptLib extends Unit_Typescript_1.Unit_Typescript {
207
213
  this.logDebug(`Checking Cyclic Imports - ${this.config.label}`);
208
214
  await nvm_1.NVM.createCommando(basic_1.Cli_Basic)
209
215
  .cd(this.runtime.pathTo.pkg)
210
- .setStdErrorValidator(stderr => {
211
- return !stderr.includes('Finding files') && !stderr.includes('Image created');
212
- })
216
+ // .setStdErrorValidator(stderr => {
217
+ // return !stderr.includes('Finding files') && !stderr.includes('Image created');
218
+ // })
213
219
  .append(`npx madge --no-spinner --image "./imports-${this.config.key}.svg" --circular ${this.runtime.pathTo.output}`)
214
220
  .append('echo $?')
215
221
  .execute();
@@ -9,12 +9,9 @@ export type Unit_FirebaseFunctionsApp_Config = Unit_TypescriptLib_Config & {
9
9
  };
10
10
  export declare class Unit_FirebaseFunctionsApp<C extends Unit_FirebaseFunctionsApp_Config = Unit_FirebaseFunctionsApp_Config> extends Unit_TypescriptLib<C> implements UnitPhaseImplementor<[Phase_ResolveConfigs, Phase_Launch, Phase_DeployBackend]>, OnUnitWatchCompiled {
11
11
  static staggerCount: number;
12
- private readonly PROXY_PID_LOG;
13
- private readonly PROXY_KILL_LOG;
14
- private readonly EMULATOR_PID_LOG;
15
- private readonly EMULATOR_KILL_LOG;
12
+ private emulatorPid?;
13
+ private proxyPid?;
16
14
  private launchCommandos;
17
- private listeners;
18
15
  __onUnitWatchCompiled(unit: BaseUnit): Promise<void>;
19
16
  constructor(config: Unit_FirebaseFunctionsApp<C>['config']);
20
17
  resolveConfigs(): Promise<void>;
@@ -29,13 +26,12 @@ export declare class Unit_FirebaseFunctionsApp<C extends Unit_FirebaseFunctionsA
29
26
  private resolveFunctionsRuntimeConfig;
30
27
  private createAppVersionFile;
31
28
  private createDependenciesDir;
29
+ private clearPorts;
30
+ private onLaunched;
32
31
  private initLaunch;
33
32
  private initLaunchListeners;
34
- private clearPorts;
35
33
  private runProxy;
36
34
  private runEmulator;
37
- private onLaunched;
38
- private getPID;
39
35
  kill(): Promise<void>;
40
36
  private printFiles;
41
37
  private deployImpl;
@@ -8,9 +8,9 @@ const params_1 = require("../../../core/params/params");
8
8
  const ts_common_1 = require("@nu-art/ts-common");
9
9
  const consts_2 = require("../../../defaults/consts");
10
10
  const RunnerParams_1 = require("../../phase-runner/RunnerParams");
11
- const cli_1 = require("@nu-art/commando/core/cli");
12
11
  const basic_1 = require("@nu-art/commando/cli/basic");
13
12
  const nvm_1 = require("@nu-art/commando/cli/nvm");
13
+ const shell_1 = require("@nu-art/commando/shell");
14
14
  const consts_3 = require("../../phase-runner/consts");
15
15
  const runner_dispatchers_1 = require("../runner-dispatchers");
16
16
  const CONST_VersionApp = 'version-app.json';
@@ -26,10 +26,6 @@ class Unit_FirebaseFunctionsApp extends core_1.Unit_TypescriptLib {
26
26
  }
27
27
  constructor(config) {
28
28
  super(config);
29
- this.PROXY_PID_LOG = '_PROXY_PID_';
30
- this.PROXY_KILL_LOG = '_PROXY_KILLED_';
31
- this.EMULATOR_PID_LOG = '_EMULATOR_PID_';
32
- this.EMULATOR_KILL_LOG = '_EMULATOR_KILLED_';
33
29
  this.addToClassStack(Unit_FirebaseFunctionsApp);
34
30
  runner_dispatchers_1.dispatcher_WatchEvent.removeListener(this);
35
31
  runner_dispatchers_1.dispatcher_UnitWatchCompile.addListener(this);
@@ -59,8 +55,10 @@ class Unit_FirebaseFunctionsApp extends core_1.Unit_TypescriptLib {
59
55
  await this.initLaunch();
60
56
  await this.initLaunchListeners();
61
57
  await this.clearPorts();
62
- await this.runProxy();
63
- await this.runEmulator();
58
+ await Promise.all([
59
+ this.runProxy(),
60
+ this.runEmulator(),
61
+ ]);
64
62
  }
65
63
  async deployBackend() {
66
64
  await this.printFiles();
@@ -227,7 +225,7 @@ class Unit_FirebaseFunctionsApp extends core_1.Unit_TypescriptLib {
227
225
  const dependencyOutputPath = `${unit.runtime.pathTo.output}/`;
228
226
  const targetPath = `${this.runtime.pathTo.output}/.dependencies/${unit.config.key}/`;
229
227
  const pjTargetPath = `${targetPath}/${consts_1.CONST_PackageJSON}`;
230
- await cli_1.Commando.create()
228
+ await shell_1.Commando.create()
231
229
  .append(`mkdir -p ${targetPath}`)
232
230
  .append(`rsync -a --delete ${dependencyOutputPath} ${targetPath}`)
233
231
  .execute();
@@ -239,6 +237,17 @@ class Unit_FirebaseFunctionsApp extends core_1.Unit_TypescriptLib {
239
237
  this.packageJson.dist = packageJsonConverter(this.packageJson.dist);
240
238
  }
241
239
  //######################### Launch Logic #########################
240
+ async clearPorts() {
241
+ const allPorts = Array.from({ length: 10 }, (_, i) => `${this.config.firebaseConfig.basePort + i}`);
242
+ await shell_1.Commando.create(basic_1.Cli_Basic)
243
+ .append(`array=($(lsof -ti:${allPorts.join(',')}))`)
244
+ .append(`((\${#array[@]} > 0)) && kill -9 "\${array[@]}"`)
245
+ .append('echo ')
246
+ .execute();
247
+ }
248
+ onLaunched() {
249
+ this.setStatus('Launch Complete');
250
+ }
242
251
  async initLaunch() {
243
252
  this.launchCommandos = {
244
253
  emulator: nvm_1.NVM.createInteractiveCommando(basic_1.Cli_Basic).setUID(this.config.key).cd(this.runtime.pathTo.pkg),
@@ -246,70 +255,29 @@ class Unit_FirebaseFunctionsApp extends core_1.Unit_TypescriptLib {
246
255
  };
247
256
  }
248
257
  async initLaunchListeners() {
249
- this.listeners = {
250
- proxy: {
251
- pid: new cli_1.CommandoCLIKeyValueListener(new RegExp(`${this.PROXY_PID_LOG}=(\\d+)`)),
252
- kill: new cli_1.CommandoCLIListener(() => this.launchCommandos.proxy.close(), this.PROXY_KILL_LOG),
253
- },
254
- emulator: {
255
- pid: new cli_1.CommandoCLIKeyValueListener(new RegExp(`${this.EMULATOR_PID_LOG}=(\\d+)`)),
256
- kill: new cli_1.CommandoCLIListener(() => this.launchCommandos.emulator.close(), this.EMULATOR_KILL_LOG),
257
- },
258
- onReady: new cli_1.CommandoCLIListener(() => this.onLaunched(), new RegExp('.*Emulator Hub running.*')),
259
- };
260
- this.listeners.proxy.kill.listen(this.launchCommandos.proxy);
261
- this.listeners.proxy.pid.listen(this.launchCommandos.proxy);
262
- this.listeners.emulator.kill.listen(this.launchCommandos.emulator);
263
- this.listeners.emulator.pid.listen(this.launchCommandos.emulator);
264
- this.listeners.onReady.listen(this.launchCommandos.emulator);
265
- }
266
- async clearPorts() {
267
- const allPorts = Array.from({ length: 10 }, (_, i) => `${this.config.firebaseConfig.basePort + i}`);
268
- await cli_1.Commando.create(basic_1.Cli_Basic)
269
- .debug()
270
- .append(`array=($(lsof -ti:${allPorts.join(',')}))`)
271
- .append(`((\${#array[@]} > 0)) && kill -9 "\${array[@]}"`)
272
- .append('echo ')
273
- .execute();
258
+ this.launchCommandos.emulator.onLog(/.*Emulator Hub running.*/, () => this.onLaunched());
274
259
  }
275
260
  async runProxy() {
276
261
  await this.launchCommandos.proxy
277
- .append('ts-node src/main/proxy.ts &')
278
- .append('pid=$!')
279
- .append(`echo "${this.PROXY_PID_LOG}=\${pid}"`)
280
- .append(`wait \$pid`)
281
- .append(`echo "${this.PROXY_KILL_LOG} \${pid}"`)
282
- .execute();
262
+ .append('ts-node src/main/proxy.ts')
263
+ .executeAsync(pid => this.proxyPid = pid);
283
264
  }
284
265
  async runEmulator() {
285
266
  await this.launchCommandos.emulator
286
- .append(`firebase emulators:start --export-on-exit --import=.trash/data ${params_1.RuntimeParams.debugBackend ? `--inspect-functions ${this.config.firebaseConfig.debugPort}` : ''} &`)
287
- .append('pid=$!')
288
- .append(`echo "${this.EMULATOR_PID_LOG}=\${pid}"`)
289
- .append(`wait \$pid`)
290
- .append(`echo "${this.EMULATOR_KILL_LOG} \${pid}"`)
291
- .execute();
292
- }
293
- onLaunched() {
294
- this.setStatus('Launch Complete');
295
- }
296
- getPID(listener) {
297
- const pid = Number(listener.getValue());
298
- return isNaN(pid) ? undefined : pid;
267
+ .append(`firebase emulators:start --export-on-exit --import=.trash/data ${params_1.RuntimeParams.debugBackend ? `--inspect-functions ${this.config.firebaseConfig.debugPort}` : ''}`)
268
+ .executeAsync(pid => this.emulatorPid = pid);
299
269
  }
300
270
  async kill() {
301
271
  if (!this.launchCommandos)
302
272
  return;
303
273
  this.logWarning(`Killing unit - ${this.config.label}`);
304
- const emulatorPid = this.getPID(this.listeners.emulator.pid);
305
- const proxyPid = this.getPID(this.listeners.proxy.pid);
306
- await this.launchCommandos.emulator.gracefullyKill(emulatorPid);
307
- await this.launchCommandos.proxy.gracefullyKill(proxyPid);
274
+ await this.launchCommandos.emulator.gracefullyKill(this.emulatorPid);
275
+ await this.launchCommandos.proxy.gracefullyKill(this.proxyPid);
308
276
  this.logWarning(`Unit killed - ${this.config.label}`);
309
277
  }
310
278
  //######################### Deploy Logic #########################
311
279
  async printFiles() {
312
- await cli_1.Commando.create(basic_1.Cli_Basic)
280
+ await shell_1.Commando.create(basic_1.Cli_Basic)
313
281
  .cd(this.runtime.pathTo.output)
314
282
  .ls()
315
283
  .cat('package.json')
@@ -325,3 +293,48 @@ class Unit_FirebaseFunctionsApp extends core_1.Unit_TypescriptLib {
325
293
  }
326
294
  Unit_FirebaseFunctionsApp.staggerCount = 0;
327
295
  exports.Unit_FirebaseFunctionsApp = Unit_FirebaseFunctionsApp;
296
+ // export class CommandoCLIListener {
297
+ //
298
+ // private cb: CommandoCLIListener_Callback;
299
+ // protected filter?: RegExp;
300
+ //
301
+ // constructor(callback: CommandoCLIListener_Callback, filter?: string | RegExp) {
302
+ // this.cb = callback;
303
+ // if (!filter)
304
+ // return;
305
+ //
306
+ // if (typeof filter === 'string')
307
+ // this.filter = new RegExp(filter);
308
+ // else
309
+ // this.filter = filter as RegExp;
310
+ // }
311
+ //
312
+ // //######################### Inner Logic #########################
313
+ //
314
+ // private _process(stdout: string) {
315
+ // if (!this.stdoutPassesFilter(stdout))
316
+ // return false;
317
+ //
318
+ // this.process(stdout);
319
+ // return true;
320
+ // }
321
+ //
322
+ // private stdoutPassesFilter = (stdout: string): boolean => {
323
+ // if (!this.filter)
324
+ // return true;
325
+ //
326
+ // return this.filter.test(stdout);
327
+ // };
328
+ //
329
+ // //######################### Functions #########################
330
+ //
331
+ // public listen = <T extends Commando | CommandoInteractive>(commando: T): T => {
332
+ // const process = this._process.bind(this);
333
+ // commando.addLogProcessor(process);
334
+ // return commando;
335
+ // };
336
+ //
337
+ // protected process(stdout: string) {
338
+ // this.cb(stdout);
339
+ // }
340
+ // }
@@ -7,10 +7,8 @@ export type Unit_FirebaseHostingApp_Config = Unit_TypescriptLib_Config & {
7
7
  sources?: string[];
8
8
  };
9
9
  export declare class Unit_FirebaseHostingApp<C extends Unit_FirebaseHostingApp_Config = Unit_FirebaseHostingApp_Config> extends Unit_TypescriptLib<C> implements UnitPhaseImplementor<[Phase_ResolveConfigs, Phase_Launch, Phase_DeployFrontend]> {
10
- private readonly APP_PID_LOG;
11
- private readonly APP_KILL_LOG;
12
10
  private launchCommando;
13
- private listeners;
11
+ private hostingPid;
14
12
  constructor(config: Unit_FirebaseHostingApp<C>['config']);
15
13
  resolveConfigs(): Promise<void>;
16
14
  compile(): Promise<void>;
@@ -23,8 +21,6 @@ export declare class Unit_FirebaseHostingApp<C extends Unit_FirebaseHostingApp_C
23
21
  protected compileImpl(): Promise<void>;
24
22
  private createAppVersionFile;
25
23
  private initLaunch;
26
- private initLaunchListeners;
27
- private getPID;
28
24
  private clearPorts;
29
25
  private runApp;
30
26
  kill(): Promise<void>;
@@ -6,18 +6,15 @@ const params_1 = require("../../../core/params/params");
6
6
  const ts_common_1 = require("@nu-art/ts-common");
7
7
  const fs_1 = require("fs");
8
8
  const consts_1 = require("../../../core/consts");
9
- const tools_1 = require("@nu-art/commando/core/tools");
10
9
  const nvm_1 = require("@nu-art/commando/cli/nvm");
11
10
  const basic_1 = require("@nu-art/commando/cli/basic");
12
11
  const RunnerParams_1 = require("../../phase-runner/RunnerParams");
13
- const cli_1 = require("@nu-art/commando/core/cli");
12
+ const tools_1 = require("@nu-art/commando/shell/tools");
14
13
  const runner_dispatchers_1 = require("../runner-dispatchers");
15
14
  const CONST_VersionApp = 'version-app.json';
16
15
  class Unit_FirebaseHostingApp extends core_1.Unit_TypescriptLib {
17
16
  constructor(config) {
18
17
  super(config);
19
- this.APP_PID_LOG = '_APP_PID_';
20
- this.APP_KILL_LOG = '_APP_KILLED_';
21
18
  this.addToClassStack(Unit_FirebaseHostingApp);
22
19
  runner_dispatchers_1.dispatcher_WatchEvent.removeListener(this);
23
20
  }
@@ -38,7 +35,6 @@ class Unit_FirebaseHostingApp extends core_1.Unit_TypescriptLib {
38
35
  async launch() {
39
36
  this.setStatus('Launching');
40
37
  await this.initLaunch();
41
- await this.initLaunchListeners();
42
38
  await this.clearPorts();
43
39
  await this.runApp();
44
40
  }
@@ -61,9 +57,13 @@ class Unit_FirebaseHostingApp extends core_1.Unit_TypescriptLib {
61
57
  }
62
58
  async resolveHostingJSON() {
63
59
  const envConfig = this.getEnvConfig();
64
- const fileContent = envConfig.isLocal ? {} : this.config.firebaseConfig.hosting;
65
60
  const targetPath = `${this.runtime.pathTo.pkg}/${consts_1.CONST_FirebaseJSON}`;
66
- await fs_1.promises.writeFile(targetPath, JSON.stringify({ hosting: fileContent }, null, 2), { encoding: 'utf-8' });
61
+ let fileContent;
62
+ if (envConfig.isLocal)
63
+ fileContent = {};
64
+ else
65
+ fileContent = { hosting: this.config.firebaseConfig.hosting };
66
+ await fs_1.promises.writeFile(targetPath, JSON.stringify(fileContent, null, 2), { encoding: 'utf-8' });
67
67
  }
68
68
  async resolveHostingRuntimeConfig() {
69
69
  var _a;
@@ -115,21 +115,8 @@ class Unit_FirebaseHostingApp extends core_1.Unit_TypescriptLib {
115
115
  .setUID(this.config.key)
116
116
  .cd(this.runtime.pathTo.pkg);
117
117
  }
118
- async initLaunchListeners() {
119
- this.listeners = {
120
- pid: new cli_1.CommandoCLIKeyValueListener(new RegExp(`${this.APP_PID_LOG}=(\\d+)`)),
121
- kill: new cli_1.CommandoCLIListener(() => this.launchCommando.close(), this.APP_KILL_LOG),
122
- };
123
- this.listeners.pid.listen(this.launchCommando);
124
- this.listeners.kill.listen(this.launchCommando);
125
- }
126
- getPID() {
127
- const pid = Number(this.listeners.pid.getValue());
128
- return isNaN(pid) ? undefined : pid;
129
- }
130
118
  async clearPorts() {
131
119
  await this.launchCommando
132
- .debug()
133
120
  .append(`array=($(lsof -ti:${[this.config.firebaseConfig.hostingPort].join(',')}))`)
134
121
  .append(`((\${#array[@]} > 0)) && kill -9 "\${array[@]}"`)
135
122
  .append('echo ')
@@ -137,20 +124,15 @@ class Unit_FirebaseHostingApp extends core_1.Unit_TypescriptLib {
137
124
  }
138
125
  async runApp() {
139
126
  await this.launchCommando
140
- .append(`npm run start &`)
141
- .append('pid=$!')
142
- .append(`echo "${this.APP_PID_LOG}=\${pid}"`)
143
- .append(`wait \$pid`)
144
- .append(`echo "${this.APP_KILL_LOG} \${pid}"`)
145
- .execute();
127
+ .append('npm run start')
128
+ .executeAsync(pid => this.hostingPid = pid);
146
129
  }
147
130
  async kill() {
148
131
  var _a;
149
132
  if (!this.launchCommando)
150
133
  return;
151
134
  this.logWarning(`Killing unit - ${this.config.label}`);
152
- const appPid = this.getPID();
153
- await ((_a = this.launchCommando) === null || _a === void 0 ? void 0 : _a.gracefullyKill(appPid));
135
+ await ((_a = this.launchCommando) === null || _a === void 0 ? void 0 : _a.gracefullyKill(this.hostingPid));
154
136
  this.logWarning(`Unit killed - ${this.config.label}`);
155
137
  }
156
138
  //######################### Deploy Logic #########################