Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

fix(@schematics/angular): fix universal tsconfig paths #711

Merged
merged 1 commit into from
Apr 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
{
"extends": "../tsconfig.json",
"extends": "./<%= tsConfigExtends %>",
"compilerOptions": {
"outDir": "<%= outDir %>-server",
"baseUrl": "./",
"module": "commonjs",
"types": []
"module": "commonjs"
},
"exclude": [
"test.ts",
"**/*.spec.ts"
],
"angularCompilerOptions": {
"entryModule": "<%= appDir %>/<%= stripTsExtension(rootModuleFileName) %>#<%= rootModuleClassName %>"
}
Expand Down
11 changes: 10 additions & 1 deletion packages/schematics/angular/universal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { JsonObject, experimental, normalize, parseJson, strings } from '@angular-devkit/core';
import {
JsonObject,
basename,
experimental,
normalize,
parseJson,
strings,
} from '@angular-devkit/core';
import {
Rule,
SchematicContext,
Expand Down Expand Up @@ -197,12 +204,14 @@ export default function (options: UniversalOptions): Rule {
const clientProject = getClientProject(host, options);
const clientArchitect = getClientArchitect(host, options);
const outDir = getTsConfigOutDir(host, clientArchitect);
const tsConfigExtends = basename(clientArchitect.build.options.tsConfig);
const templateSource = apply(url('./files'), [
template({
...strings,
...options as object,
stripTsExtension: (s: string) => { return s.replace(/\.ts$/, ''); },
outDir,
tsConfigExtends,
}),
move(clientProject.root),
]);
Expand Down
11 changes: 10 additions & 1 deletion packages/schematics/angular/universal/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,16 @@ describe('Universal Schematic', () => {
const filePath = '/projects/bar/tsconfig.server.json';
expect(tree.exists(filePath)).toEqual(true);
const contents = tree.readContent(filePath);
expect(contents).toMatch('../../out-tsc/app-server');
expect(JSON.parse(contents)).toEqual({
extends: './tsconfig.app.json',
compilerOptions: {
outDir: '../../out-tsc/app-server',
module: 'commonjs',
},
angularCompilerOptions: {
entryModule: 'src/app/app.server.module#AppServerModule',
},
});
});

it('should add dependency: @angular/platform-server', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/angular/universal/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"type": "string",
"format": "path",
"description": "The name of the application directory.",
"default": "app"
"default": "src/app"
},
"rootModuleFileName": {
"type": "string",
Expand Down