Skip to content

Commit 532dfd2

Browse files
committed
Added changes in devDeploy systems
1 parent fdf5501 commit 532dfd2

6 files changed

+95
-48
lines changed

app/shared/app.settings.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export class AppSettings {
22
public static get APP_NAME(): string {
3-
return 'GO! Fetch';
3+
return 'GO! Fetch1';
44
}
55

66
public static get TASKCAT_API_BASE(): string {

bs-config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"server": {
33
"baseDir": [
4-
"./"
4+
"./dist"
55
]
66
}
77
}

gulpfile.js

+70-30
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
11
const gulp = require('gulp');
22
const del = require('del');
3+
const runSequence = require('run-sequence');
34

45
// Loading typescript requirements
56
const typescript = require('gulp-typescript');
67
const tscConfig = require('./tsconfig.json');
78
const sourcemaps = require('gulp-sourcemaps');
89
const tslint = require('gulp-tslint');
10+
var watch = require('gulp-watch');
911

1012
// npm
1113
var install = require("gulp-install");
1214

13-
// Cleanup the dist folder
14-
gulp.task('clean', function () {
15-
return del(['dist/**/*', '!dist/node_modules', '!dist/node_modules/**/*']);
15+
/**
16+
* Remove dist directory.
17+
*/
18+
gulp.task('clean', function (cb) {
19+
del(["dist"]).then(function (paths) {
20+
console.log('Deleted files and folders:\n', paths.join('\n'));
21+
cb();
22+
});
1623
});
1724

18-
// Hard cleanup the dist folder
19-
gulp.task('clean:hard', function () {
20-
return del(['dist/**/*']);
21-
});
22-
23-
24-
// Compile Typescript
25-
gulp.task('compile', ['clean'], function () {
25+
/**
26+
* Compile TypeScript sources and create sourcemaps in build directory.
27+
*/
28+
gulp.task('compile', function () {
2629
var tsProject = typescript.createProject('tsconfig.json');
2730
return tsProject
2831
.src('app/**/*.ts')
@@ -32,36 +35,73 @@ gulp.task('compile', ['clean'], function () {
3235
.pipe(gulp.dest('dist/app'));
3336
});
3437

35-
// Tslint
36-
gulp.task('tslint', function() {
37-
return gulp.src('app/**/*.ts')
38-
.pipe(tslint())
39-
.pipe(tslint.report('verbose'));
38+
/**
39+
* Lint all custom TypeScript files.
40+
*/
41+
gulp.task('tslint', function () {
42+
return gulp.src('app/**/*.ts')
43+
.pipe(tslint())
44+
.pipe(tslint.report('verbose'));
4045
});
4146

4247
// copy dependencies from node_modules
4348
// we are just mimicking the dev environment now, but for production a lot more has to be done
44-
gulp.task('copy:libs', ['clean'], function () {
49+
gulp.task('copy:libs', function () {
4550
return gulp.src([
46-
'node_modules/**/*'
47-
])
48-
.pipe(gulp.dest('dist/node_modules'))
51+
'es6-shim/es6-shim.min.js',
52+
'systemjs/dist/system-polyfills.js',
53+
'systemjs/dist/system.src.js',
54+
'reflect-metadata/Reflect.js',
55+
'rxjs/**',
56+
'zone.js/dist/zone.js',
57+
'angular2-in-memory-web-api/web-api.js',
58+
'@angular/**',
59+
'moment/moment.js',
60+
'ng2-bootstrap/**',
61+
'ng2-bs3-modal/**'
62+
], { cwd: "node_modules/**" }) /* Glob required here. */
63+
.pipe(gulp.dest("dist/lib"));
64+
});
65+
66+
/**
67+
* copy static assets - i.e. non TypeScript compiled source
68+
*/
69+
gulp.task('copy:assets', function (cb) {
70+
console.log("copying assets");
71+
gulp.src(['app/**/*', 'assets/**/*', 'systemjs.config.js', 'config.js', 'package.json', 'index.html', 'styles.css', '!app/**/*.ts'], { base: './' })
72+
.pipe(gulp.dest('dist'));
73+
cb();
4974
});
5075

51-
// copy static assets - i.e. non TypeScript compiled source
52-
gulp.task('copy:assets', ['clean'], function () {
53-
return gulp.src(['app/**/*', 'assets/**/*', 'systemjs.config.js', 'config.js', 'package.json', 'index.html', 'styles.css', '!app/**/*.ts'], { base: './' })
54-
.pipe(gulp.dest('dist'))
76+
/**
77+
* Watch for changes in TypeScript, HTML and CSS files.
78+
*/
79+
gulp.task('watch', function () {
80+
gulp.src('/**/*', { base: "./" })
81+
.pipe(watch("app/**/*.ts", { base: "./" }))
82+
.pipe(gulp.dest("./dist"));
83+
84+
gulp.src('', { base: "./" })
85+
.pipe(watch(["app/**/*.html", "app/**/*.css", "assets/**/*", "styles.css", "index.html", "bs-config.json", "systemjs.config.js", "tsconfig.json"], { base: "./" }))
86+
.pipe(gulp.dest("./dist"));
87+
});
88+
89+
90+
/**
91+
* The build script
92+
*/
93+
94+
gulp.task('build', function (callback) {
95+
runSequence('clean',
96+
'compile',
97+
['copy:assets', 'copy:libs'],
98+
callback);
5599
});
56100

57-
// install packages in dist, its still dev mode, we will have different folders for dev and prod mode later
58-
gulp.task('copy:dep', ['copy:assets'], function () {
59-
gulp.src(['./dist/package.json'])
60-
.pipe(install());
101+
gulp.task('default', ['build'], function () {
102+
console.log("Building WebCat ...");
61103
});
62104

63-
gulp.task('build', ['copy:dep', 'compile']);
64-
gulp.task('default', ['build']);
65105

66106

67107

index.html

+6-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<meta name="description" content="Web client for TaskCat">
99
<meta name="author" content="NerdCats">
1010
<link rel="shortcut icon" href="assets/img/favicon.png">
11-
<title></title>
11+
<title>Loading ..</title>
1212

1313

1414
<!-- Fonts from Google Fonts -->
@@ -32,11 +32,12 @@
3232
<!-- 1. Load libraries -->
3333
<!-- Polyfill(s) for older browsers -->
3434

35-
<script src="node_modules/es6-shim/es6-shim.min.js"></script>
3635

37-
<script src="node_modules/zone.js/dist/zone.js"></script>
38-
<script src="node_modules/reflect-metadata/Reflect.js"></script>
39-
<script src="node_modules/systemjs/dist/system.src.js"></script>
36+
<script src="lib/es6-shim/es6-shim.min.js"></script>
37+
<script src="lib/zone.js/dist/zone.js"></script>
38+
<script src="lib/reflect-metadata/Reflect.js"></script>
39+
<script src="lib/systemjs/dist/system.src.js"></script>
40+
<script src="lib/systemjs/dist/system-polyfills.js"></script>
4041

4142
<!-- 2. Configure SystemJS -->
4243
<script src="systemjs.config.js"></script>

package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
"name": "webcat",
33
"version": "0.1.0",
44
"scripts": {
5-
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
5+
"clean": "gulp clean",
6+
"compile": "gulp compile",
7+
"build": "gulp build",
8+
"prestart": "npm run build",
9+
"start": "concurrently --kill-others \"gulp watch-folder\" \"lite-server\"",
610
"lite": "lite-server",
711
"postinstall": "typings install",
812
"tsc": "tsc",
@@ -43,7 +47,9 @@
4347
"gulp-sourcemaps": "^1.6.0",
4448
"gulp-tslint": "^5.0.0",
4549
"gulp-typescript": "^2.8.0",
50+
"gulp-watch": "^4.3.6",
4651
"lite-server": "^2.2.0",
52+
"run-sequence": "^1.2.1",
4753
"tslint": "^3.10.2",
4854
"typescript": "^1.8.10",
4955
"typings": "^0.8.1"

systemjs.config.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
// map tells the System loader where to look for things
33
var map = {
44
'app': 'app', // 'dist',
5-
'rxjs': 'node_modules/rxjs',
6-
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
7-
'@angular': 'node_modules/@angular',
8-
'ng2-bootstrap': 'node_modules/ng2-bootstrap',
9-
'moment': 'node_modules/moment',
10-
'ng2-bs3-modal': 'node_modules/ng2-bs3-modal'
5+
'rxjs': 'lib/rxjs',
6+
'angular2-in-memory-web-api': 'lib/angular2-in-memory-web-api',
7+
'@angular': 'lib/@angular',
8+
'ng2-bootstrap': 'lib/ng2-bootstrap',
9+
'moment': 'lib/moment',
10+
'ng2-bs3-modal': 'lib/ng2-bs3-modal'
1111
};
1212

1313
// packages tells the System loader how to load when no filename and/or no extension
1414
var packages = {
1515
'app': { main: 'main.js', defaultExtension: 'js' },
1616
'rxjs': { defaultExtension: 'js' },
17-
'angular2-in-memory-web-api': { defaultExtension: 'js' },
18-
'ng2-bootstrap': { main: 'ng2-bootstrap', defaultExtension: 'js'},
19-
'moment': { main: 'moment', defaultExtension: 'js'},
20-
'ng2-bs3-modal': { main: 'ng2-bs3-modal', defaultExtension: 'js'}
17+
'angular2-in-memory-web-api': { main: 'web-api.js', defaultExtension: 'js' },
18+
'ng2-bootstrap': { main: 'ng2-bootstrap.js', defaultExtension: 'js'},
19+
'moment': { main: 'moment.js', defaultExtension: 'js'},
20+
'ng2-bs3-modal': { main: 'ng2-bs3-modal.js', defaultExtension: 'js'}
2121
};
2222

2323
var packageNames = [

0 commit comments

Comments
 (0)