Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

Commit

Permalink
chore(build): Update build configs.
Browse files Browse the repository at this point in the history
  • Loading branch information
treshugart committed Jun 21, 2016
1 parent efb428a commit eb2af23
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 313 deletions.
93 changes: 1 addition & 92 deletions karma.conf.js
@@ -1,92 +1 @@
const webpackConfig = require('./webpack.config');
const sauceBrowsers = require('./sauce.browsers');

module.exports = function (config) {
// list of files / patterns to load in the browser
// all dependancies should be traced through here
var files = ['test/unit.js'];

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
// webpack will trace and watch all dependancies
var preprocessors = {
'test/unit.js': [ 'webpack', 'sourcemap' ]
};

if (process.argv.indexOf('--perf') > -1) {
files = [ require.resolve('../benchmark/benchmark.js'), 'test/perf.js' ];
preprocessors = {
'test/perf.js': [ 'webpack', 'sourcemap' ]
};
}

config.set(Object.assign({
// base path that will be used to resolve all patterns (eg. files, exclude)
// setting to process.cwd will make all paths start in current component directory
basePath: process.cwd(),

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: [ 'mocha', 'chai', 'sinon-chai' ],

// list of files / patterns to load in the browser
files: files,

// list of files to exclude
exclude: [],

// list of preprocessors
preprocessors: preprocessors,

// karma watches the test entry points
// (you don't need to specify the entry option)
// webpack watches dependencies
webpack: Object.assign({}, webpackConfig, {
devtool: 'inline-source-map',
entry: undefined
}),

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: [ 'progress' ],

// web server port
port: 9876,

// 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: true,

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: [ 'Chrome', 'Firefox' ],

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
}, process.argv.indexOf('--saucelabs') === -1 ? {} : {
sauceLabs: {
testName: 'Unit Tests',
recordScreenshots: false,
connectOptions: { verbose: true }
},
customLaunchers: sauceBrowsers,
browsers: Object.keys(sauceBrowsers),
captureTimeout: 120000,
reporters: [ 'saucelabs', 'dots' ],
autoWatch: false,
concurrency: 5,
client: {}
}));
};
module.exports = require('skatejs-build/karma.conf');
35 changes: 1 addition & 34 deletions rollup.config.js
@@ -1,34 +1 @@
const rollupBabel = require('rollup-plugin-babel');
const rollupCommonjs = require('rollup-plugin-commonjs');
const rollupNodeResolve = require('rollup-plugin-node-resolve');
const rollupUglify = require('rollup-plugin-uglify');
const path = require('path');
const pkg = require(path.join(process.cwd(), 'package.json'));
const shouldMinify = process.argv.indexOf('--min') !== -1;
const presetEs2015 = require('babel-preset-es2015-rollup');
const babel = rollupBabel({
presets: presetEs2015,
});
const plugins = [
babel,
rollupCommonjs(),
rollupNodeResolve(),
];

if (shouldMinify) {
plugins.push(rollupUglify());
}

const entry = pkg['jsnext:main'] || pkg.main || 'src/index.js';
const moduleName = pkg['build:global'] || pkg.name;

module.exports = {
dest: 'dist/index' + (shouldMinify ? '.min' : '') + '.js',
entry,
exports: 'named',
format: 'umd',
moduleName,
plugins,
sourceMap: true,
useStrict: false,
};
module.exports = require('skatejs-build/rollup.config');
141 changes: 0 additions & 141 deletions sauce.browsers.js

This file was deleted.

47 changes: 1 addition & 46 deletions webpack.config.js
@@ -1,46 +1 @@
var camelCase = require('camelcase');
var path = require('path');
var webpack = require('webpack');
var pkg = require(path.join(process.cwd(), 'package.json'));
var shouldMininimize = process.argv.indexOf('--min') !== -1;
var standardConfig = {
entry: {
'dist/bundle.js': './src/index.js'
},
output: {
path: './',
filename: '[name]',
libraryTarget: 'umd',
library: camelCase(pkg.name),
sourceMapFilename: '[file].map'
},
module: {
loaders: [{
test: /\.css$/,
loader: 'style!css'
}, {
test: /\.less$/,
loader: 'style!css!less'
}, {
loader: 'babel-loader',
test: /\.js$/,
query: {
presets: ['babel-preset-es2015', 'babel-preset-react']
}
}]
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/,
minimize: true
})
]
};

if (shouldMininimize) {
Object.assign(standardConfig.entry, {
'dist/bundle.min.js': './src/index.js'
});
}

module.exports = standardConfig;
module.exports = require('skatejs-build/webpack.config');

0 comments on commit eb2af23

Please sign in to comment.