Skip to content
This repository has been archived by the owner on Nov 4, 2020. It is now read-only.

Commit

Permalink
Use rollup for build
Browse files Browse the repository at this point in the history
  • Loading branch information
btd committed May 29, 2016
1 parent f9b3f75 commit 0b36b50
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 96 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -5,3 +5,5 @@ desktop.ini
should.js.for-tests
*.swp
npm-debug.log
cjs/
es6/
2 changes: 1 addition & 1 deletion as-function.js
@@ -1 +1 @@
module.exports = require('./lib/should');
module.exports = require('./cjs/should');
13 changes: 12 additions & 1 deletion browser-entry.js
@@ -1 +1,12 @@
should = require('./index');
import should from './es6/should';

var defaultProto = Object.prototype;
var defaultProperty = 'should';

//Expose api via `Object#should`.
try {
var prevShould = should.extend(defaultProperty, defaultProto);
should._prevShould = prevShould;
} catch (e) {
//ignore errors
}
78 changes: 0 additions & 78 deletions gulpfile.js

This file was deleted.

2 changes: 1 addition & 1 deletion index.js
@@ -1,4 +1,4 @@
var should = require('./lib/should');
var should = require('./cjs/should');

var defaultProto = Object.prototype;
var defaultProperty = 'should';
Expand Down
27 changes: 12 additions & 15 deletions package.json
Expand Up @@ -9,25 +9,22 @@
},
"homepage": "https://github.com/shouldjs/should.js",
"scripts": {
"cjs": "rollup --format=cjs --output=cjs/should.js lib/should.js",
"es6": "rollup --format=es6 --output=es6/should.js lib/should.js",
"build": "npm run cjs && npm run es6",
"prepublish": "npm run build && npm run browser",
"pretest": "npm run build",
"test": "mocha -R mocha-better-spec-reporter --check-leaks ./test/*.test.js ./test/**/*.test.js",
"zuul": "zuul -- ./test/**/*.test.js ./test/*.test.js",
"browser": "gulp script"
"browser": "rollup -c rollup.config.js --output ./should.js"
},
"devDependencies": {
"bluebird": "^3.0.6",
"browserify": "latest",
"bundle-collapser": "^1.2.1",
"eslint": "^2.4.0",
"gulp": "^3.8.10",
"gulp-derequire": "^2.1.0",
"gulp-rename": "^1.2.0",
"gulp-uglify": "^1.0.1",
"gulp-wrapper": "^1.0.0",
"lodash.template": "^4.2.4",
"mocha": "latest",
"mocha-better-spec-reporter": "latest",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0",
"rollup": "^0.26.3",
"rollup-plugin-node-resolve": "^1.5.0",
"zuul": "latest"
},
"keywords": [
Expand All @@ -39,10 +36,10 @@
"main": "./index.js",
"license": "MIT",
"dependencies": {
"should-equal": "0.8.0",
"should-format": "0.3.2",
"should-type": "0.2.0"
}
"should-equal": "^1.0.0",
"should-format": "^1.0.0",
"should-type": "^1.0.0"
},
"files": [
"cjs/*",
"es6/*",
Expand Down
44 changes: 44 additions & 0 deletions rollup.config.js
@@ -0,0 +1,44 @@
/*eslint-env node */
'use strict';

const nodeResolve = require('rollup-plugin-node-resolve');

const pkg = require('./package.json');

const banner = `/*!
* ${pkg.name} - ${pkg.description}
* @version v${pkg.version}
* @author ${pkg.author}
* @link ${pkg.homepage}
* @license ${pkg.license}
*/
`;

const outro = `
if (typeof define === 'function' && define.amd) {
define([], function() { return should });
} else if (typeof module === 'object' && module.exports) {
module.exports = should;
} else {
this.Should = should;
Object.defineProperty(this, 'should', {
enumerable: false,
configurable: true,
value: should
});
}`;

module.exports = {
entry: 'browser-entry.js',
banner,
outro,
format: 'iife',
plugins: [
nodeResolve({
jsnext: true,
main: true,
preferBuiltins: false
})
]
};

0 comments on commit 0b36b50

Please sign in to comment.