@teambit/workspace-config-files 1.0.108 → 1.0.109

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/dedup-paths.ts DELETED
@@ -1,120 +0,0 @@
1
- import { invertBy, uniq } from 'lodash';
2
- import { dirname } from 'path';
3
- import { PathLinuxRelative } from '@teambit/legacy/dist/utils/path';
4
- import { CompPathExtendingHashMap, EnvCompsDirsMap } from './workspace-config-files.main.runtime';
5
- import { ExtendingConfigFilesMap } from './writers';
6
-
7
- export type DedupedPaths = Array<{
8
- fileHash: string;
9
- paths: string[];
10
- }>;
11
-
12
- function getAllPossibleDirsFromPaths(paths: PathLinuxRelative[]): PathLinuxRelative[] {
13
- const dirs = paths.map((p) => getAllParentsDirOfPath(p)).flat();
14
- dirs.push('.'); // add the root dir
15
- return uniq(dirs);
16
- }
17
-
18
- function getAllParentsDirOfPath(p: PathLinuxRelative): PathLinuxRelative[] {
19
- const all: string[] = [];
20
- let current = p;
21
- while (current !== '.') {
22
- all.push(current);
23
- current = dirname(current);
24
- }
25
- return all;
26
- }
27
-
28
- export function buildCompPathExtendingHashMap(
29
- extendingConfigFilesMap: ExtendingConfigFilesMap,
30
- envCompsDirsMap: EnvCompsDirsMap
31
- ): CompPathExtendingHashMap {
32
- const map = Object.entries(extendingConfigFilesMap).reduce((acc, [hash, { envIds }]) => {
33
- envIds.forEach((envId) => {
34
- const envCompDirs = envCompsDirsMap[envId];
35
- envCompDirs.paths.forEach((compPath) => {
36
- acc[compPath] = hash;
37
- });
38
- });
39
- return acc;
40
- }, {});
41
- return map;
42
- }
43
-
44
- /**
45
- * easier to understand by an example:
46
- * input:
47
- * [
48
- * { fileHash: hash1, paths: [ui/button, ui/form] },
49
- * { fileHash: hash2, paths: [p/a1, p/a2] },
50
- * { fileHash: hash3, paths: [p/n1] },
51
- * ]
52
- *
53
- * output:
54
- * [
55
- * { fileHash: hash1, paths: [ui] },
56
- * { fileHash: hash2, paths: [p] },
57
- * { fileHash: hash3, paths: [p/n1] },
58
- * ]
59
- *
60
- * the goal is to minimize the amount of files to write per env if possible.
61
- * when multiple components of the same env share a root-dir, then, it's enough to write a file in that shared dir.
62
- * if in a shared-dir, some components using env1 and some env2, it finds the env that has the max number of
63
- * components, this env will be optimized. other components, will have the files written inside their dirs.
64
- */
65
- export function dedupePaths(
66
- extendingConfigFilesMap: ExtendingConfigFilesMap,
67
- envCompsDirsMap: EnvCompsDirsMap
68
- ): DedupedPaths {
69
- const rootDir = '.';
70
-
71
- const compPathExtendingHashMap = buildCompPathExtendingHashMap(extendingConfigFilesMap, envCompsDirsMap);
72
- const allPaths = Object.keys(compPathExtendingHashMap);
73
- const allPossibleDirs = getAllPossibleDirsFromPaths(allPaths);
74
-
75
- const allPathsPerFileHash: { [path: string]: string | null } = {}; // null when parent-dir has same amount of comps per env.
76
-
77
- const calculateBestFileForDir = (dir: string) => {
78
- if (compPathExtendingHashMap[dir]) {
79
- // it's the component dir, so it's the file that should be written.
80
- allPathsPerFileHash[dir] = compPathExtendingHashMap[dir];
81
- return;
82
- }
83
- const allPathsShareSameDir = dir === rootDir ? allPaths : allPaths.filter((p) => p.startsWith(`${dir}/`));
84
- const countPerFileHash: { [fileHash: string]: number } = {};
85
- allPathsShareSameDir.forEach((p) => {
86
- const fileHash = compPathExtendingHashMap[p];
87
- if (countPerFileHash[fileHash]) countPerFileHash[fileHash] += 1;
88
- else countPerFileHash[fileHash] = 1;
89
- });
90
- const max = Math.max(...Object.values(countPerFileHash));
91
- const fileHashWithMax = Object.keys(countPerFileHash).filter((fileHash) => countPerFileHash[fileHash] === max);
92
- if (!fileHashWithMax.length) throw new Error(`must be at least one fileHash related to path "${dir}"`);
93
- if (fileHashWithMax.length > 1) allPathsPerFileHash[dir] = null;
94
- else allPathsPerFileHash[dir] = fileHashWithMax[0];
95
- };
96
-
97
- allPossibleDirs.forEach((dirPath) => {
98
- calculateBestFileForDir(dirPath);
99
- });
100
-
101
- // this is the actual deduping. if found a shorter path with the same env, then no need for this path.
102
- // in other words, return only the paths that their parent is null or has a different env.
103
- const dedupedPathsPerFileHash = Object.keys(allPathsPerFileHash).reduce((acc, current) => {
104
- if (allPathsPerFileHash[current] && allPathsPerFileHash[dirname(current)] !== allPathsPerFileHash[current]) {
105
- acc[current] = allPathsPerFileHash[current];
106
- }
107
-
108
- return acc;
109
- }, {});
110
- // rootDir parent is always rootDir, so leave it as is.
111
- if (allPathsPerFileHash[rootDir]) dedupedPathsPerFileHash[rootDir] = allPathsPerFileHash[rootDir];
112
-
113
- const fileHashPerDedupedPaths = invertBy(dedupedPathsPerFileHash);
114
-
115
- const dedupedPaths = Object.keys(fileHashPerDedupedPaths).map((fileHash) => ({
116
- fileHash,
117
- paths: fileHashPerDedupedPaths[fileHash],
118
- }));
119
- return dedupedPaths;
120
- }
package/index.ts DELETED
@@ -1,22 +0,0 @@
1
- import { WorkspaceConfigFilesAspect } from './workspace-config-files.aspect';
2
-
3
- export type {
4
- WorkspaceConfigFilesMain,
5
- WriteConfigFilesResult,
6
- EnvCompsDirsMap,
7
- EnvMapValue,
8
- OneConfigWriterIdResult,
9
- WriteResults,
10
- } from './workspace-config-files.main.runtime';
11
- export type {
12
- ConfigWriterEntry,
13
- ExtendingConfigFile,
14
- ConfigFile,
15
- PostProcessExtendingConfigFilesArgs,
16
- GenerateExtendingConfigFilesArgs,
17
- } from './config-writer-entry';
18
- export type { ConfigWriterHandler } from './config-writer-list';
19
- export type { WorkspaceConfigEnv } from './workspace-config-env-type';
20
- export { ConfigWriterList } from './config-writer-list';
21
- export default WorkspaceConfigFilesAspect;
22
- export { WorkspaceConfigFilesAspect };
@@ -1,8 +0,0 @@
1
- import { ConfigWriterList } from './config-writer-list';
2
-
3
- export interface WorkspaceConfigEnv {
4
- /**
5
- * return a ConfigWriterList instance.
6
- */
7
- workspaceConfig?(): ConfigWriterList;
8
- }
@@ -1,5 +0,0 @@
1
- import { Aspect } from '@teambit/harmony';
2
-
3
- export const WorkspaceConfigFilesAspect = Aspect.create({
4
- id: 'teambit.workspace/workspace-config-files',
5
- });
@@ -1,429 +0,0 @@
1
- import fs from 'fs-extra';
2
- import { join } from 'path';
3
- import globby from 'globby';
4
- import chalk from 'chalk';
5
- import { PromptCanceled } from '@teambit/legacy/dist/prompts/exceptions';
6
- import pMapSeries from 'p-map-series';
7
- import { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';
8
- import yesno from 'yesno';
9
- import { defaults, flatMap, isFunction, pick, uniq } from 'lodash';
10
- import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';
11
- import { WorkspaceAspect } from '@teambit/workspace';
12
- import type { Workspace } from '@teambit/workspace';
13
- import { Environment, EnvsAspect, ExecutionContext } from '@teambit/envs';
14
- import type { EnvsMain } from '@teambit/envs';
15
- import { Logger, LoggerAspect } from '@teambit/logger';
16
- import type { LoggerMain } from '@teambit/logger';
17
- import { WorkspaceConfigFilesAspect } from './workspace-config-files.aspect';
18
- import { ConfigWriterEntry } from './config-writer-entry';
19
- import { WsConfigCleanCmd, WsConfigCmd, WsConfigListCmd, WsConfigWriteCmd } from './ws-config.cmd';
20
- import WriteConfigFilesFailed from './exceptions/write-failed';
21
- import { WorkspaceConfigFilesService } from './workspace-config-files.service';
22
- import {
23
- handleRealConfigFiles,
24
- handleExtendingConfigFiles,
25
- EnvsWrittenExtendingConfigFiles,
26
- EnvsWrittenRealConfigFiles,
27
- } from './writers';
28
-
29
- /**
30
- * Configs that can be configured in the workspace.jsonc file
31
- */
32
- export type WorkspaceConfigFilesAspectConfig = {
33
- configsRootDir?: string;
34
- enableWorkspaceConfigWrite?: boolean;
35
- };
36
-
37
- export type EnvConfigWriter = {
38
- envId: string;
39
- executionContext: ExecutionContext;
40
- configWriters: ConfigWriterEntry[];
41
- };
42
-
43
- export type EnvConfigWriterEntry = {
44
- envId: string;
45
- configWriter: ConfigWriterEntry;
46
- executionContext: ExecutionContext;
47
- };
48
-
49
- type WriterIdsToEnvEntriesMap = {
50
- [writerId: string]: EnvConfigWriterEntry[];
51
- };
52
-
53
- export type EnvConfigWritersList = Array<EnvConfigWriter>;
54
-
55
- export type CleanConfigFilesOptions = {
56
- silent?: boolean; // no prompt
57
- dryRun?: boolean;
58
- writers?: string[];
59
- };
60
-
61
- export type WriteConfigFilesOptions = {
62
- clean?: boolean;
63
- silent?: boolean; // no prompt
64
- dedupe?: boolean;
65
- dryRun?: boolean;
66
- throw?: boolean;
67
- writers?: string[];
68
- };
69
-
70
- export type CompPathExtendingHashMap = { [compPath: string]: string };
71
-
72
- export type EnvMapValue = { env: Environment; id: string[]; paths: string[] };
73
- export type EnvCompsDirsMap = { [envId: string]: EnvMapValue };
74
-
75
- export type OneConfigWriterIdResult = {
76
- writerId: string;
77
- totalWrittenFiles: number;
78
- realConfigFiles: EnvsWrittenRealConfigFiles;
79
- totalRealConfigFiles: number;
80
- extendingConfigFiles: EnvsWrittenExtendingConfigFiles;
81
- totalExtendingConfigFiles: number;
82
- };
83
-
84
- export type WriteResults = {
85
- writersResult: OneConfigWriterIdResult[];
86
- totalWrittenFiles: number;
87
- totalRealConfigFiles: number;
88
- totalExtendingConfigFiles: number;
89
- };
90
-
91
- export type WriteConfigFilesResult = {
92
- cleanResults?: string[];
93
- writeResults: WriteResults;
94
- wsDir: string;
95
- err?: Error;
96
- };
97
-
98
- export class WorkspaceConfigFilesMain {
99
- private envsNotImplementing = {};
100
-
101
- constructor(
102
- private workspace: Workspace,
103
- private envs: EnvsMain,
104
- private logger: Logger,
105
- private config: WorkspaceConfigFilesAspectConfig
106
- ) {}
107
-
108
- /**
109
- * It writes the configuration files for the workspace
110
- * for example: tsconfig, eslint config and prettier config files.
111
- * @param {WriteConfigFilesOptions} options - WriteConfigFilesOptions = {}
112
- * @returns An object with the following properties:
113
- * - writeResults: An object with the following properties:
114
- * - aspectsWritersResults: An array of objects with the following properties:
115
- * - aspect: The aspect that was written
116
- * - totalWrittenFiles: The number of files that were written
117
- * - totalWrittenFiles: The total number of files that were written
118
- * - cleanResults: array of deleted paths
119
- */
120
- async writeConfigFiles(options: WriteConfigFilesOptions = {}): Promise<WriteConfigFilesResult> {
121
- if (!this.workspace) {
122
- throw new ConsumerNotFound();
123
- }
124
- const defaultOpts: WriteConfigFilesOptions = {
125
- clean: false,
126
- dedupe: false,
127
- silent: false,
128
- dryRun: false,
129
- throw: true,
130
- };
131
- const optionsWithDefaults = defaults(options, defaultOpts);
132
- const execContext = await this.getExecContext();
133
-
134
- let pathsToClean: string[] | undefined = [];
135
- if (optionsWithDefaults.clean) {
136
- pathsToClean = await this.calcPathsToClean({ writers: optionsWithDefaults.writers });
137
- }
138
-
139
- let writeErr;
140
- let writeResults;
141
- try {
142
- writeResults = await this.write(execContext, optionsWithDefaults);
143
- const allWrittenFiles = writeResults.writersResult.flatMap((writerResult) => {
144
- return writerResult.extendingConfigFiles.flatMap((extendingConfigFile) => {
145
- return extendingConfigFile.extendingConfigFile.filePaths;
146
- });
147
- });
148
- // Avoid delete and re-create files that were written by other config writers
149
- // instead of deleting at the beginning then write all
150
- // we write all and then delete the files that were not written by the config writers
151
- // This reduces the config files that re-created (as many times no changes needed)
152
- // which prevent issues with needing to restart the ts-server in the ide
153
- pathsToClean = pathsToClean.filter(
154
- (pathToClean) => !allWrittenFiles.includes(join(this.workspace.path, pathToClean))
155
- );
156
- await this.deleteFiles(pathsToClean);
157
- } catch (err) {
158
- this.logger.info('writeConfigFiles failed', err);
159
- if (optionsWithDefaults.throw) {
160
- throw new WriteConfigFilesFailed();
161
- }
162
- writeErr = err;
163
- }
164
-
165
- return { writeResults, cleanResults: pathsToClean, wsDir: this.workspace.path, err: writeErr };
166
- }
167
-
168
- /**
169
- * This will check the config.enableWorkspaceConfigWrite before writing the config files.
170
- */
171
- async writeConfigFilesIfEnabled(options: WriteConfigFilesOptions = {}): Promise<WriteConfigFilesResult | undefined> {
172
- const shouldWrite = this.isWorkspaceConfigWriteEnabled();
173
- if (!shouldWrite) return undefined;
174
- return this.writeConfigFiles(options);
175
- }
176
-
177
- /**
178
- * It cleans (delete) the config files from the workspace.
179
- * This will check each file and will only delete it in case it was generated by bit
180
- * @param {CleanConfigFilesOptions} options - CleanConfigFilesOptions = {}
181
- * @returns An array of strings.
182
- */
183
- async cleanConfigFiles(options: CleanConfigFilesOptions = {}): Promise<string[]> {
184
- // const execContext = await this.getExecContext();
185
- if (!this.workspace) {
186
- throw new ConsumerNotFound();
187
- }
188
- const cleanResults = await this.clean(options);
189
- return cleanResults;
190
- }
191
-
192
- /**
193
- * The function checks if the auto writing of workspace configuration is enabled.
194
- * if it's enabled we will re-generate the configuration files upon bit create
195
- * @returns the boolean value of `!!this.config.enableWorkspaceConfigWrite`.
196
- */
197
- isWorkspaceConfigWriteEnabled() {
198
- return !!this.config.enableWorkspaceConfigWrite;
199
- }
200
-
201
- /**
202
- * It returns a list of all the config writers that have been registered with the config writer slot
203
- * @returns An array of objects with aspectId and configWriter properties.
204
- */
205
- async listConfigWriters(): Promise<EnvConfigWritersList> {
206
- if (!this.workspace) {
207
- throw new ConsumerNotFound();
208
- }
209
- const execContexts = await this.getExecContext();
210
-
211
- const result: EnvConfigWritersList = execContexts.map((executionContext) => {
212
- const configWriters = this.getConfigWriters(executionContext);
213
- return { envId: executionContext.envRuntime.id, executionContext, configWriters };
214
- });
215
- return result;
216
- }
217
-
218
- private groupByWriterId(writerList: EnvConfigWritersList): WriterIdsToEnvEntriesMap {
219
- return writerList.reduce((acc, envConfigWriter: EnvConfigWriter) => {
220
- envConfigWriter.configWriters.forEach((configWriter: ConfigWriterEntry) => {
221
- acc[configWriter.id] = acc[configWriter.id] || [];
222
- acc[configWriter.id].push({ configWriter, envId: envConfigWriter.envId });
223
- });
224
- return acc;
225
- }, {});
226
- }
227
-
228
- private async write(envsExecutionContext: ExecutionContext[], opts: WriteConfigFilesOptions): Promise<WriteResults> {
229
- const envCompDirsMap = this.getEnvComponentsDirsMap(envsExecutionContext);
230
- const configsRootDir = this.getConfigsRootDir();
231
- const configWriters = await this.listConfigWriters();
232
- const writerIdsToEnvEntriesMap = this.groupByWriterId(configWriters);
233
- const filteredWriterIdsToEnvEntriesMap = opts.writers
234
- ? pick(writerIdsToEnvEntriesMap, opts.writers)
235
- : writerIdsToEnvEntriesMap;
236
- let totalRealConfigFiles = 0;
237
- let totalExtendingConfigFiles = 0;
238
- const results = await pMapSeries(
239
- Object.entries(filteredWriterIdsToEnvEntriesMap),
240
- async ([writerId, envEntries]) => {
241
- const oneResult = await this.handleOneIdWriter(writerId, envEntries, envCompDirsMap, configsRootDir, opts);
242
- totalRealConfigFiles += oneResult.totalRealConfigFiles;
243
- totalExtendingConfigFiles += oneResult.totalExtendingConfigFiles;
244
- return oneResult;
245
- }
246
- );
247
-
248
- const totalWrittenFiles = totalRealConfigFiles + totalExtendingConfigFiles;
249
- return { writersResult: results, totalWrittenFiles, totalRealConfigFiles, totalExtendingConfigFiles };
250
- }
251
-
252
- private async handleOneIdWriter(
253
- writerId: string,
254
- envEntries: EnvConfigWriterEntry[],
255
- envCompsDirsMap: EnvCompsDirsMap,
256
- configsRootDir: string,
257
- opts: WriteConfigFilesOptions
258
- ): Promise<OneConfigWriterIdResult> {
259
- const writtenRealConfigFilesMap = await handleRealConfigFiles(envEntries, envCompsDirsMap, configsRootDir, opts);
260
- const writtenExtendingConfigFiles = await handleExtendingConfigFiles(
261
- envEntries,
262
- envCompsDirsMap,
263
- writtenRealConfigFilesMap,
264
- configsRootDir,
265
- this.workspace.path,
266
- opts
267
- );
268
-
269
- const writtenRealConfigFiles = Object.values(writtenRealConfigFilesMap);
270
- const totalRealConfigFiles = writtenRealConfigFiles.length;
271
- const totalExtendingConfigFiles = writtenExtendingConfigFiles.reduce(
272
- (acc, curr) => acc + curr.extendingConfigFile.filePaths.length,
273
- 0
274
- );
275
- const totalWrittenFiles = totalRealConfigFiles + totalExtendingConfigFiles;
276
- return {
277
- writerId,
278
- totalWrittenFiles,
279
- realConfigFiles: writtenRealConfigFiles,
280
- totalRealConfigFiles,
281
- extendingConfigFiles: writtenExtendingConfigFiles,
282
- totalExtendingConfigFiles,
283
- };
284
- }
285
-
286
- private getConfigsRootDir(): string {
287
- const userConfiguredDir = this.config.configsRootDir;
288
- return userConfiguredDir ? join(this.workspace.path, userConfiguredDir) : this.getCacheDir(this.workspace.path);
289
- }
290
-
291
- private getCacheDir(rootDir): string {
292
- return join(rootDir, 'node_modules', '.cache');
293
- }
294
-
295
- private async getExecContext(): Promise<ExecutionContext[]> {
296
- const components = await this.workspace.list();
297
- const runtime = await this.envs.createEnvironment(components);
298
- const execContext = runtime.getEnvExecutionContext();
299
- return execContext;
300
- }
301
-
302
- private getEnvComponentsDirsMap(envsExecutionContext: ExecutionContext[]): EnvCompsDirsMap {
303
- const envCompDirsMap = envsExecutionContext.reduce((acc, envExecution) => {
304
- const envRuntime = envExecution.envRuntime;
305
- const envId = envRuntime.id.toString();
306
- const value = {
307
- id: envRuntime.id,
308
- env: envRuntime.env,
309
- paths: envRuntime.components.map((c) => this.workspace.componentDir(c.id, undefined, { relative: true })),
310
- };
311
- acc[envId] = value;
312
- return acc;
313
- }, {});
314
- return envCompDirsMap;
315
- }
316
-
317
- private getConfigWriters(envExecutionContext: ExecutionContext): ConfigWriterEntry[] {
318
- if (envExecutionContext.env.workspaceConfig && isFunction(envExecutionContext.env.workspaceConfig)) {
319
- return envExecutionContext.env.workspaceConfig();
320
- }
321
- this.addToEnvsNotImplementing(envExecutionContext.env.id);
322
- return [];
323
- }
324
-
325
- private getFlatConfigWriters(envsExecutionContext: ExecutionContext[]): ConfigWriterEntry[] {
326
- return flatMap(envsExecutionContext, (envExecutionContext) => {
327
- return this.getConfigWriters(envExecutionContext);
328
- });
329
- }
330
-
331
- /**
332
- * Clean config files written by the config-writers
333
- * @param envsExecutionContext
334
- * @param param1
335
- * @returns Array of paths of deleted config files
336
- */
337
- async clean({ dryRun, silent, writers }: WriteConfigFilesOptions): Promise<string[]> {
338
- const paths = await this.calcPathsToClean({ writers });
339
- if (dryRun) return paths;
340
- if (!silent) await this.promptForCleaning(paths);
341
- await this.deleteFiles(paths);
342
- return paths;
343
- }
344
-
345
- private async calcPathsToClean({ writers }: WriteConfigFilesOptions): Promise<string[]> {
346
- const execContext = await this.getExecContext();
347
- const configWriters = this.getFlatConfigWriters(execContext);
348
- const filteredConfigWriters = writers
349
- ? configWriters.filter((configWriter) => writers.includes(configWriter.id))
350
- : configWriters;
351
-
352
- const paths = uniq(
353
- filteredConfigWriters
354
- .map((configWriter) => {
355
- const patterns = configWriter.patterns;
356
- const currPaths = globby.sync(patterns, {
357
- cwd: this.workspace.path,
358
- dot: true,
359
- onlyFiles: true,
360
- ignore: ['**/node_modules/**'],
361
- });
362
- const filteredPaths = currPaths.filter((path) => {
363
- const fullPath = join(this.workspace.path, path);
364
- return configWriter.isBitGenerated ? configWriter.isBitGenerated(fullPath) : true;
365
- });
366
- return filteredPaths;
367
- })
368
- .flat()
369
- );
370
- return paths;
371
- }
372
-
373
- private addToEnvsNotImplementing(envId: string) {
374
- this.envsNotImplementing[envId] = true;
375
- }
376
-
377
- getEnvsNotImplementing() {
378
- return Object.keys(this.envsNotImplementing);
379
- }
380
-
381
- private async promptForCleaning(paths: string[]) {
382
- this.logger.clearStatusLine();
383
- const ok = await yesno({
384
- question: `${chalk.underline('The following files will be deleted:')}
385
- ${paths.join('\n')}
386
- ${chalk.bold('Do you want to continue? [yes(y)/no(n)]')}`,
387
- });
388
- if (!ok) {
389
- throw new PromptCanceled();
390
- }
391
- }
392
-
393
- private async deleteFiles(paths: string[]) {
394
- await Promise.all(paths.map((f) => fs.remove(join(this.workspace.path, f))));
395
- }
396
-
397
- static slots = [];
398
- // define your aspect dependencies here.
399
- // in case you need to use another aspect API.
400
- static dependencies = [CLIAspect, WorkspaceAspect, EnvsAspect, LoggerAspect];
401
-
402
- static runtime = MainRuntime;
403
-
404
- static defaultConfig: Partial<WorkspaceConfigFilesAspectConfig> = {
405
- enableWorkspaceConfigWrite: false,
406
- };
407
-
408
- static async provider(
409
- [cli, workspace, envs, loggerAspect]: [CLIMain, Workspace, EnvsMain, LoggerMain],
410
- config: WorkspaceConfigFilesAspectConfig
411
- ) {
412
- const logger = loggerAspect.createLogger(WorkspaceConfigFilesAspect.id);
413
- envs.registerService(new WorkspaceConfigFilesService(logger));
414
-
415
- const workspaceConfigFilesMain = new WorkspaceConfigFilesMain(workspace, envs, logger, config);
416
- const wsConfigCmd = new WsConfigCmd();
417
- wsConfigCmd.commands = [
418
- new WsConfigWriteCmd(workspaceConfigFilesMain),
419
- new WsConfigCleanCmd(workspaceConfigFilesMain),
420
- new WsConfigListCmd(workspaceConfigFilesMain),
421
- ];
422
- cli.register(wsConfigCmd);
423
- return workspaceConfigFilesMain;
424
- }
425
- }
426
-
427
- WorkspaceConfigFilesAspect.addRuntime(WorkspaceConfigFilesMain);
428
-
429
- export default WorkspaceConfigFilesMain;