@teambit/workspace-config-files 0.0.20 → 0.0.22
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/dist/outputs/format-clean-output.d.ts +2 -0
- package/dist/outputs/format-clean-output.js +25 -0
- package/dist/outputs/format-clean-output.js.map +1 -0
- package/dist/outputs/format-list-output.d.ts +2 -0
- package/dist/outputs/format-list-output.js +31 -0
- package/dist/outputs/format-list-output.js.map +1 -0
- package/dist/outputs/format-write-output.d.ts +3 -0
- package/dist/outputs/format-write-output.js +75 -0
- package/dist/outputs/format-write-output.js.map +1 -0
- package/dist/outputs/index.d.ts +4 -0
- package/dist/outputs/index.js +59 -0
- package/dist/outputs/index.js.map +1 -0
- package/dist/outputs/verbose-format-write-output.d.ts +3 -0
- package/dist/{format-outputs.js → outputs/verbose-format-write-output.js} +21 -38
- package/dist/outputs/verbose-format-write-output.js.map +1 -0
- package/dist/outputs/write-outputs-texts.d.ts +2 -0
- package/dist/outputs/write-outputs-texts.js +13 -0
- package/dist/outputs/write-outputs-texts.js.map +1 -0
- package/dist/{preview-1682245644358.js → preview-1682479861351.js} +1 -1
- package/dist/workspace-config-files.main.runtime.d.ts +2 -0
- package/dist/workspace-config-files.main.runtime.js +11 -3
- package/dist/workspace-config-files.main.runtime.js.map +1 -1
- package/dist/ws-config.cmd.d.ts +9 -0
- package/dist/ws-config.cmd.js +8 -7
- package/dist/ws-config.cmd.js.map +1 -1
- package/outputs/format-clean-output.ts +18 -0
- package/outputs/format-list-output.ts +13 -0
- package/outputs/format-write-output.ts +67 -0
- package/outputs/index.ts +4 -0
- package/outputs/verbose-format-write-output.ts +91 -0
- package/outputs/write-outputs-texts.ts +4 -0
- package/package-tar/teambit-workspace-config-files-0.0.22.tgz +0 -0
- package/package.json +9 -9
- package/dist/format-outputs.d.ts +0 -5
- package/dist/format-outputs.js.map +0 -1
- package/package-tar/teambit-workspace-config-files-0.0.20.tgz +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.formatCleanOutput = formatCleanOutput;
|
|
8
|
+
function _chalk() {
|
|
9
|
+
const data = _interopRequireDefault(require("chalk"));
|
|
10
|
+
_chalk = function () {
|
|
11
|
+
return data;
|
|
12
|
+
};
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
function formatCleanOutput(cleanResults = [], flags) {
|
|
16
|
+
const isDryRun = !!flags.dryRun;
|
|
17
|
+
const cleanResultsOutput = getCleanResultsOutput(cleanResults, isDryRun);
|
|
18
|
+
return `${cleanResultsOutput}`;
|
|
19
|
+
}
|
|
20
|
+
function getCleanResultsOutput(cleanResults, isDryRun) {
|
|
21
|
+
const cleanResultsOutput = cleanResults ? `${_chalk().default.green(`${cleanResults.length} config files ${isDryRun ? 'will be' : 'were'} deleted`)}\n ${cleanResults.join('\n ')}\n` : '';
|
|
22
|
+
return cleanResultsOutput;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=format-clean-output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["formatCleanOutput","cleanResults","flags","isDryRun","dryRun","cleanResultsOutput","getCleanResultsOutput","chalk","green","length","join"],"sources":["format-clean-output.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { CleanConfigCmdFlags } from '../ws-config.cmd';\n\nexport function formatCleanOutput(cleanResults: string[] = [], flags: CleanConfigCmdFlags): string {\n const isDryRun = !!flags.dryRun;\n const cleanResultsOutput = getCleanResultsOutput(cleanResults, isDryRun);\n\n return `${cleanResultsOutput}`;\n}\n\nfunction getCleanResultsOutput(cleanResults: string[] | undefined, isDryRun: boolean) {\n const cleanResultsOutput = cleanResults\n ? `${chalk.green(\n `${cleanResults.length} config files ${isDryRun ? 'will be' : 'were'} deleted`\n )}\\n ${cleanResults.join('\\n ')}\\n`\n : '';\n return cleanResultsOutput;\n}\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,SAASA,iBAAiB,CAACC,YAAsB,GAAG,EAAE,EAAEC,KAA0B,EAAU;EACjG,MAAMC,QAAQ,GAAG,CAAC,CAACD,KAAK,CAACE,MAAM;EAC/B,MAAMC,kBAAkB,GAAGC,qBAAqB,CAACL,YAAY,EAAEE,QAAQ,CAAC;EAExE,OAAQ,GAAEE,kBAAmB,EAAC;AAChC;AAEA,SAASC,qBAAqB,CAACL,YAAkC,EAAEE,QAAiB,EAAE;EACpF,MAAME,kBAAkB,GAAGJ,YAAY,GAClC,GAAEM,gBAAK,CAACC,KAAK,CACX,GAAEP,YAAY,CAACQ,MAAO,iBAAgBN,QAAQ,GAAG,SAAS,GAAG,MAAO,UAAS,CAC9E,OAAMF,YAAY,CAACS,IAAI,CAAC,MAAM,CAAE,IAAG,GACrC,EAAE;EACN,OAAOL,kBAAkB;AAC3B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
require("core-js/modules/es.array.iterator.js");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.formatListOutput = formatListOutput;
|
|
9
|
+
function _cliTable() {
|
|
10
|
+
const data = _interopRequireDefault(require("cli-table"));
|
|
11
|
+
_cliTable = function () {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
return data;
|
|
15
|
+
}
|
|
16
|
+
function formatListOutput(result) {
|
|
17
|
+
const head = ['Aspect ID', 'name', 'CLI name'];
|
|
18
|
+
const rows = result.map(entry => {
|
|
19
|
+
return [entry.aspectId, entry.configWriter.name, entry.configWriter.cliName];
|
|
20
|
+
});
|
|
21
|
+
const table = new (_cliTable().default)({
|
|
22
|
+
head,
|
|
23
|
+
style: {
|
|
24
|
+
head: ['cyan']
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
table.push(...rows);
|
|
28
|
+
return table.toString();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=format-list-output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["formatListOutput","result","head","rows","map","entry","aspectId","configWriter","name","cliName","table","Table","style","push","toString"],"sources":["format-list-output.ts"],"sourcesContent":["import Table from 'cli-table';\nimport { ConfigWritersList } from '../workspace-config-files.main.runtime';\n\nexport function formatListOutput(result: ConfigWritersList): string {\n const head = ['Aspect ID', 'name', 'CLI name'];\n\n const rows = result.map((entry) => {\n return [entry.aspectId, entry.configWriter.name, entry.configWriter.cliName];\n });\n const table = new Table({ head, style: { head: ['cyan'] } });\n table.push(...rows);\n return table.toString();\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,SAASA,gBAAgB,CAACC,MAAyB,EAAU;EAClE,MAAMC,IAAI,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC;EAE9C,MAAMC,IAAI,GAAGF,MAAM,CAACG,GAAG,CAAEC,KAAK,IAAK;IACjC,OAAO,CAACA,KAAK,CAACC,QAAQ,EAAED,KAAK,CAACE,YAAY,CAACC,IAAI,EAAEH,KAAK,CAACE,YAAY,CAACE,OAAO,CAAC;EAC9E,CAAC,CAAC;EACF,MAAMC,KAAK,GAAG,KAAIC,mBAAK,EAAC;IAAET,IAAI;IAAEU,KAAK,EAAE;MAAEV,IAAI,EAAE,CAAC,MAAM;IAAE;EAAE,CAAC,CAAC;EAC5DQ,KAAK,CAACG,IAAI,CAAC,GAAGV,IAAI,CAAC;EACnB,OAAOO,KAAK,CAACI,QAAQ,EAAE;AACzB"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.formatWriteOutput = formatWriteOutput;
|
|
8
|
+
function _chalk() {
|
|
9
|
+
const data = _interopRequireDefault(require("chalk"));
|
|
10
|
+
_chalk = function () {
|
|
11
|
+
return data;
|
|
12
|
+
};
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
function _path() {
|
|
16
|
+
const data = require("path");
|
|
17
|
+
_path = function () {
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
function _formatCleanOutput() {
|
|
23
|
+
const data = require("./format-clean-output");
|
|
24
|
+
_formatCleanOutput = function () {
|
|
25
|
+
return data;
|
|
26
|
+
};
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
function _writeOutputsTexts() {
|
|
30
|
+
const data = require("./write-outputs-texts");
|
|
31
|
+
_writeOutputsTexts = function () {
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
34
|
+
return data;
|
|
35
|
+
}
|
|
36
|
+
function formatWriteOutput(writeConfigFilesResult, flags) {
|
|
37
|
+
const {
|
|
38
|
+
cleanResults,
|
|
39
|
+
writeResults,
|
|
40
|
+
wsDir
|
|
41
|
+
} = writeConfigFilesResult;
|
|
42
|
+
const isDryRun = !!(flags.dryRun || flags.dryRunWithContent);
|
|
43
|
+
const cleanResultsOutput = cleanResults !== null && cleanResults !== void 0 && cleanResults.length ? (0, _formatCleanOutput().formatCleanOutput)(cleanResults, {
|
|
44
|
+
dryRun: isDryRun
|
|
45
|
+
}) : undefined;
|
|
46
|
+
const writeResultsOutput = getWriteResultsOutput(writeResults, wsDir, isDryRun);
|
|
47
|
+
const cleanWriteOutput = cleanResultsOutput ? `${cleanResultsOutput}\n${writeResultsOutput}` : writeResultsOutput;
|
|
48
|
+
return `${cleanWriteOutput}\n\n${_writeOutputsTexts().SUMMARY}`;
|
|
49
|
+
}
|
|
50
|
+
function getWriteResultsOutput(writeResults, wsDir, isDryRun) {
|
|
51
|
+
const totalExtendingConfigFiles = writeResults.totalExtendingConfigFiles;
|
|
52
|
+
const writeTitle = isDryRun ? _chalk().default.green(`${totalExtendingConfigFiles} files will be written`) : _chalk().default.green((0, _writeOutputsTexts().WRITE_TITLE)(totalExtendingConfigFiles));
|
|
53
|
+
const writeOutput = writeResults.aspectsWritersResults.map(aspectWritersResults => getOneAspectOutput(aspectWritersResults, wsDir)).join('\n\n');
|
|
54
|
+
return `${writeTitle}\n${writeOutput}`;
|
|
55
|
+
}
|
|
56
|
+
function getOneAspectOutput(aspectWritersResults, wsDir) {
|
|
57
|
+
const title = _chalk().default.blue(`${aspectWritersResults.totalExtendingConfigFiles} ${_chalk().default.bold(aspectWritersResults.aspectId.toString())} configurations added`);
|
|
58
|
+
const writersOutput = aspectWritersResults.writersResult.map(oneWritersResults => getOneWriterOutput(oneWritersResults, wsDir)).join('\n\n');
|
|
59
|
+
return `${title}\n${writersOutput}`;
|
|
60
|
+
}
|
|
61
|
+
function getOneWriterOutput(oneWritersResults, wsDir) {
|
|
62
|
+
const extendingConfigFilesOutput = getExtendingConfigFilesOutput(oneWritersResults.extendingConfigFiles, wsDir);
|
|
63
|
+
return `${extendingConfigFilesOutput}`;
|
|
64
|
+
}
|
|
65
|
+
function getExtendingConfigFilesOutput(extendingConfigFiles, wsDir) {
|
|
66
|
+
const extendingConfigFilesOutput = extendingConfigFiles.map(envsWrittenExtendingConfigFile => getEnvGroupExtendingConfigFilesOutput(envsWrittenExtendingConfigFile, wsDir)).join('\n');
|
|
67
|
+
return `${extendingConfigFilesOutput}`;
|
|
68
|
+
}
|
|
69
|
+
function getEnvGroupExtendingConfigFilesOutput(envsWrittenExtendingConfigFile, wsDir) {
|
|
70
|
+
const extendingConfigFile = envsWrittenExtendingConfigFile.extendingConfigFile;
|
|
71
|
+
const paths = extendingConfigFile.filePaths.map(p => ` ${(0, _path().relative)(wsDir, p)}`).join('\n');
|
|
72
|
+
return `${paths}`;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=format-write-output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["formatWriteOutput","writeConfigFilesResult","flags","cleanResults","writeResults","wsDir","isDryRun","dryRun","dryRunWithContent","cleanResultsOutput","length","formatCleanOutput","undefined","writeResultsOutput","getWriteResultsOutput","cleanWriteOutput","SUMMARY","totalExtendingConfigFiles","writeTitle","chalk","green","WRITE_TITLE","writeOutput","aspectsWritersResults","map","aspectWritersResults","getOneAspectOutput","join","title","blue","bold","aspectId","toString","writersOutput","writersResult","oneWritersResults","getOneWriterOutput","extendingConfigFilesOutput","getExtendingConfigFilesOutput","extendingConfigFiles","envsWrittenExtendingConfigFile","getEnvGroupExtendingConfigFilesOutput","extendingConfigFile","paths","filePaths","p","relative"],"sources":["format-write-output.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { relative } from 'path';\nimport {\n AspectWritersResults,\n EnvsWrittenExtendingConfigFile,\n EnvsWrittenExtendingConfigFiles,\n OneConfigFileWriterResult,\n WriteConfigFilesResult,\n} from '../workspace-config-files.main.runtime';\nimport type { WriteConfigCmdFlags } from '../ws-config.cmd';\nimport { formatCleanOutput } from './format-clean-output';\nimport { SUMMARY, WRITE_TITLE } from './write-outputs-texts';\n\nexport function formatWriteOutput(writeConfigFilesResult: WriteConfigFilesResult, flags: WriteConfigCmdFlags): string {\n const { cleanResults, writeResults, wsDir } = writeConfigFilesResult;\n const isDryRun = !!(flags.dryRun || flags.dryRunWithContent);\n const cleanResultsOutput = cleanResults?.length ? formatCleanOutput(cleanResults, { dryRun: isDryRun }) : undefined;\n const writeResultsOutput = getWriteResultsOutput(writeResults, wsDir, isDryRun);\n\n const cleanWriteOutput = cleanResultsOutput ? `${cleanResultsOutput}\\n${writeResultsOutput}` : writeResultsOutput;\n\n return `${cleanWriteOutput}\\n\\n${SUMMARY}`;\n}\n\nfunction getWriteResultsOutput(writeResults: WriteConfigFilesResult['writeResults'], wsDir: string, isDryRun: boolean) {\n const totalExtendingConfigFiles = writeResults.totalExtendingConfigFiles;\n\n const writeTitle = isDryRun\n ? chalk.green(`${totalExtendingConfigFiles} files will be written`)\n : chalk.green(WRITE_TITLE(totalExtendingConfigFiles));\n const writeOutput = writeResults.aspectsWritersResults\n .map((aspectWritersResults) => getOneAspectOutput(aspectWritersResults, wsDir))\n .join('\\n\\n');\n return `${writeTitle}\\n${writeOutput}`;\n}\nfunction getOneAspectOutput(aspectWritersResults: AspectWritersResults, wsDir: string): string {\n const title = chalk.blue(\n `${aspectWritersResults.totalExtendingConfigFiles} ${chalk.bold(\n aspectWritersResults.aspectId.toString()\n )} configurations added`\n );\n const writersOutput = aspectWritersResults.writersResult\n .map((oneWritersResults) => getOneWriterOutput(oneWritersResults, wsDir))\n .join('\\n\\n');\n return `${title}\\n${writersOutput}`;\n}\nfunction getOneWriterOutput(oneWritersResults: OneConfigFileWriterResult, wsDir: string): string {\n const extendingConfigFilesOutput = getExtendingConfigFilesOutput(oneWritersResults.extendingConfigFiles, wsDir);\n return `${extendingConfigFilesOutput}`;\n}\n\nfunction getExtendingConfigFilesOutput(extendingConfigFiles: EnvsWrittenExtendingConfigFiles, wsDir: string): string {\n const extendingConfigFilesOutput = extendingConfigFiles\n .map((envsWrittenExtendingConfigFile) =>\n getEnvGroupExtendingConfigFilesOutput(envsWrittenExtendingConfigFile, wsDir)\n )\n .join('\\n');\n return `${extendingConfigFilesOutput}`;\n}\nfunction getEnvGroupExtendingConfigFilesOutput(\n envsWrittenExtendingConfigFile: EnvsWrittenExtendingConfigFile,\n wsDir: string\n): string {\n const extendingConfigFile = envsWrittenExtendingConfigFile.extendingConfigFile;\n const paths = extendingConfigFile.filePaths.map((p) => ` ${relative(wsDir, p)}`).join('\\n');\n return `${paths}`;\n}\n"],"mappings":";;;;;;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AI,CAAC;EAC5F,OAAQ,GAAEgB,KAAM,EAAC;AACnB"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "formatCleanOutput", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _formatCleanOutput().formatCleanOutput;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "formatListOutput", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _formatListOutput().formatListOutput;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "formatWriteOutput", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _formatWriteOutput().formatWriteOutput;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "verboseFormatWriteOutput", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _verboseFormatWriteOutput().verboseFormatWriteOutput;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
function _formatCleanOutput() {
|
|
31
|
+
const data = require("./format-clean-output");
|
|
32
|
+
_formatCleanOutput = function () {
|
|
33
|
+
return data;
|
|
34
|
+
};
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
function _formatListOutput() {
|
|
38
|
+
const data = require("./format-list-output");
|
|
39
|
+
_formatListOutput = function () {
|
|
40
|
+
return data;
|
|
41
|
+
};
|
|
42
|
+
return data;
|
|
43
|
+
}
|
|
44
|
+
function _formatWriteOutput() {
|
|
45
|
+
const data = require("./format-write-output");
|
|
46
|
+
_formatWriteOutput = function () {
|
|
47
|
+
return data;
|
|
48
|
+
};
|
|
49
|
+
return data;
|
|
50
|
+
}
|
|
51
|
+
function _verboseFormatWriteOutput() {
|
|
52
|
+
const data = require("./verbose-format-write-output");
|
|
53
|
+
_verboseFormatWriteOutput = function () {
|
|
54
|
+
return data;
|
|
55
|
+
};
|
|
56
|
+
return data;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { formatCleanOutput } from './format-clean-output';\nexport { formatListOutput } from './format-list-output';\nexport { formatWriteOutput } from './format-write-output';\nexport { verboseFormatWriteOutput } from './verbose-format-write-output';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { WriteConfigFilesResult } from '../workspace-config-files.main.runtime';
|
|
2
|
+
import type { WriteConfigCmdFlags } from '../ws-config.cmd';
|
|
3
|
+
export declare function verboseFormatWriteOutput(writeConfigFilesResult: WriteConfigFilesResult, flags: WriteConfigCmdFlags): string;
|
|
@@ -1,20 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
require("core-js/modules/es.array.iterator.js");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports.
|
|
9
|
-
exports.formatListOutput = formatListOutput;
|
|
10
|
-
exports.formatWriteOutput = formatWriteOutput;
|
|
11
|
-
function _cliTable() {
|
|
12
|
-
const data = _interopRequireDefault(require("cli-table"));
|
|
13
|
-
_cliTable = function () {
|
|
14
|
-
return data;
|
|
15
|
-
};
|
|
16
|
-
return data;
|
|
17
|
-
}
|
|
7
|
+
exports.verboseFormatWriteOutput = verboseFormatWriteOutput;
|
|
18
8
|
function _chalk() {
|
|
19
9
|
const data = _interopRequireDefault(require("chalk"));
|
|
20
10
|
_chalk = function () {
|
|
@@ -29,43 +19,36 @@ function _path() {
|
|
|
29
19
|
};
|
|
30
20
|
return data;
|
|
31
21
|
}
|
|
32
|
-
function
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
return
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return
|
|
22
|
+
function _formatCleanOutput() {
|
|
23
|
+
const data = require("./format-clean-output");
|
|
24
|
+
_formatCleanOutput = function () {
|
|
25
|
+
return data;
|
|
26
|
+
};
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
function _writeOutputsTexts() {
|
|
30
|
+
const data = require("./write-outputs-texts");
|
|
31
|
+
_writeOutputsTexts = function () {
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
34
|
+
return data;
|
|
45
35
|
}
|
|
46
|
-
function
|
|
36
|
+
function verboseFormatWriteOutput(writeConfigFilesResult, flags) {
|
|
47
37
|
const {
|
|
48
38
|
cleanResults,
|
|
49
39
|
writeResults,
|
|
50
40
|
wsDir
|
|
51
41
|
} = writeConfigFilesResult;
|
|
52
42
|
const isDryRun = !!(flags.dryRun || flags.dryRunWithContent);
|
|
53
|
-
const cleanResultsOutput =
|
|
43
|
+
const cleanResultsOutput = (0, _formatCleanOutput().formatCleanOutput)(cleanResults, {
|
|
44
|
+
dryRun: isDryRun
|
|
45
|
+
});
|
|
54
46
|
const writeResultsOutput = getWriteResultsOutput(writeResults, wsDir, isDryRun);
|
|
55
|
-
return `${cleanResultsOutput}${writeResultsOutput}`;
|
|
56
|
-
}
|
|
57
|
-
function formatCleanOutput(cleanResults = [], flags) {
|
|
58
|
-
const isDryRun = !!flags.dryRun;
|
|
59
|
-
const cleanResultsOutput = getCleanResultsOutput(cleanResults, isDryRun);
|
|
60
|
-
return `${cleanResultsOutput}`;
|
|
61
|
-
}
|
|
62
|
-
function getCleanResultsOutput(cleanResults, isDryRun) {
|
|
63
|
-
const cleanResultsOutput = cleanResults ? `${_chalk().default.green(`the following ${cleanResults.length} paths ${isDryRun ? 'will be' : 'were'} deleted:`)}\n ${cleanResults.join('\n ')}\n` : '';
|
|
64
|
-
return cleanResultsOutput;
|
|
47
|
+
return `${cleanResultsOutput}\n${writeResultsOutput}\n\n${_writeOutputsTexts().SUMMARY}`;
|
|
65
48
|
}
|
|
66
49
|
function getWriteResultsOutput(writeResults, wsDir, isDryRun) {
|
|
67
50
|
const totalFiles = writeResults.totalWrittenFiles;
|
|
68
|
-
const writeTitle = isDryRun ? _chalk().default.green(`${totalFiles} files will be written`) : _chalk().default.green(
|
|
51
|
+
const writeTitle = isDryRun ? _chalk().default.green(`${totalFiles} files will be written`) : _chalk().default.green((0, _writeOutputsTexts().WRITE_TITLE)(totalFiles));
|
|
69
52
|
const writeOutput = writeResults.aspectsWritersResults.map(aspectWritersResults => getOneAspectOutput(aspectWritersResults, wsDir)).join('\n\n');
|
|
70
53
|
return `${writeTitle}\n${writeOutput}`;
|
|
71
54
|
}
|
|
@@ -102,4 +85,4 @@ function getEnvGroupExtendingConfigFilesOutput(envsWrittenExtendingConfigFile, w
|
|
|
102
85
|
return `${title}\n ${paths}`;
|
|
103
86
|
}
|
|
104
87
|
|
|
105
|
-
//# sourceMappingURL=format-
|
|
88
|
+
//# sourceMappingURL=verbose-format-write-output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["verboseFormatWriteOutput","writeConfigFilesResult","flags","cleanResults","writeResults","wsDir","isDryRun","dryRun","dryRunWithContent","cleanResultsOutput","formatCleanOutput","writeResultsOutput","getWriteResultsOutput","SUMMARY","totalFiles","totalWrittenFiles","writeTitle","chalk","green","WRITE_TITLE","writeOutput","aspectsWritersResults","map","aspectWritersResults","getOneAspectOutput","join","title","blue","bold","aspectId","toString","writersOutput","writersResult","oneWritersResults","getOneWriterOutput","cyan","name","realConfigFilesOutput","getRealConfigFilesOutput","configFiles","extendingConfigFilesOutput","getExtendingConfigFilesOutput","extendingConfigFiles","envsWrittenConfigFiles","magenta","writtenConfigFilesOutput","envsWrittenConfigFile","getEnvGroupConfigFilesOutput","envIds","filePath","relative","configFile","envsWrittenExtendingConfigFile","getEnvGroupExtendingConfigFilesOutput","extendingConfigFile","paths","filePaths","p","extendingTarget"],"sources":["verbose-format-write-output.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { relative } from 'path';\nimport {\n AspectWritersResults,\n EnvsWrittenConfigFile,\n EnvsWrittenConfigFiles,\n EnvsWrittenExtendingConfigFile,\n EnvsWrittenExtendingConfigFiles,\n OneConfigFileWriterResult,\n WriteConfigFilesResult,\n} from '../workspace-config-files.main.runtime';\nimport type { WriteConfigCmdFlags } from '../ws-config.cmd';\nimport { formatCleanOutput } from './format-clean-output';\nimport { SUMMARY, WRITE_TITLE } from './write-outputs-texts';\n\nexport function verboseFormatWriteOutput(\n writeConfigFilesResult: WriteConfigFilesResult,\n flags: WriteConfigCmdFlags\n): string {\n const { cleanResults, writeResults, wsDir } = writeConfigFilesResult;\n const isDryRun = !!(flags.dryRun || flags.dryRunWithContent);\n const cleanResultsOutput = formatCleanOutput(cleanResults, { dryRun: isDryRun });\n const writeResultsOutput = getWriteResultsOutput(writeResults, wsDir, isDryRun);\n\n return `${cleanResultsOutput}\\n${writeResultsOutput}\\n\\n${SUMMARY}`;\n}\n\nfunction getWriteResultsOutput(writeResults: WriteConfigFilesResult['writeResults'], wsDir: string, isDryRun: boolean) {\n const totalFiles = writeResults.totalWrittenFiles;\n\n const writeTitle = isDryRun\n ? chalk.green(`${totalFiles} files will be written`)\n : chalk.green(WRITE_TITLE(totalFiles));\n const writeOutput = writeResults.aspectsWritersResults\n .map((aspectWritersResults) => getOneAspectOutput(aspectWritersResults, wsDir))\n .join('\\n\\n');\n return `${writeTitle}\\n${writeOutput}`;\n}\nfunction getOneAspectOutput(aspectWritersResults: AspectWritersResults, wsDir: string): string {\n const title = chalk.blue(\n `The following paths are according to aspect ${chalk.bold(aspectWritersResults.aspectId.toString())}`\n );\n const writersOutput = aspectWritersResults.writersResult\n .map((oneWritersResults) => getOneWriterOutput(oneWritersResults, wsDir))\n .join('\\n\\n');\n return `${title}\\n${writersOutput}`;\n}\nfunction getOneWriterOutput(oneWritersResults: OneConfigFileWriterResult, wsDir: string): string {\n const title = chalk.cyan(` The following paths are according to writer ${chalk.bold(oneWritersResults.name)}`);\n const realConfigFilesOutput = getRealConfigFilesOutput(oneWritersResults.configFiles, wsDir);\n const extendingConfigFilesOutput = getExtendingConfigFilesOutput(oneWritersResults.extendingConfigFiles, wsDir);\n return `${title}\\n${realConfigFilesOutput}\\n\\n${extendingConfigFilesOutput}`;\n}\n\nfunction getRealConfigFilesOutput(envsWrittenConfigFiles: EnvsWrittenConfigFiles, wsDir: string): string {\n const title = chalk.magenta(` Real config files`);\n const writtenConfigFilesOutput = envsWrittenConfigFiles\n .map((envsWrittenConfigFile) => getEnvGroupConfigFilesOutput(envsWrittenConfigFile, wsDir))\n .join('\\n\\n');\n return `${title}\\n${writtenConfigFilesOutput}`;\n}\nfunction getEnvGroupConfigFilesOutput(envsWrittenConfigFile: EnvsWrittenConfigFile, wsDir: string): string {\n const title = ` The following paths are according to env(s) ${chalk.bold(\n envsWrittenConfigFile.envIds.join(', ')\n )}`;\n const filePath = relative(wsDir, envsWrittenConfigFile.configFile.filePath);\n return `${title}\\n ${filePath}`;\n}\nfunction getExtendingConfigFilesOutput(extendingConfigFiles: EnvsWrittenExtendingConfigFiles, wsDir: string): string {\n const title = chalk.magenta(` Extending config files`);\n\n const extendingConfigFilesOutput = extendingConfigFiles\n .map((envsWrittenExtendingConfigFile) =>\n getEnvGroupExtendingConfigFilesOutput(envsWrittenExtendingConfigFile, wsDir)\n )\n .join('\\n\\n');\n return `${title}\\n${extendingConfigFilesOutput}`;\n}\nfunction getEnvGroupExtendingConfigFilesOutput(\n envsWrittenExtendingConfigFile: EnvsWrittenExtendingConfigFile,\n wsDir: string\n): string {\n const title = ` The following paths are according to env(s) ${chalk.bold(\n envsWrittenExtendingConfigFile.envIds.join(', ')\n )}`;\n const extendingConfigFile = envsWrittenExtendingConfigFile.extendingConfigFile;\n const paths = extendingConfigFile.filePaths\n .map((p) => ` ${relative(wsDir, p)} --> ${relative(wsDir, extendingConfigFile.extendingTarget.filePath)}`)\n .join('\\n ');\n return `${title}\\n ${paths}`;\n}\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAWA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,SAASA,wBAAwB,CACtCC,sBAA8C,EAC9CC,KAA0B,EAClB;EACR,MAAM;IAAEC,YAAY;IAAEC,YAAY;IAAEC;EAAM,CAAC,GAAGJ,sBAAsB;EACpE,MAAMK,QAAQ,GAAG,CAAC,EAAEJ,KAAK,CAACK,MAAM,IAAIL,KAAK,CAACM,iBAAiB,CAAC;EAC5D,MAAMC,kBAAkB,GAAG,IAAAC,sCAAiB,EAACP,YAAY,EAAE;IAAEI,MAAM,EAAED;EAAS,CAAC,CAAC;EAChF,MAAMK,kBAAkB,GAAGC,qBAAqB,CAACR,YAAY,EAAEC,KAAK,EAAEC,QAAQ,CAAC;EAE/E,OAAQ,GAAEG,kBAAmB,KAAIE,kBAAmB,OAAME,4BAAQ,EAAC;AACrE;AAEA,SAASD,qBAAqB,CAACR,YAAoD,EAAEC,KAAa,EAAEC,QAAiB,EAAE;EACrH,MAAMQ,UAAU,GAAGV,YAAY,CAACW,iBAAiB;EAEjD,MAAMC,UAAU,GAAGV,QAAQ,GACvBW,gBAAK,CAACC,KAAK,CAAE,GAAEJ,UAAW,wBAAuB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IAAM,KAAI,IAAAP,gBAAQ,EAAC7C,KAAK,EAAEoD,CAAC,CAAE,QAAO,IAAAP,gBAAQ,EAAC7C,KAAK,EAAEiD,mBAAmB,CAACI,eAAe,CAACT,QAAQ,CAAE,EAAC,CAAC,CAC1GxB,IAAI,CAAC,QAAQ,CAAC;EACjB,OAAQ,GAAEC,KAAM,SAAQ6B,KAAM,EAAC;AACjC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const WRITE_TITLE: (total: number) => string;
|
|
2
|
+
export declare const SUMMARY = "bit writes configuration files in different nested locations in your workspace to meet the configuration needs of different components.\nIDE is now in-sync with component configuration";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.WRITE_TITLE = exports.SUMMARY = void 0;
|
|
7
|
+
const WRITE_TITLE = total => `${total} config files added to workspace`;
|
|
8
|
+
exports.WRITE_TITLE = WRITE_TITLE;
|
|
9
|
+
const SUMMARY = `bit writes configuration files in different nested locations in your workspace to meet the configuration needs of different components.
|
|
10
|
+
IDE is now in-sync with component configuration`;
|
|
11
|
+
exports.SUMMARY = SUMMARY;
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=write-outputs-texts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["WRITE_TITLE","total","SUMMARY"],"sources":["write-outputs-texts.ts"],"sourcesContent":["export const WRITE_TITLE = (total: number) => `${total} config files added to workspace`;\n\nexport const SUMMARY = `bit writes configuration files in different nested locations in your workspace to meet the configuration needs of different components.\nIDE is now in-sync with component configuration`;\n"],"mappings":";;;;;;AAAO,MAAMA,WAAW,GAAIC,KAAa,IAAM,GAAEA,KAAM,kCAAiC;AAAC;AAElF,MAAMC,OAAO,GAAI;AACxB,gDAAgD;AAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
;
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace-config-files@0.0.
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace-config-files@0.0.22/dist/workspace-config-files.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -74,11 +74,13 @@ export declare type AspectWritersResults = {
|
|
|
74
74
|
aspectId: string;
|
|
75
75
|
writersResult: OneConfigFileWriterResult[];
|
|
76
76
|
totalWrittenFiles: number;
|
|
77
|
+
totalExtendingConfigFiles: number;
|
|
77
78
|
};
|
|
78
79
|
export declare type WriteConfigFilesResult = {
|
|
79
80
|
cleanResults?: string[];
|
|
80
81
|
writeResults: {
|
|
81
82
|
totalWrittenFiles: number;
|
|
83
|
+
totalExtendingConfigFiles: number;
|
|
82
84
|
aspectsWritersResults: AspectWritersResults[];
|
|
83
85
|
};
|
|
84
86
|
wsDir: string;
|
|
@@ -189,9 +189,13 @@ class WorkspaceConfigFilesMain {
|
|
|
189
189
|
const totalWrittenFiles = aspectsWritersResults.reduce((acc, curr) => {
|
|
190
190
|
return acc + curr.totalWrittenFiles;
|
|
191
191
|
}, 0);
|
|
192
|
+
const totalExtendingConfigFiles = aspectsWritersResults.reduce((acc, curr) => {
|
|
193
|
+
return acc + curr.totalExtendingConfigFiles;
|
|
194
|
+
}, 0);
|
|
192
195
|
const writeResults = {
|
|
193
196
|
aspectsWritersResults,
|
|
194
|
-
totalWrittenFiles
|
|
197
|
+
totalWrittenFiles,
|
|
198
|
+
totalExtendingConfigFiles
|
|
195
199
|
};
|
|
196
200
|
return {
|
|
197
201
|
writeResults,
|
|
@@ -246,10 +250,14 @@ class WorkspaceConfigFilesMain {
|
|
|
246
250
|
const totalWrittenFiles = compactResults.reduce((acc, curr) => {
|
|
247
251
|
return acc + curr.totalWrittenFiles;
|
|
248
252
|
}, 0);
|
|
253
|
+
const totalExtendingConfigFiles = compactResults.reduce((acc, curr) => {
|
|
254
|
+
return acc + curr.totalExtendingConfigFiles;
|
|
255
|
+
}, 0);
|
|
249
256
|
return {
|
|
250
257
|
aspectId,
|
|
251
258
|
writersResult: compactResults,
|
|
252
|
-
totalWrittenFiles
|
|
259
|
+
totalWrittenFiles,
|
|
260
|
+
totalExtendingConfigFiles
|
|
253
261
|
};
|
|
254
262
|
}
|
|
255
263
|
async handleOneConfigFileWriter(configWriter, envCompsDirsMap, configsRootDir, envsExecutionContext, opts) {
|
|
@@ -474,7 +482,7 @@ class WorkspaceConfigFilesMain {
|
|
|
474
482
|
async promptForCleaning(paths) {
|
|
475
483
|
this.logger.clearStatusLine();
|
|
476
484
|
const ok = await (0, _yesno().default)({
|
|
477
|
-
question: `${_chalk().default.underline('The following
|
|
485
|
+
question: `${_chalk().default.underline('The following files will be deleted:')}
|
|
478
486
|
${paths.join('\n')}
|
|
479
487
|
${_chalk().default.bold('Do you want to continue? [yes(y)/no(n)]')}`
|
|
480
488
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["WorkspaceConfigFilesMain","constructor","configWriterSlot","workspace","envs","logger","writeConfigFiles","options","execContext","getExecContext","cleanResults","clean","aspectsWritersResults","write","err","info","WriteConfigFilesFailed","totalWrittenFiles","reduce","acc","curr","writeResults","wsDir","path","cleanConfigFiles","listConfigWriters","slotEntries","toArray","result","aspectId","configWriters","map","configWriter","concat","envsExecutionContext","opts","envCompDirsMap","getEnvComponentsDirsMap","configsRootDir","getConfigsRootDir","results","pMapSeries","aspectEntry","handleOneAspectWriter","envCompsDirsMap","writers","includes","name","cliName","undefined","handleOneConfigFileWriter","compactResults","compact","writersResult","writtenConfigFilesMap","extendingConfigFilesMap","Object","entries","envId","envMapValue","executionContext","find","context","id","Error","writtenConfigFiles","handleRealConfigFiles","buildExtendingConfigFilesMap","keys","length","configFiles","totalConfigFiles","extendingConfigFiles","totalExtendingConfigFiles","fileHashPerDedupedPaths","dedupePaths","writeExtendingConfigFiles","postProcessExtendingConfigFiles","workspaceDir","writtenExtendingConfigFiles","dryRun","extendingConfigFile","filePaths","values","calculatedConfigFiles","calcConfigFiles","env","Promise","all","configFile","writtenConfigFile","writeConfigFile","hash","envIds","push","postProcessConfigFiles","sha1","content","format","filePath","join","fs","outputFile","res","finalResult","fileHash","paths","envsConfigFile","writtenPaths","targetPath","useAbsPaths","extendingTarget","relative","dirname","replace","generateExtendingFile","args","getCacheDir","rootDir","components","list","runtime","createEnvironment","getEnvExecutionContext","envExecution","envRuntime","toString","value","c","componentDir","getConfigWriters","getFlatConfigWriters","silent","filteredConfigWriters","filter","patterns","currPaths","globby","sync","cwd","dot","onlyFiles","ignore","filteredPaths","fullPath","isBitGenerated","flat","promptForCleaning","deleteFiles","clearStatusLine","ok","yesno","question","chalk","underline","bold","PromptCanceled","f","remove","registerConfigWriter","configWriterEntries","register","provider","cli","loggerAspect","_config","createLogger","WorkspaceConfigFilesAspect","workspaceConfigFilesMain","wsConfigCmd","WsConfigCmd","commands","WsConfigWriteCmd","WsConfigCleanCmd","WsConfigListCmd","Slot","withType","CLIAspect","WorkspaceAspect","EnvsAspect","LoggerAspect","MainRuntime","addRuntime"],"sources":["workspace-config-files.main.runtime.ts"],"sourcesContent":["import format from 'string-format';\nimport { sha1 } from '@teambit/legacy/dist/utils';\nimport fs from 'fs-extra';\nimport { dirname, join, relative } from 'path';\nimport globby from 'globby';\nimport chalk from 'chalk';\nimport { PromptCanceled } from '@teambit/legacy/dist/prompts/exceptions';\nimport pMapSeries from 'p-map-series';\nimport yesno from 'yesno';\nimport { compact } from 'lodash';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { WorkspaceAspect } from '@teambit/workspace';\nimport type { Workspace } from '@teambit/workspace';\nimport { Environment, EnvsAspect, ExecutionContext } from '@teambit/envs';\nimport type { EnvsMain } from '@teambit/envs';\nimport { Logger, LoggerAspect } from '@teambit/logger';\nimport type { LoggerMain } from '@teambit/logger';\nimport { WorkspaceConfigFilesAspect } from './workspace-config-files.aspect';\nimport { ConfigFile, ConfigWriterEntry, ExtendingConfigFile } from './config-writer-entry';\nimport { WsConfigCleanCmd, WsConfigCmd, WsConfigListCmd, WsConfigWriteCmd } from './ws-config.cmd';\nimport { DedupedPaths, dedupePaths } from './dedup-paths';\nimport WriteConfigFilesFailed from './exceptions/write-failed';\n\nexport type ConfigWriterSlot = SlotRegistry<ConfigWriterEntry[]>;\n\nexport type ConfigWritersList = Array<{\n aspectId: string;\n configWriter: ConfigWriterEntry;\n}>;\n\nexport type CleanConfigFilesOptions = {\n silent?: boolean; // no prompt\n dryRun?: boolean;\n writers?: string[];\n};\n\nexport type WriteConfigFilesOptions = {\n clean?: boolean;\n silent?: boolean; // no prompt\n dedupe?: boolean;\n dryRun?: boolean;\n writers?: string[];\n};\n\nexport type WrittenConfigFile = Required<ConfigFile> & {\n filePath: string;\n};\n\nexport type WrittenExtendingConfigFile = ExtendingConfigFile & {\n filePaths: string[];\n};\n\nexport type WrittenConfigFilesMap = {\n [configFileHash: string]: {\n envIds: string[];\n configFile: WrittenConfigFile;\n };\n};\n\nexport type ExtendingConfigFilesMap = {\n [configFileHash: string]: {\n envIds: string[];\n extendingConfigFile: Required<ExtendingConfigFile>;\n };\n};\n\nexport type CompPathExtendingHashMap = { [compPath: string]: string };\n\nexport type EnvMapValue = { env: Environment; id: string[]; paths: string[] };\nexport type EnvCompsDirsMap = { [envId: string]: EnvMapValue };\n\nexport type EnvsWrittenConfigFile = { envIds: string[]; configFile: WrittenConfigFile };\nexport type EnvsWrittenConfigFiles = Array<EnvsWrittenConfigFile>;\n\nexport type EnvsWrittenExtendingConfigFile = { envIds: string[]; extendingConfigFile: WrittenExtendingConfigFile };\nexport type EnvsWrittenExtendingConfigFiles = Array<EnvsWrittenExtendingConfigFile>;\n\nexport type OneConfigFileWriterResult = {\n name: string;\n totalWrittenFiles: number;\n configFiles: EnvsWrittenConfigFiles;\n totalConfigFiles: number;\n extendingConfigFiles: EnvsWrittenExtendingConfigFiles;\n totalExtendingConfigFiles: number;\n};\n\nexport type AspectWritersResults = {\n aspectId: string;\n writersResult: OneConfigFileWriterResult[];\n totalWrittenFiles: number;\n};\n\nexport type WriteConfigFilesResult = {\n cleanResults?: string[];\n writeResults: { totalWrittenFiles: number; aspectsWritersResults: AspectWritersResults[] };\n wsDir: string;\n};\n\nexport class WorkspaceConfigFilesMain {\n constructor(\n readonly configWriterSlot: ConfigWriterSlot,\n private workspace: Workspace,\n private envs: EnvsMain,\n private logger: Logger\n ) {}\n\n /**\n * It writes the configuration files for the workspace\n * for example: tsconfig, eslint config and prettier config files.\n * @param {WriteConfigFilesOptions} options - WriteConfigFilesOptions = {}\n * @returns An object with the following properties:\n * - writeResults: An object with the following properties:\n * - aspectsWritersResults: An array of objects with the following properties:\n * - aspect: The aspect that was written\n * - totalWrittenFiles: The number of files that were written\n * - totalWrittenFiles: The total number of files that were written\n * - cleanResults: array of deleted paths\n */\n async writeConfigFiles(options: WriteConfigFilesOptions = {}): Promise<WriteConfigFilesResult> {\n const execContext = await this.getExecContext();\n\n let cleanResults: string[] | undefined;\n if (options.clean) {\n cleanResults = await this.clean(options);\n }\n\n let aspectsWritersResults;\n try {\n aspectsWritersResults = await this.write(execContext, options);\n } catch (err) {\n this.logger.info('writeConfigFiles failed', err);\n throw new WriteConfigFilesFailed();\n }\n const totalWrittenFiles = aspectsWritersResults.reduce((acc, curr) => {\n return acc + curr.totalWrittenFiles;\n }, 0);\n const writeResults = { aspectsWritersResults, totalWrittenFiles };\n\n return { writeResults, cleanResults, wsDir: this.workspace.path };\n }\n\n /**\n * It cleans (delete) the config files from the workspace.\n * This will check each file and will only delete it in case it was generated by bit\n * @param {CleanConfigFilesOptions} options - CleanConfigFilesOptions = {}\n * @returns An array of strings.\n */\n async cleanConfigFiles(options: CleanConfigFilesOptions = {}): Promise<string[]> {\n // const execContext = await this.getExecContext();\n const cleanResults = await this.clean(options);\n return cleanResults;\n }\n\n /**\n * It returns a list of all the config writers that have been registered with the config writer slot\n * @returns An array of objects with aspectId and configWriter properties.\n */\n listConfigWriters(): ConfigWritersList {\n const slotEntries = this.configWriterSlot.toArray();\n const result: ConfigWritersList = slotEntries.reduce((acc, [aspectId, configWriters]) => {\n const curr = configWriters.map((configWriter) => ({ aspectId, configWriter }));\n return acc.concat(curr);\n }, [] as ConfigWritersList);\n return result;\n }\n\n private async write(\n envsExecutionContext: ExecutionContext[],\n opts: WriteConfigFilesOptions\n ): Promise<AspectWritersResults[]> {\n const envCompDirsMap = this.getEnvComponentsDirsMap(envsExecutionContext);\n const slotEntries = this.configWriterSlot.toArray();\n const configsRootDir = this.getConfigsRootDir();\n const results = await pMapSeries(slotEntries, async (aspectEntry) => {\n const [aspectId, configWriters] = aspectEntry;\n return this.handleOneAspectWriter(\n aspectId,\n configWriters,\n envCompDirsMap,\n configsRootDir,\n envsExecutionContext,\n opts\n );\n });\n return results;\n }\n\n private async handleOneAspectWriter(\n aspectId: string,\n configWriters: ConfigWriterEntry[],\n envCompsDirsMap: EnvCompsDirsMap,\n configsRootDir: string,\n envsExecutionContext: ExecutionContext[],\n opts: WriteConfigFilesOptions\n ): Promise<AspectWritersResults> {\n const results = await pMapSeries(configWriters, async (configWriter) => {\n if (opts.writers && !(opts.writers.includes(configWriter.name) || opts.writers.includes(configWriter.cliName)))\n return undefined;\n return this.handleOneConfigFileWriter(configWriter, envCompsDirsMap, configsRootDir, envsExecutionContext, opts);\n });\n const compactResults = compact(results);\n const totalWrittenFiles = compactResults.reduce((acc, curr) => {\n return acc + curr.totalWrittenFiles;\n }, 0);\n return { aspectId, writersResult: compactResults, totalWrittenFiles };\n }\n\n private async handleOneConfigFileWriter(\n configWriter: ConfigWriterEntry,\n envCompsDirsMap: EnvCompsDirsMap,\n configsRootDir: string,\n envsExecutionContext: ExecutionContext[],\n opts: WriteConfigFilesOptions\n ): Promise<OneConfigFileWriterResult> {\n const writtenConfigFilesMap: WrittenConfigFilesMap = {};\n const extendingConfigFilesMap: ExtendingConfigFilesMap = {};\n await pMapSeries(Object.entries(envCompsDirsMap), async ([envId, envMapValue]) => {\n const executionContext = envsExecutionContext.find((context) => context.id === envId);\n if (!executionContext) throw new Error(`failed finding execution context for env ${envId}`);\n const writtenConfigFiles = await this.handleRealConfigFiles(\n envId,\n envMapValue,\n executionContext,\n configWriter,\n configsRootDir,\n writtenConfigFilesMap,\n opts\n );\n if (writtenConfigFiles) {\n this.buildExtendingConfigFilesMap(\n configWriter,\n writtenConfigFiles,\n envId,\n extendingConfigFilesMap,\n envCompsDirsMap,\n configsRootDir,\n opts\n );\n }\n });\n if (!writtenConfigFilesMap || Object.keys(writtenConfigFilesMap).length === 0) {\n return {\n name: configWriter.name,\n configFiles: [],\n totalConfigFiles: 0,\n totalWrittenFiles: 0,\n extendingConfigFiles: [],\n totalExtendingConfigFiles: 0,\n };\n }\n\n const fileHashPerDedupedPaths = dedupePaths(extendingConfigFilesMap, envCompsDirsMap);\n const extendingConfigFiles = await this.writeExtendingConfigFiles(\n extendingConfigFilesMap,\n fileHashPerDedupedPaths,\n opts\n );\n if (configWriter.postProcessExtendingConfigFiles) {\n await configWriter.postProcessExtendingConfigFiles({\n workspaceDir: this.workspace.path,\n configsRootDir,\n writtenExtendingConfigFiles: extendingConfigFiles,\n envCompsDirsMap,\n dryRun: !!opts.dryRun,\n });\n }\n const totalExtendingConfigFiles = extendingConfigFiles.reduce(\n (acc, curr) => acc + curr.extendingConfigFile.filePaths.length,\n 0\n );\n const configFiles = Object.values(writtenConfigFilesMap);\n const totalConfigFiles = Object.keys(writtenConfigFilesMap).length;\n const totalWrittenFiles = totalConfigFiles + totalExtendingConfigFiles;\n const result: OneConfigFileWriterResult = {\n name: configWriter.name,\n configFiles,\n totalWrittenFiles,\n totalConfigFiles: Object.keys(writtenConfigFilesMap).length,\n extendingConfigFiles,\n totalExtendingConfigFiles,\n };\n return result;\n }\n\n private async handleRealConfigFiles(\n envId: string,\n envMapValue: EnvMapValue,\n executionContext: ExecutionContext,\n configWriter: ConfigWriterEntry,\n configsRootDir: string,\n writtenConfigFilesMap: WrittenConfigFilesMap,\n opts: WriteConfigFilesOptions\n ): Promise<WrittenConfigFile[] | undefined> {\n const calculatedConfigFiles = configWriter.calcConfigFiles(executionContext, envMapValue.env, configsRootDir);\n if (!calculatedConfigFiles) return undefined;\n const writtenConfigFiles = await Promise.all(\n calculatedConfigFiles.map(async (configFile) => {\n const writtenConfigFile = await this.writeConfigFile(configFile, configsRootDir, opts);\n if (!writtenConfigFilesMap[writtenConfigFile.hash]) {\n writtenConfigFilesMap[writtenConfigFile.hash] = { configFile: writtenConfigFile, envIds: [] };\n }\n writtenConfigFilesMap[writtenConfigFile.hash].envIds.push(envId);\n return writtenConfigFile;\n })\n );\n if (configWriter.postProcessConfigFiles) {\n await configWriter.postProcessConfigFiles(writtenConfigFiles, executionContext, envMapValue, {\n dryRun: !!opts.dryRun,\n });\n }\n return writtenConfigFiles;\n }\n\n private async writeConfigFile(\n configFile: ConfigFile,\n configsRootDir: string,\n opts: WriteConfigFilesOptions\n ): Promise<WrittenConfigFile> {\n const hash = configFile.hash || sha1(configFile.content);\n const name = format(configFile.name, { hash });\n const filePath = join(configsRootDir, name);\n if (!opts.dryRun) {\n // const exists = await fs.pathExists(filePath);\n // if (!exists) {\n await fs.outputFile(filePath, configFile.content);\n // }\n }\n const res = {\n name,\n hash,\n filePath,\n content: configFile.content,\n };\n return res;\n }\n\n private async writeExtendingConfigFiles(\n extendingConfigFilesMap: ExtendingConfigFilesMap,\n fileHashPerDedupedPaths: DedupedPaths,\n opts: WriteConfigFilesOptions\n ): Promise<EnvsWrittenExtendingConfigFiles> {\n const finalResult: EnvsWrittenExtendingConfigFiles = await Promise.all(\n fileHashPerDedupedPaths.map(async ({ fileHash, paths }) => {\n const envsConfigFile = extendingConfigFilesMap[fileHash];\n const configFile = envsConfigFile.extendingConfigFile;\n const hash = configFile.hash || sha1(configFile.content);\n const name = format(configFile.name, { hash });\n const writtenPaths = await Promise.all(\n paths.map(async (path) => {\n const filePath = join(this.workspace.path, path, name);\n const targetPath = configFile.useAbsPaths\n ? configFile.extendingTarget.filePath\n : `./${relative(dirname(filePath), configFile.extendingTarget.filePath)}`;\n const content = configFile.content.replace(`{${configFile.extendingTarget.name}}`, targetPath);\n if (!opts.dryRun) {\n await fs.outputFile(filePath, content);\n }\n return filePath;\n })\n );\n const res: EnvsWrittenExtendingConfigFile = {\n envIds: envsConfigFile.envIds,\n extendingConfigFile: {\n name,\n hash,\n content: configFile.content,\n extendingTarget: configFile.extendingTarget,\n filePaths: writtenPaths,\n },\n };\n return res;\n })\n );\n return finalResult;\n }\n\n private buildExtendingConfigFilesMap(\n configWriter: ConfigWriterEntry,\n writtenConfigFiles: WrittenConfigFile[],\n envId: string,\n extendingConfigFilesMap: ExtendingConfigFilesMap,\n envCompsDirsMap: EnvCompsDirsMap,\n configsRootDir: string,\n opts: WriteConfigFilesOptions\n ) {\n const extendingConfigFile = this.generateExtendingFile(\n configWriter,\n writtenConfigFiles,\n envCompsDirsMap,\n configsRootDir,\n opts\n );\n if (!extendingConfigFile) return;\n if (!extendingConfigFilesMap[extendingConfigFile.hash]) {\n extendingConfigFilesMap[extendingConfigFile.hash] = { extendingConfigFile, envIds: [] };\n }\n extendingConfigFilesMap[extendingConfigFile.hash].envIds.push(envId);\n }\n\n private generateExtendingFile(\n configWriter: ConfigWriterEntry,\n writtenConfigFiles,\n envCompsDirsMap: EnvCompsDirsMap,\n configsRootDir: string,\n opts: WriteConfigFilesOptions\n ): Required<ExtendingConfigFile> | undefined {\n const args = {\n workspaceDir: this.workspace.path,\n configsRootDir,\n writtenConfigFiles,\n envCompsDirsMap,\n dryRun: !!opts.dryRun,\n };\n const extendingConfigFile = configWriter.generateExtendingFile(args);\n if (!extendingConfigFile) return undefined;\n const hash = extendingConfigFile.hash || sha1(extendingConfigFile.content);\n return {\n ...extendingConfigFile,\n useAbsPaths: !!extendingConfigFile.useAbsPaths,\n hash,\n };\n }\n\n private getConfigsRootDir() {\n return this.getCacheDir(this.workspace.path);\n }\n\n private getCacheDir(rootDir): string {\n return join(rootDir, 'node_modules', '.cache');\n }\n\n private async getExecContext(): Promise<ExecutionContext[]> {\n const components = await this.workspace.list();\n const runtime = await this.envs.createEnvironment(components);\n const execContext = runtime.getEnvExecutionContext();\n return execContext;\n }\n\n private getEnvComponentsDirsMap(envsExecutionContext: ExecutionContext[]): EnvCompsDirsMap {\n const envCompDirsMap = envsExecutionContext.reduce((acc, envExecution) => {\n const envRuntime = envExecution.envRuntime;\n const envId = envRuntime.id.toString();\n const value = {\n id: envRuntime.id,\n env: envRuntime.env,\n paths: envRuntime.components.map((c) => this.workspace.componentDir(c.id, undefined, { relative: true })),\n };\n acc[envId] = value;\n return acc;\n }, {});\n return envCompDirsMap;\n }\n\n private getConfigWriters(): [string, ConfigWriterEntry[]][] {\n return this.configWriterSlot.toArray();\n }\n\n private getFlatConfigWriters(): ConfigWriterEntry[] {\n return this.getConfigWriters().reduce((acc: ConfigWriterEntry[], [, value]) => {\n acc = acc.concat(value);\n return acc;\n }, []);\n }\n\n /**\n * Clean config files written by the config-writers\n * @param envsExecutionContext\n * @param param1\n * @returns Array of paths of deleted config files\n */\n async clean({ dryRun, silent, writers }: WriteConfigFilesOptions): Promise<string[]> {\n const configWriters = this.getFlatConfigWriters();\n const filteredConfigWriters = writers\n ? configWriters.filter(\n (configWriter) => writers.includes(configWriter.name) || writers.includes(configWriter.cliName)\n )\n : configWriters;\n const paths = filteredConfigWriters\n .map((configWriter) => {\n const patterns = configWriter.patterns;\n const currPaths = globby.sync(patterns, {\n cwd: this.workspace.path,\n dot: true,\n onlyFiles: true,\n ignore: ['**/node_modules/**'],\n });\n const filteredPaths = currPaths.filter((path) => {\n const fullPath = join(this.workspace.path, path);\n return configWriter.isBitGenerated ? configWriter.isBitGenerated(fullPath) : true;\n });\n return filteredPaths;\n })\n .flat();\n if (dryRun) return paths;\n if (!silent) await this.promptForCleaning(paths);\n await this.deleteFiles(paths);\n return paths;\n }\n\n private async promptForCleaning(paths: string[]) {\n this.logger.clearStatusLine();\n const ok = await yesno({\n question: `${chalk.underline('The following paths will be deleted:')}\n${paths.join('\\n')}\n${chalk.bold('Do you want to continue? [yes(y)/no(n)]')}`,\n });\n if (!ok) {\n throw new PromptCanceled();\n }\n }\n\n private async deleteFiles(paths: string[]) {\n await Promise.all(paths.map((f) => fs.remove(join(this.workspace.path, f))));\n }\n\n registerConfigWriter(...configWriterEntries: ConfigWriterEntry[]) {\n this.configWriterSlot.register(configWriterEntries);\n }\n\n static slots = [Slot.withType<ConfigWriterEntry[]>()];\n // define your aspect dependencies here.\n // in case you need to use another aspect API.\n static dependencies = [CLIAspect, WorkspaceAspect, EnvsAspect, LoggerAspect];\n\n static runtime = MainRuntime;\n\n static async provider(\n [cli, workspace, envs, loggerAspect]: [CLIMain, Workspace, EnvsMain, LoggerMain],\n _config,\n [configWriterSlot]: [ConfigWriterSlot]\n ) {\n const logger = loggerAspect.createLogger(WorkspaceConfigFilesAspect.id);\n const workspaceConfigFilesMain = new WorkspaceConfigFilesMain(configWriterSlot, workspace, envs, logger);\n const wsConfigCmd = new WsConfigCmd();\n wsConfigCmd.commands = [\n new WsConfigWriteCmd(workspaceConfigFilesMain),\n new WsConfigCleanCmd(workspaceConfigFilesMain),\n new WsConfigListCmd(workspaceConfigFilesMain),\n ];\n cli.register(wsConfigCmd);\n return workspaceConfigFilesMain;\n }\n}\n\nWorkspaceConfigFilesAspect.addRuntime(WorkspaceConfigFilesMain);\n\nexport default WorkspaceConfigFilesMain;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EA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L,wBAAwB,CAAC;AAAC,eAEjDA,wBAAwB;AAAA"}
|
|
1
|
+
{"version":3,"names":["WorkspaceConfigFilesMain","constructor","configWriterSlot","workspace","envs","logger","writeConfigFiles","options","execContext","getExecContext","cleanResults","clean","aspectsWritersResults","write","err","info","WriteConfigFilesFailed","totalWrittenFiles","reduce","acc","curr","totalExtendingConfigFiles","writeResults","wsDir","path","cleanConfigFiles","listConfigWriters","slotEntries","toArray","result","aspectId","configWriters","map","configWriter","concat","envsExecutionContext","opts","envCompDirsMap","getEnvComponentsDirsMap","configsRootDir","getConfigsRootDir","results","pMapSeries","aspectEntry","handleOneAspectWriter","envCompsDirsMap","writers","includes","name","cliName","undefined","handleOneConfigFileWriter","compactResults","compact","writersResult","writtenConfigFilesMap","extendingConfigFilesMap","Object","entries","envId","envMapValue","executionContext","find","context","id","Error","writtenConfigFiles","handleRealConfigFiles","buildExtendingConfigFilesMap","keys","length","configFiles","totalConfigFiles","extendingConfigFiles","fileHashPerDedupedPaths","dedupePaths","writeExtendingConfigFiles","postProcessExtendingConfigFiles","workspaceDir","writtenExtendingConfigFiles","dryRun","extendingConfigFile","filePaths","values","calculatedConfigFiles","calcConfigFiles","env","Promise","all","configFile","writtenConfigFile","writeConfigFile","hash","envIds","push","postProcessConfigFiles","sha1","content","format","filePath","join","fs","outputFile","res","finalResult","fileHash","paths","envsConfigFile","writtenPaths","targetPath","useAbsPaths","extendingTarget","relative","dirname","replace","generateExtendingFile","args","getCacheDir","rootDir","components","list","runtime","createEnvironment","getEnvExecutionContext","envExecution","envRuntime","toString","value","c","componentDir","getConfigWriters","getFlatConfigWriters","silent","filteredConfigWriters","filter","patterns","currPaths","globby","sync","cwd","dot","onlyFiles","ignore","filteredPaths","fullPath","isBitGenerated","flat","promptForCleaning","deleteFiles","clearStatusLine","ok","yesno","question","chalk","underline","bold","PromptCanceled","f","remove","registerConfigWriter","configWriterEntries","register","provider","cli","loggerAspect","_config","createLogger","WorkspaceConfigFilesAspect","workspaceConfigFilesMain","wsConfigCmd","WsConfigCmd","commands","WsConfigWriteCmd","WsConfigCleanCmd","WsConfigListCmd","Slot","withType","CLIAspect","WorkspaceAspect","EnvsAspect","LoggerAspect","MainRuntime","addRuntime"],"sources":["workspace-config-files.main.runtime.ts"],"sourcesContent":["import format from 'string-format';\nimport { sha1 } from '@teambit/legacy/dist/utils';\nimport fs from 'fs-extra';\nimport { dirname, join, relative } from 'path';\nimport globby from 'globby';\nimport chalk from 'chalk';\nimport { PromptCanceled } from '@teambit/legacy/dist/prompts/exceptions';\nimport pMapSeries from 'p-map-series';\nimport yesno from 'yesno';\nimport { compact } from 'lodash';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { WorkspaceAspect } from '@teambit/workspace';\nimport type { Workspace } from '@teambit/workspace';\nimport { Environment, EnvsAspect, ExecutionContext } from '@teambit/envs';\nimport type { EnvsMain } from '@teambit/envs';\nimport { Logger, LoggerAspect } from '@teambit/logger';\nimport type { LoggerMain } from '@teambit/logger';\nimport { WorkspaceConfigFilesAspect } from './workspace-config-files.aspect';\nimport { ConfigFile, ConfigWriterEntry, ExtendingConfigFile } from './config-writer-entry';\nimport { WsConfigCleanCmd, WsConfigCmd, WsConfigListCmd, WsConfigWriteCmd } from './ws-config.cmd';\nimport { DedupedPaths, dedupePaths } from './dedup-paths';\nimport WriteConfigFilesFailed from './exceptions/write-failed';\n\nexport type ConfigWriterSlot = SlotRegistry<ConfigWriterEntry[]>;\n\nexport type ConfigWritersList = Array<{\n aspectId: string;\n configWriter: ConfigWriterEntry;\n}>;\n\nexport type CleanConfigFilesOptions = {\n silent?: boolean; // no prompt\n dryRun?: boolean;\n writers?: string[];\n};\n\nexport type WriteConfigFilesOptions = {\n clean?: boolean;\n silent?: boolean; // no prompt\n dedupe?: boolean;\n dryRun?: boolean;\n writers?: string[];\n};\n\nexport type WrittenConfigFile = Required<ConfigFile> & {\n filePath: string;\n};\n\nexport type WrittenExtendingConfigFile = ExtendingConfigFile & {\n filePaths: string[];\n};\n\nexport type WrittenConfigFilesMap = {\n [configFileHash: string]: {\n envIds: string[];\n configFile: WrittenConfigFile;\n };\n};\n\nexport type ExtendingConfigFilesMap = {\n [configFileHash: string]: {\n envIds: string[];\n extendingConfigFile: Required<ExtendingConfigFile>;\n };\n};\n\nexport type CompPathExtendingHashMap = { [compPath: string]: string };\n\nexport type EnvMapValue = { env: Environment; id: string[]; paths: string[] };\nexport type EnvCompsDirsMap = { [envId: string]: EnvMapValue };\n\nexport type EnvsWrittenConfigFile = { envIds: string[]; configFile: WrittenConfigFile };\nexport type EnvsWrittenConfigFiles = Array<EnvsWrittenConfigFile>;\n\nexport type EnvsWrittenExtendingConfigFile = { envIds: string[]; extendingConfigFile: WrittenExtendingConfigFile };\nexport type EnvsWrittenExtendingConfigFiles = Array<EnvsWrittenExtendingConfigFile>;\n\nexport type OneConfigFileWriterResult = {\n name: string;\n totalWrittenFiles: number;\n configFiles: EnvsWrittenConfigFiles;\n totalConfigFiles: number;\n extendingConfigFiles: EnvsWrittenExtendingConfigFiles;\n totalExtendingConfigFiles: number;\n};\n\nexport type AspectWritersResults = {\n aspectId: string;\n writersResult: OneConfigFileWriterResult[];\n totalWrittenFiles: number;\n totalExtendingConfigFiles: number;\n};\n\nexport type WriteConfigFilesResult = {\n cleanResults?: string[];\n writeResults: {\n totalWrittenFiles: number;\n totalExtendingConfigFiles: number;\n aspectsWritersResults: AspectWritersResults[];\n };\n wsDir: string;\n};\n\nexport class WorkspaceConfigFilesMain {\n constructor(\n readonly configWriterSlot: ConfigWriterSlot,\n private workspace: Workspace,\n private envs: EnvsMain,\n private logger: Logger\n ) {}\n\n /**\n * It writes the configuration files for the workspace\n * for example: tsconfig, eslint config and prettier config files.\n * @param {WriteConfigFilesOptions} options - WriteConfigFilesOptions = {}\n * @returns An object with the following properties:\n * - writeResults: An object with the following properties:\n * - aspectsWritersResults: An array of objects with the following properties:\n * - aspect: The aspect that was written\n * - totalWrittenFiles: The number of files that were written\n * - totalWrittenFiles: The total number of files that were written\n * - cleanResults: array of deleted paths\n */\n async writeConfigFiles(options: WriteConfigFilesOptions = {}): Promise<WriteConfigFilesResult> {\n const execContext = await this.getExecContext();\n\n let cleanResults: string[] | undefined;\n if (options.clean) {\n cleanResults = await this.clean(options);\n }\n\n let aspectsWritersResults;\n try {\n aspectsWritersResults = await this.write(execContext, options);\n } catch (err) {\n this.logger.info('writeConfigFiles failed', err);\n throw new WriteConfigFilesFailed();\n }\n const totalWrittenFiles = aspectsWritersResults.reduce((acc, curr) => {\n return acc + curr.totalWrittenFiles;\n }, 0);\n const totalExtendingConfigFiles = aspectsWritersResults.reduce((acc, curr) => {\n return acc + curr.totalExtendingConfigFiles;\n }, 0);\n const writeResults = { aspectsWritersResults, totalWrittenFiles, totalExtendingConfigFiles };\n\n return { writeResults, cleanResults, wsDir: this.workspace.path };\n }\n\n /**\n * It cleans (delete) the config files from the workspace.\n * This will check each file and will only delete it in case it was generated by bit\n * @param {CleanConfigFilesOptions} options - CleanConfigFilesOptions = {}\n * @returns An array of strings.\n */\n async cleanConfigFiles(options: CleanConfigFilesOptions = {}): Promise<string[]> {\n // const execContext = await this.getExecContext();\n const cleanResults = await this.clean(options);\n return cleanResults;\n }\n\n /**\n * It returns a list of all the config writers that have been registered with the config writer slot\n * @returns An array of objects with aspectId and configWriter properties.\n */\n listConfigWriters(): ConfigWritersList {\n const slotEntries = this.configWriterSlot.toArray();\n const result: ConfigWritersList = slotEntries.reduce((acc, [aspectId, configWriters]) => {\n const curr = configWriters.map((configWriter) => ({ aspectId, configWriter }));\n return acc.concat(curr);\n }, [] as ConfigWritersList);\n return result;\n }\n\n private async write(\n envsExecutionContext: ExecutionContext[],\n opts: WriteConfigFilesOptions\n ): Promise<AspectWritersResults[]> {\n const envCompDirsMap = this.getEnvComponentsDirsMap(envsExecutionContext);\n const slotEntries = this.configWriterSlot.toArray();\n const configsRootDir = this.getConfigsRootDir();\n const results = await pMapSeries(slotEntries, async (aspectEntry) => {\n const [aspectId, configWriters] = aspectEntry;\n return this.handleOneAspectWriter(\n aspectId,\n configWriters,\n envCompDirsMap,\n configsRootDir,\n envsExecutionContext,\n opts\n );\n });\n return results;\n }\n\n private async handleOneAspectWriter(\n aspectId: string,\n configWriters: ConfigWriterEntry[],\n envCompsDirsMap: EnvCompsDirsMap,\n configsRootDir: string,\n envsExecutionContext: ExecutionContext[],\n opts: WriteConfigFilesOptions\n ): Promise<AspectWritersResults> {\n const results = await pMapSeries(configWriters, async (configWriter) => {\n if (opts.writers && !(opts.writers.includes(configWriter.name) || opts.writers.includes(configWriter.cliName)))\n return undefined;\n return this.handleOneConfigFileWriter(configWriter, envCompsDirsMap, configsRootDir, envsExecutionContext, opts);\n });\n const compactResults = compact(results);\n const totalWrittenFiles = compactResults.reduce((acc, curr) => {\n return acc + curr.totalWrittenFiles;\n }, 0);\n const totalExtendingConfigFiles = compactResults.reduce((acc, curr) => {\n return acc + curr.totalExtendingConfigFiles;\n }, 0);\n return { aspectId, writersResult: compactResults, totalWrittenFiles, totalExtendingConfigFiles };\n }\n\n private async handleOneConfigFileWriter(\n configWriter: ConfigWriterEntry,\n envCompsDirsMap: EnvCompsDirsMap,\n configsRootDir: string,\n envsExecutionContext: ExecutionContext[],\n opts: WriteConfigFilesOptions\n ): Promise<OneConfigFileWriterResult> {\n const writtenConfigFilesMap: WrittenConfigFilesMap = {};\n const extendingConfigFilesMap: ExtendingConfigFilesMap = {};\n await pMapSeries(Object.entries(envCompsDirsMap), async ([envId, envMapValue]) => {\n const executionContext = envsExecutionContext.find((context) => context.id === envId);\n if (!executionContext) throw new Error(`failed finding execution context for env ${envId}`);\n const writtenConfigFiles = await this.handleRealConfigFiles(\n envId,\n envMapValue,\n executionContext,\n configWriter,\n configsRootDir,\n writtenConfigFilesMap,\n opts\n );\n if (writtenConfigFiles) {\n this.buildExtendingConfigFilesMap(\n configWriter,\n writtenConfigFiles,\n envId,\n extendingConfigFilesMap,\n envCompsDirsMap,\n configsRootDir,\n opts\n );\n }\n });\n if (!writtenConfigFilesMap || Object.keys(writtenConfigFilesMap).length === 0) {\n return {\n name: configWriter.name,\n configFiles: [],\n totalConfigFiles: 0,\n totalWrittenFiles: 0,\n extendingConfigFiles: [],\n totalExtendingConfigFiles: 0,\n };\n }\n\n const fileHashPerDedupedPaths = dedupePaths(extendingConfigFilesMap, envCompsDirsMap);\n const extendingConfigFiles = await this.writeExtendingConfigFiles(\n extendingConfigFilesMap,\n fileHashPerDedupedPaths,\n opts\n );\n if (configWriter.postProcessExtendingConfigFiles) {\n await configWriter.postProcessExtendingConfigFiles({\n workspaceDir: this.workspace.path,\n configsRootDir,\n writtenExtendingConfigFiles: extendingConfigFiles,\n envCompsDirsMap,\n dryRun: !!opts.dryRun,\n });\n }\n const totalExtendingConfigFiles = extendingConfigFiles.reduce(\n (acc, curr) => acc + curr.extendingConfigFile.filePaths.length,\n 0\n );\n const configFiles = Object.values(writtenConfigFilesMap);\n const totalConfigFiles = Object.keys(writtenConfigFilesMap).length;\n const totalWrittenFiles = totalConfigFiles + totalExtendingConfigFiles;\n const result: OneConfigFileWriterResult = {\n name: configWriter.name,\n configFiles,\n totalWrittenFiles,\n totalConfigFiles: Object.keys(writtenConfigFilesMap).length,\n extendingConfigFiles,\n totalExtendingConfigFiles,\n };\n return result;\n }\n\n private async handleRealConfigFiles(\n envId: string,\n envMapValue: EnvMapValue,\n executionContext: ExecutionContext,\n configWriter: ConfigWriterEntry,\n configsRootDir: string,\n writtenConfigFilesMap: WrittenConfigFilesMap,\n opts: WriteConfigFilesOptions\n ): Promise<WrittenConfigFile[] | undefined> {\n const calculatedConfigFiles = configWriter.calcConfigFiles(executionContext, envMapValue.env, configsRootDir);\n if (!calculatedConfigFiles) return undefined;\n const writtenConfigFiles = await Promise.all(\n calculatedConfigFiles.map(async (configFile) => {\n const writtenConfigFile = await this.writeConfigFile(configFile, configsRootDir, opts);\n if (!writtenConfigFilesMap[writtenConfigFile.hash]) {\n writtenConfigFilesMap[writtenConfigFile.hash] = { configFile: writtenConfigFile, envIds: [] };\n }\n writtenConfigFilesMap[writtenConfigFile.hash].envIds.push(envId);\n return writtenConfigFile;\n })\n );\n if (configWriter.postProcessConfigFiles) {\n await configWriter.postProcessConfigFiles(writtenConfigFiles, executionContext, envMapValue, {\n dryRun: !!opts.dryRun,\n });\n }\n return writtenConfigFiles;\n }\n\n private async writeConfigFile(\n configFile: ConfigFile,\n configsRootDir: string,\n opts: WriteConfigFilesOptions\n ): Promise<WrittenConfigFile> {\n const hash = configFile.hash || sha1(configFile.content);\n const name = format(configFile.name, { hash });\n const filePath = join(configsRootDir, name);\n if (!opts.dryRun) {\n // const exists = await fs.pathExists(filePath);\n // if (!exists) {\n await fs.outputFile(filePath, configFile.content);\n // }\n }\n const res = {\n name,\n hash,\n filePath,\n content: configFile.content,\n };\n return res;\n }\n\n private async writeExtendingConfigFiles(\n extendingConfigFilesMap: ExtendingConfigFilesMap,\n fileHashPerDedupedPaths: DedupedPaths,\n opts: WriteConfigFilesOptions\n ): Promise<EnvsWrittenExtendingConfigFiles> {\n const finalResult: EnvsWrittenExtendingConfigFiles = await Promise.all(\n fileHashPerDedupedPaths.map(async ({ fileHash, paths }) => {\n const envsConfigFile = extendingConfigFilesMap[fileHash];\n const configFile = envsConfigFile.extendingConfigFile;\n const hash = configFile.hash || sha1(configFile.content);\n const name = format(configFile.name, { hash });\n const writtenPaths = await Promise.all(\n paths.map(async (path) => {\n const filePath = join(this.workspace.path, path, name);\n const targetPath = configFile.useAbsPaths\n ? configFile.extendingTarget.filePath\n : `./${relative(dirname(filePath), configFile.extendingTarget.filePath)}`;\n const content = configFile.content.replace(`{${configFile.extendingTarget.name}}`, targetPath);\n if (!opts.dryRun) {\n await fs.outputFile(filePath, content);\n }\n return filePath;\n })\n );\n const res: EnvsWrittenExtendingConfigFile = {\n envIds: envsConfigFile.envIds,\n extendingConfigFile: {\n name,\n hash,\n content: configFile.content,\n extendingTarget: configFile.extendingTarget,\n filePaths: writtenPaths,\n },\n };\n return res;\n })\n );\n return finalResult;\n }\n\n private buildExtendingConfigFilesMap(\n configWriter: ConfigWriterEntry,\n writtenConfigFiles: WrittenConfigFile[],\n envId: string,\n extendingConfigFilesMap: ExtendingConfigFilesMap,\n envCompsDirsMap: EnvCompsDirsMap,\n configsRootDir: string,\n opts: WriteConfigFilesOptions\n ) {\n const extendingConfigFile = this.generateExtendingFile(\n configWriter,\n writtenConfigFiles,\n envCompsDirsMap,\n configsRootDir,\n opts\n );\n if (!extendingConfigFile) return;\n if (!extendingConfigFilesMap[extendingConfigFile.hash]) {\n extendingConfigFilesMap[extendingConfigFile.hash] = { extendingConfigFile, envIds: [] };\n }\n extendingConfigFilesMap[extendingConfigFile.hash].envIds.push(envId);\n }\n\n private generateExtendingFile(\n configWriter: ConfigWriterEntry,\n writtenConfigFiles,\n envCompsDirsMap: EnvCompsDirsMap,\n configsRootDir: string,\n opts: WriteConfigFilesOptions\n ): Required<ExtendingConfigFile> | undefined {\n const args = {\n workspaceDir: this.workspace.path,\n configsRootDir,\n writtenConfigFiles,\n envCompsDirsMap,\n dryRun: !!opts.dryRun,\n };\n const extendingConfigFile = configWriter.generateExtendingFile(args);\n if (!extendingConfigFile) return undefined;\n const hash = extendingConfigFile.hash || sha1(extendingConfigFile.content);\n return {\n ...extendingConfigFile,\n useAbsPaths: !!extendingConfigFile.useAbsPaths,\n hash,\n };\n }\n\n private getConfigsRootDir() {\n return this.getCacheDir(this.workspace.path);\n }\n\n private getCacheDir(rootDir): string {\n return join(rootDir, 'node_modules', '.cache');\n }\n\n private async getExecContext(): Promise<ExecutionContext[]> {\n const components = await this.workspace.list();\n const runtime = await this.envs.createEnvironment(components);\n const execContext = runtime.getEnvExecutionContext();\n return execContext;\n }\n\n private getEnvComponentsDirsMap(envsExecutionContext: ExecutionContext[]): EnvCompsDirsMap {\n const envCompDirsMap = envsExecutionContext.reduce((acc, envExecution) => {\n const envRuntime = envExecution.envRuntime;\n const envId = envRuntime.id.toString();\n const value = {\n id: envRuntime.id,\n env: envRuntime.env,\n paths: envRuntime.components.map((c) => this.workspace.componentDir(c.id, undefined, { relative: true })),\n };\n acc[envId] = value;\n return acc;\n }, {});\n return envCompDirsMap;\n }\n\n private getConfigWriters(): [string, ConfigWriterEntry[]][] {\n return this.configWriterSlot.toArray();\n }\n\n private getFlatConfigWriters(): ConfigWriterEntry[] {\n return this.getConfigWriters().reduce((acc: ConfigWriterEntry[], [, value]) => {\n acc = acc.concat(value);\n return acc;\n }, []);\n }\n\n /**\n * Clean config files written by the config-writers\n * @param envsExecutionContext\n * @param param1\n * @returns Array of paths of deleted config files\n */\n async clean({ dryRun, silent, writers }: WriteConfigFilesOptions): Promise<string[]> {\n const configWriters = this.getFlatConfigWriters();\n const filteredConfigWriters = writers\n ? configWriters.filter(\n (configWriter) => writers.includes(configWriter.name) || writers.includes(configWriter.cliName)\n )\n : configWriters;\n const paths = filteredConfigWriters\n .map((configWriter) => {\n const patterns = configWriter.patterns;\n const currPaths = globby.sync(patterns, {\n cwd: this.workspace.path,\n dot: true,\n onlyFiles: true,\n ignore: ['**/node_modules/**'],\n });\n const filteredPaths = currPaths.filter((path) => {\n const fullPath = join(this.workspace.path, path);\n return configWriter.isBitGenerated ? configWriter.isBitGenerated(fullPath) : true;\n });\n return filteredPaths;\n })\n .flat();\n if (dryRun) return paths;\n if (!silent) await this.promptForCleaning(paths);\n await this.deleteFiles(paths);\n return paths;\n }\n\n private async promptForCleaning(paths: string[]) {\n this.logger.clearStatusLine();\n const ok = await yesno({\n question: `${chalk.underline('The following files will be deleted:')}\n${paths.join('\\n')}\n${chalk.bold('Do you want to continue? [yes(y)/no(n)]')}`,\n });\n if (!ok) {\n throw new PromptCanceled();\n }\n }\n\n private async deleteFiles(paths: string[]) {\n await Promise.all(paths.map((f) => fs.remove(join(this.workspace.path, f))));\n }\n\n registerConfigWriter(...configWriterEntries: ConfigWriterEntry[]) {\n this.configWriterSlot.register(configWriterEntries);\n }\n\n static slots = [Slot.withType<ConfigWriterEntry[]>()];\n // define your aspect dependencies here.\n // in case you need to use another aspect API.\n static dependencies = [CLIAspect, WorkspaceAspect, EnvsAspect, LoggerAspect];\n\n static runtime = MainRuntime;\n\n static async provider(\n [cli, workspace, envs, loggerAspect]: [CLIMain, Workspace, EnvsMain, LoggerMain],\n _config,\n [configWriterSlot]: [ConfigWriterSlot]\n ) {\n const logger = loggerAspect.createLogger(WorkspaceConfigFilesAspect.id);\n const workspaceConfigFilesMain = new WorkspaceConfigFilesMain(configWriterSlot, workspace, envs, logger);\n const wsConfigCmd = new WsConfigCmd();\n wsConfigCmd.commands = [\n new WsConfigWriteCmd(workspaceConfigFilesMain),\n new WsConfigCleanCmd(workspaceConfigFilesMain),\n new WsConfigListCmd(workspaceConfigFilesMain),\n ];\n cli.register(wsConfigCmd);\n return workspaceConfigFilesMain;\n }\n}\n\nWorkspaceConfigFilesAspect.addRuntime(WorkspaceConfigFilesMain);\n\nexport default WorkspaceConfigFilesMain;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;E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HANGED
|
@@ -11,6 +11,7 @@ export declare type WriteConfigCmdFlags = {
|
|
|
11
11
|
dryRunWithContent?: boolean;
|
|
12
12
|
clean?: boolean;
|
|
13
13
|
silent?: boolean;
|
|
14
|
+
verbose?: boolean;
|
|
14
15
|
};
|
|
15
16
|
export declare class WsConfigCmd implements Command {
|
|
16
17
|
name: string;
|
|
@@ -37,6 +38,14 @@ export declare class WsConfigWriteCmd implements Command {
|
|
|
37
38
|
totalWrittenFiles: number;
|
|
38
39
|
aspectsWritersResults: Partial<import("./workspace-config-files.main.runtime").AspectWritersResults>[];
|
|
39
40
|
};
|
|
41
|
+
} | {
|
|
42
|
+
wsDir: string;
|
|
43
|
+
cleanResults: string[] | undefined;
|
|
44
|
+
writeResults: {
|
|
45
|
+
totalWrittenFiles: number;
|
|
46
|
+
totalExtendingConfigFiles: number;
|
|
47
|
+
aspectsWritersResults: import("./workspace-config-files.main.runtime").AspectWritersResults[];
|
|
48
|
+
};
|
|
40
49
|
}>;
|
|
41
50
|
}
|
|
42
51
|
export declare class WsConfigCleanCmd implements Command {
|
package/dist/ws-config.cmd.js
CHANGED
|
@@ -29,9 +29,9 @@ function _chalk() {
|
|
|
29
29
|
};
|
|
30
30
|
return data;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
const data = require("./
|
|
34
|
-
|
|
32
|
+
function _outputs() {
|
|
33
|
+
const data = require("./outputs");
|
|
34
|
+
_outputs = function () {
|
|
35
35
|
return data;
|
|
36
36
|
};
|
|
37
37
|
return data;
|
|
@@ -62,14 +62,15 @@ class WsConfigWriteCmd {
|
|
|
62
62
|
(0, _defineProperty2().default)(this, "description", 'EXPERIMENTAL. write config files in the workspace. useful for IDEs');
|
|
63
63
|
(0, _defineProperty2().default)(this, "alias", '');
|
|
64
64
|
(0, _defineProperty2().default)(this, "group", 'development');
|
|
65
|
-
(0, _defineProperty2().default)(this, "options", [['c', 'clean', 'delete existing config files from the workspace. highly recommended to run it with "--dry-run" first'], ['w', 'writers <writers>', `only write config files for the given writers. use comma to separate multiple writers. use ${COMMAND_NAME} list to see all writers`], ['s', 'silent', 'do not prompt for confirmation'], ['', 'no-dedupe', "write configs inside each one of the component's dir, avoid deduping"], ['', 'dry-run', 'show the paths that configs will be written per env'], ['', 'dry-run-with-content', 'use with --json flag. show the config content and the paths it will be written per env'], ['j', 'json', 'json format']]);
|
|
65
|
+
(0, _defineProperty2().default)(this, "options", [['c', 'clean', 'delete existing config files from the workspace. highly recommended to run it with "--dry-run" first'], ['w', 'writers <writers>', `only write config files for the given writers. use comma to separate multiple writers. use ${COMMAND_NAME} list to see all writers`], ['s', 'silent', 'do not prompt for confirmation'], ['', 'no-dedupe', "write configs inside each one of the component's dir, avoid deduping"], ['', 'dry-run', 'show the paths that configs will be written per env'], ['', 'dry-run-with-content', 'use with --json flag. show the config content and the paths it will be written per env'], ['v', 'verbose', 'showing verbose output for writing'], ['j', 'json', 'json format']]);
|
|
66
66
|
}
|
|
67
67
|
async report(_args, flags) {
|
|
68
68
|
const results = await this.json(_args, flags);
|
|
69
69
|
if (flags.dryRunWithContent) {
|
|
70
70
|
throw new Error(`use --json flag along with --dry-run-with-content`);
|
|
71
71
|
}
|
|
72
|
-
return (0,
|
|
72
|
+
if (flags.verbose) return (0, _outputs().verboseFormatWriteOutput)(results, flags);
|
|
73
|
+
return (0, _outputs().formatWriteOutput)(results, flags);
|
|
73
74
|
}
|
|
74
75
|
async json(_args, flags) {
|
|
75
76
|
const {
|
|
@@ -122,7 +123,7 @@ class WsConfigCleanCmd {
|
|
|
122
123
|
}
|
|
123
124
|
async report(_args, flags) {
|
|
124
125
|
const results = await this.json(_args, flags);
|
|
125
|
-
return (0,
|
|
126
|
+
return (0, _outputs().formatCleanOutput)(results, flags);
|
|
126
127
|
}
|
|
127
128
|
async json(_args, flags) {
|
|
128
129
|
var _flags$writers;
|
|
@@ -150,7 +151,7 @@ class WsConfigListCmd {
|
|
|
150
151
|
}
|
|
151
152
|
async report() {
|
|
152
153
|
const results = await this.json();
|
|
153
|
-
return (0,
|
|
154
|
+
return (0, _outputs().formatListOutput)(results);
|
|
154
155
|
}
|
|
155
156
|
async json() {
|
|
156
157
|
const cleanResults = await this.workspaceConfigFilesMain.listConfigWriters();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["COMMAND_NAME","WsConfigCmd","report","unrecognizedSubcommand","chalk","red","WsConfigWriteCmd","constructor","workspaceConfigFilesMain","_args","flags","results","json","dryRunWithContent","Error","formatWriteOutput","clean","silent","noDedupe","writers","dryRun","cleanResults","writeResults","wsDir","writeConfigFiles","dedupe","split","aspectsWritersResults","map","s","omit","totalWrittenFiles","WsConfigCleanCmd","formatCleanOutput","cleanConfigFiles","WsConfigListCmd","formatListOutput","listConfigWriters"],"sources":["ws-config.cmd.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\n\nimport { omit } from 'lodash';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { WorkspaceConfigFilesMain, WriteConfigFilesResult } from './workspace-config-files.main.runtime';\nimport { formatCleanOutput, formatListOutput, formatWriteOutput } from './
|
|
1
|
+
{"version":3,"names":["COMMAND_NAME","WsConfigCmd","report","unrecognizedSubcommand","chalk","red","WsConfigWriteCmd","constructor","workspaceConfigFilesMain","_args","flags","results","json","dryRunWithContent","Error","verbose","verboseFormatWriteOutput","formatWriteOutput","clean","silent","noDedupe","writers","dryRun","cleanResults","writeResults","wsDir","writeConfigFiles","dedupe","split","aspectsWritersResults","map","s","omit","totalWrittenFiles","WsConfigCleanCmd","formatCleanOutput","cleanConfigFiles","WsConfigListCmd","formatListOutput","listConfigWriters"],"sources":["ws-config.cmd.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\n\nimport { omit } from 'lodash';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { WorkspaceConfigFilesMain, WriteConfigFilesResult } from './workspace-config-files.main.runtime';\nimport { formatCleanOutput, formatListOutput, formatWriteOutput, verboseFormatWriteOutput } from './outputs';\n\nexport type CleanConfigCmdFlags = {\n dryRun?: boolean;\n silent?: boolean;\n};\n\nexport type WriteConfigCmdFlags = {\n dryRun?: boolean;\n writers?: string;\n noDedupe?: boolean;\n dryRunWithContent?: boolean;\n clean?: boolean;\n silent?: boolean;\n verbose?: boolean;\n};\n\nconst COMMAND_NAME = 'ws-config';\n\nexport class WsConfigCmd implements Command {\n name = `${COMMAND_NAME} <sub-command>`;\n alias = 'workspace-config';\n description = 'manage workspace config files';\n options = [];\n group = 'development';\n commands: Command[] = [];\n // helpUrl = '';\n\n async report([unrecognizedSubcommand]: [string]) {\n return chalk.red(\n `\"${unrecognizedSubcommand}\" is not a subcommand of \"ws-config\", please run \"bit ws-config --help\" to list the subcommands`\n );\n }\n}\n\nexport class WsConfigWriteCmd implements Command {\n name = 'write';\n description = 'EXPERIMENTAL. write config files in the workspace. useful for IDEs';\n alias = '';\n group = 'development';\n options = [\n [\n 'c',\n 'clean',\n 'delete existing config files from the workspace. highly recommended to run it with \"--dry-run\" first',\n ],\n [\n 'w',\n 'writers <writers>',\n `only write config files for the given writers. use comma to separate multiple writers. use ${COMMAND_NAME} list to see all writers`,\n ],\n ['s', 'silent', 'do not prompt for confirmation'],\n ['', 'no-dedupe', \"write configs inside each one of the component's dir, avoid deduping\"],\n ['', 'dry-run', 'show the paths that configs will be written per env'],\n [\n '',\n 'dry-run-with-content',\n 'use with --json flag. show the config content and the paths it will be written per env',\n ],\n ['v', 'verbose', 'showing verbose output for writing'],\n ['j', 'json', 'json format'],\n ] as CommandOptions;\n\n constructor(private workspaceConfigFilesMain: WorkspaceConfigFilesMain) {}\n\n async report(_args, flags: WriteConfigCmdFlags) {\n const results = (await this.json(_args, flags)) as WriteConfigFilesResult;\n if (flags.dryRunWithContent) {\n throw new Error(`use --json flag along with --dry-run-with-content`);\n }\n if (flags.verbose) return verboseFormatWriteOutput(results, flags);\n return formatWriteOutput(results, flags);\n }\n\n async json(_args, flags: WriteConfigCmdFlags) {\n const { clean, silent, noDedupe, dryRunWithContent, writers } = flags;\n const dryRun = dryRunWithContent ? true : !!flags.dryRun;\n const { cleanResults, writeResults, wsDir } = await this.workspaceConfigFilesMain.writeConfigFiles({\n clean,\n dedupe: !noDedupe,\n dryRun,\n silent,\n writers: writers?.split(','),\n });\n\n if (dryRun) {\n const aspectsWritersResults = dryRunWithContent\n ? writeResults.aspectsWritersResults\n : writeResults.aspectsWritersResults.map((s) => omit(s, ['content']));\n // return JSON.stringify({ cleanResults, writeResults: writeJson }, undefined, 2);\n return {\n wsDir,\n cleanResults,\n writeResults: { totalWrittenFiles: writeResults.totalWrittenFiles, aspectsWritersResults },\n };\n }\n return { wsDir, cleanResults, writeResults };\n }\n}\n\nexport class WsConfigCleanCmd implements Command {\n name = 'clean';\n description = 'EXPERIMENTAL. clean (delete) written config files in the workspace. useful for IDEs';\n alias = '';\n group = 'development';\n options = [\n ['s', 'silent', 'do not prompt for confirmation'],\n [\n 'w',\n 'writers <writers>',\n `only write config files for the given writers. use comma to separate multiple writers. use ${COMMAND_NAME} list to see all writers`,\n ],\n ['', 'dry-run', 'show the paths that configs will be written per env'],\n ['j', 'json', 'json format'],\n ] as CommandOptions;\n\n constructor(private workspaceConfigFilesMain: WorkspaceConfigFilesMain) {}\n\n async report(_args, flags: CleanConfigCmdFlags) {\n const results = await this.json(_args, flags);\n return formatCleanOutput(results, flags);\n }\n\n async json(_args, flags: WriteConfigCmdFlags) {\n const { silent, dryRun } = flags;\n const cleanResults = await this.workspaceConfigFilesMain.cleanConfigFiles({\n dryRun,\n silent,\n writers: flags.writers?.split(','),\n });\n return cleanResults;\n }\n}\n\nexport class WsConfigListCmd implements Command {\n name = 'list';\n description = 'EXPERIMENTAL. list config writers';\n alias = '';\n group = 'development';\n options = [['j', 'json', 'json format']] as CommandOptions;\n\n constructor(private workspaceConfigFilesMain: WorkspaceConfigFilesMain) {}\n\n async report() {\n const results = await this.json();\n return formatListOutput(results);\n }\n\n async json() {\n const cleanResults = await this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Aa,CAAC,CAAC;EAEiC;EAEzE,MAAMN,MAAM,GAAG;IACb,MAAMS,OAAO,GAAG,MAAM,IAAI,CAACC,IAAI,EAAE;IACjC,OAAO,IAAA0B,2BAAgB,EAAC3B,OAAO,CAAC;EAClC;EAEA,MAAMC,IAAI,GAAG;IACX,MAAMW,YAAY,GAAG,MAAM,IAAI,CAACf,wBAAwB,CAAC+B,iBAAiB,EAAE;IAC5E,OAAOhB,YAAY;EACrB;AACF;AAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import type { CleanConfigCmdFlags } from '../ws-config.cmd';
|
|
3
|
+
|
|
4
|
+
export function formatCleanOutput(cleanResults: string[] = [], flags: CleanConfigCmdFlags): string {
|
|
5
|
+
const isDryRun = !!flags.dryRun;
|
|
6
|
+
const cleanResultsOutput = getCleanResultsOutput(cleanResults, isDryRun);
|
|
7
|
+
|
|
8
|
+
return `${cleanResultsOutput}`;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function getCleanResultsOutput(cleanResults: string[] | undefined, isDryRun: boolean) {
|
|
12
|
+
const cleanResultsOutput = cleanResults
|
|
13
|
+
? `${chalk.green(
|
|
14
|
+
`${cleanResults.length} config files ${isDryRun ? 'will be' : 'were'} deleted`
|
|
15
|
+
)}\n ${cleanResults.join('\n ')}\n`
|
|
16
|
+
: '';
|
|
17
|
+
return cleanResultsOutput;
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Table from 'cli-table';
|
|
2
|
+
import { ConfigWritersList } from '../workspace-config-files.main.runtime';
|
|
3
|
+
|
|
4
|
+
export function formatListOutput(result: ConfigWritersList): string {
|
|
5
|
+
const head = ['Aspect ID', 'name', 'CLI name'];
|
|
6
|
+
|
|
7
|
+
const rows = result.map((entry) => {
|
|
8
|
+
return [entry.aspectId, entry.configWriter.name, entry.configWriter.cliName];
|
|
9
|
+
});
|
|
10
|
+
const table = new Table({ head, style: { head: ['cyan'] } });
|
|
11
|
+
table.push(...rows);
|
|
12
|
+
return table.toString();
|
|
13
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { relative } from 'path';
|
|
3
|
+
import {
|
|
4
|
+
AspectWritersResults,
|
|
5
|
+
EnvsWrittenExtendingConfigFile,
|
|
6
|
+
EnvsWrittenExtendingConfigFiles,
|
|
7
|
+
OneConfigFileWriterResult,
|
|
8
|
+
WriteConfigFilesResult,
|
|
9
|
+
} from '../workspace-config-files.main.runtime';
|
|
10
|
+
import type { WriteConfigCmdFlags } from '../ws-config.cmd';
|
|
11
|
+
import { formatCleanOutput } from './format-clean-output';
|
|
12
|
+
import { SUMMARY, WRITE_TITLE } from './write-outputs-texts';
|
|
13
|
+
|
|
14
|
+
export function formatWriteOutput(writeConfigFilesResult: WriteConfigFilesResult, flags: WriteConfigCmdFlags): string {
|
|
15
|
+
const { cleanResults, writeResults, wsDir } = writeConfigFilesResult;
|
|
16
|
+
const isDryRun = !!(flags.dryRun || flags.dryRunWithContent);
|
|
17
|
+
const cleanResultsOutput = cleanResults?.length ? formatCleanOutput(cleanResults, { dryRun: isDryRun }) : undefined;
|
|
18
|
+
const writeResultsOutput = getWriteResultsOutput(writeResults, wsDir, isDryRun);
|
|
19
|
+
|
|
20
|
+
const cleanWriteOutput = cleanResultsOutput ? `${cleanResultsOutput}\n${writeResultsOutput}` : writeResultsOutput;
|
|
21
|
+
|
|
22
|
+
return `${cleanWriteOutput}\n\n${SUMMARY}`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function getWriteResultsOutput(writeResults: WriteConfigFilesResult['writeResults'], wsDir: string, isDryRun: boolean) {
|
|
26
|
+
const totalExtendingConfigFiles = writeResults.totalExtendingConfigFiles;
|
|
27
|
+
|
|
28
|
+
const writeTitle = isDryRun
|
|
29
|
+
? chalk.green(`${totalExtendingConfigFiles} files will be written`)
|
|
30
|
+
: chalk.green(WRITE_TITLE(totalExtendingConfigFiles));
|
|
31
|
+
const writeOutput = writeResults.aspectsWritersResults
|
|
32
|
+
.map((aspectWritersResults) => getOneAspectOutput(aspectWritersResults, wsDir))
|
|
33
|
+
.join('\n\n');
|
|
34
|
+
return `${writeTitle}\n${writeOutput}`;
|
|
35
|
+
}
|
|
36
|
+
function getOneAspectOutput(aspectWritersResults: AspectWritersResults, wsDir: string): string {
|
|
37
|
+
const title = chalk.blue(
|
|
38
|
+
`${aspectWritersResults.totalExtendingConfigFiles} ${chalk.bold(
|
|
39
|
+
aspectWritersResults.aspectId.toString()
|
|
40
|
+
)} configurations added`
|
|
41
|
+
);
|
|
42
|
+
const writersOutput = aspectWritersResults.writersResult
|
|
43
|
+
.map((oneWritersResults) => getOneWriterOutput(oneWritersResults, wsDir))
|
|
44
|
+
.join('\n\n');
|
|
45
|
+
return `${title}\n${writersOutput}`;
|
|
46
|
+
}
|
|
47
|
+
function getOneWriterOutput(oneWritersResults: OneConfigFileWriterResult, wsDir: string): string {
|
|
48
|
+
const extendingConfigFilesOutput = getExtendingConfigFilesOutput(oneWritersResults.extendingConfigFiles, wsDir);
|
|
49
|
+
return `${extendingConfigFilesOutput}`;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function getExtendingConfigFilesOutput(extendingConfigFiles: EnvsWrittenExtendingConfigFiles, wsDir: string): string {
|
|
53
|
+
const extendingConfigFilesOutput = extendingConfigFiles
|
|
54
|
+
.map((envsWrittenExtendingConfigFile) =>
|
|
55
|
+
getEnvGroupExtendingConfigFilesOutput(envsWrittenExtendingConfigFile, wsDir)
|
|
56
|
+
)
|
|
57
|
+
.join('\n');
|
|
58
|
+
return `${extendingConfigFilesOutput}`;
|
|
59
|
+
}
|
|
60
|
+
function getEnvGroupExtendingConfigFilesOutput(
|
|
61
|
+
envsWrittenExtendingConfigFile: EnvsWrittenExtendingConfigFile,
|
|
62
|
+
wsDir: string
|
|
63
|
+
): string {
|
|
64
|
+
const extendingConfigFile = envsWrittenExtendingConfigFile.extendingConfigFile;
|
|
65
|
+
const paths = extendingConfigFile.filePaths.map((p) => ` ${relative(wsDir, p)}`).join('\n');
|
|
66
|
+
return `${paths}`;
|
|
67
|
+
}
|
package/outputs/index.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { relative } from 'path';
|
|
3
|
+
import {
|
|
4
|
+
AspectWritersResults,
|
|
5
|
+
EnvsWrittenConfigFile,
|
|
6
|
+
EnvsWrittenConfigFiles,
|
|
7
|
+
EnvsWrittenExtendingConfigFile,
|
|
8
|
+
EnvsWrittenExtendingConfigFiles,
|
|
9
|
+
OneConfigFileWriterResult,
|
|
10
|
+
WriteConfigFilesResult,
|
|
11
|
+
} from '../workspace-config-files.main.runtime';
|
|
12
|
+
import type { WriteConfigCmdFlags } from '../ws-config.cmd';
|
|
13
|
+
import { formatCleanOutput } from './format-clean-output';
|
|
14
|
+
import { SUMMARY, WRITE_TITLE } from './write-outputs-texts';
|
|
15
|
+
|
|
16
|
+
export function verboseFormatWriteOutput(
|
|
17
|
+
writeConfigFilesResult: WriteConfigFilesResult,
|
|
18
|
+
flags: WriteConfigCmdFlags
|
|
19
|
+
): string {
|
|
20
|
+
const { cleanResults, writeResults, wsDir } = writeConfigFilesResult;
|
|
21
|
+
const isDryRun = !!(flags.dryRun || flags.dryRunWithContent);
|
|
22
|
+
const cleanResultsOutput = formatCleanOutput(cleanResults, { dryRun: isDryRun });
|
|
23
|
+
const writeResultsOutput = getWriteResultsOutput(writeResults, wsDir, isDryRun);
|
|
24
|
+
|
|
25
|
+
return `${cleanResultsOutput}\n${writeResultsOutput}\n\n${SUMMARY}`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function getWriteResultsOutput(writeResults: WriteConfigFilesResult['writeResults'], wsDir: string, isDryRun: boolean) {
|
|
29
|
+
const totalFiles = writeResults.totalWrittenFiles;
|
|
30
|
+
|
|
31
|
+
const writeTitle = isDryRun
|
|
32
|
+
? chalk.green(`${totalFiles} files will be written`)
|
|
33
|
+
: chalk.green(WRITE_TITLE(totalFiles));
|
|
34
|
+
const writeOutput = writeResults.aspectsWritersResults
|
|
35
|
+
.map((aspectWritersResults) => getOneAspectOutput(aspectWritersResults, wsDir))
|
|
36
|
+
.join('\n\n');
|
|
37
|
+
return `${writeTitle}\n${writeOutput}`;
|
|
38
|
+
}
|
|
39
|
+
function getOneAspectOutput(aspectWritersResults: AspectWritersResults, wsDir: string): string {
|
|
40
|
+
const title = chalk.blue(
|
|
41
|
+
`The following paths are according to aspect ${chalk.bold(aspectWritersResults.aspectId.toString())}`
|
|
42
|
+
);
|
|
43
|
+
const writersOutput = aspectWritersResults.writersResult
|
|
44
|
+
.map((oneWritersResults) => getOneWriterOutput(oneWritersResults, wsDir))
|
|
45
|
+
.join('\n\n');
|
|
46
|
+
return `${title}\n${writersOutput}`;
|
|
47
|
+
}
|
|
48
|
+
function getOneWriterOutput(oneWritersResults: OneConfigFileWriterResult, wsDir: string): string {
|
|
49
|
+
const title = chalk.cyan(` The following paths are according to writer ${chalk.bold(oneWritersResults.name)}`);
|
|
50
|
+
const realConfigFilesOutput = getRealConfigFilesOutput(oneWritersResults.configFiles, wsDir);
|
|
51
|
+
const extendingConfigFilesOutput = getExtendingConfigFilesOutput(oneWritersResults.extendingConfigFiles, wsDir);
|
|
52
|
+
return `${title}\n${realConfigFilesOutput}\n\n${extendingConfigFilesOutput}`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function getRealConfigFilesOutput(envsWrittenConfigFiles: EnvsWrittenConfigFiles, wsDir: string): string {
|
|
56
|
+
const title = chalk.magenta(` Real config files`);
|
|
57
|
+
const writtenConfigFilesOutput = envsWrittenConfigFiles
|
|
58
|
+
.map((envsWrittenConfigFile) => getEnvGroupConfigFilesOutput(envsWrittenConfigFile, wsDir))
|
|
59
|
+
.join('\n\n');
|
|
60
|
+
return `${title}\n${writtenConfigFilesOutput}`;
|
|
61
|
+
}
|
|
62
|
+
function getEnvGroupConfigFilesOutput(envsWrittenConfigFile: EnvsWrittenConfigFile, wsDir: string): string {
|
|
63
|
+
const title = ` The following paths are according to env(s) ${chalk.bold(
|
|
64
|
+
envsWrittenConfigFile.envIds.join(', ')
|
|
65
|
+
)}`;
|
|
66
|
+
const filePath = relative(wsDir, envsWrittenConfigFile.configFile.filePath);
|
|
67
|
+
return `${title}\n ${filePath}`;
|
|
68
|
+
}
|
|
69
|
+
function getExtendingConfigFilesOutput(extendingConfigFiles: EnvsWrittenExtendingConfigFiles, wsDir: string): string {
|
|
70
|
+
const title = chalk.magenta(` Extending config files`);
|
|
71
|
+
|
|
72
|
+
const extendingConfigFilesOutput = extendingConfigFiles
|
|
73
|
+
.map((envsWrittenExtendingConfigFile) =>
|
|
74
|
+
getEnvGroupExtendingConfigFilesOutput(envsWrittenExtendingConfigFile, wsDir)
|
|
75
|
+
)
|
|
76
|
+
.join('\n\n');
|
|
77
|
+
return `${title}\n${extendingConfigFilesOutput}`;
|
|
78
|
+
}
|
|
79
|
+
function getEnvGroupExtendingConfigFilesOutput(
|
|
80
|
+
envsWrittenExtendingConfigFile: EnvsWrittenExtendingConfigFile,
|
|
81
|
+
wsDir: string
|
|
82
|
+
): string {
|
|
83
|
+
const title = ` The following paths are according to env(s) ${chalk.bold(
|
|
84
|
+
envsWrittenExtendingConfigFile.envIds.join(', ')
|
|
85
|
+
)}`;
|
|
86
|
+
const extendingConfigFile = envsWrittenExtendingConfigFile.extendingConfigFile;
|
|
87
|
+
const paths = extendingConfigFile.filePaths
|
|
88
|
+
.map((p) => ` ${relative(wsDir, p)} --> ${relative(wsDir, extendingConfigFile.extendingTarget.filePath)}`)
|
|
89
|
+
.join('\n ');
|
|
90
|
+
return `${title}\n ${paths}`;
|
|
91
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export const WRITE_TITLE = (total: number) => `${total} config files added to workspace`;
|
|
2
|
+
|
|
3
|
+
export const SUMMARY = `bit writes configuration files in different nested locations in your workspace to meet the configuration needs of different components.
|
|
4
|
+
IDE is now in-sync with component configuration`;
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/workspace-config-files",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/workspace/workspace-config-files",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.workspace",
|
|
8
8
|
"name": "workspace-config-files",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.22"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"lodash": "4.17.21",
|
|
13
13
|
"chalk": "2.4.2",
|
|
14
|
-
"cli-table": "0.3.6",
|
|
15
14
|
"fs-extra": "10.0.0",
|
|
16
15
|
"globby": "11.0.1",
|
|
17
16
|
"p-map-series": "2.1.0",
|
|
18
17
|
"string-format": "0.5.0",
|
|
19
18
|
"yesno": "0.4.0",
|
|
19
|
+
"cli-table": "0.3.6",
|
|
20
20
|
"core-js": "^3.0.0",
|
|
21
21
|
"@babel/runtime": "7.20.0",
|
|
22
22
|
"@teambit/harmony": "0.4.6",
|
|
23
|
-
"@teambit/envs": "0.0.
|
|
24
|
-
"@teambit/cli": "0.0.
|
|
25
|
-
"@teambit/logger": "0.0.
|
|
26
|
-
"@teambit/workspace": "0.0.
|
|
23
|
+
"@teambit/envs": "0.0.1042",
|
|
24
|
+
"@teambit/cli": "0.0.702",
|
|
25
|
+
"@teambit/logger": "0.0.795",
|
|
26
|
+
"@teambit/workspace": "0.0.1042",
|
|
27
27
|
"@teambit/bit-error": "0.0.402"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/chai": "4.2.15",
|
|
31
31
|
"chai": "4.3.0",
|
|
32
32
|
"@types/lodash": "4.14.165",
|
|
33
|
-
"@types/cli-table": "^0.3.0",
|
|
34
33
|
"@types/fs-extra": "9.0.7",
|
|
34
|
+
"@types/cli-table": "^0.3.0",
|
|
35
35
|
"@types/mocha": "9.1.0",
|
|
36
36
|
"@types/node": "12.20.4",
|
|
37
37
|
"@types/react": "^17.0.8",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@types/testing-library__jest-dom": "5.9.5"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@teambit/legacy": "1.0.
|
|
43
|
+
"@teambit/legacy": "1.0.481",
|
|
44
44
|
"react": "^16.8.0 || ^17.0.0",
|
|
45
45
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
46
46
|
},
|
package/dist/format-outputs.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { ConfigWritersList, WriteConfigFilesResult } from './workspace-config-files.main.runtime';
|
|
2
|
-
import type { CleanConfigCmdFlags, WriteConfigCmdFlags } from './ws-config.cmd';
|
|
3
|
-
export declare function formatListOutput(result: ConfigWritersList): string;
|
|
4
|
-
export declare function formatWriteOutput(writeConfigFilesResult: WriteConfigFilesResult, flags: WriteConfigCmdFlags): string;
|
|
5
|
-
export declare function formatCleanOutput(cleanResults: string[] | undefined, flags: CleanConfigCmdFlags): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["formatListOutput","result","head","rows","map","entry","aspectId","configWriter","name","cliName","table","Table","style","push","toString","formatWriteOutput","writeConfigFilesResult","flags","cleanResults","writeResults","wsDir","isDryRun","dryRun","dryRunWithContent","cleanResultsOutput","getCleanResultsOutput","writeResultsOutput","getWriteResultsOutput","formatCleanOutput","chalk","green","length","join","totalFiles","totalWrittenFiles","writeTitle","writeOutput","aspectsWritersResults","aspectWritersResults","getOneAspectOutput","title","blue","bold","writersOutput","writersResult","oneWritersResults","getOneWriterOutput","cyan","realConfigFilesOutput","getRealConfigFilesOutput","configFiles","extendingConfigFilesOutput","getExtendingConfigFilesOutput","extendingConfigFiles","envsWrittenConfigFiles","magenta","writtenConfigFilesOutput","envsWrittenConfigFile","getEnvGroupConfigFilesOutput","envIds","filePath","relative","configFile","envsWrittenExtendingConfigFile","getEnvGroupExtendingConfigFilesOutput","extendingConfigFile","paths","filePaths","p","extendingTarget"],"sources":["format-outputs.ts"],"sourcesContent":["import Table from 'cli-table';\nimport chalk from 'chalk';\nimport { relative } from 'path';\nimport {\n AspectWritersResults,\n ConfigWritersList,\n EnvsWrittenConfigFile,\n EnvsWrittenConfigFiles,\n EnvsWrittenExtendingConfigFile,\n EnvsWrittenExtendingConfigFiles,\n OneConfigFileWriterResult,\n WriteConfigFilesResult,\n} from './workspace-config-files.main.runtime';\nimport type { CleanConfigCmdFlags, WriteConfigCmdFlags } from './ws-config.cmd';\n\nexport function formatListOutput(result: ConfigWritersList): string {\n const head = ['Aspect ID', 'name', 'CLI name'];\n\n const rows = result.map((entry) => {\n return [entry.aspectId, entry.configWriter.name, entry.configWriter.cliName];\n });\n const table = new Table({ head, style: { head: ['cyan'] } });\n table.push(...rows);\n return table.toString();\n}\nexport function formatWriteOutput(writeConfigFilesResult: WriteConfigFilesResult, flags: WriteConfigCmdFlags): string {\n const { cleanResults, writeResults, wsDir } = writeConfigFilesResult;\n const isDryRun = !!(flags.dryRun || flags.dryRunWithContent);\n const cleanResultsOutput = getCleanResultsOutput(cleanResults, isDryRun);\n const writeResultsOutput = getWriteResultsOutput(writeResults, wsDir, isDryRun);\n\n return `${cleanResultsOutput}${writeResultsOutput}`;\n}\n\nexport function formatCleanOutput(cleanResults: string[] = [], flags: CleanConfigCmdFlags): string {\n const isDryRun = !!flags.dryRun;\n const cleanResultsOutput = getCleanResultsOutput(cleanResults, isDryRun);\n\n return `${cleanResultsOutput}`;\n}\n\nfunction getCleanResultsOutput(cleanResults: string[] | undefined, isDryRun: boolean) {\n const cleanResultsOutput = cleanResults\n ? `${chalk.green(\n `the following ${cleanResults.length} paths ${isDryRun ? 'will be' : 'were'} deleted:`\n )}\\n ${cleanResults.join('\\n ')}\\n`\n : '';\n return cleanResultsOutput;\n}\nfunction getWriteResultsOutput(writeResults: WriteConfigFilesResult['writeResults'], wsDir: string, isDryRun: boolean) {\n const totalFiles = writeResults.totalWrittenFiles;\n\n const writeTitle = isDryRun\n ? chalk.green(`${totalFiles} files will be written`)\n : chalk.green(`${totalFiles} files have been written successfully`);\n const writeOutput = writeResults.aspectsWritersResults\n .map((aspectWritersResults) => getOneAspectOutput(aspectWritersResults, wsDir))\n .join('\\n\\n');\n return `${writeTitle}\\n${writeOutput}`;\n}\nfunction getOneAspectOutput(aspectWritersResults: AspectWritersResults, wsDir: string): string {\n const title = chalk.blue(\n `The following paths are according to aspect ${chalk.bold(aspectWritersResults.aspectId.toString())}`\n );\n const writersOutput = aspectWritersResults.writersResult\n .map((oneWritersResults) => getOneWriterOutput(oneWritersResults, wsDir))\n .join('\\n\\n');\n return `${title}\\n${writersOutput}`;\n}\nfunction getOneWriterOutput(oneWritersResults: OneConfigFileWriterResult, wsDir: string): string {\n const title = chalk.cyan(` The following paths are according to writer ${chalk.bold(oneWritersResults.name)}`);\n const realConfigFilesOutput = getRealConfigFilesOutput(oneWritersResults.configFiles, wsDir);\n const extendingConfigFilesOutput = getExtendingConfigFilesOutput(oneWritersResults.extendingConfigFiles, wsDir);\n return `${title}\\n${realConfigFilesOutput}\\n\\n${extendingConfigFilesOutput}`;\n}\n\nfunction getRealConfigFilesOutput(envsWrittenConfigFiles: EnvsWrittenConfigFiles, wsDir: string): string {\n const title = chalk.magenta(` Real config files`);\n const writtenConfigFilesOutput = envsWrittenConfigFiles\n .map((envsWrittenConfigFile) => getEnvGroupConfigFilesOutput(envsWrittenConfigFile, wsDir))\n .join('\\n\\n');\n return `${title}\\n${writtenConfigFilesOutput}`;\n}\nfunction getEnvGroupConfigFilesOutput(envsWrittenConfigFile: EnvsWrittenConfigFile, wsDir: string): string {\n const title = ` The following paths are according to env(s) ${chalk.bold(\n envsWrittenConfigFile.envIds.join(', ')\n )}`;\n const filePath = relative(wsDir, envsWrittenConfigFile.configFile.filePath);\n return `${title}\\n ${filePath}`;\n}\nfunction getExtendingConfigFilesOutput(extendingConfigFiles: EnvsWrittenExtendingConfigFiles, wsDir: string): string {\n const title = chalk.magenta(` Extending config files`);\n\n const extendingConfigFilesOutput = extendingConfigFiles\n .map((envsWrittenExtendingConfigFile) =>\n getEnvGroupExtendingConfigFilesOutput(envsWrittenExtendingConfigFile, wsDir)\n )\n .join('\\n\\n');\n return `${title}\\n${extendingConfigFilesOutput}`;\n}\nfunction getEnvGroupExtendingConfigFilesOutput(\n envsWrittenExtendingConfigFile: EnvsWrittenExtendingConfigFile,\n wsDir: string\n): string {\n const title = ` The following paths are according to env(s) ${chalk.bold(\n envsWrittenExtendingConfigFile.envIds.join(', ')\n )}`;\n const extendingConfigFile = envsWrittenExtendingConfigFile.extendingConfigFile;\n const paths = extendingConfigFile.filePaths\n .map((p) => ` ${relative(wsDir, p)} --> ${relative(wsDir, extendingConfigFile.extendingTarget.filePath)}`)\n .join('\\n ');\n return `${title}\\n ${paths}`;\n}\n"],"mappings":";;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAaO,SAASA,gBAAgB,CAACC,MAAyB,EAAU;EAClE,MAAMC,IAAI,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC;EAE9C,MAAMC,IAAI,GAAGF,MAAM,CAACG,GAAG,CAAEC,KAAK,IAAK;IACjC,OAAO,CAACA,KAAK,CAACC,QAAQ,EAAED,KAAK,CAACE,YAAY,CAACC,IAAI,EAAEH,KAAK,CAACE,YAAY,CAACE,OAAO,CAAC;EAC9E,CAAC,CAAC;EACF,MAAMC,KAAK,GAAG,KAAIC,mBAAK,EAAC;IAAET,IAAI;IAAEU,KAAK,EAAE;MAAEV,IAAI,EAAE,CAAC,MAAM;IAAE;EAAE,CAAC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