Skip to content

Commit 4b5a418

Browse files
nlm-prohansl
authored andcommitted
feat(@angular-devkit/build-ng-packagr): tsConfig option
permit to use a custom tsconfig.json file by setting its path with a new tsConfig option
1 parent 207239b commit 4b5a418

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

packages/angular_devkit/build_ng_packagr/src/build/index.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ function requireProjectModule(root: string, moduleName: string) {
2727

2828
export interface NgPackagrBuilderOptions {
2929
project: string;
30+
tsConfig?: string;
3031
}
3132

3233
export class NgPackagrBuilder implements Builder<NgPackagrBuilderOptions> {
@@ -46,9 +47,15 @@ export class NgPackagrBuilder implements Builder<NgPackagrBuilderOptions> {
4647
getSystemPath(root), 'ng-packagr') as typeof ngPackagr;
4748
const packageJsonPath = getSystemPath(resolve(root, normalize(options.project)));
4849

49-
projectNgPackagr.ngPackagr()
50-
.forProject(packageJsonPath)
51-
.build()
50+
const ngPkgProject = projectNgPackagr.ngPackagr()
51+
.forProject(packageJsonPath);
52+
53+
if (options.tsConfig) {
54+
const tsConfigPath = getSystemPath(resolve(root, normalize(options.tsConfig)));
55+
ngPkgProject.withTsConfig(tsConfigPath);
56+
}
57+
58+
ngPkgProject.build()
5259
.then(() => {
5360
obs.next({ success: true });
5461
obs.complete();

packages/angular_devkit/build_ng_packagr/src/build/schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
"project": {
77
"type": "string",
88
"description": "The file path of the package.json for distribution via npm."
9+
},
10+
"tsConfig": {
11+
"type": "string",
12+
"description": "The file path of the TypeScript configuration file."
913
}
1014
},
1115
"additionalProperties": false,

0 commit comments

Comments
 (0)