Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"parser": "babel-eslint",
"extends": "eslint:recommended",
"env": {
"node": true,
"browser": true,
"mocha": true
}
}
}
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@ language: node_js
node_js:
- "4.0"
- "5.0"
cache:
directories:
- node_modules
env:
global:
- NPM_CONFIG_PROGRESS="false"
12 changes: 12 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sample project for packages built with rollup</title>
</head>
<body>
<div class="end-matter">
<script src="dist/rollup-starter-project.min.js"></script>
</div>
</body>
</html>
98 changes: 98 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
// Karma configuration
// Generated on Sun Feb 05 2017 11:15:12 GMT+1100 (AEDT)
var babel = require('rollup-plugin-babel');
var babelrc = require('babelrc-rollup').default;
var globals = require('rollup-plugin-node-globals');
var builtins = require('rollup-plugin-node-builtins');
var resolve = require('rollup-plugin-node-resolve');
var istanbul = require('rollup-plugin-istanbul');

var pkg = require('./package.json');
var external = Object.keys(pkg.dependencies);
var testFiles = [
'test/**/*_test.js'
];

module.exports = function(config) {
config.set({

// 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: ['mocha'],

client: { mocha: { reporter: './istanbul.reporter.js' } },

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


// 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: {
'test/**/*_test.js': ['rollup']
},

rollupPreprocessor: {
plugins: [
babel(babelrc()),
globals(),
builtins(),
resolve({
jsnext: true
}),
istanbul({
exclude: testFiles.concat([ 'node_modules/**/*' ])
})
],
external: external,
format: 'iife',
sourceMap: 'inline'
},


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


// web server port
port: 9876,


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


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


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


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

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
})
}
2 changes: 2 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ export function multiply(n, m, negative=false) {
}
return negative ? -result : result;
}

document.write(multiply(11, 9));
21 changes: 17 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@
"build": "rollup -c",
"watch": "rollup -c -w",
"pretest": "npm run build",
"test": "mocha",
"prepublish": "npm test"
"test": "karma start",
"preuglify": "npm test",
"uglify": "cd dist && uglifyjs rollup-starter-project.js --output rollup-starter-project.min.js --source-map rollup-starter-project.min.js.map --in-source-map rollup-starter-project.js.map --compress --mangle",
"prepublish": "npm run uglify",
"prestart": "npm install",
"start": "ws"
},
"repository": "rollup/rollup-starter-project",
"keywords": [
Expand Down Expand Up @@ -39,11 +43,20 @@
"babel-register": "^6.18.0",
"babelrc-rollup": "^3.0.0",
"eslint": "^3.12.2",
"istanbul": "^0.4.5",
"karma": "^1.4.1",
"karma-coverage": "^1.1.1",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-rollup-plugin": "^0.2.4",
"local-web-server": "^1.2.6",
"mocha": "^3.2.0",
"rollup": "^0.37.0",
"rollup-plugin-babel": "^2.7.1",
"rollup-plugin-istanbul": "^1.1.0",
"rollup-watch": "^2.5.0"
"rollup-plugin-node-builtins": "^2.0.0",
"rollup-plugin-node-globals": "^1.1.0",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-watch": "^2.5.0",
"uglify-js": "^2.7.5"
}
}
6 changes: 1 addition & 5 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import babel from 'rollup-plugin-babel';
import babelrc from 'babelrc-rollup';
import istanbul from 'rollup-plugin-istanbul';

let pkg = require('./package.json');
let external = Object.keys(pkg.dependencies);

export default {
entry: 'lib/index.js',
plugins: [
babel(babelrc()),
istanbul({
exclude: ['test/**/*', 'node_modules/**/*']
})
babel(babelrc())
],
external: external,
targets: [
Expand Down
2 changes: 1 addition & 1 deletion test/index_test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { multiply } from '../';
import { multiply } from '../lib/index.js';
import { strictEqual } from 'assert';

describe('multiply', () => {
Expand Down
17 changes: 0 additions & 17 deletions test/istanbul.reporter.js

This file was deleted.

1 change: 0 additions & 1 deletion test/mocha.opts

This file was deleted.