Skip to content

Commit 4a4261e

Browse files
devversionkara
authored andcommitted
build: use typescript cli for compilation (#2802)
1 parent 3b6cab0 commit 4a4261e

File tree

4 files changed

+10
-34
lines changed

4 files changed

+10
-34
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
"gulp-sass": "^3.1.0",
7373
"gulp-sourcemaps": "^2.4.0",
7474
"gulp-transform": "^1.1.0",
75-
"gulp-typescript": "^3.1.4",
7675
"hammerjs": "^2.0.8",
7776
"highlight.js": "^9.9.0",
7877
"jasmine-core": "^2.5.2",

src/demo-app/tsconfig.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"compilerOptions": {
3-
"declaration": true,
3+
"declaration": false,
44
"emitDecoratorMetadata": true,
55
"experimentalDecorators": true,
66
"lib": ["es6", "es2015", "dom"],
@@ -22,8 +22,11 @@
2222
]
2323
}
2424
},
25-
"exclude": [
26-
"*-aot.ts"
25+
"files": [
26+
"./demo-app-types.d.ts",
27+
"./demo-app-module.ts",
28+
"./system-config.ts",
29+
"./main.ts"
2730
],
2831
"angularCompilerOptions": {
2932
"genDir": "../../dist",

tools/gulp/task_helpers.ts

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as child_process from 'child_process';
22
import * as fs from 'fs';
33
import * as gulp from 'gulp';
4-
import * as gulpTs from 'gulp-typescript';
54
import * as path from 'path';
65

76
import {NPM_VENDOR_FILES, PROJECT_ROOT, DIST_ROOT, SASS_AUTOPREFIXER_OPTIONS} from './constants';
@@ -34,34 +33,9 @@ function _globify(maybeGlob: string, suffix = '**/*') {
3433
}
3534

3635

37-
/** Create a TS Build Task, based on the options. */
38-
export function tsBuildTask(tsConfigPath: string, tsConfigName = 'tsconfig.json') {
39-
let tsConfigDir = tsConfigPath;
40-
if (fs.existsSync(path.join(tsConfigDir, tsConfigName))) {
41-
// Append tsconfig.json
42-
tsConfigPath = path.join(tsConfigDir, tsConfigName);
43-
} else {
44-
tsConfigDir = path.dirname(tsConfigDir);
45-
}
46-
47-
return () => {
48-
const tsConfig: any = JSON.parse(fs.readFileSync(tsConfigPath, 'utf-8'));
49-
const dest: string = path.join(tsConfigDir, tsConfig['compilerOptions']['outDir']);
50-
51-
const tsProject = gulpTs.createProject(tsConfigPath);
52-
53-
let pipe = tsProject.src()
54-
.pipe(gulpSourcemaps.init())
55-
.pipe(tsProject());
56-
let dts = pipe.dts.pipe(gulp.dest(dest));
57-
58-
return gulpMerge([
59-
dts,
60-
pipe
61-
.pipe(gulpSourcemaps.write('.'))
62-
.pipe(gulp.dest(dest))
63-
]);
64-
};
36+
/** Creates a task that runs the TypeScript compiler */
37+
export function tsBuildTask(tsConfigPath: string) {
38+
return execNodeTask('typescript', 'tsc', ['-p', tsConfigPath]);
6539
}
6640

6741

tools/gulp/tasks/components.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ task(':watch:components', () => {
3737

3838

3939
/** Builds component typescript only (ESM output). */
40-
task(':build:components:ts', tsBuildTask(COMPONENTS_DIR, 'tsconfig-srcs.json'));
40+
task(':build:components:ts', tsBuildTask(path.join(COMPONENTS_DIR, 'tsconfig-srcs.json')));
4141

4242
/** Builds components typescript for tests (CJS output). */
4343
task(':build:components:spec', tsBuildTask(COMPONENTS_DIR));

0 commit comments

Comments
 (0)