Comparing version 0.0.6 to 0.0.7
@@ -1,2 +0,1 @@ | ||
var webpackConf = require('./webpack.config.js'); | ||
@@ -7,96 +6,116 @@ | ||
module.exports = function(config) { | ||
config.set({ | ||
config.set({ | ||
// base path that will be used to resolve all patterns (eg. files, exclude) | ||
basePath: '', | ||
// base path that will be used to resolve all patterns (eg. files, exclude) | ||
basePath: '', | ||
// frameworks to use | ||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter | ||
frameworks: [ | ||
'sinon-chai', | ||
'sinon', | ||
'chai', | ||
'mocha' | ||
], | ||
// frameworks to use | ||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter | ||
frameworks: [ | ||
'sinon-chai', | ||
'sinon', | ||
'chai', | ||
'mocha' | ||
], | ||
// list of files / patterns to load in the browser | ||
files: [ | ||
'__tests__/bootstrap.js' | ||
], | ||
// list of files / patterns to load in the browser | ||
files: [ | ||
'__tests__/**/*.spec.js' | ||
], | ||
// list of files to exclude | ||
exclude: [ | ||
], | ||
// list of files to exclude | ||
exclude: [], | ||
// preprocess matching files before serving them to the browser | ||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor | ||
preprocessors: { | ||
'__tests__/bootstrap.js': ['webpack', 'sourcemap'] | ||
}, | ||
// preprocess matching files before serving them to the browser | ||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor | ||
preprocessors: { | ||
'__tests__/**/*.spec.js': ['webpack', 'sourcemap'] | ||
}, | ||
webpack: { | ||
hot: false, | ||
test: true, | ||
devtool: 'inline-source-map', | ||
eslintrcPath: './_test.eslintrc', | ||
module: { | ||
preLoaders: [ | ||
{ test: /\.js$/, loader: 'isparta', exclude: ['__tests__', 'node_modules'] }, | ||
{ test: /\.js$/, loader: 'eslint', exclude: ['node_modules'], } | ||
], | ||
loaders: [ | ||
{ test: /\.js$/, loader: 'babel-loader', exclude: /(node_modules)/ } | ||
] | ||
}, | ||
resolve: { | ||
modulesDirectories: [ | ||
'src', | ||
'node_modules' | ||
], | ||
extensions: ['', '.json', '.js'] | ||
}, | ||
plugins: [], | ||
webpackServer: { | ||
noInfo: true | ||
} | ||
}, | ||
// test results reporter to use | ||
// possible values: 'dots', 'progress' | ||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter | ||
reporters: ['progress', 'coverage'], | ||
webpack: { | ||
hot: false, | ||
test: true, | ||
devtool: 'inline-source-map', | ||
eslintrcPath: './_test.eslintrc', | ||
module: { | ||
preLoaders: [{ | ||
test: /\.js$/, | ||
loader: 'isparta?{babel: {stage: 0}}', | ||
exclude: ['__tests__', 'node_modules'] | ||
}, { | ||
test: /\.js$/, | ||
loader: 'eslint', | ||
exclude: ['node_modules'], | ||
}], | ||
loaders: [{ | ||
test: /\.js$/, | ||
loader: 'babel-loader', | ||
exclude: /(node_modules)/ | ||
}] | ||
}, | ||
resolve: { | ||
modulesDirectories: [ | ||
'src', | ||
'node_modules' | ||
], | ||
extensions: ['', '.json', '.js'] | ||
}, | ||
plugins: [], | ||
webpackServer: { | ||
noInfo: true, | ||
stats: { | ||
assets: false, | ||
hot: true, | ||
colors: true, | ||
version: false, | ||
hash: false, | ||
timings: false, | ||
chunks: false, | ||
chunkModules: false | ||
} | ||
} | ||
}, | ||
// test results reporter to use | ||
// possible values: 'dots', 'progress' | ||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter | ||
reporters: ['progress', 'coverage'], | ||
coverageReporter: { | ||
reporters: [{ | ||
type: 'text' | ||
}, { | ||
type: 'lcovonly', | ||
subdir: '.' | ||
}] | ||
}, | ||
// web server port | ||
port: 9876, | ||
captureTimeout: 60000, | ||
browserNoActivityTimeout: 45000, | ||
coverageReporter: { | ||
reporters: [{ | ||
type: 'text' | ||
}, { | ||
type: 'lcovonly', | ||
subdir: '.' | ||
}] | ||
}, | ||
// web server port | ||
port: 9876, | ||
// If browser does not capture in given timeout [ms], kill it | ||
captureTimeout: 100000, | ||
browserNoActivityTimeout: 30000, | ||
// enable / disable colors in the output (reporters and logs) | ||
colors: true, | ||
// enable / disable colors in the output (reporters and logs) | ||
colors: true, | ||
// level of logging | ||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | ||
logLevel: config.LOG_INFO, | ||
// level of logging | ||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | ||
logLevel: config.LOG_INFO, | ||
// enable / disable watching file and executing tests whenever any file changes | ||
autoWatch: true, | ||
// enable / disable watching file and executing tests whenever any file changes | ||
autoWatch: true, | ||
// Start these browsers, currently available: | ||
// - Chrome | ||
// - ChromeCanary | ||
// - Firefox | ||
// - Opera (has to be installed with `npm install karma-opera-launcher`) | ||
// - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) | ||
// - PhantomJS | ||
// - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) | ||
browsers: ['Chrome'], | ||
// start these browsers | ||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher | ||
browsers: ['Chrome'], | ||
// Continuous Integration mode | ||
// if true, Karma captures browsers, runs the tests and exits | ||
singleRun: true | ||
}); | ||
}; | ||
// Continuous Integration mode | ||
// if true, Karma captures browsers, runs the tests and exits | ||
singleRun: true | ||
}); | ||
}; |
{ | ||
"name": "trolly", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Isomorphic boilerplate for creating libraries. Using Babel 6.x, Webpack, Karma and ESLint", | ||
@@ -29,2 +29,3 @@ "dependencies": {}, | ||
"karma-chrome-launcher": "^0.2.0", | ||
"karma-ie-launcher": "^0.2.0", | ||
"karma-chai": "^0.1.0", | ||
@@ -51,8 +52,6 @@ "karma-webpack": "^1.7.0", | ||
"scripts": { | ||
"prebuild": "rimraf ./dist", | ||
"build": "webpack --no-minimize", | ||
"postbuild": "webpack -p -d", | ||
"build": "rimraf dist && set NODE_ENV=production && webpack --config ./webpack.production.config.js --progress --profile --colors", | ||
"clean": "rm -fr tmp/coverage/javascript/* && rm -fr dist/*", | ||
"start": "nodemon --exec babel-node --stage 0 -- ./src/server.js --compilers js:babel/register", | ||
"coverage": "karma start karma.conf.js", | ||
"coverage": "./node_modules/.bin/karma start karma.conf.js", | ||
"lint": "eslint -c .eslintrc src api", | ||
@@ -64,10 +63,12 @@ "packages": "npm list --depth=0", | ||
"package:upgrade": "npm run package:updates -u", | ||
"karma": "karma start", | ||
"karma:browser": "karma start --single-run", | ||
"karma": "./node_modules/.bin/karma start", | ||
"karma:browser": "./node_modules/.bin/karma start --single-run", | ||
"karma:firefox": "npm run karma -- --browsers=Firefox", | ||
"karma:chrome": "npm run karma -- --browsers=Chrome", | ||
"karma:ie": "npm run karma -- --browsers=IE", | ||
"karma:legacy": "karma start karma.conf.legacy.js", | ||
"karma:server": "npm run karma -- --browsers=PhantomJS", | ||
"karma:watch": "npm run karma -- --auto-watch --no-single-run", | ||
"mocha:browser": "webpack-dev-server --config webpack.mocha.config.js --progress --colors --hot --inline ", | ||
"mocha:server": "mocha ./__tests__/bootstrap.js --compilers js:babel-core/register --reporter spec --timeout 15000 --bail --require ./__tests__/setup/bootstrap.js", | ||
"mocha:server": "mocha ./__tests__/**/*.spec.js --compilers js:babel-core/register --reporter spec --timeout 15000 --bail --require ./__tests__/setup/bootstrap.js", | ||
"mocha:watch": "npm run mocha:server -- -watch" | ||
@@ -74,0 +75,0 @@ |
@@ -1,2 +0,2 @@ | ||
# A isomorphic boilerplate written in ES2015 for Node and the browser. | ||
# Isomorphic boilerplate written in ES2015 for Node and the browser. | ||
@@ -7,2 +7,4 @@ [![Travis Status][trav_img]][trav_site] | ||
> A boilerplate for creating isomorphic libraries using Babel, Webpack, Mocha, Chai, Karma, Isparta, and ESLint | ||
## Features | ||
@@ -14,8 +16,6 @@ | ||
* Webpack for bundling | ||
* Webpack Dev Middleware | ||
* Webpack Hot Middleware | ||
* Eslint to maintain a consistent code style | ||
* UMD pattern, which provides compatibility with the most popular script loaders, to the output. | ||
* Coverage report | ||
* Support NodeJS v. 4.x LTS and the *stable* branch ( v.5x) | ||
* Isparta for coverage report | ||
* Node >= 4.x | ||
@@ -32,13 +32,16 @@ ## Basic guide | ||
* `npm run build` - Build task that generates minified scripts | ||
* `npm run lint` - Lint the source and unit tests | ||
* `npm run build` - Build a production version of the library | ||
* `npm run postbuild` - Build a development version of the library | ||
* `npm run dev-server` - Run the development server ( port 5000) | ||
* `npm run test:browser` - Runs the unit tests with karma and Chrome | ||
* `npm run karma:server` - Runs the unit tests with karma and PhantomJS | ||
* `npm run karma:watch` - Runs the unit tests with karma tests and continuously run the unit tests as you make changes to the source and test files themselves | ||
* `npm run clean` - Remove the coverage report and the *dist* folder | ||
* `npm run test:browser` - Runs the unit tests with karma and Chrome once | ||
* `npm run test:chrome` - Runs the unit tests with karma and Chrome once | ||
* `npm run test:firefox` - Runs the unit tests with karma and Firefox once | ||
* `npm run test:firefox` - Runs the unit tests with karma and Internet Explorer once | ||
* `npm run test:legacy` - Runs the unit tests with karma and Internet Explorer 9.0 once | ||
* `npm run karma:server` - Runs the unit tests with karma and PhantomJS once | ||
* `npm run karma:watch` - Run Karma tests & watch files for changes | ||
* `npm run mocha:browser` - Runs the unit tests together with the spec runner ( open port 8080 in the browser) | ||
* `npm run mocha:server` - Runs the unit tests on the server | ||
* `npm run mocha:watch` - Runs the unit tests on the server, and continuously run the unit tests as you make changes to the source and test files themselves | ||
* `npm run coverage` - Generate a coverage report | ||
* `npm run mocha:server` - Runs the unit tests on the server once | ||
* `npm run mocha:watch` - Run Mocha tests & watch files for changes | ||
* `npm run coverage` - Run Isparta, a code coverage tool; | ||
* `npm run packages` - Shows all installed dependencies | ||
@@ -60,3 +63,3 @@ * `npm run package:purge` - Remove all dependencies | ||
The browser spec runner can be opened in a browser to run your tests. For it to work, you must first run `npm run mocha:server`, and | ||
The browser spec runner can be opened in a browser to run your tests. For it to work, you must first run `npm run mocha:browser`, and | ||
then open port 8080 in your browser. Example: `localhost::8080` | ||
@@ -82,6 +85,4 @@ | ||
This boilerplate is easily customizable. Add your dependencies to the package.json file, and adjsut the `webpack` section inside the `karma.config.js` after your own needs. | ||
This boilerplate is easily customizable. Add your dependencies to the package.json file, and modify either the webpack config files or the karma files itself. | ||
Do not set anything inside the `webpack.config`. Everything are maintained by `karma`. | ||
[trav_img]: https://api.travis-ci.org/Kflash/trolly.svg | ||
@@ -98,3 +99,5 @@ [trav_site]: https://travis-ci.org/Kflash/trolly.svg?branch=master | ||
## License | ||
MIT © [Kenny Flashlight](https://github.com/kflash) | ||
const webpack = require('webpack'); | ||
const path = require('path'); | ||
const minimize = process.argv.indexOf('--no-minimize') === -1 ? true : false; | ||
const plugins = []; | ||
if (minimize) { | ||
plugins = [ | ||
// optimizations | ||
new webpack.optimize.DedupePlugin(), | ||
new webpack.optimize.OccurenceOrderPlugin(), | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compress: { | ||
warnings: false | ||
}, | ||
minimize: true | ||
}) | ||
] | ||
} | ||
module.exports = { | ||
entry: path.join(__dirname, 'src'), | ||
cache: true, | ||
debug: minimize ? false : true, | ||
devtool: 'source-map', | ||
output: { | ||
path: path.join(__dirname, 'dist'), | ||
filename: minimize ? 'trolly.min.js' : 'trolly.js', | ||
filename: 'trolly.js', | ||
libraryTarget: 'umd', | ||
library: 'trolly', | ||
publicPath: 'http://localhost:8080/' | ||
library: 'trolly' | ||
}, | ||
@@ -41,3 +21,3 @@ module: { | ||
}, | ||
plugins: plugins | ||
plugins: [] | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
188711
48
3950
98
0
39