@nu-art/build-and-install 0.400.6 → 0.400.7

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.
@@ -1,4 +1,4 @@
1
- import { _keys, arrayToMap, BeLogged, DebugFlag, filterDuplicates, LogClient_Terminal, Logger, LogLevel, merge } from '@nu-art/ts-common';
1
+ import { _keys, arrayToMap, BeLogged, DebugFlag, filterDuplicates, ImplementationMissingException, LogClient_Terminal, Logger, LogLevel, merge } from '@nu-art/ts-common';
2
2
  import { AllBaiParams } from './core/params/params.js';
3
3
  import { phases_Build, phases_Deploy, phases_Launch, phases_Terminating } from './v3/phase/index.js';
4
4
  import { UnitsMapper } from './v3/UnitsMapper/UnitsMapper.js';
@@ -76,6 +76,8 @@ export class BuildAndInstall extends Logger {
76
76
  const nodeProjectUnit = allProjectUnits.find(unit => unit.isInstanceOf(Unit_NodeProject));
77
77
  // @ts-ignore
78
78
  this['nodeProjectUnit'] = nodeProjectUnit;
79
+ if (!this.nodeProjectUnit)
80
+ throw new ImplementationMissingException('NodeProject unit not found. Make sure you have a Unit_NodeProject in your project.');
79
81
  this.nodeProjectUnit.assignUnit(allProjectUnits);
80
82
  this.logDebug(`Parent unit: ${this.nodeProjectUnit.config.key}`);
81
83
  this.logDebug(`Child units: ${allProjectUnits.map(unit => unit.config.key).join(', ')}`);
@@ -129,8 +131,15 @@ export class BuildAndInstall extends Logger {
129
131
  if (killCounter > 5)
130
132
  process.exit(1);
131
133
  });
132
- await phaseManager.execute(executionPlan);
133
- this.logInfo('Completed successfully');
134
- this.logInfo('---------------------------------- Process Completed successfully ----------------------------------');
134
+ try {
135
+ await phaseManager.execute(executionPlan);
136
+ this.logInfo('Completed successfully');
137
+ this.logInfo('---------------------------------- Process Completed successfully ----------------------------------');
138
+ }
139
+ catch (e) {
140
+ this.logInfo('Process Failed');
141
+ this.logInfo('---------------------------------- Process Failed ----------------------------------');
142
+ throw e;
143
+ }
135
144
  }
136
145
  }
@@ -1,5 +1,8 @@
1
- import { CustomException } from '@nu-art/ts-common';
1
+ import { CustomException, Logger } from '@nu-art/ts-common';
2
2
  import { ScheduledStep } from '../../v3/PhaseManager.js';
3
+ import { UnitPhaseException } from './UnitPhaseException.js';
3
4
  export declare class PhaseAggregatedException extends CustomException {
4
- constructor(errors: Error[], step: ScheduledStep);
5
+ errors: UnitPhaseException[];
6
+ constructor(errors: UnitPhaseException[], step: ScheduledStep);
7
+ print(logger: Logger): void;
5
8
  }
@@ -1,8 +1,24 @@
1
- import { CustomException } from '@nu-art/ts-common';
1
+ import { CustomException, isErrorOfType } from '@nu-art/ts-common';
2
+ import { CommandoException } from '@nu-art/commando/shell/core/CliError';
2
3
  export class PhaseAggregatedException extends CustomException {
4
+ errors;
3
5
  constructor(errors, step) {
4
6
  super(PhaseAggregatedException, `One or more errors occurred in step execution: ${JSON.stringify(step)}`);
5
7
  // @ts-ignore
6
- this.cause = errors;
8
+ this.errors = errors;
9
+ }
10
+ print(logger) {
11
+ logger.logError(this.message);
12
+ this.errors.forEach(error => {
13
+ const commandoError = isErrorOfType(error, CommandoException);
14
+ if (commandoError) {
15
+ logger.logWarning(`message: ${commandoError.message}`);
16
+ commandoError.cause && logger.logWarning('caused by: ', commandoError.cause);
17
+ logger.logError('stdout: ', commandoError.stdout);
18
+ logger.logError('stderr', commandoError.stderr);
19
+ return;
20
+ }
21
+ logger.logWarning('error: ', error);
22
+ });
7
23
  }
8
24
  }
@@ -0,0 +1,5 @@
1
+ import { CustomException } from '@nu-art/ts-common';
2
+ import { BaseUnit } from '../../v3/units/index.js';
3
+ export declare class UnitPhaseException extends CustomException {
4
+ constructor(cause: Error, unit: BaseUnit, phase: string);
5
+ }
@@ -0,0 +1,6 @@
1
+ import { CustomException } from '@nu-art/ts-common';
2
+ export class UnitPhaseException extends CustomException {
3
+ constructor(cause, unit, phase) {
4
+ super(UnitPhaseException, `Error in ${unit.config.key} (${phase})`, cause);
5
+ }
6
+ }
@@ -1,7 +1,6 @@
1
1
  import { BaseCliParam, CliParams } from '@nu-art/commando/cli-params/types';
2
2
  export declare const BaiParam_AllUnits: BaseCliParam<'allUnits', boolean>;
3
3
  export declare const BaiParam_DependencyTree: BaseCliParam<'dependencyTree', boolean>;
4
- export declare const BaiParam_continue: BaseCliParam<'continue', boolean>;
5
4
  export declare const BaiParam_SetEnv: BaseCliParam<'environment', string>;
6
5
  export declare const BaiParam_Install: BaseCliParam<'install', boolean>;
7
6
  export declare const BaiParam_Clean: BaseCliParam<'clean', boolean>;
@@ -14,6 +13,7 @@ export declare const BaiParam_DryRun: BaseCliParam<'dryRun', boolean>;
14
13
  export declare const BaiParam_Lint: BaseCliParam<'lint', boolean>;
15
14
  export declare const BaiParam_Watch: BaseCliParam<'watch', boolean>;
16
15
  export declare const BaiParam_WatchBuildTree: BaseCliParam<'watchBuildTree', boolean>;
16
+ export declare const BaiParam_continue: BaseCliParam<'continue', boolean>;
17
17
  export declare const BaiParam_Test: BaseCliParam<'test', boolean>;
18
18
  export declare const TestTypes: string[];
19
19
  export type TestType = typeof TestTypes[number];
@@ -35,6 +35,6 @@ export declare const BaiParam_includePackage: BaseCliParam<'includePackage', str
35
35
  export declare const BaiParam_ToESM: BaseCliParam<'toESM', boolean>;
36
36
  export declare const BaiParam_Simulate: BaseCliParam<'simulation', boolean>;
37
37
  export declare const BaiParam_CheckCyclicImports: BaseCliParam<'checkCyclicImports', boolean>;
38
- export declare const AllBaiParams: (BaseCliParam<"allUnits", boolean> | BaseCliParam<"dependencyTree", boolean> | BaseCliParam<"continue", boolean> | BaseCliParam<"environment", string> | BaseCliParam<"install", boolean> | BaseCliParam<"clean", boolean> | BaseCliParam<"purge", boolean> | BaseCliParam<"generate", boolean> | BaseCliParam<"generateDocs", boolean> | BaseCliParam<"noBuild", boolean> | BaseCliParam<"prepare", boolean> | BaseCliParam<"dryRun", boolean> | BaseCliParam<"lint", boolean> | BaseCliParam<"watch", boolean> | BaseCliParam<"watchBuildTree", boolean> | BaseCliParam<"test", boolean> | BaseCliParam<"testType", string[]> | BaseCliParam<"testFiles", string[]> | BaseCliParam<"testCases", string[]> | BaseCliParam<"testDebugPort", number> | BaseCliParam<"launch", boolean> | BaseCliParam<"debugBackend", boolean> | BaseCliParam<"deploy", boolean> | BaseCliParam<"debug", boolean> | BaseCliParam<"debugLifecycle", boolean> | BaseCliParam<"verbose", boolean> | BaseCliParam<"publish", PromoteType> | BaseCliParam<"usePackage", string[]> | BaseCliParam<"includePackage", string[]> | BaseCliParam<"toESM", boolean> | BaseCliParam<"simulation", boolean> | BaseCliParam<"checkCyclicImports", boolean>)[];
38
+ export declare const AllBaiParams: (BaseCliParam<"allUnits", boolean> | BaseCliParam<"dependencyTree", boolean> | BaseCliParam<"environment", string> | BaseCliParam<"install", boolean> | BaseCliParam<"clean", boolean> | BaseCliParam<"purge", boolean> | BaseCliParam<"generate", boolean> | BaseCliParam<"generateDocs", boolean> | BaseCliParam<"noBuild", boolean> | BaseCliParam<"prepare", boolean> | BaseCliParam<"dryRun", boolean> | BaseCliParam<"lint", boolean> | BaseCliParam<"watch", boolean> | BaseCliParam<"watchBuildTree", boolean> | BaseCliParam<"continue", boolean> | BaseCliParam<"test", boolean> | BaseCliParam<"testType", string[]> | BaseCliParam<"testFiles", string[]> | BaseCliParam<"testCases", string[]> | BaseCliParam<"testDebugPort", number> | BaseCliParam<"launch", boolean> | BaseCliParam<"debugBackend", boolean> | BaseCliParam<"deploy", boolean> | BaseCliParam<"debug", boolean> | BaseCliParam<"debugLifecycle", boolean> | BaseCliParam<"verbose", boolean> | BaseCliParam<"publish", PromoteType> | BaseCliParam<"usePackage", string[]> | BaseCliParam<"includePackage", string[]> | BaseCliParam<"toESM", boolean> | BaseCliParam<"simulation", boolean> | BaseCliParam<"checkCyclicImports", boolean>)[];
39
39
  export type BaiParams = CliParams<typeof AllBaiParams>;
40
40
  export {};
@@ -12,13 +12,6 @@ export const BaiParam_DependencyTree = {
12
12
  group: 'General',
13
13
  description: 'Will print the projects packages dependencies tree into the .trash folder'
14
14
  };
15
- export const BaiParam_continue = {
16
- keys: ['--continue', '-con'],
17
- keyName: 'continue',
18
- type: 'boolean',
19
- group: 'Build',
20
- description: 'Will pick up where last build process failed'
21
- };
22
15
  export const BaiParam_SetEnv = {
23
16
  keys: ['--set-env', '-se'],
24
17
  keyName: 'environment',
@@ -108,6 +101,14 @@ export const BaiParam_WatchBuildTree = {
108
101
  description: 'Once watch triggers, will build the entire tree that depends on the libs that changed',
109
102
  dependencies: [{ param: BaiParam_Watch, value: true }, { param: BaiParam_NoBuild, value: true }, { param: BaiParam_Prepare, value: false }]
110
103
  };
104
+ export const BaiParam_continue = {
105
+ keys: ['--continue', '-con'],
106
+ keyName: 'continue',
107
+ type: 'boolean',
108
+ group: 'Build',
109
+ description: 'Will pick up where last build process failed',
110
+ dependencies: [{ param: BaiParam_Watch, value: false }]
111
+ };
111
112
  export const BaiParam_Test = {
112
113
  keys: ['--test', '-t'],
113
114
  keyName: 'test',
@@ -158,7 +159,7 @@ export const BaiParam_Launch = {
158
159
  keyName: 'launch',
159
160
  type: 'boolean',
160
161
  group: 'Apps',
161
- description: 'It will add the provided App to the launch list \nrequired input: path-to-app-to-launch(string)'
162
+ description: 'Will perform the launch phast on packages that supports it. use the --use-package flag to filter out for specific packages'
162
163
  };
163
164
  export const BaiParam_DebugBackend = {
164
165
  keys: ['--debug-backend', '-lbd'],
@@ -172,7 +173,7 @@ export const BaiParam_Deploy = {
172
173
  keyName: 'deploy',
173
174
  type: 'boolean',
174
175
  group: 'Apps',
175
- description: 'Will add the provided App to the deploy list or all applications',
176
+ description: 'Will perform the deploy phast on packages that supports it. use the --use-package flag to filter out for specific packages',
176
177
  dependencies: [
177
178
  { param: BaiParam_Launch, value: false },
178
179
  { param: BaiParam_Watch, value: false },
@@ -195,7 +196,7 @@ export const BaiParam_DebugLifecycle = {
195
196
  description: 'Will only print the run config and die'
196
197
  };
197
198
  export const BaiParam_Verbose = {
198
- keys: ['--verbose', '-d'],
199
+ keys: ['--verbose', '-v'],
199
200
  keyName: 'verbose',
200
201
  group: 'Other',
201
202
  type: 'boolean',
@@ -206,7 +207,14 @@ export const BaiParam_QuickDeploy = {
206
207
  keyName: 'quickDeploy',
207
208
  type: 'boolean',
208
209
  group: 'Other',
209
- description: 'Will deploy both frontend & backend, without any other lifecycle action'
210
+ description: 'Will perform the deploy phase without other lifecycle options',
211
+ dependencies: [
212
+ ...BaiParam_Deploy.dependencies,
213
+ { param: BaiParam_Purge, value: false },
214
+ { param: BaiParam_Lint, value: false },
215
+ { param: BaiParam_Test, value: false },
216
+ { param: BaiParam_NoBuild, value: true },
217
+ ]
210
218
  };
211
219
  export const BaiParam_Publish = {
212
220
  keys: ['--publish'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nu-art/build-and-install",
3
- "version": "0.400.6",
3
+ "version": "0.400.7",
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.6",
35
- "@nu-art/commando": "0.400.6"
34
+ "@nu-art/ts-common": "0.400.7",
35
+ "@nu-art/commando": "0.400.7"
36
36
  },
37
37
  "unitConfig": {
38
38
  "type": "typescript-lib"
@@ -1,5 +1,6 @@
1
1
  import { addItemToArray, asArray, exists, flatArray, Logger, removeItemFromArray, timeCounter } from '@nu-art/ts-common';
2
2
  import { PhaseAggregatedException } from '../core/exceptions/PhaseAggregatedException.js';
3
+ import { UnitPhaseException } from '../core/exceptions/UnitPhaseException.js';
3
4
  export class PhaseManager extends Logger {
4
5
  phases;
5
6
  units;
@@ -110,7 +111,7 @@ export class PhaseManager extends Logger {
110
111
  }
111
112
  catch (error) {
112
113
  this.logError(`Phase(${phase.name}) - Error - ${unit.config.key}`, error);
113
- errors.push(error);
114
+ errors.push(new UnitPhaseException(error, unit, phase.key));
114
115
  failedStep = scheduledStep;
115
116
  this.killed = true;
116
117
  failed = true;
@@ -123,8 +124,9 @@ export class PhaseManager extends Logger {
123
124
  if (!failed)
124
125
  await this.runningStatus.onUnitCompleted(unit.config.key);
125
126
  }));
126
- if (failedStep && errors.length)
127
+ if (failedStep && errors.length) {
127
128
  throw new PhaseAggregatedException(errors, failedStep);
129
+ }
128
130
  await this.runningStatus.onStepEnded();
129
131
  }
130
132
  this.logInfo('All steps completed.');
@@ -23,8 +23,10 @@ export class UnitMapper_FirebaseHosting_Class extends UnitMapper_Node {
23
23
  const outputDir = context.packageJson.publishConfig?.directory;
24
24
  const env = this.runtimeParams[BaiParam_SetEnv.keyName];
25
25
  const envUnitConfig = context.packageJson.unitConfig.envs[env];
26
- if (!envUnitConfig)
26
+ if (!envUnitConfig) {
27
+ this.logWarning('Package Json config:', context.packageJson.unitConfig);
27
28
  throw new ImplementationMissingException(`Missing configuration for env: ${env}`);
29
+ }
28
30
  const envConfig = {
29
31
  config: envUnitConfig.config,
30
32
  projectId: envUnitConfig.projectId,
@@ -3,7 +3,7 @@ import { UnitPhaseImplementor } from './types.js';
3
3
  import { Phase } from '../phase/index.js';
4
4
  import { ProjectUnit } from '../units/index.js';
5
5
  export declare const BaiParam_Help: BaseCliParam<'help', boolean>;
6
- declare const AllBaiParams_Help: (BaseCliParam<"allUnits", boolean> | BaseCliParam<"dependencyTree", boolean> | BaseCliParam<"continue", boolean> | BaseCliParam<"environment", string> | BaseCliParam<"install", boolean> | BaseCliParam<"clean", boolean> | BaseCliParam<"purge", boolean> | BaseCliParam<"generate", boolean> | BaseCliParam<"generateDocs", boolean> | BaseCliParam<"noBuild", boolean> | BaseCliParam<"prepare", boolean> | BaseCliParam<"dryRun", boolean> | BaseCliParam<"lint", boolean> | BaseCliParam<"watch", boolean> | BaseCliParam<"watchBuildTree", boolean> | BaseCliParam<"test", boolean> | BaseCliParam<"testType", string[]> | BaseCliParam<"testFiles", string[]> | BaseCliParam<"testCases", string[]> | BaseCliParam<"testDebugPort", number> | BaseCliParam<"launch", boolean> | BaseCliParam<"debugBackend", boolean> | BaseCliParam<"deploy", boolean> | BaseCliParam<"debug", boolean> | BaseCliParam<"debugLifecycle", boolean> | BaseCliParam<"verbose", boolean> | BaseCliParam<"publish", "patch" | "minor" | "major"> | BaseCliParam<"usePackage", string[]> | BaseCliParam<"includePackage", string[]> | BaseCliParam<"toESM", boolean> | BaseCliParam<"simulation", boolean> | BaseCliParam<"checkCyclicImports", boolean> | BaseCliParam<"help", boolean>)[];
6
+ declare const AllBaiParams_Help: (BaseCliParam<"allUnits", boolean> | BaseCliParam<"dependencyTree", boolean> | BaseCliParam<"environment", string> | BaseCliParam<"install", boolean> | BaseCliParam<"clean", boolean> | BaseCliParam<"purge", boolean> | BaseCliParam<"generate", boolean> | BaseCliParam<"generateDocs", boolean> | BaseCliParam<"noBuild", boolean> | BaseCliParam<"prepare", boolean> | BaseCliParam<"dryRun", boolean> | BaseCliParam<"lint", boolean> | BaseCliParam<"watch", boolean> | BaseCliParam<"watchBuildTree", boolean> | BaseCliParam<"continue", boolean> | BaseCliParam<"test", boolean> | BaseCliParam<"testType", string[]> | BaseCliParam<"testFiles", string[]> | BaseCliParam<"testCases", string[]> | BaseCliParam<"testDebugPort", number> | BaseCliParam<"launch", boolean> | BaseCliParam<"debugBackend", boolean> | BaseCliParam<"deploy", boolean> | BaseCliParam<"debug", boolean> | BaseCliParam<"debugLifecycle", boolean> | BaseCliParam<"verbose", boolean> | BaseCliParam<"publish", "patch" | "minor" | "major"> | BaseCliParam<"usePackage", string[]> | BaseCliParam<"includePackage", string[]> | BaseCliParam<"toESM", boolean> | BaseCliParam<"simulation", boolean> | BaseCliParam<"checkCyclicImports", boolean> | BaseCliParam<"help", boolean>)[];
7
7
  export type Help_BaiParams = CliParams<typeof AllBaiParams_Help>;
8
8
  export type Phase_Help = typeof phase_Help;
9
9
  export declare const phaseKey_Help = "help";
@@ -11,6 +11,7 @@ export type Unit_TypescriptLib_Config = Unit_PackageJson_Config & {
11
11
  export declare class Unit_TypescriptLib<C extends Unit_TypescriptLib_Config = Unit_TypescriptLib_Config> extends Unit_PackageJson<C> implements UnitPhaseImplementor<[Phase_PreCompile, Phase_Compile, Phase_PrintDependencyTree, Phase_CheckCyclicImports, Phase_Lint, Phase_Test, Phase_Publish, Phase_ToESM]> {
12
12
  private TestTypeWorkspaceSetup;
13
13
  runTests(): Promise<void>;
14
+ protected dependencyUnits: Unit_TypescriptLib[];
14
15
  constructor(config: Unit_TypescriptLib<C>['config']);
15
16
  protected clearOutputDir(): Promise<void>;
16
17
  protected clearOutputDirImpl(): Promise<void>;
@@ -126,6 +126,7 @@ export class Unit_TypescriptLib extends Unit_PackageJson {
126
126
  });
127
127
  }
128
128
  }
129
+ dependencyUnits;
129
130
  constructor(config) {
130
131
  super(config);
131
132
  this.addToClassStack(Unit_TypescriptLib);
@@ -147,6 +148,8 @@ export class Unit_TypescriptLib extends Unit_PackageJson {
147
148
  // @ts-ignore
148
149
  this.publish = undefined;
149
150
  }
151
+ const unitKeys = this.runtimeContext.unitsMapper.getTransitiveDependencies([this.config.key]);
152
+ this.dependencyUnits = this.runtimeContext.unitsResolver(unitKeys, Unit_TypescriptLib);
150
153
  }
151
154
  async compileImpl() {
152
155
  const pathToCompile = `${this.config.fullPath}/src/main`;
@@ -228,6 +231,8 @@ export class Unit_TypescriptLib extends Unit_PackageJson {
228
231
  .execute();
229
232
  }
230
233
  async compile() {
234
+ if (!this.dependencyUnits)
235
+ await this.prepare();
231
236
  await this.clearOutputDirImpl();
232
237
  await this.compileImpl();
233
238
  await this.copyAssetsToOutput();
@@ -1,6 +1,6 @@
1
1
  import { CONST_FirebaseJSON, CONST_FirebaseRC, CONST_NodeModules, CONST_PackageJSON } from '../../../core/consts.js';
2
2
  import { promises as _fs } from 'fs';
3
- import { __stringify, _logger_logPrefixes, deepClone, ImplementationMissingException, LogLevel, reduceObject, Second, sleep } from '@nu-art/ts-common';
3
+ import { __stringify, _keys, _logger_logPrefixes, deepClone, ImplementationMissingException, LogLevel, Second, sleep } from '@nu-art/ts-common';
4
4
  import { Const_FirebaseConfigKeys, Const_FirebaseDefaultsKeyToFile } from '../../../defaults/consts.js';
5
5
  import { Commando_NVM } from '@nu-art/commando/shell/plugins/nvm';
6
6
  import { resolve } from 'path';
@@ -48,11 +48,20 @@ export class Unit_FirebaseFunctionsApp extends Unit_TypescriptLib {
48
48
  const distDependencies = this.deriveDistDependencies();
49
49
  packageJson.main = 'index.js';
50
50
  packageJson.types = 'index.d.ts';
51
- if (packageJson.dependencies)
52
- packageJson.dependencies = reduceObject(packageJson.dependencies, packageJson.dependencies, (acc, key, value) => {
53
- acc[key] = distDependencies[key] ?? value;
54
- return acc;
55
- });
51
+ const dependencies = packageJson.dependencies ?? {};
52
+ // First, update existing dependencies (replace workspace:* with file: paths where applicable)
53
+ _keys(dependencies).reduce((dependencies, packageName) => {
54
+ if (distDependencies[packageName])
55
+ dependencies[packageName] = distDependencies[packageName];
56
+ return dependencies;
57
+ }, dependencies);
58
+ // Then, add ALL dependencyUnits to the dependencies (this includes transitive dependencies)
59
+ // This ensures the entire dependency tree is referenced in the main package.json
60
+ this.dependencyUnits.reduce((dependencies, unit) => {
61
+ dependencies[unit.config.key] = distDependencies[unit.config.key];
62
+ return dependencies;
63
+ }, dependencies);
64
+ packageJson.dependencies = dependencies;
56
65
  await FileSystemUtils.file.template.write(targetPath, __stringify(packageJson, true), this.deriveDistDependencies(), DEFAULT_OLD_TEMPLATE_PATTERN);
57
66
  }
58
67
  async prepare() {
@@ -101,8 +110,9 @@ export class Unit_FirebaseFunctionsApp extends Unit_TypescriptLib {
101
110
  });
102
111
  const debug = this.runtimeContext.runtimeParams.verbose ? ' --debug' : '';
103
112
  await this.executeAsyncCommando(commando, `firebase${debug} deploy --only functions --force`, (stdout, stderr, exitCode) => {
104
- if (exitCode !== 0)
105
- throw new CommandoException('Failed to deploy function', stdout, stderr, exitCode);
113
+ if (exitCode === 0)
114
+ return;
115
+ throw new CommandoException(`Failed to deploy function with exit code ${exitCode}`, stdout, stderr, exitCode);
106
116
  });
107
117
  this.logInfo(`Functions: `, this.functions);
108
118
  }
@@ -245,18 +255,14 @@ export class Unit_FirebaseFunctionsApp extends Unit_TypescriptLib {
245
255
  // await _fs.writeFile(targetPath, fileContent, {encoding: 'utf-8'});
246
256
  }
247
257
  deriveDistDependencies() {
248
- const unitKeys = this.runtimeContext.unitsMapper.getTransitiveDependencies([this.config.key]);
249
- const dependencyUnits = this.runtimeContext.unitsResolver(unitKeys, Unit_TypescriptLib);
250
- return dependencyUnits.reduce((dependencies, unit) => {
258
+ return this.dependencyUnits.reduce((dependencies, unit) => {
251
259
  dependencies[unit.config.key] = `file:.dependencies/${unit.config.key}`;
252
260
  return dependencies;
253
261
  }, super.deriveDistDependencies());
254
262
  }
255
263
  async createDependenciesDir() {
256
264
  //Gather units that are dependencies of this unit
257
- const unitKeys = this.runtimeContext.unitsMapper.getTransitiveDependencies([this.config.key]);
258
- const dependencyUnits = this.runtimeContext.unitsResolver(unitKeys, Unit_TypescriptLib);
259
- await Promise.all(dependencyUnits.map(async (unit) => {
265
+ await Promise.all(this.dependencyUnits.map(async (unit) => {
260
266
  //Copy dependency unit output into this units output/.dependency dir
261
267
  const dependencyOutputPath = `${unit.config.output}/`;
262
268
  const targetPath = `${this.config.output}/.dependencies/${unit.config.key}/`;
@@ -70,7 +70,14 @@ export class Unit_FirebaseHostingApp extends Unit_TypescriptLib {
70
70
  if (envConfig.isLocal)
71
71
  fileContent = {};
72
72
  else
73
- fileContent = { hosting: this.config.hostingConfig };
73
+ fileContent = {
74
+ hosting: this.config.hostingConfig ?? {
75
+ 'public': 'dist',
76
+ 'rewrites': [
77
+ { 'source': '**', 'destination': '/index.html' }
78
+ ]
79
+ }
80
+ };
74
81
  await _fs.writeFile(targetPath, JSON.stringify(fileContent, null, 2), { encoding: 'utf-8' });
75
82
  }
76
83
  async resolveHostingRuntimeConfig() {