mirror of https://github.com/lukechilds/rollup.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
720 B
33 lines
720 B
9 years ago
|
import { readFileSync } from 'fs';
|
||
|
import babel from 'rollup-plugins-babel';
|
||
|
import replace from 'rollup-plugins-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' );
|
||
|
} catch ( err ) {
|
||
|
return 'unknown';
|
||
|
}
|
||
|
})();
|
||
|
|
||
|
var banner = readFileSync( 'src/banner.js', 'utf-8' )
|
||
|
.replace( '${version}', version )
|
||
|
.replace( '${time}', new Date() )
|
||
|
.replace( '${commitHash}', commitHash );
|
||
|
|
||
|
export default {
|
||
|
entry: 'src/rollup.js',
|
||
|
format: 'cjs',
|
||
|
plugins: [
|
||
|
babel(),
|
||
|
replace({
|
||
|
'VERSION': pkg.version
|
||
|
})
|
||
|
],
|
||
|
external: [ 'fs' ],
|
||
|
banner: banner,
|
||
|
sourceMap: true
|
||
|
};
|