@nu-art/build-and-install 0.400.8 → 0.400.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nu-art/build-and-install",
3
- "version": "0.400.8",
3
+ "version": "0.400.9",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -31,8 +31,8 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "chokidar": "^3.6.0",
34
- "@nu-art/ts-common": "0.400.8",
35
- "@nu-art/commando": "0.400.8"
34
+ "@nu-art/ts-common": "0.400.9",
35
+ "@nu-art/commando": "0.400.9"
36
36
  },
37
37
  "unitConfig": {
38
38
  "type": "typescript-lib"
@@ -8,6 +8,7 @@ export type Unit_PackageJson_Config = Config_ProjectUnit & {
8
8
  };
9
9
  export declare class Unit_PackageJson<C extends Unit_PackageJson_Config = Unit_PackageJson_Config> extends ProjectUnit<C> implements UnitPhaseImplementor<[Phase_Purge, Phase_Prepare]> {
10
10
  constructor(config: C);
11
+ protected npmCommand(command: string): string;
11
12
  protected deriveDistDependencies(): StringMap;
12
13
  protected deriveLibDependencies(): StringMap;
13
14
  prepare(): Promise<void>;
@@ -10,6 +10,9 @@ export class Unit_PackageJson extends ProjectUnit {
10
10
  this.addToClassStack(Unit_PackageJson);
11
11
  }
12
12
  //######################### Internal Logic #########################
13
+ npmCommand(command) {
14
+ return resolve(this.runtimeContext.parentUnit.config.fullPath, './node_modules/.bin', command);
15
+ }
13
16
  deriveDistDependencies() {
14
17
  const params = this.runtimeContext.childUnits.reduce((dependencies, unit) => {
15
18
  dependencies[unit.config.key] = unit.config.packageJson.version;
@@ -1,7 +1,7 @@
1
1
  import * as fs from 'fs';
2
2
  import { copyFileSync, existsSync, promises as _fs, readdirSync, statSync } from 'fs';
3
3
  import { __stringify, arrayToMap, BadImplementationException, ImplementationMissingException, LogLevel, NotImplementedYetException } from '@nu-art/ts-common';
4
- import { CONST_BaiConfig, CONST_FirebaseJSON, CONST_FirebaseRC, CONST_NodeModules, CONST_PackageJSON, CONST_PackageJSONTemplate, CONST_TS_CONFIG } from '../../core/consts.js';
4
+ import { CONST_BaiConfig, CONST_FirebaseJSON, CONST_FirebaseRC, CONST_PackageJSON, CONST_PackageJSONTemplate, CONST_TS_CONFIG } from '../../core/consts.js';
5
5
  import { CommandoException } from '@nu-art/commando/shell/core/CliError';
6
6
  import { Commando_NVM } from '@nu-art/commando/shell/plugins/nvm';
7
7
  import { Commando_Basic } from '@nu-art/commando/shell/plugins/basic';
@@ -160,8 +160,7 @@ export class Unit_TypescriptLib extends Unit_PackageJson {
160
160
  return LogLevel.Error;
161
161
  })
162
162
  .addLogProcessor((log) => !log.includes('Now using node') && !log.includes('.nvmrc\' with version'));
163
- const command = resolve(this.runtimeContext.parentUnit.config.fullPath, CONST_NodeModules, 'typescript', 'bin', 'tsc');
164
- await this.executeAsyncCommando(commando, `${command} -p "${pathToTSConfig}" --rootDir "${pathToCompile}" --outDir "${this.config.output}"`, (stdout, stderr, exitCode) => {
163
+ await this.executeAsyncCommando(commando, `${this.npmCommand('tsc')} -p "${pathToTSConfig}" --rootDir "${pathToCompile}" --outDir "${this.config.output}"`, (stdout, stderr, exitCode) => {
165
164
  if (stderr.length)
166
165
  this.logError(stderr);
167
166
  if (exitCode > 0)
@@ -43,6 +43,7 @@ export declare class Unit_FirebaseFunctionsApp<C extends Unit_FirebaseFunctionsA
43
43
  protected copyPackageJSONToOutput(): Promise<void>;
44
44
  prepare(): Promise<void>;
45
45
  resolveConfigs(): Promise<void>;
46
+ compile(): Promise<void>;
46
47
  postCompile(): Promise<void>;
47
48
  launch(): Promise<void>;
48
49
  releaseEmulatorPorts(): Promise<void>;
@@ -1,4 +1,4 @@
1
- import { CONST_FirebaseJSON, CONST_FirebaseRC, CONST_NodeModules, CONST_PackageJSON, CONST_VersionApp } from '../../../core/consts.js';
1
+ import { CONST_FirebaseJSON, CONST_FirebaseRC, CONST_PackageJSON, CONST_VersionApp } from '../../../core/consts.js';
2
2
  import { __stringify, _keys, _logger_logPrefixes, deepClone, ImplementationMissingException, LogLevel, Second, sleep } from '@nu-art/ts-common';
3
3
  import { Const_FirebaseConfigKeys, Const_FirebaseDefaultsKeyToFile } from '../../../defaults/consts.js';
4
4
  import { Commando_NVM } from '@nu-art/commando/shell/plugins/nvm';
@@ -79,8 +79,11 @@ export class Unit_FirebaseFunctionsApp extends Unit_TypescriptLib {
79
79
  await this.resolveFunctionsRuntimeConfig();
80
80
  await this.resolveFunctionsJSON();
81
81
  }
82
- async postCompile() {
82
+ async compile() {
83
83
  await this.createAppVersionFile();
84
+ await super.compile();
85
+ }
86
+ async postCompile() {
84
87
  await this.createDependenciesDir();
85
88
  }
86
89
  async launch() {
@@ -108,7 +111,7 @@ export class Unit_FirebaseFunctionsApp extends Unit_TypescriptLib {
108
111
  this.functions[match[1]] = match[2];
109
112
  });
110
113
  const debug = this.runtimeContext.runtimeParams.verbose ? ' --debug' : '';
111
- await this.executeAsyncCommando(commando, `firebase${debug} deploy --only functions --force`, (stdout, stderr, exitCode) => {
114
+ await this.executeAsyncCommando(commando, `${this.npmCommand('firebase')}${debug} deploy --only functions --force`, (stdout, stderr, exitCode) => {
112
115
  if (exitCode === 0)
113
116
  return;
114
117
  throw new CommandoException(`Failed to deploy function with exit code ${exitCode}`, stdout, stderr, exitCode);
@@ -275,8 +278,7 @@ export class Unit_FirebaseFunctionsApp extends Unit_TypescriptLib {
275
278
  await this.resolveProxyFile();
276
279
  const commando = this.allocateCommando(Commando_NVM).applyNVM()
277
280
  .cd(this.config.fullPath);
278
- const command = `${this.runtimeContext.parentUnit.config.fullPath}/${CONST_NodeModules}/.bin/tsx`;
279
- await this.executeAsyncCommando(commando, `${command} src/main/proxy.ts`);
281
+ await this.executeAsyncCommando(commando, `${this.npmCommand('tsx')} src/main/proxy.ts`);
280
282
  this.logWarning('PROXY TERMINATED');
281
283
  }
282
284
  async runEmulator() {
@@ -290,7 +292,7 @@ export class Unit_FirebaseFunctionsApp extends Unit_TypescriptLib {
290
292
  return LogLevel.Warning;
291
293
  })
292
294
  .onLog(/.*Emulator Hub running.*/, () => this.setStatus('Launch Complete'));
293
- await this.executeAsyncCommando(commando, `firebase emulators:start --project ${this.config.envConfig.projectId} --export-on-exit --import=${this.config.pathToEmulatorData} ${this.runtimeContext.runtimeParams.debugBackend
295
+ await this.executeAsyncCommando(commando, `${this.npmCommand('firebase')} emulators:start --project ${this.config.envConfig.projectId} --export-on-exit --import=${this.config.pathToEmulatorData} ${this.runtimeContext.runtimeParams.debugBackend
294
296
  ? `--inspect-functions ${this.config.debugPort}` : ''}`);
295
297
  this.logWarning('EMULATORS TERMINATED');
296
298
  }
@@ -47,7 +47,7 @@ export class Unit_FirebaseHostingApp extends Unit_TypescriptLib {
47
47
  this.hosting[match[1]] = match[2];
48
48
  });
49
49
  const debug = this.runtimeContext.runtimeParams.verbose ? ' --debug' : '';
50
- await this.executeAsyncCommando(commando, `firebase${debug} deploy --only hosting`);
50
+ await this.executeAsyncCommando(commando, `${this.npmCommand('firebase')}${debug} deploy --only hosting`);
51
51
  }
52
52
  //######################### ResolveConfig Logic #########################
53
53
  getEnvConfig() {