-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d60bf7
commit cb7d51f
Showing
199 changed files
with
4,378 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,4 +34,4 @@ jspm_packages | |
.npm | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
.node_repl_history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# AppVeyor file | ||
# http://www.appveyor.com/docs/appveyor-yml | ||
# This file: cloned from https://github.com/gruntjs/grunt/blob/master/appveyor.yml | ||
|
||
# Build version format | ||
version: "{build}" | ||
|
||
# Test against this version of Node.js | ||
environment: | ||
nodejs_version: "5.5.0" | ||
|
||
build: off | ||
|
||
clone_depth: 10 | ||
|
||
# Fix line endings on Windows | ||
init: | ||
- git config --global core.autocrlf true | ||
|
||
install: | ||
- ps: Install-Product node $env:nodejs_version | ||
- npm install -g npm | ||
- ps: $env:path = $env:appdata + "\npm;" + $env:path | ||
- npm install | ||
|
||
test_script: | ||
# Output useful info for debugging. | ||
- node --version && npm --version | ||
- node -e 'console.log(process.env);' | ||
# We test multiple Windows shells because of prior stdout buffering issues | ||
# filed against Grunt. https://github.com/joyent/node/issues/3584 | ||
- ps: "npm test # PowerShell" # Pass comment to PS for easier debugging | ||
- cmd: npm test | ||
|
||
cache: | ||
- node_modules -> package.json # local npm modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* THIS FILE IS GENERATED by `gulp env` command from `env.json` | ||
* Generated on <%= new Date() %> | ||
* | ||
* Make sure the keys in `env.model.ts` exist in `env.json` | ||
* otherwise it'll throw message like this | ||
* Property '<missing-key>' is missing in type '{}' | ||
* | ||
* Feel free to modify for direct updates in development | ||
*/ | ||
|
||
import { AppEnv } from './env.model'; | ||
|
||
export const ENV: AppEnv = {<% _.forEach(env, function(v, k) { %> | ||
<%= k %>: <%= _.isString(v) ? "\'"+v+"\'" : v %>,<% }) %> | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
var envConfig = require('./utils/env'); | ||
|
||
module.exports = function () { | ||
var root = '', | ||
src = root + 'src/', | ||
config = root + 'config/', | ||
app = src + 'app/', | ||
test = src + 'test/', | ||
tmp = src + 'tmp/', | ||
tmpApp = tmp + 'app/', | ||
tmpTest = tmp + 'test/', | ||
testHelper = test + 'test-helpers/', | ||
e2e = root + 'e2e/', | ||
assets = src + 'assets/', | ||
assetsPath = { | ||
styles: assets + 'styles/', | ||
images: assets + 'images/', | ||
fonts: assets + 'fonts/' | ||
}, | ||
index = src + 'index.html', | ||
tsFiles = [ | ||
app + '**/!(*.spec)+(.ts)' | ||
], | ||
tsTestFiles = { | ||
unit: [app + '**/*.spec.ts'], | ||
e2e: [e2e + '**/*.ts'], | ||
helper: [testHelper + '**/*.ts'] | ||
}, | ||
build = { | ||
path: 'build/', | ||
app: 'build/app/', | ||
fonts: 'build/fonts', | ||
assetPath: 'build/assets/', | ||
assets: { | ||
lib: { | ||
js: 'lib.js', | ||
css: 'lib.css' | ||
} | ||
} | ||
}, | ||
report = { | ||
path: 'report/' | ||
}; | ||
|
||
var e2eConfig = { | ||
seleniumTarget: 'http://127.0.0.1:3000' | ||
}; | ||
|
||
var systemJs = { | ||
builder: { | ||
normalize: true, | ||
minify: true, | ||
mangle: true, | ||
runtime: false, | ||
globalDefs: { | ||
DEBUG: false, | ||
ENV: 'production' | ||
} | ||
} | ||
}; | ||
|
||
var gulpConfig = { | ||
root: root, | ||
config: config, | ||
src: src, | ||
app: app, | ||
test: test, | ||
tmp: tmp, | ||
tmpApp: tmpApp, | ||
tmpTest: tmpTest, | ||
testHelper: testHelper, | ||
e2e: e2e, | ||
e2eConfig: e2eConfig, | ||
assets: assets, | ||
index: index, | ||
build: build, | ||
report: report, | ||
assetsPath: assetsPath, | ||
tsFiles: tsFiles, | ||
tsTestFiles: tsTestFiles, | ||
systemJs: systemJs | ||
}; | ||
|
||
if (envConfig.ENV === envConfig.ENVS.DEV) | ||
{ | ||
var historyApiFallback = require('connect-history-api-fallback'); | ||
var browserSync = { | ||
dev: { | ||
port: 3000, | ||
injectChanges: false, | ||
server: { | ||
baseDir: './src/', | ||
middleware: [historyApiFallback()], | ||
routes: { | ||
"/node_modules": "node_modules", | ||
"/src": "src" | ||
} | ||
}, | ||
files: [ | ||
src + "index.html", | ||
src + "systemjs.conf.js", | ||
assetsPath.styles + "main.css", | ||
tmpApp + "**/*.js", | ||
app + "**/*.css", | ||
app + "**/*.html" | ||
] | ||
}, | ||
prod: { | ||
port: 3001, | ||
server: { | ||
baseDir: './' + build.path, | ||
middleware: [historyApiFallback()] | ||
} | ||
} | ||
}; | ||
|
||
gulpConfig.browserSync = browserSync; | ||
} | ||
|
||
return gulpConfig; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
var gulp = require('gulp'); | ||
var util = require('gulp-util'); | ||
var runSequence = require('run-sequence'); | ||
var config = require('../config')(); | ||
var useref = require('gulp-useref'); | ||
var gulpif = require('gulp-if'); | ||
var rev = require('gulp-rev'); | ||
var revReplace = require('gulp-rev-replace'); | ||
var uglify = require('gulp-uglify'); | ||
var cssnano = require('gulp-cssnano'); | ||
var gulpTemplate = require('gulp-template'); | ||
var flatten = require('gulp-flatten'); | ||
|
||
var envVars = require('../utils/env-vars'); | ||
|
||
require('@ngstarter/systemjs-extension')(config); | ||
|
||
gulp.task('build', function (done) { | ||
runSequence('test', 'build-systemjs', 'build-assets', done); | ||
}); | ||
|
||
/* Concat and minify/uglify all css, js, and copy fonts */ | ||
gulp.task('build-assets', function (done) { | ||
runSequence('clean-build', ['sass', 'fonts'], function () { | ||
gulp.src(config.app + '**/*.html') | ||
.pipe(flatten()) | ||
.pipe(gulp.dest(config.build.path)); | ||
|
||
gulp.src(config.app + '**/*.css') | ||
.pipe(cssnano({zindex: false})) | ||
.pipe(flatten()) | ||
.pipe(gulp.dest(config.build.path)); | ||
|
||
gulp.src(config.src + 'favicon.ico') | ||
.pipe(gulp.dest(config.build.path)); | ||
|
||
gulp.src(config.assetsPath.images + '**/*.*', { | ||
base: config.assetsPath.images | ||
}) | ||
.pipe(gulp.dest(config.build.assetPath + 'images')); | ||
|
||
gulp.src(config.index) | ||
.pipe(useref()) | ||
.pipe(gulpif('assets/lib.js', uglify())) | ||
.pipe(gulpif('*.css', cssnano())) | ||
.pipe(gulpif('!*.html', rev())) | ||
.pipe(revReplace()) | ||
.pipe(gulp.dest(config.build.path)) | ||
.on('finish', done); | ||
}); | ||
}); | ||
|
||
/* Copy fonts in packages */ | ||
gulp.task('fonts', function () { | ||
gulp.src(config.assetsPath.fonts + '**/*.*', { | ||
base: config.assetsPath.fonts | ||
}) | ||
.pipe(gulp.dest(config.build.fonts)); | ||
|
||
gulp.src([ | ||
'node_modules/font-awesome/fonts/*.*' | ||
]) | ||
.pipe(gulp.dest(config.build.fonts)); | ||
}); | ||
|
||
gulp.task('env', function () { | ||
return gulp.src(config.config + 'env/env.ts') | ||
.pipe(gulpTemplate({ | ||
env: envVars || {} | ||
})) | ||
.pipe(gulp.dest(config.app + 'shared/constant')) | ||
.on('finish', function () { | ||
util.log(config.app + 'shared/constant/env.ts is generated successfully'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
var gulp = require('gulp'); | ||
var config = require('../config')(); | ||
var del = require('del'); | ||
|
||
/* Run all clean tasks */ | ||
gulp.task('clean', ['clean-build', 'clean-report', 'clean-ts']); | ||
|
||
/* Clean build folder */ | ||
gulp.task('clean-build', function () { | ||
return del([config.build.path]); | ||
}); | ||
|
||
/* Clean report folder */ | ||
gulp.task('clean-report', function () { | ||
return del([config.report.path]); | ||
}); | ||
|
||
/* Clean js and map */ | ||
gulp.task('clean-ts', function () { | ||
return del([config.tmp]); | ||
}); | ||
|
||
gulp.task('clean-ts-app', function () { | ||
return del([config.tmpApp]); | ||
}); | ||
|
||
gulp.task('clean-ts-test', function () { | ||
return del([config.tmpTest]); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
var gulp = require('gulp'); | ||
var path = require('path'); | ||
|
||
var config = require('../config')(); | ||
|
||
gulp.task('html', function () { | ||
return gulp.src(config.app + '**/*.html') | ||
.pipe(gulp.dest(config.tmpApp)); | ||
}); | ||
|
||
gulp.task('watch-html', function () { | ||
gulp.watch(config.app + '**/*.html', function(file) { | ||
var des = convertToTmpPath(file); | ||
|
||
return gulp.src(file.path) | ||
.pipe(gulp.dest(path.dirname(des))); | ||
}); | ||
}); | ||
|
||
gulp.task('css', function () { | ||
return gulp.src(config.app + '**/*.css') | ||
.pipe(gulp.dest(config.tmpApp)); | ||
}); | ||
|
||
gulp.task('watch-css', function () { | ||
gulp.watch(config.app + '**/*.css', function(file) { | ||
var des = convertToTmpPath(file); | ||
|
||
return gulp.src(file.path) | ||
.pipe(gulp.dest(path.dirname(des))); | ||
}); | ||
}); | ||
|
||
function convertToTmpPath(file) { | ||
var unixPath = file.path.replace(/\\/g, "/"); | ||
return unixPath.replace(/src\/app\//, config.tmpApp); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var gulp = require('gulp'); | ||
var sass = require('gulp-sass'); | ||
var config = require('../config')(); | ||
|
||
gulp.task('sass', function () { | ||
return gulp.src(config.assetsPath.styles + 'main.scss') | ||
.pipe(sass().on('error', sass.logError)) | ||
.pipe(gulp.dest(config.assetsPath.styles)); | ||
}); | ||
|
||
gulp.task('watch-sass', function () { | ||
gulp.watch(config.assetsPath.styles + '**/*.scss', ['sass']); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
var runSequence = require('run-sequence'); | ||
|
||
var envConfig = require('../utils/env'); | ||
|
||
if (envConfig.ENV === envConfig.ENVS.DEV) | ||
{ | ||
var gulp = require('gulp'); | ||
var config = require('../config')(); | ||
var bs = require("browser-sync"); | ||
|
||
function startBrowsersync (config) | ||
{ | ||
bsIns = bs.create(); | ||
bsIns.init(config); | ||
bsIns.reload(); | ||
} | ||
|
||
/* Start live server dev mode */ | ||
gulp.task('serve-dev', function () | ||
{ | ||
runSequence( | ||
['sass', 'tsc-app'], | ||
['html', 'css'], | ||
['watch-sass', 'watch-ts', 'watch-html', 'watch-css'], function() { | ||
startBrowsersync(config.browserSync.dev); | ||
}); | ||
}); | ||
|
||
/* Start live server production mode */ | ||
gulp.task('serve-build', ['build'], function () | ||
{ | ||
startBrowsersync(config.browserSync.prod); | ||
}); | ||
} |
Oops, something went wrong.