Skip to content

Commit

Permalink
feat(webpack): Add support for webpack
Browse files Browse the repository at this point in the history
Also changed code style to use npm standard package to lint js - this is non-configurable and does not allow semicolons.
  • Loading branch information
dalelotts committed Sep 12, 2016
1 parent 54bafe7 commit b8299ea
Show file tree
Hide file tree
Showing 13 changed files with 840 additions and 769 deletions.
8 changes: 0 additions & 8 deletions .jscsrc

This file was deleted.

140 changes: 66 additions & 74 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,88 +1,80 @@
/*globals require, __dirname */
/* globals require, __dirname */
/* jshint node:true */
'use strict';
'use strict'

var gulp = require('gulp');
var jscs = require('gulp-jscs');
var jshint = require('gulp-jshint');
var karmaConfig = __dirname + '/karma.conf.js';
var lodash = require('lodash');
var paths = require('./paths');
var plato = require('plato');
var Server = require('karma').Server;
var gulp = require('gulp')
var lodash = require('lodash')
var path = require('path')
var paths = require('./paths')
var plato = require('plato')
var Server = require('karma').Server
var standard = require('gulp-standard')

gulp.task('clean', function () {

var del = require('del');
return del([
'build'
]);
});
var karmaConfig = path.join(__dirname, 'karma.conf.js')

gulp.task('default', ['clean:mobile']);
gulp.task('clean', function () {
var del = require('del')
return del([
'build'
])
})

gulp.task('complexity', function (done) {
var callback = function () {
done()
}

var callback = function () {
done();
};

plato.inspect(paths.lint, 'build/complexity', {title: 'prerender', recurse: true}, callback);
});

gulp.task('jscs', function () {
return gulp
.src(paths.lint)
.pipe(jscs('.jscsrc'));
});
plato.inspect(paths.lint, 'build/complexity', {title: 'prerender', recurse: true}, callback)
})

gulp.task('lint', function () {
return gulp
.src(paths.lint)
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('default', {verbose: true}))
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'));
});

var testConfig = function (options) {
var travisOptions = process.env.TRAVIS &&
{
browsers: ['Firefox'],
reporters: ['dots', 'coverage', 'threshold']
};

return lodash.assign(options, travisOptions);
};
return gulp
.src(paths.lint)
.pipe(standard())
.pipe(standard.reporter('default', {
breakOnError: true,
quiet: true
}))
})

gulp.task('tdd', function (done) {
gulp.watch(paths.all, ['jscs', 'lint']);

var config = testConfig(
{
autoWatch: true,
browsers: ['PhantomJS'],
configFile: karmaConfig,
singleRun: false
}
);
gulp.watch(paths.all, ['jscs', 'lint'])

var config = testConfig(
{
autoWatch: true,
browsers: ['PhantomJS'],
configFile: karmaConfig,
singleRun: false
}
)

var server = new Server(config, done)
server.start()
})

gulp.task('test', ['lint'], function (done) {
var config = testConfig(
{
configFile: karmaConfig,
singleRun: true,
reporters: ['progress', 'coverage', 'threshold']
}
)

var server = new Server(config, done)
server.start()
})

gulp.task('default', ['complexity', 'test'])

var server = new Server(config, done);
server.start();
});

gulp.task('test', ['jscs', 'lint'], function (done) {

var config = testConfig(
{
configFile: karmaConfig,
singleRun: true,
reporters: ['progress', 'coverage', 'threshold']
}
);
var testConfig = function (options) {
var travisDefaultOptions = {
browsers: ['Firefox'],
reporters: ['dots', 'coverage', 'threshold']
}

var server = new Server(config, done);
server.start();
});
var travisOptions = process.env.TRAVIS && travisDefaultOptions

gulp.task('default', ['complexity', 'test']);
return lodash.assign(options, travisOptions)
}
20 changes: 6 additions & 14 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*globals require */
/* globals require */
/* jshint node:true */

/**
Expand All @@ -13,11 +13,11 @@
* @since 7/21/13
*/


var paths = require('./paths');
var paths = require('./paths')

module.exports = function (config) {
'use strict';
'use strict'

config.set({

frameworks: ['jasmine'],
Expand Down Expand Up @@ -53,7 +53,6 @@ module.exports = function (config) {
// possible values: 'dots', 'progress', 'junit'
reporters: ['progress', 'coverage'],


// the configure thresholds
thresholdReporter: {
statements: 100,
Expand All @@ -65,24 +64,19 @@ module.exports = function (config) {
// web server port
port: 9876,


// cli runner port
runnerPort: 9100,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,


// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
Expand All @@ -93,13 +87,11 @@ module.exports = function (config) {
// - IE (only Windows)
browsers: ['PhantomJS'],


// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,


// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
});
};
})
}
34 changes: 19 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,40 @@
"angular-mocks": "^1.x",
"coveralls": "^2.11.6",
"cz-conventional-changelog": "^1.1.5",
"eslint": "^2.2.0",
"grunt-bump": "^0.7.0",
"eslint": "^3.5.0",
"grunt-bump": "^0.8.0",
"gulp": "^3.8.11",
"gulp-htmlmin": "^1.3.0",
"gulp-jscs": "^3.0.2",
"gulp-htmlmin": "^2.0.0",
"gulp-jscs": "^4.0.0",
"gulp-jshint": "^2.0.0",
"gulp-standard": "^8.0.2",
"jasmine-core": "^2.4.1",
"jquery": "^2.2.0",
"jquery": "^3.1.0",
"jshint": "^2.9.1",
"jshint-stylish": "^2.1.0",
"karma": "^0.13.21",
"karma-chrome-launcher": "^0.2.2",
"karma-coverage": "^0.5.3",
"karma-firefox-launcher": "^0.1.7",
"karma-jasmine": "^0.3.7",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "^1.0.0",
"karma-jasmine": "^1.0.2",
"karma-phantomjs-launcher": "^1.0.0",
"karma-threshold-reporter": "^0.1.12",
"karma-webpack": "^1.8.0",
"lodash": "^4.5.0",
"phantomjs-prebuilt": "^2.1.4",
"plato": "^1.5.0",
"run-browser": "^2.0.2",
"semantic-release": "^6.2.0",
"standard": "^6.0.7",
"tape": "^4.4.0"
"semantic-release": "^6.3.0",
"standard": "^8.0.0",
"tape": "^4.4.0",
"webpack": "^1.13.2"
},
"scripts": {
"test": "npm run test-browserify && gulp",
"coverage:upload": "cat build/coverage/lcov.info | coveralls",
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
"test": "npm run test-browserify && npm run test-webpack && gulp",
"test-browserify": "run-browser test/commonjs/browserify.test.js -b",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
"test-webpack": "karma start test/webpack/karma.conf.js"
},
"repository": {
"type": "git",
Expand Down
18 changes: 9 additions & 9 deletions paths.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/* jshint node:true */

var bower = [
var nodeModules = [
'node_modules/jquery/dist/jquery.js',
'node_modules/moment/moment.js',
'node_modules/angular/angular.js',
'node_modules/angular-mocks/angular-mocks.js'
];
var bumpFiles = ['package.json', 'bower.json', 'README.md', 'src/js/*.js'];
var miscFiles = ['GruntFile.js', 'gulpfile.js', 'karma.conf.js', 'paths.js'];
var demoFiles = [];
var sourceFiles = ['src/**/*.js'];
var testFiles = ['test/**/*.spec.js'];
]
var bumpFiles = ['package.json', 'bower.json', 'README.md', 'src/js/*.js']
var miscFiles = ['GruntFile.js', 'gulpfile.js', 'karma.conf.js', 'paths.js']
var demoFiles = []
var sourceFiles = ['src/**/*.js']
var testFiles = ['test/**/*.spec.js']

module.exports = {
all: bower.concat(sourceFiles).concat(testFiles).concat(demoFiles),
all: nodeModules.concat(sourceFiles).concat(testFiles).concat(demoFiles),
app: sourceFiles,
bump: bumpFiles,
lint: miscFiles.concat(sourceFiles).concat(testFiles).concat(miscFiles),
src: sourceFiles,
test: testFiles
};
}
Loading

0 comments on commit b8299ea

Please sign in to comment.