@nu-art/build-and-install 0.300.7 → 0.400.0

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 (195) hide show
  1. package/build-and-install-v3.d.ts +29 -0
  2. package/build-and-install-v3.js +132 -0
  3. package/build-and-install-v3.js.map +1 -0
  4. package/build-and-install.js +18 -24
  5. package/build-and-install.js.map +1 -0
  6. package/core/consts.d.ts +7 -2
  7. package/core/consts.js +12 -9
  8. package/core/consts.js.map +1 -0
  9. package/core/exceptions/PhaseAggregatedException.d.ts +5 -0
  10. package/core/exceptions/PhaseAggregatedException.js +9 -0
  11. package/core/exceptions/PhaseAggregatedException.js.map +1 -0
  12. package/core/package/consts.d.ts +1 -1
  13. package/core/package/consts.js +7 -9
  14. package/core/package/consts.js.map +1 -0
  15. package/core/params/params.d.ts +18 -19
  16. package/core/params/params.js +142 -178
  17. package/core/params/params.js.map +1 -0
  18. package/core/types/configs/firebasejson.js +2 -2
  19. package/core/types/configs/firebasejson.js.map +1 -0
  20. package/core/types/configs/firebaserc.js +2 -2
  21. package/core/types/configs/firebaserc.js.map +1 -0
  22. package/core/types/configs/index.d.ts +3 -3
  23. package/core/types/configs/index.js +4 -19
  24. package/core/types/configs/index.js.map +1 -0
  25. package/core/types/configs/package-json.d.ts +2 -1
  26. package/core/types/configs/package-json.js +2 -2
  27. package/core/types/configs/package-json.js.map +1 -0
  28. package/core/types/core.js +2 -2
  29. package/core/types/core.js.map +1 -0
  30. package/core/types/index.d.ts +4 -4
  31. package/core/types/index.js +5 -20
  32. package/core/types/index.js.map +1 -0
  33. package/core/types/package/index.d.ts +2 -2
  34. package/core/types/package/index.js +3 -18
  35. package/core/types/package/index.js.map +1 -0
  36. package/core/types/package/package.d.ts +10 -14
  37. package/core/types/package/package.js +15 -12
  38. package/core/types/package/package.js.map +1 -0
  39. package/core/types/package/runtime-package.d.ts +2 -2
  40. package/core/types/package/runtime-package.js +2 -2
  41. package/core/types/package/runtime-package.js.map +1 -0
  42. package/core/types/project-config.d.ts +31 -2
  43. package/core/types/project-config.js +2 -2
  44. package/core/types/project-config.js.map +1 -0
  45. package/defaults/backend-proxy/proxy._ts +3 -1
  46. package/defaults/consts.d.ts +0 -7
  47. package/defaults/consts.js +10 -10
  48. package/defaults/consts.js.map +1 -0
  49. package/{v2/phase-runner → old}/PhaseRunnerDispatcher.d.ts +4 -4
  50. package/old/PhaseRunnerDispatcher.js +33 -0
  51. package/old/PhaseRunnerDispatcher.js.map +1 -0
  52. package/{v2/unit → old}/runner-dispatchers.d.ts +3 -3
  53. package/old/runner-dispatchers.js +4 -0
  54. package/old/runner-dispatchers.js.map +1 -0
  55. package/package.json +20 -15
  56. package/v3/PhaseManager.d.ts +26 -0
  57. package/v3/PhaseManager.js +144 -0
  58. package/v3/PhaseManager.js.map +1 -0
  59. package/v3/RunningStatusHandler.d.ts +16 -0
  60. package/v3/RunningStatusHandler.js +57 -0
  61. package/v3/RunningStatusHandler.js.map +1 -0
  62. package/v3/UnitsDependencyMapper/UnitsDependencyMapper.d.ts +52 -0
  63. package/v3/UnitsDependencyMapper/UnitsDependencyMapper.js +287 -0
  64. package/v3/UnitsDependencyMapper/UnitsDependencyMapper.js.map +1 -0
  65. package/v3/UnitsMapper/UnitsMapper.d.ts +21 -0
  66. package/v3/UnitsMapper/UnitsMapper.js +60 -0
  67. package/v3/UnitsMapper/UnitsMapper.js.map +1 -0
  68. package/v3/UnitsMapper/resolvers/UnitMapper_Base.d.ts +23 -0
  69. package/v3/UnitsMapper/resolvers/UnitMapper_Base.js +17 -0
  70. package/v3/UnitsMapper/resolvers/UnitMapper_Base.js.map +1 -0
  71. package/v3/UnitsMapper/resolvers/UnitMapper_FirebaseFunction.d.ts +62 -0
  72. package/v3/UnitsMapper/resolvers/UnitMapper_FirebaseFunction.js +56 -0
  73. package/v3/UnitsMapper/resolvers/UnitMapper_FirebaseFunction.js.map +1 -0
  74. package/v3/UnitsMapper/resolvers/UnitMapper_FirebaseHosting.d.ts +38 -0
  75. package/v3/UnitsMapper/resolvers/UnitMapper_FirebaseHosting.js +49 -0
  76. package/v3/UnitsMapper/resolvers/UnitMapper_FirebaseHosting.js.map +1 -0
  77. package/v3/UnitsMapper/resolvers/UnitMapper_Node.d.ts +30 -0
  78. package/v3/UnitsMapper/resolvers/UnitMapper_Node.js +59 -0
  79. package/v3/UnitsMapper/resolvers/UnitMapper_Node.js.map +1 -0
  80. package/v3/UnitsMapper/resolvers/UnitMapper_NodeLib.d.ts +25 -0
  81. package/v3/UnitsMapper/resolvers/UnitMapper_NodeLib.js +29 -0
  82. package/v3/UnitsMapper/resolvers/UnitMapper_NodeLib.js.map +1 -0
  83. package/v3/UnitsMapper/resolvers/UnitMapper_NodeProject.d.ts +24 -0
  84. package/v3/UnitsMapper/resolvers/UnitMapper_NodeProject.js +23 -0
  85. package/v3/UnitsMapper/resolvers/UnitMapper_NodeProject.js.map +1 -0
  86. package/v3/UnitsMapper/resolvers/index.d.ts +4 -0
  87. package/v3/UnitsMapper/resolvers/index.js +5 -0
  88. package/v3/UnitsMapper/resolvers/index.js.map +1 -0
  89. package/v3/UnitsMapper/types.d.ts +24 -0
  90. package/v3/UnitsMapper/types.js +2 -0
  91. package/v3/UnitsMapper/types.js.map +1 -0
  92. package/v3/core/FileSystemUtils.d.ts +34 -0
  93. package/v3/core/FileSystemUtils.js +152 -0
  94. package/v3/core/FileSystemUtils.js.map +1 -0
  95. package/v3/core/FilesCache.d.ts +7 -0
  96. package/v3/core/FilesCache.js +34 -0
  97. package/v3/core/FilesCache.js.map +1 -0
  98. package/v3/core/Unit_HelpPrinter.d.ts +16 -0
  99. package/v3/core/Unit_HelpPrinter.js +48 -0
  100. package/v3/core/Unit_HelpPrinter.js.map +1 -0
  101. package/v3/core/types.d.ts +17 -0
  102. package/v3/core/types.js +6 -0
  103. package/v3/core/types.js.map +1 -0
  104. package/v3/phase/consts.d.ts +52 -0
  105. package/v3/phase/consts.js +127 -0
  106. package/v3/phase/consts.js.map +1 -0
  107. package/v3/phase/index.d.ts +2 -0
  108. package/v3/phase/index.js +3 -0
  109. package/v3/phase/index.js.map +1 -0
  110. package/v3/phase/types.d.ts +9 -0
  111. package/v3/phase/types.js +2 -0
  112. package/v3/phase/types.js.map +1 -0
  113. package/v3/units/BaseUnit.d.ts +46 -0
  114. package/v3/units/BaseUnit.js +120 -0
  115. package/v3/units/BaseUnit.js.map +1 -0
  116. package/v3/units/ProjectUnit.d.ts +18 -0
  117. package/v3/units/ProjectUnit.js +12 -0
  118. package/v3/units/ProjectUnit.js.map +1 -0
  119. package/v3/units/Unit_NodeProject.d.ts +32 -0
  120. package/v3/units/Unit_NodeProject.js +244 -0
  121. package/v3/units/Unit_NodeProject.js.map +1 -0
  122. package/v3/units/Unit_PackageJson.d.ts +19 -0
  123. package/v3/units/Unit_PackageJson.js +42 -0
  124. package/v3/units/Unit_PackageJson.js.map +1 -0
  125. package/v3/units/Unit_TypescriptLib.d.ts +45 -0
  126. package/v3/units/Unit_TypescriptLib.js +373 -0
  127. package/v3/units/Unit_TypescriptLib.js.map +1 -0
  128. package/v3/units/firebase/Unit_FirebaseFunctionsApp.d.ts +62 -0
  129. package/v3/units/firebase/Unit_FirebaseFunctionsApp.js +281 -0
  130. package/v3/units/firebase/Unit_FirebaseFunctionsApp.js.map +1 -0
  131. package/v3/units/firebase/Unit_FirebaseHostingApp.d.ts +49 -0
  132. package/v3/units/firebase/Unit_FirebaseHostingApp.js +100 -0
  133. package/v3/units/firebase/Unit_FirebaseHostingApp.js.map +1 -0
  134. package/v3/units/index.d.ts +5 -0
  135. package/v3/units/index.js +6 -0
  136. package/v3/units/index.js.map +1 -0
  137. package/core/params/types.d.ts +0 -51
  138. package/core/params/types.js +0 -2
  139. package/tsconfig.json +0 -23
  140. package/v2/phase/consts.d.ts +0 -53
  141. package/v2/phase/consts.js +0 -149
  142. package/v2/phase/index.d.ts +0 -2
  143. package/v2/phase/index.js +0 -18
  144. package/v2/phase/types.d.ts +0 -12
  145. package/v2/phase/types.js +0 -2
  146. package/v2/phase-runner/PhaseRunner.d.ts +0 -69
  147. package/v2/phase-runner/PhaseRunner.js +0 -472
  148. package/v2/phase-runner/PhaseRunnerDispatcher.js +0 -37
  149. package/v2/phase-runner/RunnerParams.d.ts +0 -12
  150. package/v2/phase-runner/RunnerParams.js +0 -9
  151. package/v2/phase-runner/consts.d.ts +0 -7
  152. package/v2/phase-runner/consts.js +0 -9
  153. package/v2/phase-runner/kaki.d.ts +0 -0
  154. package/v2/phase-runner/kaki.js +0 -1
  155. package/v2/phase-runner/types.d.ts +0 -13
  156. package/v2/phase-runner/types.js +0 -6
  157. package/v2/project/types.d.ts +0 -8
  158. package/v2/project/types.js +0 -2
  159. package/v2/screens/BAIScreen.d.ts +0 -22
  160. package/v2/screens/BAIScreen.js +0 -82
  161. package/v2/screens/BAIScreenManager.d.ts +0 -28
  162. package/v2/screens/BAIScreenManager.js +0 -77
  163. package/v2/screens/BAIScreen_Launch.d.ts +0 -28
  164. package/v2/screens/BAIScreen_Launch.js +0 -173
  165. package/v2/screens/BAIScreen_UnitList.d.ts +0 -36
  166. package/v2/screens/BAIScreen_UnitList.js +0 -203
  167. package/v2/unit/consts.d.ts +0 -6
  168. package/v2/unit/consts.js +0 -8
  169. package/v2/unit/core/BaseUnit.d.ts +0 -39
  170. package/v2/unit/core/BaseUnit.js +0 -138
  171. package/v2/unit/core/Unit_Python.d.ts +0 -16
  172. package/v2/unit/core/Unit_Python.js +0 -26
  173. package/v2/unit/core/Unit_Typescript.d.ts +0 -49
  174. package/v2/unit/core/Unit_Typescript.js +0 -143
  175. package/v2/unit/core/Unit_TypescriptLib.d.ts +0 -48
  176. package/v2/unit/core/Unit_TypescriptLib.js +0 -226
  177. package/v2/unit/core/Unit_TypescriptProject.d.ts +0 -31
  178. package/v2/unit/core/Unit_TypescriptProject.js +0 -194
  179. package/v2/unit/core/index.d.ts +0 -5
  180. package/v2/unit/core/index.js +0 -21
  181. package/v2/unit/firebase-units/Unit_FirebaseFunctionsApp.d.ts +0 -35
  182. package/v2/unit/firebase-units/Unit_FirebaseFunctionsApp.js +0 -309
  183. package/v2/unit/firebase-units/Unit_FirebaseHostingApp.d.ts +0 -24
  184. package/v2/unit/firebase-units/Unit_FirebaseHostingApp.js +0 -138
  185. package/v2/unit/firebase-units/consts.d.ts +0 -2
  186. package/v2/unit/firebase-units/consts.js +0 -9
  187. package/v2/unit/firebase-units/index.d.ts +0 -2
  188. package/v2/unit/firebase-units/index.js +0 -18
  189. package/v2/unit/runner-dispatchers.js +0 -6
  190. package/v2/unit/thunderstorm.d.ts +0 -171
  191. package/v2/unit/thunderstorm.js +0 -199
  192. package/v2/unit/tools/tools.d.ts +0 -2
  193. package/v2/unit/tools/tools.js +0 -15
  194. package/v2/unit/types.d.ts +0 -8
  195. package/v2/unit/types.js +0 -2
@@ -0,0 +1,244 @@
1
+ import { _keys, arrayToMap, BadImplementationException, flatArray, lastElement, MUSTNeverHappenException, Promise_all_sequentially, queuedDebounce, Second } from '@nu-art/ts-common';
2
+ import * as chokidar from 'chokidar';
3
+ import { Unit_TypescriptLib } from './Unit_TypescriptLib.js';
4
+ import { Commando_NVM } from '@nu-art/commando/shell/plugins/nvm';
5
+ import { Commando_PNPM } from '@nu-art/commando/shell/plugins/pnpm';
6
+ import { PNPM } from '@nu-art/commando/shell/services/pnpm';
7
+ import { Unit_PackageJson } from './Unit_PackageJson.js';
8
+ import { resolve } from 'path';
9
+ import { FileSystemUtils } from '../core/FileSystemUtils.js';
10
+ import { PhaseManager } from '../PhaseManager.js';
11
+ import { phase_CompileWatch } from '../phase/index.js';
12
+ import { UnitsDependencyMapper } from '../UnitsDependencyMapper/UnitsDependencyMapper.js';
13
+ import { CommandoException } from '@nu-art/commando/shell/core/CliError';
14
+ import { CONST_PNPM_LOCK, CONST_PNPM_WORKSPACE } from '../../core/consts.js';
15
+ import { RunningStatusHandler } from '../RunningStatusHandler.js';
16
+ export class Unit_NodeProject extends Unit_PackageJson {
17
+ watcher;
18
+ innerUnits = [];
19
+ suffixesToWatch = [
20
+ 'ts',
21
+ 'tsx',
22
+ 'scss',
23
+ 'json',
24
+ 'svg'
25
+ ];
26
+ constructor(config) {
27
+ super(config);
28
+ this.addToClassStack(Unit_NodeProject);
29
+ }
30
+ deriveDistDependencies() {
31
+ return this.innerUnits.reduce((dependencies, unit) => {
32
+ dependencies[unit.config.key] = this.runtimeContext.baiConfig.thunderstormVersion;
33
+ return dependencies;
34
+ }, super.deriveDistDependencies());
35
+ }
36
+ assignUnit(units) {
37
+ const validUnits = units
38
+ .filter(unit => unit.isInstanceOf(Unit_PackageJson))
39
+ .filter(unit => unit !== this && unit.config.fullPath.includes(this.config.fullPath));
40
+ this.innerUnits.push(...validUnits);
41
+ Object.freeze(this.innerUnits);
42
+ }
43
+ /**
44
+ * Resolve all paths to watch in all project libs
45
+ * @private
46
+ * @returns string[]
47
+ */
48
+ prepareWatchPaths() {
49
+ // Using phase runner instance to resolve all project libs to watch
50
+ const projectLibs = this.innerUnits.filter(unit => unit.isInstanceOf(Unit_TypescriptLib) && !unit.config.hasSelfHotReload);
51
+ //return all paths to watch
52
+ return projectLibs.map(lib => {
53
+ const sourceFolder = `${lib.config.fullPath}/src/main`;
54
+ return {
55
+ paths: this.suffixesToWatch.map(suffix => `${sourceFolder}/**/*.${suffix}`),
56
+ unit: lib,
57
+ fullPath: lib.config.fullPath
58
+ };
59
+ });
60
+ }
61
+ async stopWatch() {
62
+ return this.watcher?.close();
63
+ }
64
+ findUnit = (pathDeclarations, currentPath) => {
65
+ const unitToReturn = pathDeclarations.find(declaration => currentPath.startsWith(`${declaration.fullPath}/`))?.unit;
66
+ if (!unitToReturn)
67
+ throw new MUSTNeverHappenException(`current path doesnt match any declared unit, current path: ${currentPath}`);
68
+ return unitToReturn;
69
+ };
70
+ //######################### Phase Implementation #########################
71
+ async install() {
72
+ if (!this.runtimeContext.runtimeParams.install)
73
+ return;
74
+ const units = this.innerUnits.filter(unit => unit.isInstanceOf(Unit_TypescriptLib));
75
+ const packages = units.map(unit => unit.config.relativePath);
76
+ if (packages.length > 0)
77
+ await PNPM.createWorkspace(packages, this.config.fullPath);
78
+ const commando = this.allocateCommando(Commando_NVM, Commando_PNPM)
79
+ .cd(this.config.fullPath)
80
+ .append(`pnpm store prune`);
81
+ await this.executeAsyncCommando(commando, `pnpm install -f --no-frozen-lockfile --prefer-offline false`, (stdout, stderr, exitCode) => {
82
+ if (exitCode !== 0)
83
+ throw new CommandoException(`Error installing packages`, stdout, stderr, exitCode);
84
+ });
85
+ }
86
+ async watch(timeout = 2 * Second, maxTimeout = 10 * Second) {
87
+ if (this.watcher)
88
+ throw new BadImplementationException('Watcher already initialized, MUST call stopWatch() before calling watch()');
89
+ const pathDeclarations = this.prepareWatchPaths();
90
+ pathDeclarations.forEach(declaration => {
91
+ this.logVerbose('listening unit:', declaration.unit.config.key);
92
+ declaration.unit.logVerbose('listening paths:', declaration.paths.join('\n'));
93
+ });
94
+ const paths = pathDeclarations.flatMap(path => path.paths);
95
+ this.watcher = chokidar.watch(paths);
96
+ // set all events to watch and handle them
97
+ return new Promise((resolve, error) => {
98
+ this.logInfo('Starting the watcher...');
99
+ const units = new Set();
100
+ const pathsToDelete = [];
101
+ const onUnitChange = (path) => {
102
+ const unit = this.findUnit(pathDeclarations, path);
103
+ const filesToIgnore = unit.ignoreWatchFiles();
104
+ if (path.match(new RegExp(filesToIgnore.join('|'))))
105
+ return;
106
+ // @ts-ignore - FIXME: should be a better way
107
+ unit.setStatus('Dirty');
108
+ //add unit to set
109
+ units.add(unit);
110
+ return unit;
111
+ };
112
+ const keyToInnerUnitMap = arrayToMap(this.innerUnits, u => u.config.key);
113
+ const unitsMapper = new UnitsDependencyMapper(this.innerUnits.map(unit => {
114
+ const config = unit.config;
115
+ return ({
116
+ key: config.key,
117
+ dependsOn: _keys(unit.config.dependencies).filter(key => !!keyToInnerUnitMap[key])
118
+ });
119
+ }), this.runtimeContext.globalOutputFolder);
120
+ let watchCompileRunning = false;
121
+ // set the debounce event
122
+ const watchDebounce = () => {
123
+ if (watchCompileRunning)
124
+ return;
125
+ return watchDebounceImpl();
126
+ };
127
+ const watchDebounceImpl = queuedDebounce(async () => {
128
+ watchCompileRunning = true;
129
+ const _pathsToDelete = [...pathsToDelete];
130
+ const unitsToCompile = Array.from(units.values());
131
+ let unitDependencyTree = [unitsToCompile];
132
+ // clear values in order to start collecting values for next debounce
133
+ pathsToDelete.length = 0;
134
+ units.clear();
135
+ // fire all delete events
136
+ await Promise_all_sequentially(_pathsToDelete.map(path => {
137
+ return async () => path.unit.removeSpecificFileFromDist(path.path);
138
+ }));
139
+ const changedKeys = unitsToCompile.map(u => u.config.key);
140
+ const libsToCompile = unitsMapper.getReverseDependencies(changedKeys);
141
+ const fullDependencyTree = (await unitsMapper.buildDependencyTree(libsToCompile))
142
+ .map(units => units.map(unitKey => keyToInnerUnitMap[unitKey]));
143
+ if (this.runtimeContext.runtimeParams.watchBuildTree) {
144
+ unitDependencyTree = fullDependencyTree;
145
+ }
146
+ else {
147
+ const units = flatArray(unitDependencyTree);
148
+ const topApps = lastElement(fullDependencyTree);
149
+ if (topApps?.length) {
150
+ const items = topApps.filter(unit => {
151
+ return unit.isInstanceOf(Unit_TypescriptLib)
152
+ && !unit.isInstanceType(Unit_TypescriptLib)
153
+ && !unit.config.hasSelfHotReload
154
+ && !units.find(u => u.config.key === unit.config.key);
155
+ });
156
+ if (items.length)
157
+ unitDependencyTree.push(items);
158
+ }
159
+ }
160
+ const watchRuntimeParams = {
161
+ ...this.runtimeContext.runtimeParams,
162
+ noBuild: false,
163
+ continue: false
164
+ };
165
+ const phaseManager = new PhaseManager(new RunningStatusHandler(this.config.fullPath, watchRuntimeParams).isolate(), [[phase_CompileWatch]], unitDependencyTree);
166
+ // @ts-ignore
167
+ phaseManager.setTag('PhaseManager-Watcher');
168
+ const executionPlan = await phaseManager.calculateExecutionSteps();
169
+ const stopWatchCompileAction = async () => {
170
+ await phaseManager.break();
171
+ };
172
+ process.on('SIGINT', stopWatchCompileAction);
173
+ try {
174
+ this.unregisterTerminatable(stopWatchAction);
175
+ await phaseManager.execute(executionPlan);
176
+ }
177
+ catch (e) {
178
+ this.logError('Error while compiling', e);
179
+ }
180
+ finally {
181
+ this.registerTerminatable(stopWatchAction);
182
+ }
183
+ process.off('SIGINT', stopWatchCompileAction);
184
+ this.logInfo('Watch Compile Completed successfully');
185
+ watchCompileRunning = false;
186
+ if (units.size > 0)
187
+ watchDebounce();
188
+ }, timeout, maxTimeout);
189
+ this.watcher
190
+ .on('error', (error) => {
191
+ this.logError('Error while watching', error);
192
+ })
193
+ .on('ready', () => {
194
+ this.logInfo('Watching...');
195
+ for (const unit of this.innerUnits)
196
+ // @ts-ignore
197
+ unit.setStatus('Watching...');
198
+ this.watcher
199
+ .on('add', (path) => {
200
+ onUnitChange(path);
201
+ if (!watchCompileRunning)
202
+ //trigger debounce
203
+ watchDebounce();
204
+ })
205
+ .on('change', (path) => {
206
+ onUnitChange(path);
207
+ //trigger debounce
208
+ watchDebounce();
209
+ })
210
+ .on('unlinkDir', (path) => {
211
+ const unit = onUnitChange(path);
212
+ if (!unit)
213
+ return;
214
+ //update paths to delete
215
+ pathsToDelete.push({ path, unit });
216
+ //trigger debounce
217
+ watchDebounce();
218
+ })
219
+ .on('unlink', (path) => {
220
+ const unit = onUnitChange(path);
221
+ if (!unit)
222
+ return;
223
+ //update paths to delete
224
+ pathsToDelete.push({ path, unit });
225
+ //trigger debounce
226
+ watchDebounce();
227
+ });
228
+ });
229
+ const stopWatchAction = async () => {
230
+ await this.watcher?.close();
231
+ resolve();
232
+ };
233
+ this.registerTerminatable(stopWatchAction);
234
+ });
235
+ }
236
+ async purge() {
237
+ await FileSystemUtils.file.delete(resolve(this.config.fullPath, CONST_PNPM_LOCK));
238
+ await FileSystemUtils.file.delete(resolve(this.config.fullPath, CONST_PNPM_WORKSPACE));
239
+ return super.purge();
240
+ }
241
+ async postPublish() {
242
+ }
243
+ }
244
+ //# sourceMappingURL=Unit_NodeProject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Unit_NodeProject.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/build-and-install/src/main/","sources":["v3/units/Unit_NodeProject.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,KAAK,EACL,UAAU,EACV,0BAA0B,EAC1B,SAAS,EACT,WAAW,EACX,wBAAwB,EACxB,wBAAwB,EACxB,cAAc,EACd,MAAM,EACN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAErC,OAAO,EAAC,kBAAkB,EAAC,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAC,YAAY,EAAC,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAC,aAAa,EAAC,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAC,IAAI,EAAC,MAAM,sCAAsC,CAAC;AAC1D,OAAO,EAAC,gBAAgB,EAA0B,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAC,OAAO,EAAC,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAC,eAAe,EAAC,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAC,kBAAkB,EAAgD,MAAM,mBAAmB,CAAC;AACpG,OAAO,EAAC,qBAAqB,EAAC,MAAM,mDAAmD,CAAC;AAExF,OAAO,EAAC,iBAAiB,EAAC,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAC,oBAAoB,EAAC,MAAM,4BAA4B,CAAC;AAUhE,MAAM,OAAO,gBACZ,SAAQ,gBAAmB;IAGnB,OAAO,CAAa;IACnB,UAAU,GAAuB,EAAE,CAAC;IAE5B,eAAe,GAAa;QAC5C,IAAI;QACJ,KAAK;QACL,MAAM;QACN,MAAM;QACN,KAAK;KACL,CAAC;IAGF,YAA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M,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC;QACvF,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,WAAW;IAEjB,CAAC;CACD"}
@@ -0,0 +1,19 @@
1
+ import { UnitPhaseImplementor } from '../core/types.js';
2
+ import { Config_ProjectUnit, ProjectUnit } from './ProjectUnit.js';
3
+ import { TS_PackageJSON } from '../UnitsMapper/types.js';
4
+ import { Phase_Prepare, Phase_Purge } from '../phase/index.js';
5
+ export type Unit_PackageJson_Config = Config_ProjectUnit & {
6
+ packageJson: TS_PackageJSON;
7
+ };
8
+ export declare class Unit_PackageJson<C extends Unit_PackageJson_Config = Unit_PackageJson_Config> extends ProjectUnit<C> implements UnitPhaseImplementor<[Phase_Purge, Phase_Prepare]> {
9
+ constructor(config: C);
10
+ protected deriveDistDependencies(): {
11
+ [s: string]: string;
12
+ };
13
+ protected deriveLibDependencies(): {
14
+ [s: string]: string;
15
+ };
16
+ prepare(): Promise<void>;
17
+ purge(): Promise<void>;
18
+ protected releasePorts(allPorts: string[]): Promise<void>;
19
+ }
@@ -0,0 +1,42 @@
1
+ import { CONST_NodeModules, CONST_PackageJSON } from '../../core/consts.js';
2
+ import { __stringify } from '@nu-art/ts-common';
3
+ import { ProjectUnit } from './ProjectUnit.js';
4
+ import { resolve } from 'path';
5
+ import { DEFAULT_OLD_TEMPLATE_PATTERN, FileSystemUtils } from '../core/FileSystemUtils.js';
6
+ import { Commando_NVM } from '@nu-art/commando/shell/plugins/nvm';
7
+ export class Unit_PackageJson extends ProjectUnit {
8
+ constructor(config) {
9
+ super(config);
10
+ this.addToClassStack(Unit_PackageJson);
11
+ }
12
+ //######################### Internal Logic #########################
13
+ deriveDistDependencies() {
14
+ return { ...this.runtimeContext.baiConfig.templateParams?.packageJson };
15
+ }
16
+ deriveLibDependencies() {
17
+ return this.runtimeContext.childUnits.reduce((dependencies, unit) => {
18
+ dependencies[unit.config.key] = 'workspace:*';
19
+ return dependencies;
20
+ }, { ...this.runtimeContext.baiConfig.templateParams?.packageJson });
21
+ }
22
+ //######################### Phase Implementations #########################
23
+ async prepare() {
24
+ const targetPath = resolve(this.config.fullPath, CONST_PackageJSON);
25
+ const params = this.deriveLibDependencies();
26
+ const packageJson = FileSystemUtils.file.template.transform(__stringify(this.config.packageJson, true), params);
27
+ await FileSystemUtils.file.template.write(targetPath, packageJson, params, DEFAULT_OLD_TEMPLATE_PATTERN);
28
+ }
29
+ async purge() {
30
+ await FileSystemUtils.file.delete(resolve(this.config.fullPath, CONST_PackageJSON));
31
+ await FileSystemUtils.folder.delete(resolve(this.config.fullPath, CONST_NodeModules));
32
+ }
33
+ async releasePorts(allPorts) {
34
+ const commando = this.allocateCommando(Commando_NVM).applyNVM();
35
+ await commando.setUID(this.config.key)
36
+ .append(`array=($(lsof -ti:${allPorts.join(',')}))`)
37
+ .append(`((\${#array[@]} > 0)) && kill -9 "\${array[@]}"`)
38
+ .append('echo ')
39
+ .execute();
40
+ }
41
+ }
42
+ //# sourceMappingURL=Unit_PackageJson.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Unit_PackageJson.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/build-and-install/src/main/","sources":["v3/units/Unit_PackageJson.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAqB,WAAW,EAAC,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAC,OAAO,EAAC,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAC,4BAA4B,EAAE,eAAe,EAAC,MAAM,4BAA4B,CAAC;AAGzF,OAAO,EAAC,YAAY,EAAC,MAAM,oCAAoC,CAAC;AAMhE,MAAM,OAAO,gBACZ,SAAQ,WAAc;IAItB,YAAY,MAAS;QACpB,KAAK,CAAC,M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AAM,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC;IACvF,CAAC;IAES,KAAK,CAAC,YAAY,CAAC,QAAkB;QAC9C,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC;QAEhE,MAAM,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;aACpC,MAAM,CAAC,qBAAqB,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;aACnD,MAAM,CAAC,iDAAiD,CAAC;aACzD,MAAM,CAAC,OAAO,CAAC;aACf,OAAO,EAAE,CAAC;IACb,CAAC;CACD"}
@@ -0,0 +1,45 @@
1
+ import { TypedMap } from '@nu-art/ts-common';
2
+ import { UnitPhaseImplementor } from '../core/types.js';
3
+ import { Unit_PackageJson, Unit_PackageJson_Config } from './Unit_PackageJson.js';
4
+ import { Phase_CheckCyclicImports, Phase_Compile, Phase_Lint, Phase_PreCompile, Phase_PrintDependencyTree, Phase_Publish, Phase_PublishDryRun, Phase_Test } from '../phase/index.js';
5
+ export type Unit_TypescriptLib_Config = Unit_PackageJson_Config & {
6
+ customESLintConfig: boolean;
7
+ customTSConfig: boolean;
8
+ hasSelfHotReload: boolean;
9
+ output: string;
10
+ };
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_PublishDryRun]> {
12
+ private TestTypeWorkspaceSetup;
13
+ runTests(): Promise<void>;
14
+ constructor(config: Unit_TypescriptLib<C>['config']);
15
+ protected clearOutputDir(): Promise<void>;
16
+ protected clearOutputDirImpl(): Promise<void>;
17
+ prepare(): Promise<void>;
18
+ protected compileImpl(): Promise<void>;
19
+ protected copyAssetsToOutput(): Promise<void>;
20
+ ignoreWatchFiles(): string[];
21
+ /**
22
+ * Watch compile actions, use this to perform all necessary compile actions for watch.
23
+ * watch compile is a subset of the general watch action
24
+ */
25
+ watchCompile(): Promise<void>;
26
+ /**
27
+ * Remove the deleted file/folder from the dist folder on watch remove file event
28
+ * @param path The path of the currently removed file/folder
29
+ * @private
30
+ */
31
+ removeSpecificFileFromDist(path: string): Promise<void>;
32
+ preCompile(): Promise<void>;
33
+ compile(): Promise<void>;
34
+ protected postCompile(): Promise<void>;
35
+ protected copyPackageJSONToOutput(): Promise<void>;
36
+ purge(): Promise<void>;
37
+ printDependencyTree(): Promise<void>;
38
+ checkCyclicImports(): Promise<void>;
39
+ lint(): Promise<void>;
40
+ private resolveESLintConfig;
41
+ protected deriveTSConfigPaths(): TypedMap<string[]>;
42
+ protected resolveTSConfig(srcFolder: string, sourceFolderType: string): Promise<void>;
43
+ publishDryRun(): Promise<void>;
44
+ publish(): Promise<void>;
45
+ }