Skip to content

Commit

Permalink
update build process
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Oct 27, 2015
1 parent 170f167 commit 0d5005e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"test-coverage": "rm -rf coverage/* && istanbul cover --report json node_modules/.bin/_mocha -- -u exports -R spec test/test.js",
"posttest-coverage": "remap-istanbul -i coverage/coverage-final.json -o coverage/coverage-remapped.json -b dist && remap-istanbul -i coverage/coverage-final.json -o coverage/coverage-remapped.lcov -t lcovonly -b dist && remap-istanbul -i coverage/coverage-final.json -o coverage/coverage-remapped -t html -b dist",
"ci": "npm run test-coverage && codecov < coverage/coverage-remapped.lcov",
"build": "git rev-parse HEAD > .commithash && rollup -c",
"build:browser": "git rev-parse HEAD > .commithash && rollup -c rollup.config.browser.js",
"build": "git rev-parse HEAD > .commithash && rollup -c -o dist/rollup.js",
"build:browser": "git rev-parse HEAD > .commithash && rollup -c rollup.config.browser.js -o dist/rollup.browser.js",
"prepublish": "npm test && npm run build:browser",
"lint": "eslint src"
},
Expand Down Expand Up @@ -51,6 +51,9 @@
"magic-string": "^0.8.0",
"mocha": "^2.3.3",
"remap-istanbul": "^0.3.1",
"rollup": "^0.20.1",
"rollup-plugin-babel": "^1.0.0",
"rollup-plugin-npm": "^1.0.0",
"rollup-plugin-replace": "^1.0.1",
"sander": "^0.4.0",
"source-map": "^0.5.3",
Expand Down
23 changes: 17 additions & 6 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { readFileSync } from 'fs';
import babel from 'rollup-plugins-babel';
import replace from 'rollup-plugins-replace';
import babel from 'rollup-plugin-babel';
import npm from 'rollup-plugin-npm';
import replace from 'rollup-plugin-replace';

var pkg = JSON.parse( readFileSync( 'package.json', 'utf-8' ) );
var version = JSON.parse( pkg.version );

var commitHash = (function () {
try {
return readFileSync( '.commithash', 'utf-8' );
Expand All @@ -13,17 +14,27 @@ var commitHash = (function () {
})();

var banner = readFileSync( 'src/banner.js', 'utf-8' )
.replace( '${version}', version )
.replace( '${version}', pkg.version )
.replace( '${time}', new Date() )
.replace( '${commitHash}', commitHash );

export default {
entry: 'src/rollup.js',
format: 'cjs',
plugins: [
babel(),
babel({
//include: [ 'src/**', 'node_modules/acorn/**' ]
}),

npm({
jsnext: true
}),

replace({
'VERSION': pkg.version
include: 'src/rollup.js',
delimiters: [ '<@', '@>' ],
sourceMap: true,
values: { 'VERSION': pkg.version }
})
],
external: [ 'fs' ],
Expand Down

0 comments on commit 0d5005e

Please sign in to comment.