Skip to content

Commit

Permalink
remove grunt build dependencies utilizing rollup 100%
Browse files Browse the repository at this point in the history
  • Loading branch information
scurker committed Jul 3, 2018
1 parent 9ec5950 commit 2eaefbe
Show file tree
Hide file tree
Showing 7 changed files with 2,515 additions and 521 deletions.
55 changes: 0 additions & 55 deletions Gruntfile.js

This file was deleted.

10 changes: 10 additions & 0 deletions config/banner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import pkg from '../package.json';

export default `/*!
* ${pkg.name} - v${pkg.version}
* ${pkg.homepage}
*
* Copyright (c) ${new Date().getFullYear()} ${pkg.author}
* Released under MIT license
*/
`;
12 changes: 12 additions & 0 deletions config/closure.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const compile = require('google-closure-compiler-js').compile;

export default function(flags = {}) {
return {
name: 'closure-compiler-js',
transformChunk(src) {
flags = Object.assign({}, flags);
flags.jsCode = [{ src }];
return { code: compile(flags).compiledCode };
}
};
}
11 changes: 6 additions & 5 deletions config/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { readFileSync } from 'fs';
import pkg from '../package.json';
import babel from 'rollup-plugin-babel';

const pkg = JSON.parse(readFileSync('./package.json', 'utf8'));
import banner from './banner';

export default {
input: 'src/currency.js',
Expand All @@ -13,11 +12,13 @@ export default {
output: [
{
format: 'es',
file: pkg.module
file: pkg.module,
banner
},
{
format: 'cjs',
file: pkg.main
file: pkg.main,
banner
}
]
};
35 changes: 31 additions & 4 deletions config/rollup.umd.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import pkg from '../package.json';
import babel from 'rollup-plugin-babel';
import banner from './banner';
import closure from './closure';

export default {
input: 'src/currency.js',
const input = 'src/currency.js';

export default [{
input,
plugins: [
babel({
exclude: 'node_modules/**',
Expand All @@ -12,7 +17,29 @@ export default {
{
format: 'umd',
file: 'dist/currency.umd.js',
name: 'currency'
name: 'currency',
banner
}
]
},
{
input: 'src/currency.js',
plugins: [
babel({
exclude: 'node_modules/**',
plugins: ['transform-object-assign']
}),
closure({
compilationLevel: 'SIMPLE',
rewritePolyfills: false
})
],
output: [
{
format: 'umd',
file: pkg.browser,
name: 'currency',
banner
}
]
};
}];

0 comments on commit 2eaefbe

Please sign in to comment.