mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
#33 draft gulp
This commit is contained in:
83
demo-shell-ng2/gulpfile.js
Normal file
83
demo-shell-ng2/gulpfile.js
Normal file
@@ -0,0 +1,83 @@
|
||||
const gulp = require('gulp');
|
||||
const del = require('del');
|
||||
const typescript = require('gulp-typescript');
|
||||
const tscConfig = require('./tsconfig.json');
|
||||
const sourcemaps = require('gulp-sourcemaps');
|
||||
const tslint = require('gulp-tslint');
|
||||
const browserSync = require('browser-sync');
|
||||
const reload = browserSync.reload;
|
||||
const tsconfig = require('tsconfig-glob');
|
||||
|
||||
// clean the contents of the distribution directory
|
||||
gulp.task('clean', function () {
|
||||
return del('dist/**/*');
|
||||
});
|
||||
|
||||
// copy static assets - i.e. non TypeScript compiled source
|
||||
gulp.task('copy:assets', ['clean'], function() {
|
||||
return gulp.src(['app/**/*',
|
||||
'index.html',
|
||||
'!app/**/*.ts'], { base : './' })
|
||||
.pipe(gulp.dest('dist'))
|
||||
});
|
||||
|
||||
// copy dependencies
|
||||
gulp.task('copy:libs', ['clean'], function() {
|
||||
return gulp.src([
|
||||
'node_modules/es6-shim/es6-shim.min.js',
|
||||
'node_modules/systemjs/dist/system-polyfills.js',
|
||||
'node_modules/angular2/es6/dev/src/testing/shims_for_IE.js',
|
||||
'node_modules/angular2/bundles/angular2-polyfills.js',
|
||||
'node_modules/systemjs/dist/system.src.js',
|
||||
'node_modules/rxjs/bundles/Rx.js',
|
||||
'node_modules/angular2/bundles/angular2.dev.js',
|
||||
'node_modules/angular2/bundles/router.dev.js',
|
||||
'node_modules/angular2/bundles/http.dev.js',
|
||||
'node_modules/jquery/dist/jquery.min.js',
|
||||
'node_modules/bootstrap/dist/js/bootstrap.min.js',
|
||||
'node_modules/font-awesome/css/font-awesome.min.css',
|
||||
'node_modules/bootstrap/dist/css/bootstrap.min.css'
|
||||
])
|
||||
.pipe(gulp.dest('dist/lib'))
|
||||
});
|
||||
|
||||
// linting
|
||||
gulp.task('tslint', function() {
|
||||
return gulp.src(['app/**/*.ts', '!node_modules/**'])
|
||||
.pipe(tslint())
|
||||
.pipe(tslint.report('verbose'));
|
||||
});
|
||||
|
||||
|
||||
// TypeScript compile
|
||||
gulp.task('compile', ['clean'], function () {
|
||||
return gulp
|
||||
.src(tscConfig.files)
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(typescript(tscConfig.compilerOptions))
|
||||
.pipe(sourcemaps.write('.'))
|
||||
.pipe(gulp.dest('dist/app'));
|
||||
});
|
||||
|
||||
// update the tsconfig files based on the glob pattern
|
||||
gulp.task('tsconfig-glob', function () {
|
||||
return tsconfig({
|
||||
configPath: '.',
|
||||
indent: 2
|
||||
});
|
||||
});
|
||||
|
||||
// Run browsersync for development
|
||||
gulp.task('serve', ['build'], function() {
|
||||
browserSync({
|
||||
server: {
|
||||
baseDir: 'dist'
|
||||
}
|
||||
});
|
||||
|
||||
gulp.watch(['app/**/*', 'index.html'], ['buildAndReload']);
|
||||
});
|
||||
|
||||
gulp.task('build', ['tslint', 'compile', 'copy:libs', 'copy:assets']);
|
||||
gulp.task('dev', ['build', 'serve'], reload);
|
||||
gulp.task('default', ['build']);
|
Reference in New Issue
Block a user