Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

chore: add support for aot compilation #36

Closed
wants to merge 1 commit into from
Closed
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
14 changes: 7 additions & 7 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var del = require('del');
var path = require("path");

var tsOutput = './in-memory-web-api/';
var jsCopySrc = ['*.js', '*.js.map', '*.d.ts'].map(ext => tsOutput + ext);
var jsCopySrc = ['*.js', '*.js.map', '*.d.ts', '*.metadata.json'].map(ext => tsOutput + ext);

gulp.task('default', ['help']);

Expand All @@ -19,18 +19,18 @@ gulp.task('help', $.taskListing.withFilters(function (taskName) {
return shouldRemove;
}));

gulp.task('build', ['tsc'], function(){
gulp.task('build', ['ngc'], function(){
return gulp
.src(jsCopySrc)
.pipe(gulp.dest('./'));
});

gulp.task('tsc',['clean'], function(done) {
runTSC('./', done);
gulp.task('ngc',['clean'], function(done) {
runNGC('./', done);
});

gulp.task('clean', function(done) {
clean([tsOutput+'*.*', '*.js', '*.js.map', '*.d.ts', '!gulpfile.js'], done);
clean([tsOutput+'*.*', '*.js', '*.js.map', '*.d.ts', '!gulpfile.js', '*.metadata.json'], done);
});

/**
Expand Down Expand Up @@ -83,9 +83,9 @@ function log(msg) {
$.util.log($.util.colors.blue(msg));
}
}
function runTSC(directory, done) {
function runNGC(directory, done) {
directory = directory || './';
var tscjs = path.join(process.cwd(), 'node_modules/typescript/bin/tsc');
var tscjs = path.join(process.cwd(), 'node_modules/.bin/ngc');
var childProcess = cp.spawn('node', [tscjs, '-p', directory], { cwd: process.cwd() });
childProcess.stdout.on('data', function (data) {
console.log(data.toString());
Expand Down
7 changes: 5 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"moduleResolution": "node",
"sourceMap": true,
"sourceRoot": "./src",
"outDir": "./in-memory-web-api",
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
Expand All @@ -18,5 +17,9 @@
"in-memory-web-api",
"typings/main",
"typings/main.d.ts"
]
],
"angularCompilerOptions": {
"genDir": "aot",
"skipMetadataEmit" : false
}
}