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

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.
Files changed (100) hide show
  1. package/build-and-install-v3.d.ts +3 -0
  2. package/build-and-install-v3.js +14 -10
  3. package/build-and-install.js +0 -1
  4. package/core/consts.js +0 -1
  5. package/core/exceptions/PhaseAggregatedException.js +0 -1
  6. package/core/package/consts.js +0 -1
  7. package/core/params/params.d.ts +4 -4
  8. package/core/params/params.js +39 -19
  9. package/core/types/configs/firebasejson.js +0 -1
  10. package/core/types/configs/firebaserc.js +0 -1
  11. package/core/types/configs/index.js +0 -1
  12. package/core/types/configs/package-json.js +0 -1
  13. package/core/types/core.js +0 -1
  14. package/core/types/index.js +0 -1
  15. package/core/types/package/index.js +0 -1
  16. package/core/types/package/package.js +0 -1
  17. package/core/types/package/runtime-package.js +0 -1
  18. package/core/types/project-config.js +0 -1
  19. package/defaults/consts.js +0 -1
  20. package/old/PhaseRunnerDispatcher.js +0 -1
  21. package/old/runner-dispatchers.js +0 -1
  22. package/package.json +3 -3
  23. package/v3/PhaseManager.js +15 -3
  24. package/v3/RunningStatusHandler.d.ts +7 -5
  25. package/v3/RunningStatusHandler.js +21 -11
  26. package/v3/UnitsDependencyMapper/UnitsDependencyMapper.js +0 -1
  27. package/v3/UnitsMapper/UnitsMapper.js +0 -1
  28. package/v3/UnitsMapper/resolvers/UnitMapper_Base.js +0 -1
  29. package/v3/UnitsMapper/resolvers/UnitMapper_FirebaseFunction.js +0 -1
  30. package/v3/UnitsMapper/resolvers/UnitMapper_FirebaseHosting.js +0 -1
  31. package/v3/UnitsMapper/resolvers/UnitMapper_Node.js +41 -35
  32. package/v3/UnitsMapper/resolvers/UnitMapper_NodeLib.js +0 -1
  33. package/v3/UnitsMapper/resolvers/UnitMapper_NodeProject.js +0 -1
  34. package/v3/UnitsMapper/resolvers/index.js +0 -1
  35. package/v3/UnitsMapper/types.js +0 -1
  36. package/v3/core/FilesCache.js +0 -1
  37. package/v3/core/Unit_HelpPrinter.d.ts +1 -1
  38. package/v3/core/Unit_HelpPrinter.js +0 -1
  39. package/v3/core/types.js +0 -1
  40. package/v3/phase/consts.d.ts +1 -0
  41. package/v3/phase/consts.js +4 -1
  42. package/v3/phase/index.js +0 -1
  43. package/v3/phase/types.js +0 -1
  44. package/v3/units/BaseUnit.js +0 -1
  45. package/v3/units/ProjectUnit.js +0 -1
  46. package/v3/units/Unit_NodeProject.js +0 -1
  47. package/v3/units/Unit_PackageJson.js +0 -1
  48. package/v3/units/Unit_TypescriptLib.js +71 -36
  49. package/v3/units/firebase/Unit_FirebaseFunctionsApp.d.ts +5 -2
  50. package/v3/units/firebase/Unit_FirebaseFunctionsApp.js +29 -17
  51. package/v3/units/firebase/Unit_FirebaseHostingApp.d.ts +3 -2
  52. package/v3/units/firebase/Unit_FirebaseHostingApp.js +16 -5
  53. package/v3/units/firebase/common.d.ts +3 -0
  54. package/v3/units/firebase/common.js +13 -0
  55. package/v3/units/index.js +0 -1
  56. package/build-and-install-v3.js.map +0 -1
  57. package/build-and-install.js.map +0 -1
  58. package/core/consts.js.map +0 -1
  59. package/core/exceptions/PhaseAggregatedException.js.map +0 -1
  60. package/core/package/consts.js.map +0 -1
  61. package/core/params/params.js.map +0 -1
  62. package/core/types/configs/firebasejson.js.map +0 -1
  63. package/core/types/configs/firebaserc.js.map +0 -1
  64. package/core/types/configs/index.js.map +0 -1
  65. package/core/types/configs/package-json.js.map +0 -1
  66. package/core/types/core.js.map +0 -1
  67. package/core/types/index.js.map +0 -1
  68. package/core/types/package/index.js.map +0 -1
  69. package/core/types/package/package.js.map +0 -1
  70. package/core/types/package/runtime-package.js.map +0 -1
  71. package/core/types/project-config.js.map +0 -1
  72. package/defaults/consts.js.map +0 -1
  73. package/old/PhaseRunnerDispatcher.js.map +0 -1
  74. package/old/runner-dispatchers.js.map +0 -1
  75. package/v3/PhaseManager.js.map +0 -1
  76. package/v3/RunningStatusHandler.js.map +0 -1
  77. package/v3/UnitsDependencyMapper/UnitsDependencyMapper.js.map +0 -1
  78. package/v3/UnitsMapper/UnitsMapper.js.map +0 -1
  79. package/v3/UnitsMapper/resolvers/UnitMapper_Base.js.map +0 -1
  80. package/v3/UnitsMapper/resolvers/UnitMapper_FirebaseFunction.js.map +0 -1
  81. package/v3/UnitsMapper/resolvers/UnitMapper_FirebaseHosting.js.map +0 -1
  82. package/v3/UnitsMapper/resolvers/UnitMapper_Node.js.map +0 -1
  83. package/v3/UnitsMapper/resolvers/UnitMapper_NodeLib.js.map +0 -1
  84. package/v3/UnitsMapper/resolvers/UnitMapper_NodeProject.js.map +0 -1
  85. package/v3/UnitsMapper/resolvers/index.js.map +0 -1
  86. package/v3/UnitsMapper/types.js.map +0 -1
  87. package/v3/core/FilesCache.js.map +0 -1
  88. package/v3/core/Unit_HelpPrinter.js.map +0 -1
  89. package/v3/core/types.js.map +0 -1
  90. package/v3/phase/consts.js.map +0 -1
  91. package/v3/phase/index.js.map +0 -1
  92. package/v3/phase/types.js.map +0 -1
  93. package/v3/units/BaseUnit.js.map +0 -1
  94. package/v3/units/ProjectUnit.js.map +0 -1
  95. package/v3/units/Unit_NodeProject.js.map +0 -1
  96. package/v3/units/Unit_PackageJson.js.map +0 -1
  97. package/v3/units/Unit_TypescriptLib.js.map +0 -1
  98. package/v3/units/firebase/Unit_FirebaseFunctionsApp.js.map +0 -1
  99. package/v3/units/firebase/Unit_FirebaseHostingApp.js.map +0 -1
  100. package/v3/units/index.js.map +0 -1
@@ -1,6 +1,7 @@
1
1
  import { Logger } from '@nu-art/ts-common';
2
2
  import { BaiParams } from './core/params/params.js';
3
3
  import { Phase } from './v3/phase/index.js';
4
+ import { UnitsMapper } from './v3/UnitsMapper/UnitsMapper.js';
4
5
  import { ProjectUnit } from './v3/units/ProjectUnit.js';
5
6
  import { Unit_NodeProject } from './v3/units/index.js';
6
7
  import { BaseCliParam } from '@nu-art/commando/cli-params/types';
@@ -11,6 +12,7 @@ type BAI_Options = {
11
12
  runtimeParams: BaseCliParam<string, any>[];
12
13
  };
13
14
  export declare class BuildAndInstall extends Logger {
15
+ private unitsMapper;
14
16
  private phases;
15
17
  private pathToProject;
16
18
  private allUnits;
@@ -21,6 +23,7 @@ export declare class BuildAndInstall extends Logger {
21
23
  readonly runningStatus: RunningStatusHandler;
22
24
  constructor(config?: Partial<BAI_Options>);
23
25
  init(): Promise<void>;
26
+ prepareUnitsMapper(unitsMapper: UnitsMapper): void;
24
27
  setApplicativeUnits(projectUnits: ProjectUnit[]): void;
25
28
  setPhases(phases: Phase<string>[][]): void;
26
29
  build(): Promise<ProjectUnit<import("./v3/units/ProjectUnit.js").Config_ProjectUnit>[]>;
@@ -1,6 +1,6 @@
1
1
  import { _keys, arrayToMap, BeLogged, DebugFlag, filterDuplicates, LogClient_Terminal, Logger, LogLevel, merge } from '@nu-art/ts-common';
2
2
  import { AllBaiParams } from './core/params/params.js';
3
- import { phases_Build, phases_Deploy, phases_Launch } from './v3/phase/index.js';
3
+ import { phases_Build, phases_Deploy, phases_Launch, phases_Terminating } from './v3/phase/index.js';
4
4
  import { UnitsMapper } from './v3/UnitsMapper/UnitsMapper.js';
5
5
  import { UnitsDependencyMapper } from './v3/UnitsDependencyMapper/UnitsDependencyMapper.js';
6
6
  import { FilesCache } from './v3/core/FilesCache.js';
@@ -15,10 +15,12 @@ import { RunningStatusHandler } from './v3/RunningStatusHandler.js';
15
15
  import { FileSystemUtils } from '@nu-art/ts-common/utils/FileSystemUtils';
16
16
  export const DefaultPhases = [
17
17
  ...phases_Build,
18
+ ...phases_Terminating,
18
19
  ...phases_Launch,
19
20
  ...phases_Deploy,
20
21
  ];
21
22
  export class BuildAndInstall extends Logger {
23
+ unitsMapper;
22
24
  phases = DefaultPhases;
23
25
  pathToProject;
24
26
  allUnits = [];
@@ -46,6 +48,16 @@ export class BuildAndInstall extends Logger {
46
48
  DebugFlag.DefaultLogLevel = LogLevel.Verbose;
47
49
  this.setMinLevel(DebugFlag.DefaultLogLevel);
48
50
  this.logDebug('Runtime params:', this.runtimeParams);
51
+ this.unitsMapper = new UnitsMapper();
52
+ this.prepareUnitsMapper(this.unitsMapper);
53
+ }
54
+ prepareUnitsMapper(unitsMapper) {
55
+ unitsMapper
56
+ .addRules(UnitMapper_NodeLib)
57
+ .addRules(UnitMapper_NodeProject)
58
+ .addRules(UnitMapper_FirebaseHosting)
59
+ .addRules(UnitMapper_FirebaseFunction)
60
+ .setRuntimeParams(this.runtimeParams);
49
61
  }
50
62
  setApplicativeUnits(projectUnits) {
51
63
  this.projectUnits.push(...projectUnits);
@@ -56,14 +68,7 @@ export class BuildAndInstall extends Logger {
56
68
  async build() {
57
69
  await this.init();
58
70
  this.logVerbose(`Resolving units from: ${this.pathToProject}`);
59
- const unitsMapper = new UnitsMapper();
60
- this.allUnits = await unitsMapper
61
- .addRules(UnitMapper_NodeLib)
62
- .addRules(UnitMapper_NodeProject)
63
- .addRules(UnitMapper_FirebaseHosting)
64
- .addRules(UnitMapper_FirebaseFunction)
65
- .setRuntimeParams(this.runtimeParams)
66
- .resolveUnits(this.pathToProject);
71
+ this.allUnits = await this.unitsMapper.resolveUnits(this.pathToProject);
67
72
  Object.freeze(this.allUnits);
68
73
  this.logDebug('Units found:', this.allUnits.map(unit => `${unit.constructor?.['name']}: ${unit.config.key}`).join('\n'));
69
74
  const unitKeyToUnitMap = arrayToMap(this.allUnits, unit => unit.config.key);
@@ -129,4 +134,3 @@ export class BuildAndInstall extends Logger {
129
134
  this.logInfo('---------------------------------- Process Completed successfully ----------------------------------');
130
135
  }
131
136
  }
132
- //# sourceMappingURL=build-and-install-v3.js.map
@@ -15,4 +15,3 @@ import { BuildAndInstall } from './build-and-install-v3.js';
15
15
  // return process.exit(1);
16
16
  // });
17
17
  // });
18
- //# sourceMappingURL=build-and-install.js.map
package/core/consts.js CHANGED
@@ -9,4 +9,3 @@ export const CONST_TS_CONFIG = 'tsconfig.json';
9
9
  export const CONST_PNPM_WORKSPACE = 'pnpm-workspace.yaml';
10
10
  export const CONST_PNPM_LOCK = 'pnpm-lock.yaml';
11
11
  export const MemKey_Packages = new MemKey('bai-packages', true);
12
- //# sourceMappingURL=consts.js.map
@@ -6,4 +6,3 @@ export class PhaseAggregatedException extends CustomException {
6
6
  this.cause = errors;
7
7
  }
8
8
  }
9
- //# sourceMappingURL=PhaseAggregatedException.js.map
@@ -38,4 +38,3 @@ export const Default_FirebaseProjectConfig = {
38
38
  },
39
39
  hosting: Default_HostingConfig
40
40
  };
41
- //# sourceMappingURL=consts.js.map
@@ -1,10 +1,8 @@
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_CheckCyclicImports: BaseCliParam<'checkCyclicImports', boolean>;
5
4
  export declare const BaiParam_continue: BaseCliParam<'continue', boolean>;
6
5
  export declare const BaiParam_SetEnv: BaseCliParam<'environment', string>;
7
- export declare const BaiParam_Setup: BaseCliParam<'setup', boolean>;
8
6
  export declare const BaiParam_Install: BaseCliParam<'install', boolean>;
9
7
  export declare const BaiParam_Clean: BaseCliParam<'clean', boolean>;
10
8
  export declare const BaiParam_Purge: BaseCliParam<'purge', boolean>;
@@ -25,7 +23,7 @@ export declare const BaiParam_TestCase: BaseCliParam<'testCases', string[]>;
25
23
  export declare const BaiParam_TestDebugPort: BaseCliParam<'testDebugPort', number>;
26
24
  export declare const BaiParam_Launch: BaseCliParam<'launch', boolean>;
27
25
  export declare const BaiParam_DebugBackend: BaseCliParam<'debugBackend', boolean>;
28
- export declare const BaiParam_Deploy: BaseCliParam<'deploy', string>;
26
+ export declare const BaiParam_Deploy: BaseCliParam<'deploy', boolean>;
29
27
  export declare const BaiParam_Debug: BaseCliParam<'debug', boolean>;
30
28
  export declare const BaiParam_DebugLifecycle: BaseCliParam<'debugLifecycle', boolean>;
31
29
  export declare const BaiParam_Verbose: BaseCliParam<'verbose', boolean>;
@@ -33,8 +31,10 @@ export declare const BaiParam_QuickDeploy: BaseCliParam<'quickDeploy', boolean>;
33
31
  type PromoteType = 'patch' | 'minor' | 'major';
34
32
  export declare const BaiParam_Publish: BaseCliParam<'publish', PromoteType>;
35
33
  export declare const BaiParam_UsePackage: BaseCliParam<'usePackage', string[]>;
34
+ export declare const BaiParam_includePackage: BaseCliParam<'includePackage', string[]>;
36
35
  export declare const BaiParam_ToESM: BaseCliParam<'toESM', boolean>;
37
36
  export declare const BaiParam_Simulate: BaseCliParam<'simulation', boolean>;
38
- export declare const AllBaiParams: (BaseCliParam<"allUnits", boolean> | BaseCliParam<"dependencyTree", boolean> | BaseCliParam<"checkCyclicImports", boolean> | BaseCliParam<"continue", boolean> | BaseCliParam<"environment", string> | BaseCliParam<"setup", boolean> | 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", string> | BaseCliParam<"debug", boolean> | BaseCliParam<"debugLifecycle", boolean> | BaseCliParam<"verbose", boolean> | BaseCliParam<"publish", PromoteType> | BaseCliParam<"usePackage", string[]> | BaseCliParam<"toESM", boolean> | BaseCliParam<"simulation", boolean>)[];
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>)[];
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_CheckCyclicImports = {
16
- keys: ['--check-cyclic-imports', '-cci'],
17
- keyName: 'checkCyclicImports',
18
- type: 'boolean',
19
- group: 'General',
20
- description: 'will check for cyclic imports and render an svg with the import graph'
21
- };
22
15
  export const BaiParam_continue = {
23
16
  keys: ['--continue', '-con'],
24
17
  keyName: 'continue',
@@ -34,13 +27,6 @@ export const BaiParam_SetEnv = {
34
27
  initialValue: 'local',
35
28
  description: 'Will set the .config-${environment}.json as the current .config.json and prepare it as base 64 for local usage \ninput required: envName(string)'
36
29
  };
37
- export const BaiParam_Setup = {
38
- keys: ['--setup'],
39
- keyName: 'setup',
40
- type: 'boolean',
41
- group: 'Build',
42
- description: 'Setup local project for developer'
43
- };
44
30
  export const BaiParam_Install = {
45
31
  keys: ['--install', '-i'],
46
32
  keyName: 'install',
@@ -184,9 +170,15 @@ export const BaiParam_DebugBackend = {
184
170
  export const BaiParam_Deploy = {
185
171
  keys: ['--deploy', '-dep'],
186
172
  keyName: 'deploy',
187
- type: 'string',
173
+ type: 'boolean',
188
174
  group: 'Apps',
189
- description: 'Will add the provided App to the deploy list or all applications'
175
+ description: 'Will add the provided App to the deploy list or all applications',
176
+ dependencies: [
177
+ { param: BaiParam_Launch, value: false },
178
+ { param: BaiParam_Watch, value: false },
179
+ { param: BaiParam_WatchBuildTree, value: false },
180
+ { param: BaiParam_GenerateDocs, value: false },
181
+ ]
190
182
  };
191
183
  export const BaiParam_Debug = {
192
184
  keys: ['--debug', '-d'],
@@ -239,6 +231,19 @@ export const BaiParam_UsePackage = {
239
231
  },
240
232
  dependencies: [{ param: BaiParam_AllUnits, value: true }]
241
233
  };
234
+ export const BaiParam_includePackage = {
235
+ keys: ['-in', '--include='],
236
+ keyName: 'includePackage',
237
+ type: 'string[]',
238
+ group: 'Other',
239
+ description: 'Will include the units to process',
240
+ process: (value) => {
241
+ if (!value)
242
+ return [];
243
+ return value.split(',').map(str => str.trim());
244
+ },
245
+ dependencies: []
246
+ };
242
247
  export const BaiParam_ToESM = {
243
248
  keys: ['-tesm', '--to-esm'],
244
249
  keyName: 'toESM',
@@ -248,13 +253,29 @@ export const BaiParam_ToESM = {
248
253
  dependencies: [{ param: BaiParam_AllUnits, value: true }]
249
254
  };
250
255
  export const BaiParam_Simulate = {
251
- keys: ['--simulate', '-sim'],
256
+ keys: ['--simulate', '-sim', '--simulation'],
252
257
  keyName: 'simulation',
253
258
  type: 'boolean',
254
259
  group: 'Other',
255
260
  description: 'In combination with other params, will not perform the outbound operation, but instead simulate it',
256
261
  dependencies: [{ param: BaiParam_AllUnits, value: true }]
257
262
  };
263
+ export const BaiParam_CheckCyclicImports = {
264
+ keys: ['--check-cyclic-imports', '-cci'],
265
+ keyName: 'checkCyclicImports',
266
+ type: 'boolean',
267
+ group: 'General',
268
+ description: 'will check for cyclic imports and render an svg with the import graph',
269
+ dependencies: [
270
+ { param: BaiParam_NoBuild, value: true },
271
+ { param: BaiParam_Launch, value: false },
272
+ { param: BaiParam_Install, value: false },
273
+ { param: BaiParam_Deploy, value: false },
274
+ { param: BaiParam_Publish, value: false },
275
+ { param: BaiParam_Purge, value: false },
276
+ { param: BaiParam_Clean, value: false },
277
+ ]
278
+ };
258
279
  export const AllBaiParams = [
259
280
  BaiParam_AllUnits,
260
281
  BaiParam_DependencyTree,
@@ -264,7 +285,6 @@ export const AllBaiParams = [
264
285
  BaiParam_continue,
265
286
  BaiParam_Prepare,
266
287
  BaiParam_SetEnv,
267
- BaiParam_Setup,
268
288
  BaiParam_Install,
269
289
  BaiParam_Generate, // TODO: to implement
270
290
  BaiParam_GenerateDocs, // TODO: to implement
@@ -284,9 +304,9 @@ export const AllBaiParams = [
284
304
  BaiParam_Debug,
285
305
  BaiParam_Verbose,
286
306
  BaiParam_Publish,
307
+ BaiParam_includePackage,
287
308
  BaiParam_UsePackage,
288
309
  BaiParam_ToESM,
289
310
  BaiParam_Simulate,
290
311
  BaiParam_DebugLifecycle
291
312
  ];
292
- //# sourceMappingURL=params.js.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=firebasejson.js.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=firebaserc.js.map
@@ -1,4 +1,3 @@
1
1
  export * from './firebasejson.js';
2
2
  export * from './firebaserc.js';
3
3
  export * from './package-json.js';
4
- //# sourceMappingURL=index.js.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=package-json.js.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=core.js.map
@@ -2,4 +2,3 @@ export * from './core.js';
2
2
  export * from './configs/index.js';
3
3
  export * from './package/index.js';
4
4
  export * from './project-config.js';
5
- //# sourceMappingURL=index.js.map
@@ -1,3 +1,2 @@
1
1
  export * from './package.js';
2
2
  export * from './runtime-package.js';
3
- //# sourceMappingURL=index.js.map
@@ -12,4 +12,3 @@ export const PackageTypes = [PackageType_InfraLib,
12
12
  PackageType_Sourceless,
13
13
  PackageType_Python];
14
14
  export const PackageTypesWithOutput = [PackageType_InfraLib, PackageType_ProjectLib, PackageType_FirebaseHostingApp, PackageType_FirebaseFunctionsApp];
15
- //# sourceMappingURL=package.js.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=runtime-package.js.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=project-config.js.map
@@ -34,4 +34,3 @@ export const Default_OutputFiles = {
34
34
  outputLogs: `${Default_OutputPath}/logs`,
35
35
  runningStatus: `${Default_OutputPath}/running-status.json`
36
36
  };
37
- //# sourceMappingURL=consts.js.map
@@ -30,4 +30,3 @@ export class PhaseRunnerDispatcher {
30
30
  export const dispatcher_PhaseChange = new PhaseRunnerDispatcher('__onPhaseChange');
31
31
  export const dispatcher_UnitStatusChange = new PhaseRunnerDispatcher('__onUnitStatusChange');
32
32
  export const dispatcher_UnitChange = new PhaseRunnerDispatcher('__onUnitsChange');
33
- //# sourceMappingURL=PhaseRunnerDispatcher.js.map
@@ -1,4 +1,3 @@
1
1
  import { PhaseRunnerDispatcher } from './PhaseRunnerDispatcher.js';
2
2
  export const dispatcher_WatchReady = new PhaseRunnerDispatcher('__onWatchReady');
3
3
  export const dispatcher_UnitWatchCompile = new PhaseRunnerDispatcher('__onUnitWatchCompiled');
4
- //# sourceMappingURL=runner-dispatchers.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nu-art/build-and-install",
3
- "version": "0.400.5",
3
+ "version": "0.400.6",
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.5",
35
- "@nu-art/commando": "0.400.5"
34
+ "@nu-art/ts-common": "0.400.6",
35
+ "@nu-art/commando": "0.400.6"
36
36
  },
37
37
  "unitConfig": {
38
38
  "type": "typescript-lib"
@@ -1,4 +1,4 @@
1
- import { addItemToArray, exists, flatArray, Logger, removeItemFromArray, timeCounter } from '@nu-art/ts-common';
1
+ import { addItemToArray, asArray, exists, flatArray, Logger, removeItemFromArray, timeCounter } from '@nu-art/ts-common';
2
2
  import { PhaseAggregatedException } from '../core/exceptions/PhaseAggregatedException.js';
3
3
  export class PhaseManager extends Logger {
4
4
  phases;
@@ -28,6 +28,12 @@ export class PhaseManager extends Logger {
28
28
  const regexMatchers = usePackageKeys.map(filter => new RegExp(`.*?${filter}.*?`, 'i'));
29
29
  this.activeUnits = allUnits.filter(unit => regexMatchers.some(matcher => matcher.test(unit.config.key))).map(unit => unit.config.key);
30
30
  }
31
+ const packagesToInclude = this.runningStatus.runtimeParams.includePackage;
32
+ if (packagesToInclude?.length) {
33
+ const regexMatchers = asArray(packagesToInclude).map(filter => new RegExp(`.*?${filter}.*?`, 'i'));
34
+ this.activeUnits.push(...allUnits.filter(unit => regexMatchers.some(matcher => matcher.test(unit.config.key))).map(unit => unit.config.key));
35
+ this.activeUnits = [...new Set(this.activeUnits)];
36
+ }
31
37
  this.keyToPhaseMap = flatArray(phases).reduce((acc, phase) => {
32
38
  acc[phase.key] = phase;
33
39
  return acc;
@@ -75,11 +81,15 @@ export class PhaseManager extends Logger {
75
81
  break;
76
82
  const scheduledStep = _steps[i];
77
83
  const step = this.mapStep(scheduledStep);
84
+ await this.runningStatus.onStepStarted(i);
78
85
  this.logDebug(`Executing step #${i + 1}/${_steps.length}`);
79
86
  this.logVerbose(scheduledStep);
80
87
  const errors = [];
81
88
  let failedStep;
82
89
  await Promise.all(step.units.map(async (unit) => {
90
+ if (this.runningStatus.isCompleted(unit.config.key))
91
+ return;
92
+ let failed = false;
83
93
  for (const phase of step.phases) {
84
94
  if (this.killed)
85
95
  break;
@@ -103,16 +113,19 @@ export class PhaseManager extends Logger {
103
113
  errors.push(error);
104
114
  failedStep = scheduledStep;
105
115
  this.killed = true;
116
+ failed = true;
106
117
  break;
107
118
  }
108
119
  finally {
109
120
  removeItemFromArray(this.runningUnits, unit);
110
121
  }
111
122
  }
123
+ if (!failed)
124
+ await this.runningStatus.onUnitCompleted(unit.config.key);
112
125
  }));
113
- await this.runningStatus.update(i);
114
126
  if (failedStep && errors.length)
115
127
  throw new PhaseAggregatedException(errors, failedStep);
128
+ await this.runningStatus.onStepEnded();
116
129
  }
117
130
  this.logInfo('All steps completed.');
118
131
  }
@@ -141,4 +154,3 @@ export class PhaseManager extends Logger {
141
154
  };
142
155
  }
143
156
  }
144
- //# sourceMappingURL=PhaseManager.js.map
@@ -1,16 +1,18 @@
1
1
  import { Logger } from '@nu-art/ts-common';
2
- import { ScheduledStep } from './PhaseManager.js';
3
2
  import { BaiParams } from '../core/params/params.js';
4
3
  export declare class RunningStatusHandler extends Logger {
5
4
  private isolated;
6
- private steps;
7
- private outputFolder;
5
+ private readonly outputFolder;
6
+ private completedUnits;
8
7
  runtimeParams: BaiParams;
9
8
  startIndex: number;
10
9
  constructor(outputFolder: string, runtimeParams: BaiParams);
11
10
  init(): Promise<void>;
12
- setSteps(steps: ScheduledStep[]): void;
13
11
  isolate(): RunningStatusHandler;
14
- update(index: number): Promise<void>;
12
+ isCompleted(unitKey: string): boolean;
13
+ onUnitCompleted(unitKey: string): Promise<void>;
14
+ onStepEnded(): Promise<void>;
15
+ onStepStarted(index: number): Promise<void>;
16
+ private saveStatus;
15
17
  load(): Promise<any>;
16
18
  }
@@ -2,8 +2,9 @@ import fs, { promises as _fs } from 'fs';
2
2
  import { __stringify, Logger } from '@nu-art/ts-common';
3
3
  export class RunningStatusHandler extends Logger {
4
4
  isolated = false;
5
- steps = [];
6
5
  outputFolder;
6
+ // The completed units in the phase.. when running -con, these can be skipped
7
+ completedUnits = [];
7
8
  runtimeParams;
8
9
  startIndex = 0;
9
10
  constructor(outputFolder, runtimeParams) {
@@ -20,31 +21,41 @@ export class RunningStatusHandler extends Logger {
20
21
  this.runtimeParams = Object.assign(currentParams, this.runtimeParams);
21
22
  }
22
23
  }
23
- setSteps(steps) {
24
- if (this.runtimeParams.continue)
25
- return;
26
- this.steps = steps;
27
- }
28
24
  isolate() {
29
25
  this.isolated = true;
30
26
  return this;
31
27
  }
32
- async update(index) {
28
+ isCompleted(unitKey) {
29
+ return this.completedUnits.includes(unitKey);
30
+ }
31
+ async onUnitCompleted(unitKey) {
32
+ this.logDebug(`On unit completed: ${unitKey}`);
33
+ this.completedUnits.push(unitKey);
34
+ await this.saveStatus();
35
+ }
36
+ async onStepEnded() {
37
+ this.logDebug(`On step ended successfully #${this.startIndex}`);
38
+ this.completedUnits = [];
39
+ }
40
+ async onStepStarted(index) {
33
41
  this.startIndex = index;
42
+ this.logDebug(`Setting execution index to #${this.startIndex}`);
34
43
  if (this.isolated)
35
44
  return;
36
- this.logVerbose(`Setting execution index to #${index}`, this.steps[index]);
45
+ await this.saveStatus();
46
+ }
47
+ async saveStatus() {
37
48
  await _fs.writeFile(`${this.outputFolder}/running-status.json`, __stringify({
38
49
  index: this.startIndex,
39
50
  runtimeParams: this.runtimeParams,
40
- steps: this.steps
51
+ completedUnits: this.completedUnits
41
52
  }, true));
42
53
  }
43
54
  async load() {
44
55
  try {
45
56
  const data = JSON.parse(await _fs.readFile(`${this.outputFolder}/running-status.json`, { encoding: 'utf-8' }));
46
57
  this.startIndex = data.index;
47
- this.steps = data.steps;
58
+ this.completedUnits = data.completedUnits ?? [];
48
59
  this.runtimeParams = data.runtimeParams;
49
60
  return data.index;
50
61
  }
@@ -54,4 +65,3 @@ export class RunningStatusHandler extends Logger {
54
65
  }
55
66
  }
56
67
  }
57
- //# sourceMappingURL=RunningStatusHandler.js.map
@@ -284,4 +284,3 @@ export class UnitsDependencyMapper extends Logger {
284
284
  return _values(this.map).filter(node => node.dependsOn.length === 0).map(node => node.key).sort();
285
285
  }
286
286
  }
287
- //# sourceMappingURL=UnitsDependencyMapper.js.map
@@ -57,4 +57,3 @@ export class UnitsMapper extends Logger {
57
57
  }
58
58
  }
59
59
  }
60
- //# sourceMappingURL=UnitsMapper.js.map
@@ -14,4 +14,3 @@ export class UnitMapper_Base extends Logger {
14
14
  this.baiConfig = config;
15
15
  }
16
16
  }
17
- //# sourceMappingURL=UnitMapper_Base.js.map
@@ -53,4 +53,3 @@ export class UnitMapper_FirebaseFunction_Class extends UnitMapper_Node {
53
53
  }
54
54
  }
55
55
  export const UnitMapper_FirebaseFunction = new UnitMapper_FirebaseFunction_Class();
56
- //# sourceMappingURL=UnitMapper_FirebaseFunction.js.map
@@ -46,4 +46,3 @@ export class UnitMapper_FirebaseHosting_Class extends UnitMapper_Node {
46
46
  }
47
47
  }
48
48
  export const UnitMapper_FirebaseHosting = new UnitMapper_FirebaseHosting_Class();
49
- //# sourceMappingURL=UnitMapper_FirebaseHosting.js.map
@@ -19,41 +19,47 @@ export class UnitMapper_Node extends UnitMapper_Base {
19
19
  const pathToFile = `${path}/__package.json`;
20
20
  if (!await FileSystemUtils.file.exists(pathToFile))
21
21
  return;
22
- let packageJson = await FilesCache.load.json(pathToFile);
23
- if (!packageJson)
24
- return;
25
- if (!packageJson.unitConfig) {
26
- this.logWarning(`Found a package.json without unitConfig at: ${pathToFile}`);
27
- UnitMapper_Node.invalidPaths.push(path);
28
- return;
22
+ let packageJson;
23
+ try {
24
+ packageJson = await FilesCache.load.json(pathToFile);
25
+ if (!packageJson)
26
+ return;
27
+ if (!packageJson.unitConfig) {
28
+ this.logWarning(`Found a package.json without unitConfig at: ${pathToFile}`);
29
+ UnitMapper_Node.invalidPaths.push(path);
30
+ return;
31
+ }
32
+ if (tsValidateResult(packageJson.unitConfig.type, this.validator.type))
33
+ return; // not the expected type for this mapper
34
+ packageJson = deepClone(packageJson);
35
+ tsValidate(packageJson.unitConfig, this.validator);
36
+ const dependencies = packageJson.dependencies;
37
+ if (dependencies)
38
+ packageJson.dependencies = _keys(dependencies).reduce((acc, key) => {
39
+ acc[key] = dependencies[key] === '?' ? `{{${key}}}` : dependencies[key];
40
+ return acc;
41
+ }, {});
42
+ const devDependencies = packageJson.devDependencies;
43
+ if (devDependencies)
44
+ packageJson.devDependencies = _keys(devDependencies).reduce((acc, key) => {
45
+ acc[key] = devDependencies[key] === '?' ? `{{${key}}}` : devDependencies[key];
46
+ return acc;
47
+ }, {});
48
+ Object.freeze(packageJson);
49
+ const baseConfig = {
50
+ key: packageJson.name,
51
+ fullPath: path,
52
+ relativePath: path.replace(root, '.'),
53
+ label: packageJson.unitConfig.label ?? packageJson.name,
54
+ dependencies: { ...dependencies, ...packageJson.devDependencies },
55
+ };
56
+ const customESLintConfig = packageJson.unitConfig.customESLintConfig ?? false;
57
+ const customTSConfig = packageJson.unitConfig.customTSConfig ?? false;
58
+ return this.resolveNodeUnit({ path, root, packageJson, baseConfig, customESLintConfig, customTSConfig });
59
+ }
60
+ catch (e) {
61
+ this.logError(`Failed to load package.json at: ${pathToFile}`, e);
62
+ throw e;
29
63
  }
30
- if (tsValidateResult(packageJson.unitConfig.type, this.validator.type))
31
- return; // not the expected type for this mapper
32
- packageJson = deepClone(packageJson);
33
- tsValidate(packageJson.unitConfig, this.validator);
34
- const dependencies = packageJson.dependencies;
35
- if (dependencies)
36
- packageJson.dependencies = _keys(dependencies).reduce((acc, key) => {
37
- acc[key] = dependencies[key] === '?' ? `{{${key}}}` : dependencies[key];
38
- return acc;
39
- }, {});
40
- const devDependencies = packageJson.devDependencies;
41
- if (devDependencies)
42
- packageJson.devDependencies = _keys(devDependencies).reduce((acc, key) => {
43
- acc[key] = devDependencies[key] === '?' ? `{{${key}}}` : devDependencies[key];
44
- return acc;
45
- }, {});
46
- Object.freeze(packageJson);
47
- const baseConfig = {
48
- key: packageJson.name,
49
- fullPath: path,
50
- relativePath: path.replace(root, '.'),
51
- label: packageJson.unitConfig.label ?? packageJson.name,
52
- dependencies: { ...dependencies, ...packageJson.devDependencies },
53
- };
54
- const customESLintConfig = packageJson.unitConfig.customESLintConfig ?? false;
55
- const customTSConfig = packageJson.unitConfig.customTSConfig ?? false;
56
- return this.resolveNodeUnit({ path, root, packageJson, baseConfig, customESLintConfig, customTSConfig });
57
64
  }
58
65
  }
59
- //# sourceMappingURL=UnitMapper_Node.js.map
@@ -26,4 +26,3 @@ export class UnitMapper_NodeLib_Class extends UnitMapper_Node {
26
26
  }
27
27
  }
28
28
  export const UnitMapper_NodeLib = new UnitMapper_NodeLib_Class();
29
- //# sourceMappingURL=UnitMapper_NodeLib.js.map
@@ -20,4 +20,3 @@ export class UnitMapper_NodeProject_Class extends UnitMapper_Node {
20
20
  }
21
21
  }
22
22
  export const UnitMapper_NodeProject = new UnitMapper_NodeProject_Class();
23
- //# sourceMappingURL=UnitMapper_NodeProject.js.map
@@ -2,4 +2,3 @@ export * from './UnitMapper_NodeLib.js';
2
2
  export * from './UnitMapper_NodeProject.js';
3
3
  export * from './UnitMapper_FirebaseFunction.js';
4
4
  export * from './UnitMapper_FirebaseHosting.js';
5
- //# sourceMappingURL=index.js.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=types.js.map
@@ -31,4 +31,3 @@ export const FilesCache = {
31
31
  }
32
32
  }
33
33
  };
34
- //# sourceMappingURL=FilesCache.js.map