@teambit/workspace-config-files 1.0.1160 → 1.0.1161
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-skipped-output.d.ts +5 -0
- package/dist/outputs/format-skipped-output.js +33 -0
- package/dist/outputs/format-skipped-output.js.map +1 -0
- package/dist/outputs/format-skipped-output.spec.d.ts +1 -0
- package/dist/outputs/format-skipped-output.spec.js +80 -0
- package/dist/outputs/format-skipped-output.spec.js.map +1 -0
- package/dist/outputs/format-write-output.js +16 -1
- package/dist/outputs/format-write-output.js.map +1 -1
- package/dist/outputs/index.d.ts +1 -0
- package/dist/outputs/index.js +13 -0
- package/dist/outputs/index.js.map +1 -1
- package/dist/outputs/verbose-format-write-output.js +16 -1
- package/dist/outputs/verbose-format-write-output.js.map +1 -1
- package/dist/{preview-1789064510576.js → preview-1789144897043.js} +1 -1
- package/dist/workspace-config-files.main.runtime.d.ts +16 -0
- package/dist/workspace-config-files.main.runtime.js +28 -4
- package/dist/workspace-config-files.main.runtime.js.map +1 -1
- package/dist/writers/extending-config-files.d.ts +15 -2
- package/dist/writers/extending-config-files.js +35 -7
- package/dist/writers/extending-config-files.js.map +1 -1
- package/dist/writers/extending-config-files.spec.d.ts +1 -0
- package/dist/writers/extending-config-files.spec.js +91 -0
- package/dist/writers/extending-config-files.spec.js.map +1 -0
- package/dist/writers/index.d.ts +2 -2
- package/dist/writers/index.js +6 -0
- package/dist/writers/index.js.map +1 -1
- package/dist/ws-config.cmd.d.ts +1 -0
- package/dist/ws-config.cmd.js +5 -3
- package/dist/ws-config.cmd.js.map +1 -1
- package/outputs/format-skipped-output.spec.ts +51 -0
- package/outputs/format-skipped-output.ts +14 -0
- package/outputs/format-write-output.ts +4 -1
- package/outputs/index.ts +1 -0
- package/outputs/verbose-format-write-output.ts +4 -1
- package/package.json +4 -4
- package/writers/extending-config-files.spec.ts +67 -0
- package/writers/extending-config-files.ts +54 -24
- package/writers/index.ts +2 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.formatSkippedOutput = formatSkippedOutput;
|
|
7
|
+
function _path() {
|
|
8
|
+
const data = require("path");
|
|
9
|
+
_path = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _cli() {
|
|
15
|
+
const data = require("@teambit/cli");
|
|
16
|
+
_cli = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
const SKIPPED_DESCRIPTION = `these files already exist and were not generated by bit, so they were left untouched.
|
|
22
|
+
to have bit write them, delete them first or run "bit ws-config write --force".`;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* config files that bit wanted to write but are authored by the user.
|
|
26
|
+
* returns an empty string when nothing was skipped.
|
|
27
|
+
*/
|
|
28
|
+
function formatSkippedOutput(skippedPaths, wsDir) {
|
|
29
|
+
const items = skippedPaths.map(path => (0, _cli().formatItem)((0, _path().relative)(wsDir, path)));
|
|
30
|
+
return (0, _cli().formatSection)(`${_cli().warnSymbol} config files not overridden`, SKIPPED_DESCRIPTION, items);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=format-skipped-output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_path","data","require","_cli","SKIPPED_DESCRIPTION","formatSkippedOutput","skippedPaths","wsDir","items","map","path","formatItem","relative","formatSection","warnSymbol"],"sources":["format-skipped-output.ts"],"sourcesContent":["import { relative } from 'path';\nimport { formatItem, formatSection, warnSymbol } from '@teambit/cli';\n\nconst SKIPPED_DESCRIPTION = `these files already exist and were not generated by bit, so they were left untouched.\nto have bit write them, delete them first or run \"bit ws-config write --force\".`;\n\n/**\n * config files that bit wanted to write but are authored by the user.\n * returns an empty string when nothing was skipped.\n */\nexport function formatSkippedOutput(skippedPaths: string[], wsDir: string): string {\n const items = skippedPaths.map((path) => formatItem(relative(wsDir, path)));\n return formatSection(`${warnSymbol} config files not overridden`, SKIPPED_DESCRIPTION, items);\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,KAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,MAAMG,mBAAmB,GAAG;AAC5B,gFAAgF;;AAEhF;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAACC,YAAsB,EAAEC,KAAa,EAAU;EACjF,MAAMC,KAAK,GAAGF,YAAY,CAACG,GAAG,CAAEC,IAAI,IAAK,IAAAC,iBAAU,EAAC,IAAAC,gBAAQ,EAACL,KAAK,EAAEG,IAAI,CAAC,CAAC,CAAC;EAC3E,OAAO,IAAAG,oBAAa,EAAC,GAAGC,iBAAU,8BAA8B,EAAEV,mBAAmB,EAAEI,KAAK,CAAC;AAC/F","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _chai() {
|
|
4
|
+
const data = require("chai");
|
|
5
|
+
_chai = function () {
|
|
6
|
+
return data;
|
|
7
|
+
};
|
|
8
|
+
return data;
|
|
9
|
+
}
|
|
10
|
+
function _path() {
|
|
11
|
+
const data = require("path");
|
|
12
|
+
_path = function () {
|
|
13
|
+
return data;
|
|
14
|
+
};
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
function _formatSkippedOutput() {
|
|
18
|
+
const data = require("./format-skipped-output");
|
|
19
|
+
_formatSkippedOutput = function () {
|
|
20
|
+
return data;
|
|
21
|
+
};
|
|
22
|
+
return data;
|
|
23
|
+
}
|
|
24
|
+
function _formatWriteOutput() {
|
|
25
|
+
const data = require("./format-write-output");
|
|
26
|
+
_formatWriteOutput = function () {
|
|
27
|
+
return data;
|
|
28
|
+
};
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
31
|
+
function _verboseFormatWriteOutput() {
|
|
32
|
+
const data = require("./verbose-format-write-output");
|
|
33
|
+
_verboseFormatWriteOutput = function () {
|
|
34
|
+
return data;
|
|
35
|
+
};
|
|
36
|
+
return data;
|
|
37
|
+
}
|
|
38
|
+
const wsDir = (0, _path().join)('/', 'my-workspace');
|
|
39
|
+
const skippedPath = (0, _path().join)(wsDir, 'tsconfig.json');
|
|
40
|
+
function mockWriteConfigFilesResult(skippedPaths) {
|
|
41
|
+
return {
|
|
42
|
+
wsDir,
|
|
43
|
+
writeResults: {
|
|
44
|
+
writersResult: [],
|
|
45
|
+
totalWrittenFiles: 0,
|
|
46
|
+
totalRealConfigFiles: 0,
|
|
47
|
+
totalExtendingConfigFiles: 0,
|
|
48
|
+
skippedPaths
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
describe('formatSkippedOutput()', () => {
|
|
53
|
+
it('should return an empty string when no file was skipped', () => {
|
|
54
|
+
(0, _chai().expect)((0, _formatSkippedOutput().formatSkippedOutput)([], wsDir)).to.equal('');
|
|
55
|
+
});
|
|
56
|
+
it('should show the path relative to the workspace and how to override it', () => {
|
|
57
|
+
const output = (0, _formatSkippedOutput().formatSkippedOutput)([skippedPath], wsDir);
|
|
58
|
+
(0, _chai().expect)(output).to.have.string('tsconfig.json');
|
|
59
|
+
(0, _chai().expect)(output).to.not.have.string(wsDir);
|
|
60
|
+
(0, _chai().expect)(output).to.have.string('--force');
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
describe('write output with skipped files', () => {
|
|
64
|
+
it('should show the skipped files', () => {
|
|
65
|
+
const output = (0, _formatWriteOutput().formatWriteOutput)(mockWriteConfigFilesResult([skippedPath]), {});
|
|
66
|
+
(0, _chai().expect)(output).to.have.string('not overridden');
|
|
67
|
+
(0, _chai().expect)(output).to.have.string('tsconfig.json');
|
|
68
|
+
});
|
|
69
|
+
it('should show the skipped files in verbose mode as well', () => {
|
|
70
|
+
const output = (0, _verboseFormatWriteOutput().verboseFormatWriteOutput)(mockWriteConfigFilesResult([skippedPath]), {});
|
|
71
|
+
(0, _chai().expect)(output).to.have.string('not overridden');
|
|
72
|
+
(0, _chai().expect)(output).to.have.string('tsconfig.json');
|
|
73
|
+
});
|
|
74
|
+
it('should not mention skipped files when there are none', () => {
|
|
75
|
+
(0, _chai().expect)((0, _formatWriteOutput().formatWriteOutput)(mockWriteConfigFilesResult([]), {})).to.not.have.string('not overridden');
|
|
76
|
+
(0, _chai().expect)((0, _verboseFormatWriteOutput().verboseFormatWriteOutput)(mockWriteConfigFilesResult([]), {})).to.not.have.string('not overridden');
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=format-skipped-output.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_chai","data","require","_path","_formatSkippedOutput","_formatWriteOutput","_verboseFormatWriteOutput","wsDir","join","skippedPath","mockWriteConfigFilesResult","skippedPaths","writeResults","writersResult","totalWrittenFiles","totalRealConfigFiles","totalExtendingConfigFiles","describe","it","expect","formatSkippedOutput","to","equal","output","have","string","not","formatWriteOutput","verboseFormatWriteOutput"],"sources":["format-skipped-output.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport { join } from 'path';\nimport type { WriteConfigFilesResult } from '../workspace-config-files.main.runtime';\nimport { formatSkippedOutput } from './format-skipped-output';\nimport { formatWriteOutput } from './format-write-output';\nimport { verboseFormatWriteOutput } from './verbose-format-write-output';\n\nconst wsDir = join('/', 'my-workspace');\nconst skippedPath = join(wsDir, 'tsconfig.json');\n\nfunction mockWriteConfigFilesResult(skippedPaths: string[]): WriteConfigFilesResult {\n return {\n wsDir,\n writeResults: {\n writersResult: [],\n totalWrittenFiles: 0,\n totalRealConfigFiles: 0,\n totalExtendingConfigFiles: 0,\n skippedPaths,\n },\n };\n}\n\ndescribe('formatSkippedOutput()', () => {\n it('should return an empty string when no file was skipped', () => {\n expect(formatSkippedOutput([], wsDir)).to.equal('');\n });\n it('should show the path relative to the workspace and how to override it', () => {\n const output = formatSkippedOutput([skippedPath], wsDir);\n expect(output).to.have.string('tsconfig.json');\n expect(output).to.not.have.string(wsDir);\n expect(output).to.have.string('--force');\n });\n});\n\ndescribe('write output with skipped files', () => {\n it('should show the skipped files', () => {\n const output = formatWriteOutput(mockWriteConfigFilesResult([skippedPath]), {});\n expect(output).to.have.string('not overridden');\n expect(output).to.have.string('tsconfig.json');\n });\n it('should show the skipped files in verbose mode as well', () => {\n const output = verboseFormatWriteOutput(mockWriteConfigFilesResult([skippedPath]), {});\n expect(output).to.have.string('not overridden');\n expect(output).to.have.string('tsconfig.json');\n });\n it('should not mention skipped files when there are none', () => {\n expect(formatWriteOutput(mockWriteConfigFilesResult([]), {})).to.not.have.string('not overridden');\n expect(verboseFormatWriteOutput(mockWriteConfigFilesResult([]), {})).to.not.have.string('not overridden');\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,MAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,qBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,oBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,mBAAA;EAAA,MAAAJ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,13 @@ function _path() {
|
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
+
function _cli() {
|
|
22
|
+
const data = require("@teambit/cli");
|
|
23
|
+
_cli = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
21
28
|
function _formatCleanOutput() {
|
|
22
29
|
const data = require("./format-clean-output");
|
|
23
30
|
_formatCleanOutput = function () {
|
|
@@ -25,6 +32,13 @@ function _formatCleanOutput() {
|
|
|
25
32
|
};
|
|
26
33
|
return data;
|
|
27
34
|
}
|
|
35
|
+
function _formatSkippedOutput() {
|
|
36
|
+
const data = require("./format-skipped-output");
|
|
37
|
+
_formatSkippedOutput = function () {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
28
42
|
function _writeOutputsTexts() {
|
|
29
43
|
const data = require("./write-outputs-texts");
|
|
30
44
|
_writeOutputsTexts = function () {
|
|
@@ -45,7 +59,8 @@ function formatWriteOutput(writeConfigFilesResult, flags) {
|
|
|
45
59
|
}) : undefined;
|
|
46
60
|
const writeResultsOutput = getWriteResultsOutput(writeResults, wsDir, isDryRun);
|
|
47
61
|
const cleanWriteOutput = cleanResultsOutput ? `${cleanResultsOutput}\n${writeResultsOutput}` : writeResultsOutput;
|
|
48
|
-
|
|
62
|
+
const skippedOutput = (0, _formatSkippedOutput().formatSkippedOutput)(writeResults.skippedPaths, wsDir);
|
|
63
|
+
return (0, _cli().joinSections)([cleanWriteOutput, skippedOutput, _writeOutputsTexts().SUMMARY]);
|
|
49
64
|
}
|
|
50
65
|
function getWriteResultsOutput(writeResults, wsDir, isDryRun) {
|
|
51
66
|
const totalExtendingConfigFiles = writeResults.totalExtendingConfigFiles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_path","_formatCleanOutput","_writeOutputsTexts","e","__esModule","default","formatWriteOutput","writeConfigFilesResult","flags","cleanResults","writeResults","wsDir","isDryRun","dryRun","dryRunWithContent","cleanResultsOutput","length","formatCleanOutput","undefined","writeResultsOutput","getWriteResultsOutput","cleanWriteOutput","SUMMARY","totalExtendingConfigFiles","writeTitle","chalk","green","WRITE_TITLE","writeOutput","writersResult","map","writerResult","getOneWriterOutput","join","title","blue","bold","writerId","toString","writersOutput","getExtendingConfigFilesOutput","extendingConfigFiles","extendingConfigFilesOutput","envsWrittenExtendingConfigFile","getEnvGroupExtendingConfigFilesOutput","extendingConfigFile","paths","filePaths","p","relative"],"sources":["format-write-output.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { relative } from 'path';\nimport type {\n OneConfigWriterIdResult,\n WriteConfigFilesResult,\n WriteResults,\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';\nimport type { EnvsWrittenExtendingConfigFile, EnvsWrittenExtendingConfigFiles } from '../writers';\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
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_path","_cli","_formatCleanOutput","_formatSkippedOutput","_writeOutputsTexts","e","__esModule","default","formatWriteOutput","writeConfigFilesResult","flags","cleanResults","writeResults","wsDir","isDryRun","dryRun","dryRunWithContent","cleanResultsOutput","length","formatCleanOutput","undefined","writeResultsOutput","getWriteResultsOutput","cleanWriteOutput","skippedOutput","formatSkippedOutput","skippedPaths","joinSections","SUMMARY","totalExtendingConfigFiles","writeTitle","chalk","green","WRITE_TITLE","writeOutput","writersResult","map","writerResult","getOneWriterOutput","join","title","blue","bold","writerId","toString","writersOutput","getExtendingConfigFilesOutput","extendingConfigFiles","extendingConfigFilesOutput","envsWrittenExtendingConfigFile","getEnvGroupExtendingConfigFilesOutput","extendingConfigFile","paths","filePaths","p","relative"],"sources":["format-write-output.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { relative } from 'path';\nimport { joinSections } from '@teambit/cli';\nimport type {\n OneConfigWriterIdResult,\n WriteConfigFilesResult,\n WriteResults,\n} from '../workspace-config-files.main.runtime';\nimport type { WriteConfigCmdFlags } from '../ws-config.cmd';\nimport { formatCleanOutput } from './format-clean-output';\nimport { formatSkippedOutput } from './format-skipped-output';\nimport { SUMMARY, WRITE_TITLE } from './write-outputs-texts';\nimport type { EnvsWrittenExtendingConfigFile, EnvsWrittenExtendingConfigFiles } from '../writers';\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 const skippedOutput = formatSkippedOutput(writeResults.skippedPaths, wsDir);\n\n return joinSections([cleanWriteOutput, skippedOutput, SUMMARY]);\n}\n\nfunction getWriteResultsOutput(writeResults: 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.writersResult\n .map((writerResult) => getOneWriterOutput(writerResult, wsDir))\n .join('\\n\\n');\n return `${writeTitle}\\n${writeOutput}`;\n}\nfunction getOneWriterOutput(writerResult: OneConfigWriterIdResult, wsDir: string): string {\n const title = chalk.blue(\n `${writerResult.totalExtendingConfigFiles} ${chalk.bold(writerResult.writerId.toString())} configurations added`\n );\n const writersOutput = getExtendingConfigFilesOutput(writerResult.extendingConfigFiles, wsDir);\n return `${title}\\n${writersOutput}`;\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":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,KAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,IAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAOA,SAAAK,mBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,kBAAA,YAAA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AAK,IAAAC,gBAAQ,EAAC1C,KAAK,EAAEyC,CAAC,CAAC,EAAE,CAAC,CAACf,IAAI,CAAC,IAAI,CAAC;EAC5F,OAAO,GAAGa,KAAK,EAAE;AACnB","ignoreList":[]}
|
package/dist/outputs/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { formatCleanOutput } from './format-clean-output';
|
|
2
|
+
export { formatSkippedOutput } from './format-skipped-output';
|
|
2
3
|
export { formatListOutput } from './format-list-output';
|
|
3
4
|
export { formatWriteOutput } from './format-write-output';
|
|
4
5
|
export { verboseFormatWriteOutput } from './verbose-format-write-output';
|
package/dist/outputs/index.js
CHANGED
|
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "formatListOutput", {
|
|
|
15
15
|
return _formatListOutput().formatListOutput;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "formatSkippedOutput", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _formatSkippedOutput().formatSkippedOutput;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
18
24
|
Object.defineProperty(exports, "formatWriteOutput", {
|
|
19
25
|
enumerable: true,
|
|
20
26
|
get: function () {
|
|
@@ -34,6 +40,13 @@ function _formatCleanOutput() {
|
|
|
34
40
|
};
|
|
35
41
|
return data;
|
|
36
42
|
}
|
|
43
|
+
function _formatSkippedOutput() {
|
|
44
|
+
const data = require("./format-skipped-output");
|
|
45
|
+
_formatSkippedOutput = function () {
|
|
46
|
+
return data;
|
|
47
|
+
};
|
|
48
|
+
return data;
|
|
49
|
+
}
|
|
37
50
|
function _formatListOutput() {
|
|
38
51
|
const data = require("./format-list-output");
|
|
39
52
|
_formatListOutput = function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_formatCleanOutput","data","require","_formatListOutput","_formatWriteOutput","_verboseFormatWriteOutput"],"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":"
|
|
1
|
+
{"version":3,"names":["_formatCleanOutput","data","require","_formatSkippedOutput","_formatListOutput","_formatWriteOutput","_verboseFormatWriteOutput"],"sources":["index.ts"],"sourcesContent":["export { formatCleanOutput } from './format-clean-output';\nexport { formatSkippedOutput } from './format-skipped-output';\nexport { formatListOutput } from './format-list-output';\nexport { formatWriteOutput } from './format-write-output';\nexport { verboseFormatWriteOutput } from './verbose-format-write-output';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,mBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,kBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,qBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,oBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,kBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,iBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,mBAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,kBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,0BAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,yBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA","ignoreList":[]}
|
|
@@ -18,6 +18,13 @@ function _path() {
|
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
+
function _cli() {
|
|
22
|
+
const data = require("@teambit/cli");
|
|
23
|
+
_cli = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
21
28
|
function _formatCleanOutput() {
|
|
22
29
|
const data = require("./format-clean-output");
|
|
23
30
|
_formatCleanOutput = function () {
|
|
@@ -25,6 +32,13 @@ function _formatCleanOutput() {
|
|
|
25
32
|
};
|
|
26
33
|
return data;
|
|
27
34
|
}
|
|
35
|
+
function _formatSkippedOutput() {
|
|
36
|
+
const data = require("./format-skipped-output");
|
|
37
|
+
_formatSkippedOutput = function () {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
28
42
|
function _writeOutputsTexts() {
|
|
29
43
|
const data = require("./write-outputs-texts");
|
|
30
44
|
_writeOutputsTexts = function () {
|
|
@@ -44,7 +58,8 @@ function verboseFormatWriteOutput(writeConfigFilesResult, flags) {
|
|
|
44
58
|
dryRun: isDryRun
|
|
45
59
|
});
|
|
46
60
|
const writeResultsOutput = getWriteResultsOutput(writeResults, wsDir, isDryRun);
|
|
47
|
-
|
|
61
|
+
const skippedOutput = (0, _formatSkippedOutput().formatSkippedOutput)(writeResults.skippedPaths, wsDir);
|
|
62
|
+
return (0, _cli().joinSections)([`${cleanResultsOutput}\n${writeResultsOutput}`, skippedOutput, _writeOutputsTexts().SUMMARY]);
|
|
48
63
|
}
|
|
49
64
|
function getWriteResultsOutput(writeResults, wsDir, isDryRun) {
|
|
50
65
|
const totalFiles = writeResults.totalWrittenFiles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_path","_formatCleanOutput","_writeOutputsTexts","e","__esModule","default","verboseFormatWriteOutput","writeConfigFilesResult","flags","cleanResults","writeResults","wsDir","isDryRun","dryRun","dryRunWithContent","cleanResultsOutput","formatCleanOutput","writeResultsOutput","getWriteResultsOutput","SUMMARY","totalFiles","totalWrittenFiles","writeTitle","chalk","green","WRITE_TITLE","writeOutput","writersResult","map","writerResult","getOneWriterOutput","join","oneWritersResults","title","cyan","bold","writerId","realConfigFilesOutput","getRealConfigFilesOutput","realConfigFiles","extendingConfigFilesOutput","getExtendingConfigFilesOutput","extendingConfigFiles","envsWrittenRealConfigFiles","magenta","writtenConfigFilesOutput","envsWrittenConfigFile","getEnvGroupConfigFilesOutput","envIds","filePath","relative","writtenRealConfigFile","envsWrittenExtendingConfigFile","getEnvGroupExtendingConfigFilesOutput","extendingConfigFile","paths","filePaths","p","extendingTarget"],"sources":["verbose-format-write-output.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { relative } from 'path';\nimport type {\n OneConfigWriterIdResult,\n WriteConfigFilesResult,\n WriteResults,\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';\nimport type {\n EnvsWrittenExtendingConfigFile,\n EnvsWrittenExtendingConfigFiles,\n EnvsWrittenRealConfigFile,\n EnvsWrittenRealConfigFiles,\n} from '../writers';\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}
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_path","_cli","_formatCleanOutput","_formatSkippedOutput","_writeOutputsTexts","e","__esModule","default","verboseFormatWriteOutput","writeConfigFilesResult","flags","cleanResults","writeResults","wsDir","isDryRun","dryRun","dryRunWithContent","cleanResultsOutput","formatCleanOutput","writeResultsOutput","getWriteResultsOutput","skippedOutput","formatSkippedOutput","skippedPaths","joinSections","SUMMARY","totalFiles","totalWrittenFiles","writeTitle","chalk","green","WRITE_TITLE","writeOutput","writersResult","map","writerResult","getOneWriterOutput","join","oneWritersResults","title","cyan","bold","writerId","realConfigFilesOutput","getRealConfigFilesOutput","realConfigFiles","extendingConfigFilesOutput","getExtendingConfigFilesOutput","extendingConfigFiles","envsWrittenRealConfigFiles","magenta","writtenConfigFilesOutput","envsWrittenConfigFile","getEnvGroupConfigFilesOutput","envIds","filePath","relative","writtenRealConfigFile","envsWrittenExtendingConfigFile","getEnvGroupExtendingConfigFilesOutput","extendingConfigFile","paths","filePaths","p","extendingTarget"],"sources":["verbose-format-write-output.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { relative } from 'path';\nimport { joinSections } from '@teambit/cli';\nimport type {\n OneConfigWriterIdResult,\n WriteConfigFilesResult,\n WriteResults,\n} from '../workspace-config-files.main.runtime';\nimport type { WriteConfigCmdFlags } from '../ws-config.cmd';\nimport { formatCleanOutput } from './format-clean-output';\nimport { formatSkippedOutput } from './format-skipped-output';\nimport { SUMMARY, WRITE_TITLE } from './write-outputs-texts';\nimport type {\n EnvsWrittenExtendingConfigFile,\n EnvsWrittenExtendingConfigFiles,\n EnvsWrittenRealConfigFile,\n EnvsWrittenRealConfigFiles,\n} from '../writers';\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 const skippedOutput = formatSkippedOutput(writeResults.skippedPaths, wsDir);\n\n return joinSections([`${cleanResultsOutput}\\n${writeResultsOutput}`, skippedOutput, SUMMARY]);\n}\n\nfunction getWriteResultsOutput(writeResults: 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.writersResult\n .map((writerResult) => getOneWriterOutput(writerResult, wsDir))\n .join('\\n\\n');\n return `${writeTitle}\\n${writeOutput}`;\n}\n\nfunction getOneWriterOutput(oneWritersResults: OneConfigWriterIdResult, wsDir: string): string {\n const title = chalk.cyan(` The following paths are according to writer ${chalk.bold(oneWritersResults.writerId)}`);\n const realConfigFilesOutput = getRealConfigFilesOutput(oneWritersResults.realConfigFiles, wsDir);\n const extendingConfigFilesOutput = getExtendingConfigFilesOutput(oneWritersResults.extendingConfigFiles, wsDir);\n return `${title}\\n${realConfigFilesOutput}\\n\\n${extendingConfigFilesOutput}`;\n}\n\nfunction getRealConfigFilesOutput(envsWrittenRealConfigFiles: EnvsWrittenRealConfigFiles, wsDir: string): string {\n const title = chalk.magenta(` Real config files`);\n const writtenConfigFilesOutput = envsWrittenRealConfigFiles\n .map((envsWrittenConfigFile) => getEnvGroupConfigFilesOutput(envsWrittenConfigFile, wsDir))\n .join('\\n\\n');\n return `${title}\\n${writtenConfigFilesOutput}`;\n}\nfunction getEnvGroupConfigFilesOutput(envsWrittenConfigFile: EnvsWrittenRealConfigFile, 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.writtenRealConfigFile.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,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,KAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,IAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAOA,SAAAK,mBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,kBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,qBAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,oBAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,mBAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,kBAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA6D,SAAAC,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAQtD,SAASG,wBAAwBA,CACtCC,sBAA8C,EAC9CC,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OAAO,GAAGE,KAAK,KAAKO,0BAA0B,EAAE;AAClD;AACA,SAASa,qCAAqCA,CAC5CD,8BAA8D,EAC9D7C,KAAa,EACL;EACR,MAAM0B,KAAK,GAAG,mDAAmDV,gBAAK,CAACY,IAAI,CACzEiB,8BAA8B,CAACJ,MAAM,CAACjB,IAAI,CAAC,IAAI,CACjD,CAAC,EAAE;EACH,MAAMuB,mBAAmB,GAAGF,8BAA8B,CAACE,mBAAmB;EAC9E,MAAMC,KAAK,GAAGD,mBAAmB,CAACE,SAAS,CACxC5B,GAAG,CAAE6B,CAAC,IAAK,KAAK,IAAAP,gBAAQ,EAAC3C,KAAK,EAAEkD,CAAC,CAAC,QAAQ,IAAAP,gBAAQ,EAAC3C,KAAK,EAAE+C,mBAAmB,CAACI,eAAe,CAACT,QAAQ,CAAC,EAAE,CAAC,CAC1GlB,IAAI,CAAC,QAAQ,CAAC;EACjB,OAAO,GAAGE,KAAK,SAASsB,KAAK,EAAE;AACjC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
;
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace-config-files@1.0.
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace-config-files@1.0.1161/dist/workspace-config-files.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -52,6 +52,11 @@ export type WriteConfigFilesOptions = {
|
|
|
52
52
|
dryRun?: boolean;
|
|
53
53
|
throw?: boolean;
|
|
54
54
|
writers?: string[];
|
|
55
|
+
/**
|
|
56
|
+
* override config files that already exist in the workspace and were not generated by bit.
|
|
57
|
+
* by default such files are left untouched, so the user's own configuration isn't lost.
|
|
58
|
+
*/
|
|
59
|
+
force?: boolean;
|
|
55
60
|
};
|
|
56
61
|
export type CompPathExtendingHashMap = {
|
|
57
62
|
[compPath: string]: string;
|
|
@@ -71,12 +76,18 @@ export type OneConfigWriterIdResult = {
|
|
|
71
76
|
totalRealConfigFiles: number;
|
|
72
77
|
extendingConfigFiles: EnvsWrittenExtendingConfigFiles;
|
|
73
78
|
totalExtendingConfigFiles: number;
|
|
79
|
+
skippedPaths: string[];
|
|
74
80
|
};
|
|
75
81
|
export type WriteResults = {
|
|
76
82
|
writersResult: OneConfigWriterIdResult[];
|
|
77
83
|
totalWrittenFiles: number;
|
|
78
84
|
totalRealConfigFiles: number;
|
|
79
85
|
totalExtendingConfigFiles: number;
|
|
86
|
+
/**
|
|
87
|
+
* absolute paths of config files that already existed in the workspace and were not generated by bit,
|
|
88
|
+
* therefore were not overridden.
|
|
89
|
+
*/
|
|
90
|
+
skippedPaths: string[];
|
|
80
91
|
};
|
|
81
92
|
export type WriteConfigFilesResult = {
|
|
82
93
|
cleanResults?: string[];
|
|
@@ -115,6 +126,11 @@ export declare class WorkspaceConfigFilesMain {
|
|
|
115
126
|
* @returns An array of strings.
|
|
116
127
|
*/
|
|
117
128
|
cleanConfigFiles(options?: CleanConfigFilesOptions): Promise<string[]>;
|
|
129
|
+
/**
|
|
130
|
+
* a human readable warning about config files bit didn't override because they were authored by the user.
|
|
131
|
+
* returns an empty string when there are no such files.
|
|
132
|
+
*/
|
|
133
|
+
formatSkippedFilesWarning(skippedPaths?: string[]): string;
|
|
118
134
|
/**
|
|
119
135
|
* The function checks if the auto writing of workspace configuration is enabled.
|
|
120
136
|
* if it's enabled we will re-generate the configuration files upon bit create
|
|
@@ -130,6 +130,13 @@ function _writers() {
|
|
|
130
130
|
};
|
|
131
131
|
return data;
|
|
132
132
|
}
|
|
133
|
+
function _outputs() {
|
|
134
|
+
const data = require("./outputs");
|
|
135
|
+
_outputs = function () {
|
|
136
|
+
return data;
|
|
137
|
+
};
|
|
138
|
+
return data;
|
|
139
|
+
}
|
|
133
140
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
134
141
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
135
142
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
@@ -173,7 +180,8 @@ class WorkspaceConfigFilesMain {
|
|
|
173
180
|
dedupe: false,
|
|
174
181
|
silent: false,
|
|
175
182
|
dryRun: false,
|
|
176
|
-
throw: true
|
|
183
|
+
throw: true,
|
|
184
|
+
force: false
|
|
177
185
|
};
|
|
178
186
|
const optionsWithDefaults = (0, _lodash().defaults)(options, defaultOpts);
|
|
179
187
|
const execContext = await this.getExecContext();
|
|
@@ -238,6 +246,15 @@ class WorkspaceConfigFilesMain {
|
|
|
238
246
|
return cleanResults;
|
|
239
247
|
}
|
|
240
248
|
|
|
249
|
+
/**
|
|
250
|
+
* a human readable warning about config files bit didn't override because they were authored by the user.
|
|
251
|
+
* returns an empty string when there are no such files.
|
|
252
|
+
*/
|
|
253
|
+
formatSkippedFilesWarning(skippedPaths = []) {
|
|
254
|
+
if (!skippedPaths.length) return '';
|
|
255
|
+
return (0, _outputs().formatSkippedOutput)(skippedPaths, this.workspace.path);
|
|
256
|
+
}
|
|
257
|
+
|
|
241
258
|
/**
|
|
242
259
|
* The function checks if the auto writing of workspace configuration is enabled.
|
|
243
260
|
* if it's enabled we will re-generate the configuration files upon bit create
|
|
@@ -287,10 +304,12 @@ class WorkspaceConfigFilesMain {
|
|
|
287
304
|
const filteredWriterIdsToEnvEntriesMap = opts.writers ? (0, _lodash().pick)(writerIdsToEnvEntriesMap, opts.writers) : writerIdsToEnvEntriesMap;
|
|
288
305
|
let totalRealConfigFiles = 0;
|
|
289
306
|
let totalExtendingConfigFiles = 0;
|
|
307
|
+
const skippedPaths = [];
|
|
290
308
|
const results = await (0, _pMapSeries().default)(Object.entries(filteredWriterIdsToEnvEntriesMap), async ([writerId, envEntries]) => {
|
|
291
309
|
const oneResult = await this.handleOneIdWriter(writerId, envEntries, envCompDirsMap, configsRootDir, componentsRootDir, opts);
|
|
292
310
|
totalRealConfigFiles += oneResult.totalRealConfigFiles;
|
|
293
311
|
totalExtendingConfigFiles += oneResult.totalExtendingConfigFiles;
|
|
312
|
+
skippedPaths.push(...oneResult.skippedPaths);
|
|
294
313
|
return oneResult;
|
|
295
314
|
});
|
|
296
315
|
const totalWrittenFiles = totalRealConfigFiles + totalExtendingConfigFiles;
|
|
@@ -298,12 +317,16 @@ class WorkspaceConfigFilesMain {
|
|
|
298
317
|
writersResult: results,
|
|
299
318
|
totalWrittenFiles,
|
|
300
319
|
totalRealConfigFiles,
|
|
301
|
-
totalExtendingConfigFiles
|
|
320
|
+
totalExtendingConfigFiles,
|
|
321
|
+
skippedPaths
|
|
302
322
|
};
|
|
303
323
|
}
|
|
304
324
|
async handleOneIdWriter(writerId, envEntries, envCompsDirsMap, configsRootDir, componentsRootDir, opts) {
|
|
305
325
|
const writtenRealConfigFilesMap = await (0, _writers().handleRealConfigFiles)(envEntries, envCompsDirsMap, configsRootDir, this.workspace.path, opts);
|
|
306
|
-
const
|
|
326
|
+
const {
|
|
327
|
+
extendingConfigFiles: writtenExtendingConfigFiles,
|
|
328
|
+
skippedPaths
|
|
329
|
+
} = await (0, _writers().handleExtendingConfigFiles)(envEntries, envCompsDirsMap, writtenRealConfigFilesMap, configsRootDir, componentsRootDir, this.workspace.path, opts);
|
|
307
330
|
const writtenRealConfigFiles = Object.values(writtenRealConfigFilesMap);
|
|
308
331
|
const totalRealConfigFiles = writtenRealConfigFiles.length;
|
|
309
332
|
const totalExtendingConfigFiles = writtenExtendingConfigFiles.reduce((acc, curr) => acc + curr.extendingConfigFile.filePaths.length, 0);
|
|
@@ -314,7 +337,8 @@ class WorkspaceConfigFilesMain {
|
|
|
314
337
|
realConfigFiles: writtenRealConfigFiles,
|
|
315
338
|
totalRealConfigFiles,
|
|
316
339
|
extendingConfigFiles: writtenExtendingConfigFiles,
|
|
317
|
-
totalExtendingConfigFiles
|
|
340
|
+
totalExtendingConfigFiles,
|
|
341
|
+
skippedPaths
|
|
318
342
|
};
|
|
319
343
|
}
|
|
320
344
|
getConfigsRootDir() {
|