Skip to content

Commit

Permalink
Merge pull request #4 from b091/feature/node4
Browse files Browse the repository at this point in the history
Feature/node4
  • Loading branch information
b091 committed Sep 23, 2015
2 parents 8ba14a0 + 5a44ca6 commit fe2422e
Show file tree
Hide file tree
Showing 16 changed files with 80 additions and 95 deletions.
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"quotmark": "single",
"undef": true,
"unused": true,
"strict": true,
"strict": false,
"trailing": true,
"smarttabs": true,
"expr": true,
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: node_js

node_js:
- '0.12'
- '4.1.1'

before_install:
- npm install --quiet -g gulp jspm typescript tsd
Expand Down
7 changes: 3 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use strict';
var gulp = require('gulp');
var path = require('path');
const gulp = require('gulp');
const path = require('path');

var config = {
const config = {
projectDir: __dirname,
configDir: path.join(__dirname, 'config'),
taskDir: path.join(__dirname, 'tasks'),
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"typescript": "^1.6.2"
},
"engines": {
"node": ">=0.12.0"
"node": ">=4.1.1"
},
"scripts": {
"test": "gulp test",
Expand All @@ -60,7 +60,7 @@
"angular-messages": "github:angular/bower-angular-messages@^1.4.3",
"angular-resource": "github:angular/bower-angular-resource@^1.4.3",
"angular-sanitize": "github:angular/bower-angular-sanitize@^1.4.3",
"angular-toastr": "github:Foxandxss/angular-toastr@^1.4.1",
"angular-toastr": "github:Foxandxss/angular-toastr@^1.5.0",
"angular-translate": "github:angular-translate/bower-angular-translate@^2.7.2",
"angular-translate-loader-static-files": "github:angular-translate/bower-angular-translate-loader-static-files@^2.7.2",
"angular-translate-loader-url": "github:angular-translate/bower-angular-translate-loader-url@^2.7.2",
Expand Down
31 changes: 15 additions & 16 deletions tasks/build.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
'use strict';
module.exports = function(gulp, config) {
return function() {
var path = require('path');
var replace = require('gulp-replace');
var appName = require(path.join(config.projectDir, 'package.json')).name;
var Builder = require('jspm').Builder;
module.exports = (gulp, config) => {
return () => {
const path = require('path');
const replace = require('gulp-replace');
const appName = require(path.join(config.projectDir, 'package.json')).name;
const Builder = require('jspm').Builder;

var builder = new Builder();
var distFileName = appName + '.min.js';
var outFile = path.join(config.distDir, distFileName);
const builder = new Builder();
const distFileName = appName + '.min.js';
const outFile = path.join(config.distDir, distFileName);

builder.reset();
builder.loadConfig(path.join(config.projectDir, 'jspm.conf.js'))
.then(function() {
var moduleName = 'app';
var buildConfig = {
.then(() => {
const moduleName = 'app';
const buildConfig = {
format: 'amd',
minify: true,
sourceMaps: true
};
return builder.buildStatic(moduleName, outFile, buildConfig);
})
.then(function() {
var mapFile = outFile + '.map';
.then(() => {
const mapFile = outFile + '.map';
// Walk around for babel issue
// https://github.com/babel/babel/issues/1567
gulp.src(mapFile, {base: config.distDir})
.pipe(replace(config.distDir, '.'))
.pipe(gulp.dest(config.distDir));
console.log('Build complete');
})
.catch(function(err) {
.catch((err) => {
console.log('Build Failed', err);
});
};
Expand Down
9 changes: 4 additions & 5 deletions tasks/clean.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use strict';
module.exports = function(gulp, dir) {
return function() {
var del = require('del');
var path = require('path');
module.exports = (gulp, dir) => {
return () => {
const del = require('del');
const path = require('path');

return del([
path.join(dir, '**', '*.js'),
Expand Down
20 changes: 9 additions & 11 deletions tasks/compile.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
'use strict';
module.exports = function(gulp, src) {
module.exports = (gulp, src) => {

function runTSC(directory, done) {
var cp = require('child_process');
var path = require('path');
const cp = require('child_process');
const path = require('path');
const tscJs = path.join(process.cwd(), 'node_modules/typescript/bin/tsc');
const childProcess = cp.spawn('node', [tscJs, '-p', directory], {cwd: process.cwd()});

var tscJs = path.join(process.cwd(), 'node_modules/typescript/bin/tsc');
var childProcess = cp.spawn('node', [tscJs, '-p', directory], {cwd: process.cwd()});

childProcess.stdout.on('data', function(data) {
childProcess.stdout.on('data', (data) => {
console.log(data.toString());
});
childProcess.stderr.on('data', function(data) {
childProcess.stderr.on('data', (data) => {
console.log(data.toString());
});
childProcess.on('close', function() {
childProcess.on('close', () => {
done();
});
}

return function(done) {
return (done) => {
return runTSC(src, done);
};
};
8 changes: 3 additions & 5 deletions tasks/default.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict';
module.exports = function() {
return function() {
var runSequence = require('run-sequence');
return runSequence('check', 'compile', 'test:unit', 'test:e2e', function() {
module.exports = () => {
return () => {
return require('run-sequence')('check', 'compile', 'test:unit', 'test:e2e', () => {
console.log('Done');
});
};
Expand Down
9 changes: 4 additions & 5 deletions tasks/e2e.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use strict';
module.exports = function(gulp, config) {
return function() {
var protractor = require('gulp-protractor').protractor;
var path = require('path');
module.exports = (gulp, config) => {
return () => {
const protractor = require('gulp-protractor').protractor;
const path = require('path');

return gulp.src([path.join(config.testDir, 'e2e/*.js')])
.pipe(protractor({
Expand Down
19 changes: 9 additions & 10 deletions tasks/jshint.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
'use strict';
module.exports = function(gulp, config) {
return function() {
var jsHint = require('gulp-jshint');
var path = require('path');
module.exports = (gulp, config) => {
return () => {
const jsHint = require('gulp-jshint');
const path = require('path');

return gulp.src([
path.join(config.configDir, '**', '*.js'),
'!' + path.join(config.projectDir, 'jspm.conf.js'),
path.join(config.taskDir, '**', '*.js'),
'gulpfile.js'
])
path.join(config.configDir, '**', '*.js'),
'!' + path.join(config.projectDir, 'jspm.conf.js'),
path.join(config.taskDir, '**', '*.js'),
'gulpfile.js'
])
.pipe(jsHint(path.join(config.projectDir, '.jshintrc')))
.pipe(jsHint.reporter(require('jshint-stylish')));
};
Expand Down
9 changes: 4 additions & 5 deletions tasks/ngannotate.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use strict';
module.exports = function(gulp, config) {
return function() {
var ngAnnotate = require('gulp-ng-annotate');
var path = require('path');
module.exports = (gulp, config) => {
return () => {
const ngAnnotate = require('gulp-ng-annotate');
const path = require('path');

return gulp.src(path.join(config.srcDir, '**', '*.js'))
.pipe(ngAnnotate())
Expand Down
9 changes: 4 additions & 5 deletions tasks/ngdirectives.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use strict';
module.exports = function(gulp, config) {
return function() {
var directiveReplace = require('gulp-directive-replace');
var path = require('path');
module.exports = (gulp, config) => {
return () => {
const directiveReplace = require('gulp-directive-replace');
const path = require('path');

return gulp.src(path.join(config.srcDir, '**', '*.js'))
.pipe(directiveReplace())
Expand Down
13 changes: 6 additions & 7 deletions tasks/server.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
'use strict';
module.exports = function(gulp, serverRootDir, watchDir, openBrowser) {
module.exports = (gulp, serverRootDir, watchDir, openBrowser) => {
var fs = require('fs');

return function() {
var path = require('path');
var portFinder = require('portfinder');
var webServer = require('gulp-webserver');
return () => {
const path = require('path');
const portFinder = require('portfinder');
const webServer = require('gulp-webserver');
openBrowser = typeof openBrowser !== 'undefined' ? openBrowser : true;

if (shouldWatchTypeScript() && liveReload()) {
Expand All @@ -17,7 +16,7 @@ module.exports = function(gulp, serverRootDir, watchDir, openBrowser) {

return portFinder.getPort({
host: 'localhost'
}, function runServer(err, port) {
}, (err, port) => {
gulp.src([serverRootDir])
.pipe(webServer({
livereload: {
Expand Down
9 changes: 4 additions & 5 deletions tasks/test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use strict';
module.exports = function(dir) {
return function(done) {
var path = require('path');
var Server = require('karma').Server;
module.exports = (dir) => {
return (done) => {
const path = require('path');
const Server = require('karma').Server;

new Server({
configFile: path.join(dir, 'karma.conf.js')
Expand Down
9 changes: 4 additions & 5 deletions tasks/tslint.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use strict';
module.exports = function(gulp, directory, configuration) {
return function() {
var path = require('path');
var tslint = require('gulp-tslint');
module.exports = (gulp, directory, configuration) => {
return () => {
const path = require('path');
const tslint = require('gulp-tslint');

return gulp.src([
path.join(directory, '**', '*.ts'),
Expand Down
15 changes: 7 additions & 8 deletions tasks/typedoc.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
'use strict';
module.exports = function(gulp, config) {
return function() {
var path = require('path');
var typeDoc = require('gulp-typedoc');
var appName = require(path.join(config.projectDir, 'package.json')).name;
var tsConfig = require(path.join(config.srcDir, 'tsconfig.json'));
module.exports = (gulp, config) => {
return () => {
const path = require('path');
const typeDoc = require('gulp-typedoc');
const appName = require(path.join(config.projectDir, 'package.json')).name;
const tsConfig = require(path.join(config.srcDir, 'tsconfig.json'));
const compilerOptions = tsConfig.compilerOptions;

var compilerOptions = tsConfig.compilerOptions;
delete(compilerOptions.sourceMap);
compilerOptions.out = config.docsDir;
compilerOptions.name = appName;
Expand Down

0 comments on commit fe2422e

Please sign in to comment.