Demo app project cleanup

This commit is contained in:
Denys Vuika
2016-05-19 12:26:35 +01:00
parent 49b74cfbc6
commit 9ec8123a2c
5 changed files with 1 additions and 184 deletions
-101
View File
@@ -1,101 +0,0 @@
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');
const license = require('gulp-license-check');
// clean the contents of the distribution directory
gulp.task('clean', function () {
return del('dist/*');
});
gulp.task('license', function () {
return gulp.src('./app/**/*.ts')
.pipe(license({
path: 'app/license_header.txt',
blocking: false,
logInfo: false,
logError: true
}));
});
// copy static assets - i.e. non TypeScript compiled source
gulp.task('copy:assets', ['clean'], function () {
return gulp.src(['app/**/*',
'index.html',
'typings.json',
'!app/**/*.ts'], {base: './'})
.pipe(gulp.dest('dist'))
});
// copy dependencies
gulp.task('copy:libs', ['clean'], function () {
return gulp.src([
'node_modules/**/*',
'!node_modules/ng2-alfresco-*{,/**/*}'
])
.pipe(gulp.dest('dist/node_modules'))
});
gulp.task('copy:components', ['clean'], function() {
return gulp.src([
'../ng2-components/**/*',
'!../ng2-components/README.md'
])
.pipe(gulp.dest('dist/node_modules'))
});
// copy typings
gulp.task('copy:typings', ['clean'], function () {
return gulp.src([
'typings/**/*'
])
.pipe(gulp.dest('dist/typings'))
});
// linting
gulp.task('tslint', function () {
return gulp.src('app/**/*.ts')
.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'));
});
// 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', ['license', 'tslint', 'copy:assets', 'copy:libs', 'copy:components', 'copy:typings', 'compile']);
gulp.task('dev', ['build', 'serve'], reload);
gulp.task('default', ['build']);
gulp.task('buildAndReload', ['build'], reload);
-7
View File
@@ -57,14 +57,7 @@
"browser-sync": "^2.10.0",
"concurrently": "^2.0.0",
"del": "^2.1.0",
"gulp": "^3.9.1",
"gulp-license-check": "^1.0.1",
"gulp-sourcemaps": "^1.6.0",
"gulp-tslint": "^3.6.0",
"gulp-typescript": "^2.8.0",
"jasmine-core": "2.4.1",
"lite-server": "^2.2.0",
"tsconfig-glob": "^0.3.3",
"typescript": "^1.8.10",
"typings": "^0.7.12"
}
-52
View File
@@ -1,52 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Alfresco Angular 2 Unit Tests</title>
<base href="/dist/">
<link rel="stylesheet" href="../node_modules/jasmine-core/lib/jasmine-core/jasmine.css">
<script src="../node_modules/jasmine-core/lib/jasmine-core/jasmine.js"></script>
<script src="../node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js"></script>
<script src="../node_modules/jasmine-core/lib/jasmine-core/boot.js"></script>
<!-- #1. add the system.js library -->
<script src="node_modules/es6-shim/es6-shim.min.js"></script>
<script src="node_modules/systemjs/dist/system-polyfills.js"></script>
<script src="node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script>
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="node_modules/angular2/bundles/http.dev.js"></script>
<script src="node_modules/angular2/bundles/router.dev.js"></script>
<script src="node_modules/angular2/bundles/testing.dev.js"></script>
<script>
// #2. Configure systemjs to use the .js extension
// for imports from the app folder
System.config({
packages: {
'app': {defaultExtension: 'js'}
}
});
// #3. Import the spec file explicitly
System.import('app/services/authentication.spec')
// #4. wait for all imports to load ...
// then re-execute `window.onload` which
// triggers the Jasmine test-runner start
// or explain what went wrong.
.then(window.onload)
.catch(console.error.bind(console));
</script>
</head>
<body>
<!-- Unit Testing Chapter #1: Proof of life. -->
<script>
</script>
</body>
</html>
-18
View File
@@ -1,18 +0,0 @@
{
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"dist",
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}
+1 -6
View File
@@ -1,7 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"outDir": "dist/app",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
@@ -10,12 +9,8 @@
"removeComments": false,
"noImplicitAny": false
},
"files": [
"node_modules/angular2/typings/browser.d.ts",
"typings/browser/ambient/jasmine/index.d.ts",
"app/**/*.ts"
],
"exclude": [
"dist",
"node_modules",
"typings/main",
"typings/main.d.ts"