forked from wangdahoo/vue-animate-number
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
51 lines (48 loc) · 1.13 KB
/
build.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const rollup = require('rollup').rollup
const resolve = require('rollup-plugin-node-resolve')
const commonjs = require('rollup-plugin-commonjs')
const vue = require('rollup-plugin-vue')
const babel = require('rollup-plugin-babel')
const gulp = require('gulp')
const uglify = require('gulp-uglify')
const rename = require('gulp-rename')
const header = require('gulp-header')
const pkg = require('./package.json')
const dist = pkg.main.replace('.min', '')
rollup({
entry: 'src/index.js',
plugins: [
resolve(),
commonjs(),
vue(),
babel({
exclude: 'node_modules/**'
})
]
})
.then((bundle) => {
return bundle.write({
format: 'umd',
moduleName: 'VueAnimateNumber',
dest: dist
})
})
.then(() => {
let banner = ['/**',
' * <%= pkg.name %> - <%= pkg.description %>',
' * @version v<%= pkg.version %>',
' * @link <%= pkg.homepage %>',
' * @license <%= pkg.license %>',
' */',
''].join('\n')
gulp.src(dist)
.pipe(uglify())
.pipe(header(banner, { pkg : pkg }))
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('dist/'))
})
.catch(err => {
console.log(err)
})