@teambit/typescript 1.0.259 → 1.0.261
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/artifacts/__bit_junit.xml +17 -20
- package/artifacts/preview/teambit_typescript_typescript-preview.js +1 -1
- package/artifacts/schema.json +388 -752
- package/dist/{preview-1714533890836.js → preview-1714706485042.js} +2 -2
- package/dist/typescript.main.runtime.d.ts +1 -8
- package/dist/typescript.main.runtime.js +3 -41
- package/dist/typescript.main.runtime.js.map +1 -1
- package/package.json +18 -19
- package/cmds/write-tsconfig.cmd.ts +0 -75
- package/dist/cmds/write-tsconfig.cmd.d.ts +0 -26
- package/dist/cmds/write-tsconfig.cmd.js +0 -95
- package/dist/cmds/write-tsconfig.cmd.js.map +0 -1
- package/dist/dedupe-path.spec.d.ts +0 -1
- package/dist/dedupe-path.spec.js +0 -62
- package/dist/dedupe-path.spec.js.map +0 -1
- package/dist/tsconfig-writer.d.ts +0 -49
- package/dist/tsconfig-writer.js +0 -284
- package/dist/tsconfig-writer.js.map +0 -1
package/dist/dedupe-path.spec.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
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 _tsconfigWriter() {
|
|
11
|
-
const data = require("./tsconfig-writer");
|
|
12
|
-
_tsconfigWriter = function () {
|
|
13
|
-
return data;
|
|
14
|
-
};
|
|
15
|
-
return data;
|
|
16
|
-
}
|
|
17
|
-
describe('dedupePath', () => {
|
|
18
|
-
it('should return the root-dir if there is only one env involved', () => {
|
|
19
|
-
const input = [{
|
|
20
|
-
ids: ['env1'],
|
|
21
|
-
paths: ['p1/e1, p2']
|
|
22
|
-
}];
|
|
23
|
-
const output = (0, _tsconfigWriter().dedupePaths)(input);
|
|
24
|
-
(0, _chai().expect)(output).to.deep.equal([{
|
|
25
|
-
ids: ['env1'],
|
|
26
|
-
paths: ['.']
|
|
27
|
-
}]);
|
|
28
|
-
});
|
|
29
|
-
it('should set the env with the most components', () => {
|
|
30
|
-
const input = [{
|
|
31
|
-
ids: ['env1'],
|
|
32
|
-
paths: ['p1/e1', 'p1/e2']
|
|
33
|
-
}, {
|
|
34
|
-
ids: ['env2'],
|
|
35
|
-
paths: ['p1/e3']
|
|
36
|
-
}];
|
|
37
|
-
const output = (0, _tsconfigWriter().dedupePaths)(input);
|
|
38
|
-
// @ts-ignore
|
|
39
|
-
(0, _chai().expect)(output).to.deep.equal([{
|
|
40
|
-
ids: ['env2'],
|
|
41
|
-
paths: ['p1/e3']
|
|
42
|
-
}, {
|
|
43
|
-
ids: ['env1'],
|
|
44
|
-
paths: ['.']
|
|
45
|
-
}]);
|
|
46
|
-
});
|
|
47
|
-
it('should not set any env to a shared dir if it no env has max components', () => {
|
|
48
|
-
const input = [{
|
|
49
|
-
ids: ['env1'],
|
|
50
|
-
paths: ['p1/e1']
|
|
51
|
-
}, {
|
|
52
|
-
ids: ['env2'],
|
|
53
|
-
paths: ['p1/e2']
|
|
54
|
-
}];
|
|
55
|
-
const output = (0, _tsconfigWriter().dedupePaths)(input);
|
|
56
|
-
(0, _chai().expect)(output.length).to.equal(2);
|
|
57
|
-
// @ts-ignore
|
|
58
|
-
(0, _chai().expect)(output).to.deep.equal(input);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
//# sourceMappingURL=dedupe-path.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_chai","data","require","_tsconfigWriter","describe","it","input","ids","paths","output","dedupePaths","expect","to","deep","equal","length"],"sources":["dedupe-path.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport { dedupePaths } from './tsconfig-writer';\n\ndescribe('dedupePath', () => {\n it('should return the root-dir if there is only one env involved', () => {\n const input = [{ ids: ['env1'], paths: ['p1/e1, p2'] }];\n const output = dedupePaths(input);\n expect(output).to.deep.equal([{ ids: ['env1'], paths: ['.'] }]);\n });\n it('should set the env with the most components', () => {\n const input = [\n { ids: ['env1'], paths: ['p1/e1', 'p1/e2'] },\n { ids: ['env2'], paths: ['p1/e3'] },\n ];\n const output = dedupePaths(input);\n // @ts-ignore\n expect(output).to.deep.equal([\n { ids: ['env2'], paths: ['p1/e3'] },\n { ids: ['env1'], paths: ['.'] },\n ]);\n });\n it('should not set any env to a shared dir if it no env has max components', () => {\n const input = [\n { ids: ['env1'], paths: ['p1/e1'] },\n { ids: ['env2'], paths: ['p1/e2'] },\n ];\n const output = dedupePaths(input);\n expect(output.length).to.equal(2);\n // @ts-ignore\n expect(output).to.deep.equal(input);\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,gBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,eAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEAG,QAAQ,CAAC,YAAY,EAAE,MAAM;EAC3BC,EAAE,CAAC,8DAA8D,EAAE,MAAM;IACvE,MAAMC,KAAK,GAAG,CAAC;MAAEC,GAAG,EAAE,CAAC,MAAM,CAAC;MAAEC,KAAK,EAAE,CAAC,WAAW;IAAE,CAAC,CAAC;IACvD,MAAMC,MAAM,GAAG,IAAAC,6BAAW,EAACJ,KAAK,CAAC;IACjC,IAAAK,cAAM,EAACF,MAAM,CAAC,CAACG,EAAE,CAACC,IAAI,CAACC,KAAK,CAAC,CAAC;MAAEP,GAAG,EAAE,CAAC,MAAM,CAAC;MAAEC,KAAK,EAAE,CAAC,GAAG;IAAE,CAAC,CAAC,CAAC;EACjE,CAAC,CAAC;EACFH,EAAE,CAAC,6CAA6C,EAAE,MAAM;IACtD,MAAMC,KAAK,GAAG,CACZ;MAAEC,GAAG,EAAE,CAAC,MAAM,CAAC;MAAEC,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO;IAAE,CAAC,EAC5C;MAAED,GAAG,EAAE,CAAC,MAAM,CAAC;MAAEC,KAAK,EAAE,CAAC,OAAO;IAAE,CAAC,CACpC;IACD,MAAMC,MAAM,GAAG,IAAAC,6BAAW,EAACJ,KAAK,CAAC;IACjC;IACA,IAAAK,cAAM,EAACF,MAAM,CAAC,CAACG,EAAE,CAACC,IAAI,CAACC,KAAK,CAAC,CAC3B;MAAEP,GAAG,EAAE,CAAC,MAAM,CAAC;MAAEC,KAAK,EAAE,CAAC,OAAO;IAAE,CAAC,EACnC;MAAED,GAAG,EAAE,CAAC,MAAM,CAAC;MAAEC,KAAK,EAAE,CAAC,GAAG;IAAE,CAAC,CAChC,CAAC;EACJ,CAAC,CAAC;EACFH,EAAE,CAAC,wEAAwE,EAAE,MAAM;IACjF,MAAMC,KAAK,GAAG,CACZ;MAAEC,GAAG,EAAE,CAAC,MAAM,CAAC;MAAEC,KAAK,EAAE,CAAC,OAAO;IAAE,CAAC,EACnC;MAAED,GAAG,EAAE,CAAC,MAAM,CAAC;MAAEC,KAAK,EAAE,CAAC,OAAO;IAAE,CAAC,CACpC;IACD,MAAMC,MAAM,GAAG,IAAAC,6BAAW,EAACJ,KAAK,CAAC;IACjC,IAAAK,cAAM,EAACF,MAAM,CAACM,MAAM,CAAC,CAACH,EAAE,CAACE,KAAK,CAAC,CAAC,CAAC;IACjC;IACA,IAAAH,cAAM,EAACF,MAAM,CAAC,CAACG,EAAE,CAACC,IAAI,CAACC,KAAK,CAACR,KAAK,CAAC;EACrC,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { ExecutionContext } from '@teambit/envs';
|
|
2
|
-
import { Workspace } from '@teambit/workspace';
|
|
3
|
-
import { Logger } from '@teambit/logger';
|
|
4
|
-
import { TsconfigWriterOptions } from './typescript.main.runtime';
|
|
5
|
-
export type TsconfigPathsPerEnv = {
|
|
6
|
-
envIds: string[];
|
|
7
|
-
tsconfig: string;
|
|
8
|
-
paths: string[];
|
|
9
|
-
};
|
|
10
|
-
export declare class TsconfigWriter {
|
|
11
|
-
private workspace;
|
|
12
|
-
private logger;
|
|
13
|
-
constructor(workspace: Workspace, logger: Logger);
|
|
14
|
-
write(envsExecutionContext: ExecutionContext[], options: TsconfigWriterOptions): Promise<TsconfigPathsPerEnv[]>;
|
|
15
|
-
private getTsconfigFromEnv;
|
|
16
|
-
clean(envsExecutionContext: ExecutionContext[], { dryRun, silent }: TsconfigWriterOptions): Promise<string[]>;
|
|
17
|
-
private promptForWriting;
|
|
18
|
-
private promptForCleaning;
|
|
19
|
-
private deleteFiles;
|
|
20
|
-
private writeFiles;
|
|
21
|
-
private getPathsPerEnv;
|
|
22
|
-
}
|
|
23
|
-
type PathsPerEnvIds = {
|
|
24
|
-
ids: string[];
|
|
25
|
-
paths: string[];
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* easier to understand by an example:
|
|
29
|
-
* input:
|
|
30
|
-
* [
|
|
31
|
-
* { id: react, paths: [ui/button, ui/form] },
|
|
32
|
-
* { id: aspect, paths: [p/a1, p/a2] },
|
|
33
|
-
* { id: node, paths: [p/n1] },
|
|
34
|
-
* ]
|
|
35
|
-
*
|
|
36
|
-
* output:
|
|
37
|
-
* [
|
|
38
|
-
* { id: react, paths: [ui] },
|
|
39
|
-
* { id: aspect, paths: [p] },
|
|
40
|
-
* { id: node, paths: [p/n1] },
|
|
41
|
-
* ]
|
|
42
|
-
*
|
|
43
|
-
* the goal is to minimize the amount of files to write per env if possible.
|
|
44
|
-
* when multiple components of the same env share a root-dir, then, it's enough to write a file in that shared dir.
|
|
45
|
-
* if in a shared-dir, some components using env1 and some env2, it finds the env that has the max number of
|
|
46
|
-
* components, this env will be optimized. other components, will have the files written inside their dirs.
|
|
47
|
-
*/
|
|
48
|
-
export declare function dedupePaths(pathsPerEnvId: PathsPerEnvIds[]): PathsPerEnvIds[];
|
|
49
|
-
export {};
|
package/dist/tsconfig-writer.js
DELETED
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.TsconfigWriter = void 0;
|
|
7
|
-
exports.dedupePaths = dedupePaths;
|
|
8
|
-
function _fsExtra() {
|
|
9
|
-
const data = _interopRequireDefault(require("fs-extra"));
|
|
10
|
-
_fsExtra = function () {
|
|
11
|
-
return data;
|
|
12
|
-
};
|
|
13
|
-
return data;
|
|
14
|
-
}
|
|
15
|
-
function _path() {
|
|
16
|
-
const data = _interopRequireDefault(require("path"));
|
|
17
|
-
_path = function () {
|
|
18
|
-
return data;
|
|
19
|
-
};
|
|
20
|
-
return data;
|
|
21
|
-
}
|
|
22
|
-
function _yesno() {
|
|
23
|
-
const data = _interopRequireDefault(require("yesno"));
|
|
24
|
-
_yesno = function () {
|
|
25
|
-
return data;
|
|
26
|
-
};
|
|
27
|
-
return data;
|
|
28
|
-
}
|
|
29
|
-
function _lodash() {
|
|
30
|
-
const data = require("lodash");
|
|
31
|
-
_lodash = function () {
|
|
32
|
-
return data;
|
|
33
|
-
};
|
|
34
|
-
return data;
|
|
35
|
-
}
|
|
36
|
-
function _exceptions() {
|
|
37
|
-
const data = require("@teambit/legacy/dist/prompts/exceptions");
|
|
38
|
-
_exceptions = function () {
|
|
39
|
-
return data;
|
|
40
|
-
};
|
|
41
|
-
return data;
|
|
42
|
-
}
|
|
43
|
-
function _chalk() {
|
|
44
|
-
const data = _interopRequireDefault(require("chalk"));
|
|
45
|
-
_chalk = function () {
|
|
46
|
-
return data;
|
|
47
|
-
};
|
|
48
|
-
return data;
|
|
49
|
-
}
|
|
50
|
-
function _typescript() {
|
|
51
|
-
const data = require("./typescript.aspect");
|
|
52
|
-
_typescript = function () {
|
|
53
|
-
return data;
|
|
54
|
-
};
|
|
55
|
-
return data;
|
|
56
|
-
}
|
|
57
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
58
|
-
class TsconfigWriter {
|
|
59
|
-
constructor(workspace, logger) {
|
|
60
|
-
this.workspace = workspace;
|
|
61
|
-
this.logger = logger;
|
|
62
|
-
}
|
|
63
|
-
async write(envsExecutionContext, options) {
|
|
64
|
-
const pathsPerEnvs = this.getPathsPerEnv(envsExecutionContext, options);
|
|
65
|
-
const tsconfigPathsPerEnv = pathsPerEnvs.map(pathsPerEnv => ({
|
|
66
|
-
envIds: pathsPerEnv.ids,
|
|
67
|
-
tsconfig: this.getTsconfigFromEnv(pathsPerEnv.env),
|
|
68
|
-
// pathsPerEnv.env.getTsConfig(),
|
|
69
|
-
paths: pathsPerEnv.paths
|
|
70
|
-
}));
|
|
71
|
-
if (options.dryRun) return tsconfigPathsPerEnv;
|
|
72
|
-
if (!options.silent) await this.promptForWriting(tsconfigPathsPerEnv.map(p => p.paths).flat());
|
|
73
|
-
await this.writeFiles(tsconfigPathsPerEnv);
|
|
74
|
-
return tsconfigPathsPerEnv;
|
|
75
|
-
}
|
|
76
|
-
getTsconfigFromEnv(env) {
|
|
77
|
-
const compiler = env.getCompiler();
|
|
78
|
-
if (compiler.id === _typescript().TypescriptAspect.id) {
|
|
79
|
-
return compiler.displayConfig();
|
|
80
|
-
}
|
|
81
|
-
return JSON.stringify(env.getTsConfig(), undefined, 2);
|
|
82
|
-
}
|
|
83
|
-
async clean(envsExecutionContext, {
|
|
84
|
-
dryRun,
|
|
85
|
-
silent
|
|
86
|
-
}) {
|
|
87
|
-
const pathsPerEnvs = this.getPathsPerEnv(envsExecutionContext, {
|
|
88
|
-
dedupe: false
|
|
89
|
-
});
|
|
90
|
-
const componentPaths = pathsPerEnvs.map(p => p.paths).flat();
|
|
91
|
-
const allPossibleDirs = getAllPossibleDirsFromPaths(componentPaths);
|
|
92
|
-
const dirsWithTsconfig = await filterDirsWithTsconfigFile(allPossibleDirs);
|
|
93
|
-
const tsconfigFiles = dirsWithTsconfig.map(dir => _path().default.join(dir, 'tsconfig.json'));
|
|
94
|
-
if (dryRun) return tsconfigFiles;
|
|
95
|
-
if (!dirsWithTsconfig.length) return [];
|
|
96
|
-
if (!silent) await this.promptForCleaning(tsconfigFiles);
|
|
97
|
-
await this.deleteFiles(tsconfigFiles);
|
|
98
|
-
return tsconfigFiles;
|
|
99
|
-
}
|
|
100
|
-
async promptForWriting(dirs) {
|
|
101
|
-
this.logger.clearStatusLine();
|
|
102
|
-
const tsconfigFiles = dirs.map(dir => _path().default.join(dir, 'tsconfig.json'));
|
|
103
|
-
const ok = await (0, _yesno().default)({
|
|
104
|
-
question: `${_chalk().default.underline('The following paths will be written:')}
|
|
105
|
-
${tsconfigFiles.join('\n')}
|
|
106
|
-
${_chalk().default.bold('Do you want to continue? [yes(y)/no(n)]')}`
|
|
107
|
-
});
|
|
108
|
-
if (!ok) {
|
|
109
|
-
throw new (_exceptions().PromptCanceled)();
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
async promptForCleaning(tsconfigFiles) {
|
|
113
|
-
this.logger.clearStatusLine();
|
|
114
|
-
const ok = await (0, _yesno().default)({
|
|
115
|
-
question: `${_chalk().default.underline('The following paths will be deleted:')}
|
|
116
|
-
${tsconfigFiles.join('\n')}
|
|
117
|
-
${_chalk().default.bold('Do you want to continue? [yes(y)/no(n)]')}`
|
|
118
|
-
});
|
|
119
|
-
if (!ok) {
|
|
120
|
-
throw new (_exceptions().PromptCanceled)();
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
async deleteFiles(tsconfigFiles) {
|
|
124
|
-
await Promise.all(tsconfigFiles.map(f => _fsExtra().default.remove(f)));
|
|
125
|
-
}
|
|
126
|
-
async writeFiles(tsconfigPathsPerEnvs) {
|
|
127
|
-
await Promise.all(tsconfigPathsPerEnvs.map(pathsPerEnv => {
|
|
128
|
-
return Promise.all(pathsPerEnv.paths.map(p => _fsExtra().default.writeFile(_path().default.join(p, 'tsconfig.json'), pathsPerEnv.tsconfig)));
|
|
129
|
-
}));
|
|
130
|
-
}
|
|
131
|
-
getPathsPerEnv(envsExecutionContext, {
|
|
132
|
-
dedupe
|
|
133
|
-
}) {
|
|
134
|
-
const pathsPerEnvs = envsExecutionContext.map(envExecution => {
|
|
135
|
-
return {
|
|
136
|
-
id: envExecution.id,
|
|
137
|
-
env: envExecution.env,
|
|
138
|
-
paths: envExecution.components.map(c => this.workspace.componentDir(c.id, undefined, {
|
|
139
|
-
relative: true
|
|
140
|
-
}))
|
|
141
|
-
};
|
|
142
|
-
});
|
|
143
|
-
if (!dedupe) {
|
|
144
|
-
return pathsPerEnvs.map(({
|
|
145
|
-
id,
|
|
146
|
-
env,
|
|
147
|
-
paths
|
|
148
|
-
}) => ({
|
|
149
|
-
ids: [id],
|
|
150
|
-
env,
|
|
151
|
-
paths
|
|
152
|
-
}));
|
|
153
|
-
}
|
|
154
|
-
const envsWithFiles = envsExecutionContext.map(e => ({
|
|
155
|
-
id: e.id,
|
|
156
|
-
file: e.env.getTsConfig()
|
|
157
|
-
}));
|
|
158
|
-
const envsPerFile = [];
|
|
159
|
-
const isEnvProcessed = envId => envsPerFile.map(e => e.envIds).flat().find(e => e === envId);
|
|
160
|
-
envsWithFiles.forEach(({
|
|
161
|
-
id,
|
|
162
|
-
file
|
|
163
|
-
}) => {
|
|
164
|
-
if (isEnvProcessed(id)) return;
|
|
165
|
-
const foundSameFile = envsWithFiles.filter(e => (0, _lodash().isEqual)(file, e.file));
|
|
166
|
-
envsPerFile.push({
|
|
167
|
-
envIds: foundSameFile.map(f => f.id),
|
|
168
|
-
fileContent: file
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
const pathsPerEnvIds = envsPerFile.map(e => ({
|
|
172
|
-
ids: e.envIds,
|
|
173
|
-
paths: (0, _lodash().compact)(e.envIds.map(envId => pathsPerEnvs.find(p => p.id === envId)?.paths).flat())
|
|
174
|
-
}));
|
|
175
|
-
// const pathsPerEnvIds = pathsPerEnvs.map((p) => ({ ids: p.ids, paths: p.paths }));
|
|
176
|
-
const envsPerDedupedPaths = dedupePaths(pathsPerEnvIds);
|
|
177
|
-
const dedupedPathsPerEnvs = envsPerDedupedPaths.map(envWithDedupePaths => {
|
|
178
|
-
const found = pathsPerEnvs.find(p => envWithDedupePaths.ids.includes(p.id));
|
|
179
|
-
if (!found) throw new Error(`dedupedPathsPerEnvs, unable to find ${envWithDedupePaths.ids}`);
|
|
180
|
-
return {
|
|
181
|
-
env: found.env,
|
|
182
|
-
ids: envWithDedupePaths.ids,
|
|
183
|
-
paths: envWithDedupePaths.paths
|
|
184
|
-
};
|
|
185
|
-
});
|
|
186
|
-
return dedupedPathsPerEnvs;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
exports.TsconfigWriter = TsconfigWriter;
|
|
190
|
-
async function filterDirsWithTsconfigFile(dirs) {
|
|
191
|
-
const dirsWithTsconfig = await Promise.all(dirs.map(async dir => {
|
|
192
|
-
const hasTsconfig = await _fsExtra().default.pathExists(_path().default.join(dir, 'tsconfig.json'));
|
|
193
|
-
return hasTsconfig ? dir : undefined;
|
|
194
|
-
}));
|
|
195
|
-
return (0, _lodash().compact)(dirsWithTsconfig);
|
|
196
|
-
}
|
|
197
|
-
function getAllPossibleDirsFromPaths(paths) {
|
|
198
|
-
const dirs = paths.map(p => getAllParentsDirOfPath(p)).flat();
|
|
199
|
-
dirs.push('.'); // add the root dir
|
|
200
|
-
return (0, _lodash().uniq)(dirs);
|
|
201
|
-
}
|
|
202
|
-
function getAllParentsDirOfPath(p) {
|
|
203
|
-
const all = [];
|
|
204
|
-
let current = p;
|
|
205
|
-
while (current !== '.') {
|
|
206
|
-
all.push(current);
|
|
207
|
-
current = _path().default.dirname(current);
|
|
208
|
-
}
|
|
209
|
-
return all;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* easier to understand by an example:
|
|
214
|
-
* input:
|
|
215
|
-
* [
|
|
216
|
-
* { id: react, paths: [ui/button, ui/form] },
|
|
217
|
-
* { id: aspect, paths: [p/a1, p/a2] },
|
|
218
|
-
* { id: node, paths: [p/n1] },
|
|
219
|
-
* ]
|
|
220
|
-
*
|
|
221
|
-
* output:
|
|
222
|
-
* [
|
|
223
|
-
* { id: react, paths: [ui] },
|
|
224
|
-
* { id: aspect, paths: [p] },
|
|
225
|
-
* { id: node, paths: [p/n1] },
|
|
226
|
-
* ]
|
|
227
|
-
*
|
|
228
|
-
* the goal is to minimize the amount of files to write per env if possible.
|
|
229
|
-
* when multiple components of the same env share a root-dir, then, it's enough to write a file in that shared dir.
|
|
230
|
-
* if in a shared-dir, some components using env1 and some env2, it finds the env that has the max number of
|
|
231
|
-
* components, this env will be optimized. other components, will have the files written inside their dirs.
|
|
232
|
-
*/
|
|
233
|
-
function dedupePaths(pathsPerEnvId) {
|
|
234
|
-
const rootDir = '.';
|
|
235
|
-
const individualPathPerConcatenatedEnvIds = pathsPerEnvId.reduce((acc, current) => {
|
|
236
|
-
current.paths.forEach(p => {
|
|
237
|
-
acc[p] = current.ids.join(',');
|
|
238
|
-
});
|
|
239
|
-
return acc;
|
|
240
|
-
}, {});
|
|
241
|
-
const allPaths = Object.keys(individualPathPerConcatenatedEnvIds);
|
|
242
|
-
const allPossibleDirs = getAllPossibleDirsFromPaths(allPaths);
|
|
243
|
-
const allPathsPerEnvId = {}; // null when parent-dir has same amount of comps per env.
|
|
244
|
-
|
|
245
|
-
const calculateBestEnvForDir = dir => {
|
|
246
|
-
if (individualPathPerConcatenatedEnvIds[dir]) {
|
|
247
|
-
// it's the component dir, so it's the best env
|
|
248
|
-
allPathsPerEnvId[dir] = individualPathPerConcatenatedEnvIds[dir];
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
const allPathsShareSameDir = dir === rootDir ? allPaths : allPaths.filter(p => p.startsWith(`${dir}/`));
|
|
252
|
-
const countPerEnv = {};
|
|
253
|
-
allPathsShareSameDir.forEach(p => {
|
|
254
|
-
const envIdStr = individualPathPerConcatenatedEnvIds[p];
|
|
255
|
-
if (countPerEnv[envIdStr]) countPerEnv[envIdStr] += 1;else countPerEnv[envIdStr] = 1;
|
|
256
|
-
});
|
|
257
|
-
const max = Math.max(...Object.values(countPerEnv));
|
|
258
|
-
const envWithMax = Object.keys(countPerEnv).filter(env => countPerEnv[env] === max);
|
|
259
|
-
if (!envWithMax.length) throw new Error(`must be at least one env related to path "${dir}"`);
|
|
260
|
-
if (envWithMax.length > 1) allPathsPerEnvId[dir] = null;else allPathsPerEnvId[dir] = envWithMax[0];
|
|
261
|
-
};
|
|
262
|
-
allPossibleDirs.forEach(dirPath => {
|
|
263
|
-
calculateBestEnvForDir(dirPath);
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
// this is the actual deduping. if found a shorter path with the same env, then no need for this path.
|
|
267
|
-
// in other words, return only the paths that their parent is null or has a different env.
|
|
268
|
-
const dedupedPathsPerEnvIds = Object.keys(allPathsPerEnvId).reduce((acc, current) => {
|
|
269
|
-
if (allPathsPerEnvId[current] && allPathsPerEnvId[_path().default.dirname(current)] !== allPathsPerEnvId[current]) {
|
|
270
|
-
acc[current] = allPathsPerEnvId[current];
|
|
271
|
-
}
|
|
272
|
-
return acc;
|
|
273
|
-
}, {});
|
|
274
|
-
// rootDir parent is always rootDir, so leave it as is.
|
|
275
|
-
if (allPathsPerEnvId[rootDir]) dedupedPathsPerEnvIds[rootDir] = allPathsPerEnvId[rootDir];
|
|
276
|
-
const envIdsPerDedupedPaths = (0, _lodash().invertBy)(dedupedPathsPerEnvIds);
|
|
277
|
-
const dedupedPaths = Object.keys(envIdsPerDedupedPaths).map(envIdStr => ({
|
|
278
|
-
ids: envIdStr.split(','),
|
|
279
|
-
paths: envIdsPerDedupedPaths[envIdStr]
|
|
280
|
-
}));
|
|
281
|
-
return dedupedPaths;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
//# sourceMappingURL=tsconfig-writer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","_yesno","_lodash","_exceptions","_chalk","_typescript","obj","__esModule","default","TsconfigWriter","constructor","workspace","logger","write","envsExecutionContext","options","pathsPerEnvs","getPathsPerEnv","tsconfigPathsPerEnv","map","pathsPerEnv","envIds","ids","tsconfig","getTsconfigFromEnv","env","paths","dryRun","silent","promptForWriting","p","flat","writeFiles","compiler","getCompiler","id","TypescriptAspect","displayConfig","JSON","stringify","getTsConfig","undefined","clean","dedupe","componentPaths","allPossibleDirs","getAllPossibleDirsFromPaths","dirsWithTsconfig","filterDirsWithTsconfigFile","tsconfigFiles","dir","path","join","length","promptForCleaning","deleteFiles","dirs","clearStatusLine","ok","yesno","question","chalk","underline","bold","PromptCanceled","Promise","all","f","fs","remove","tsconfigPathsPerEnvs","writeFile","envExecution","components","c","componentDir","relative","envsWithFiles","e","file","envsPerFile","isEnvProcessed","envId","find","forEach","foundSameFile","filter","isEqual","push","fileContent","pathsPerEnvIds","compact","envsPerDedupedPaths","dedupePaths","dedupedPathsPerEnvs","envWithDedupePaths","found","includes","Error","exports","hasTsconfig","pathExists","getAllParentsDirOfPath","uniq","current","dirname","pathsPerEnvId","rootDir","individualPathPerConcatenatedEnvIds","reduce","acc","allPaths","Object","keys","allPathsPerEnvId","calculateBestEnvForDir","allPathsShareSameDir","startsWith","countPerEnv","envIdStr","max","Math","values","envWithMax","dirPath","dedupedPathsPerEnvIds","envIdsPerDedupedPaths","invertBy","dedupedPaths","split"],"sources":["tsconfig-writer.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport path from 'path';\nimport yesno from 'yesno';\nimport { PathLinuxRelative } from '@teambit/legacy/dist/utils/path';\nimport { compact, invertBy, isEqual, uniq } from 'lodash';\nimport { PromptCanceled } from '@teambit/legacy/dist/prompts/exceptions';\nimport { Environment, ExecutionContext } from '@teambit/envs';\nimport { Workspace } from '@teambit/workspace';\nimport { Logger } from '@teambit/logger';\nimport chalk from 'chalk';\nimport { TsconfigWriterOptions } from './typescript.main.runtime';\nimport { TypescriptAspect } from './typescript.aspect';\n\nexport type TsconfigPathsPerEnv = { envIds: string[]; tsconfig: string; paths: string[] };\n\ntype PathsPerEnv = { env: Environment; ids: string[]; paths: string[] };\n\nexport class TsconfigWriter {\n constructor(private workspace: Workspace, private logger: Logger) {}\n\n async write(\n envsExecutionContext: ExecutionContext[],\n options: TsconfigWriterOptions\n ): Promise<TsconfigPathsPerEnv[]> {\n const pathsPerEnvs = this.getPathsPerEnv(envsExecutionContext, options);\n const tsconfigPathsPerEnv = pathsPerEnvs.map((pathsPerEnv) => ({\n envIds: pathsPerEnv.ids,\n tsconfig: this.getTsconfigFromEnv(pathsPerEnv.env), // pathsPerEnv.env.getTsConfig(),\n paths: pathsPerEnv.paths,\n }));\n if (options.dryRun) return tsconfigPathsPerEnv;\n if (!options.silent) await this.promptForWriting(tsconfigPathsPerEnv.map((p) => p.paths).flat());\n await this.writeFiles(tsconfigPathsPerEnv);\n return tsconfigPathsPerEnv;\n }\n\n private getTsconfigFromEnv(env: Environment) {\n const compiler = env.getCompiler();\n if (compiler.id === TypescriptAspect.id) {\n return compiler.displayConfig() as string;\n }\n return JSON.stringify(env.getTsConfig(), undefined, 2);\n }\n\n async clean(envsExecutionContext: ExecutionContext[], { dryRun, silent }: TsconfigWriterOptions): Promise<string[]> {\n const pathsPerEnvs = this.getPathsPerEnv(envsExecutionContext, { dedupe: false });\n const componentPaths = pathsPerEnvs.map((p) => p.paths).flat();\n const allPossibleDirs = getAllPossibleDirsFromPaths(componentPaths);\n const dirsWithTsconfig = await filterDirsWithTsconfigFile(allPossibleDirs);\n const tsconfigFiles = dirsWithTsconfig.map((dir) => path.join(dir, 'tsconfig.json'));\n if (dryRun) return tsconfigFiles;\n if (!dirsWithTsconfig.length) return [];\n if (!silent) await this.promptForCleaning(tsconfigFiles);\n await this.deleteFiles(tsconfigFiles);\n return tsconfigFiles;\n }\n\n private async promptForWriting(dirs: string[]) {\n this.logger.clearStatusLine();\n const tsconfigFiles = dirs.map((dir) => path.join(dir, 'tsconfig.json'));\n const ok = await yesno({\n question: `${chalk.underline('The following paths will be written:')}\n${tsconfigFiles.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 promptForCleaning(tsconfigFiles: string[]) {\n this.logger.clearStatusLine();\n const ok = await yesno({\n question: `${chalk.underline('The following paths will be deleted:')}\n${tsconfigFiles.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(tsconfigFiles: string[]) {\n await Promise.all(tsconfigFiles.map((f) => fs.remove(f)));\n }\n\n private async writeFiles(tsconfigPathsPerEnvs: TsconfigPathsPerEnv[]) {\n await Promise.all(\n tsconfigPathsPerEnvs.map((pathsPerEnv) => {\n return Promise.all(\n pathsPerEnv.paths.map((p) => fs.writeFile(path.join(p, 'tsconfig.json'), pathsPerEnv.tsconfig))\n );\n })\n );\n }\n\n private getPathsPerEnv(envsExecutionContext: ExecutionContext[], { dedupe }: TsconfigWriterOptions): PathsPerEnv[] {\n const pathsPerEnvs = envsExecutionContext.map((envExecution) => {\n return {\n id: envExecution.id,\n env: envExecution.env,\n paths: envExecution.components.map((c) => this.workspace.componentDir(c.id, undefined, { relative: true })),\n };\n });\n if (!dedupe) {\n return pathsPerEnvs.map(({ id, env, paths }) => ({ ids: [id], env, paths }));\n }\n\n const envsWithFiles = envsExecutionContext.map((e) => ({\n id: e.id,\n file: e.env.getTsConfig(),\n }));\n const envsPerFile: { envIds: string[]; fileContent: Record<string, any> }[] = [];\n const isEnvProcessed = (envId: string) =>\n envsPerFile\n .map((e) => e.envIds)\n .flat()\n .find((e) => e === envId);\n envsWithFiles.forEach(({ id, file }) => {\n if (isEnvProcessed(id)) return;\n const foundSameFile = envsWithFiles.filter((e) => isEqual(file, e.file));\n envsPerFile.push({ envIds: foundSameFile.map((f) => f.id), fileContent: file });\n });\n const pathsPerEnvIds = envsPerFile.map((e) => ({\n ids: e.envIds,\n paths: compact(e.envIds.map((envId) => pathsPerEnvs.find((p) => p.id === envId)?.paths).flat()),\n }));\n // const pathsPerEnvIds = pathsPerEnvs.map((p) => ({ ids: p.ids, paths: p.paths }));\n const envsPerDedupedPaths = dedupePaths(pathsPerEnvIds);\n const dedupedPathsPerEnvs: PathsPerEnv[] = envsPerDedupedPaths.map((envWithDedupePaths) => {\n const found = pathsPerEnvs.find((p) => envWithDedupePaths.ids.includes(p.id));\n if (!found) throw new Error(`dedupedPathsPerEnvs, unable to find ${envWithDedupePaths.ids}`);\n return {\n env: found.env,\n ids: envWithDedupePaths.ids,\n paths: envWithDedupePaths.paths,\n };\n });\n\n return dedupedPathsPerEnvs;\n }\n}\n\ntype PathsPerEnvIds = { ids: string[]; paths: string[] };\n\nasync function filterDirsWithTsconfigFile(dirs: string[]): Promise<string[]> {\n const dirsWithTsconfig = await Promise.all(\n dirs.map(async (dir) => {\n const hasTsconfig = await fs.pathExists(path.join(dir, 'tsconfig.json'));\n return hasTsconfig ? dir : undefined;\n })\n );\n return compact(dirsWithTsconfig);\n}\n\nfunction getAllPossibleDirsFromPaths(paths: PathLinuxRelative[]): PathLinuxRelative[] {\n const dirs = paths.map((p) => getAllParentsDirOfPath(p)).flat();\n dirs.push('.'); // add the root dir\n return uniq(dirs);\n}\n\nfunction getAllParentsDirOfPath(p: PathLinuxRelative): PathLinuxRelative[] {\n const all: string[] = [];\n let current = p;\n while (current !== '.') {\n all.push(current);\n current = path.dirname(current);\n }\n return all;\n}\n\n/**\n * easier to understand by an example:\n * input:\n * [\n * { id: react, paths: [ui/button, ui/form] },\n * { id: aspect, paths: [p/a1, p/a2] },\n * { id: node, paths: [p/n1] },\n * ]\n *\n * output:\n * [\n * { id: react, paths: [ui] },\n * { id: aspect, paths: [p] },\n * { id: node, paths: [p/n1] },\n * ]\n *\n * the goal is to minimize the amount of files to write per env if possible.\n * when multiple components of the same env share a root-dir, then, it's enough to write a file in that shared dir.\n * if in a shared-dir, some components using env1 and some env2, it finds the env that has the max number of\n * components, this env will be optimized. other components, will have the files written inside their dirs.\n */\nexport function dedupePaths(pathsPerEnvId: PathsPerEnvIds[]): PathsPerEnvIds[] {\n const rootDir = '.';\n const individualPathPerConcatenatedEnvIds: { [path: string]: string } = pathsPerEnvId.reduce((acc, current) => {\n current.paths.forEach((p) => {\n acc[p] = current.ids.join(',');\n });\n return acc;\n }, {});\n const allPaths = Object.keys(individualPathPerConcatenatedEnvIds);\n const allPossibleDirs = getAllPossibleDirsFromPaths(allPaths);\n\n const allPathsPerEnvId: { [path: string]: string | null } = {}; // null when parent-dir has same amount of comps per env.\n\n const calculateBestEnvForDir = (dir: string) => {\n if (individualPathPerConcatenatedEnvIds[dir]) {\n // it's the component dir, so it's the best env\n allPathsPerEnvId[dir] = individualPathPerConcatenatedEnvIds[dir];\n return;\n }\n const allPathsShareSameDir = dir === rootDir ? allPaths : allPaths.filter((p) => p.startsWith(`${dir}/`));\n const countPerEnv: { [env: string]: number } = {};\n allPathsShareSameDir.forEach((p) => {\n const envIdStr = individualPathPerConcatenatedEnvIds[p];\n if (countPerEnv[envIdStr]) countPerEnv[envIdStr] += 1;\n else countPerEnv[envIdStr] = 1;\n });\n const max = Math.max(...Object.values(countPerEnv));\n const envWithMax = Object.keys(countPerEnv).filter((env) => countPerEnv[env] === max);\n if (!envWithMax.length) throw new Error(`must be at least one env related to path \"${dir}\"`);\n if (envWithMax.length > 1) allPathsPerEnvId[dir] = null;\n else allPathsPerEnvId[dir] = envWithMax[0];\n };\n\n allPossibleDirs.forEach((dirPath) => {\n calculateBestEnvForDir(dirPath);\n });\n\n // this is the actual deduping. if found a shorter path with the same env, then no need for this path.\n // in other words, return only the paths that their parent is null or has a different env.\n const dedupedPathsPerEnvIds = Object.keys(allPathsPerEnvId).reduce((acc, current) => {\n if (allPathsPerEnvId[current] && allPathsPerEnvId[path.dirname(current)] !== allPathsPerEnvId[current]) {\n acc[current] = allPathsPerEnvId[current];\n }\n\n return acc;\n }, {});\n // rootDir parent is always rootDir, so leave it as is.\n if (allPathsPerEnvId[rootDir]) dedupedPathsPerEnvIds[rootDir] = allPathsPerEnvId[rootDir];\n\n const envIdsPerDedupedPaths = invertBy(dedupedPathsPerEnvIds);\n\n const dedupedPaths = Object.keys(envIdsPerDedupedPaths).map((envIdStr) => ({\n ids: envIdStr.split(','),\n paths: envIdsPerDedupedPaths[envIdStr],\n }));\n return dedupedPaths;\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,OAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,YAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,WAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAO,OAAA;EAAA,MAAAP,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAK,MAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAA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