Skip to content

Commit

Permalink
Migrate to rollup v0.48
Browse files Browse the repository at this point in the history
  • Loading branch information
ClassicOldSong committed Aug 22, 2017
1 parent b4a636a commit 5aae5f3
Show file tree
Hide file tree
Showing 10 changed files with 385 additions and 270 deletions.
26 changes: 0 additions & 26 deletions build/build.js

This file was deleted.

51 changes: 0 additions & 51 deletions build/dev-server.js

This file was deleted.

2 changes: 1 addition & 1 deletion config/bs-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
|
|
*/
module.exports = {
export default {
"ui": false,
"files": "test/index.html",
"watchOptions": {},
Expand Down
76 changes: 76 additions & 0 deletions config/rollup.base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import chalk from 'chalk'

// Rollup plugins
import buble from 'rollup-plugin-buble'
import eslint from 'rollup-plugin-eslint'
import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
import replace from 'rollup-plugin-replace'
import uglify from 'rollup-plugin-uglify'
import progress from 'rollup-plugin-progress'
import json from 'rollup-plugin-json'

// Log build environment
console.log('Target:', chalk.bold.green(process.env.NODE_ENV || 'development'))
switch (process.env.BUILD_ENV) {
case 'DEV': {
console.log(chalk.cyan`
+---------------+
| DEVELOP BUILD |
+---------------+
`)
break
}
case 'CI': {
console.log(chalk.green`
+----------+
| CI BUILD |
+----------+
`)
break
}
default: {
console.log(chalk.yellow`
+--------------+
| NORMAL BUILD |
+--------------+
`)
}
}

export default {
input: 'src/ef.js',
output: {
name: 'ef',
format: 'umd',
sourcemap: true
},
devDest: 'test/ef.dev.js',
proDest: 'dist/ef.min.js',
plugins: [
progress({
clearLine: false
}),
eslint({
exclude: ['*.json', '**/*.json']
}),
resolve({
jsnext: true,
main: true,
browser: true,
}),
commonjs(),
json(),
replace({
ENV: `'${process.env.NODE_ENV || 'development'}'`
}),
buble({
transforms: {
modules: false,
dangerousForOf: true
},
objectAssign: 'Object.assign'
}),
(process.env.NODE_ENV === 'production' && uglify())
]
}
7 changes: 7 additions & 0 deletions config/rollup.build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Import base config
import base from './rollup.base'

base.output.file = base.proDest
base.output.sourcemap = process.env.BUILD_ENV === 'DEMO' || process.env.BUILD_ENV === 'CI' ? base.output.sourcemap : false

export default base
71 changes: 0 additions & 71 deletions config/rollup.config.js

This file was deleted.

15 changes: 15 additions & 0 deletions config/rollup.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Import base config
import base from './rollup.base'
// Import browsersync config
import bsConfig from './bs-config'
// Import dev plugins
import browsersync from 'rollup-plugin-browsersync'

base.output.file = base.devDest
base.plugins.push(browsersync(bsConfig))
base.watch = {
chokidar: true,
include: 'src/'
}

export default base
Loading

0 comments on commit 5aae5f3

Please sign in to comment.