Skip to content

Commit be1bcba

Browse files
alan-agius4mgechev
authored andcommitted
fix(@schematics/angular): improve paths and exclude options
Currently the library schematic doesn't support adding a secondary entry-point and having deep imports is not recommanded. It's best if paths are more stricter when having a secondary entry-point instead of a wildcard. Instead of : ``` "lib/*": [ "dist/lib/*" ] ``` Users should configure: ``` "lib/secondary": [ "dist/lib/secondary" ] ``` This would allow a better DX experience when using auto imports in IDE's. Closes: #15952
1 parent cc0d5fc commit be1bcba

File tree

3 files changed

+1
-11
lines changed

3 files changed

+1
-11
lines changed

packages/schematics/angular/library/index.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,6 @@ function updateTsConfig(packageName: string, distRoot: string) {
6868
tsconfig.compilerOptions.paths[packageName] = [];
6969
}
7070
tsconfig.compilerOptions.paths[packageName].push(distRoot);
71-
72-
// deep import & secondary entrypoint support
73-
const deepPackagePath = packageName + '/*';
74-
if (!tsconfig.compilerOptions.paths[deepPackagePath]) {
75-
tsconfig.compilerOptions.paths[deepPackagePath] = [];
76-
}
77-
tsconfig.compilerOptions.paths[deepPackagePath].push(distRoot + '/*');
7871
});
7972
};
8073
}

packages/schematics/angular/library/index_spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,6 @@ describe('Library Schematic', () => {
208208
expect(tsConfigJson.compilerOptions.paths.foo).toBeTruthy();
209209
expect(tsConfigJson.compilerOptions.paths.foo.length).toEqual(1);
210210
expect(tsConfigJson.compilerOptions.paths.foo[0]).toEqual('dist/foo');
211-
expect(tsConfigJson.compilerOptions.paths['foo/*']).toBeTruthy();
212-
expect(tsConfigJson.compilerOptions.paths['foo/*'].length).toEqual(1);
213-
expect(tsConfigJson.compilerOptions.paths['foo/*'][0]).toEqual('dist/foo/*');
214211
});
215212

216213
it(`should append to existing paths mappings`, async () => {

packages/schematics/angular/workspace/files/tsconfig.json.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"compileOnSave": false,
33
"compilerOptions": {
44
"baseUrl": "./",
5-
"outDir": "./dist/out-tsc",<% if (strict) { %>
5+
"outDir": "./dist",<% if (strict) { %>
66
"noImplicitAny": true,
77
"noImplicitReturns": true,
88
"noImplicitThis": true,

0 commit comments

Comments
 (0)