-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
47 lines (41 loc) · 1.12 KB
/
rollup.config.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
// rollup.config.js
import {readFileSync} from 'fs'
import replace from 'rollup-plugin-replace'
var pkg = JSON.parse(readFileSync('package.json', 'utf-8'))
var lib = 'lib/cssobj-core.js'
var commitHash = (function () {
try {
return readFileSync('.commithash', 'utf-8').trim()
} catch (err ) {
return 'unknown'
}
})()
var banner = readFileSync('lib/zbanner.js', 'utf-8')
.replace('<@VERSION@>', pkg.version)
.replace('<@TIME@>', new Date())
.replace('<@COMMIT@>', commitHash)
export default {
entry: lib,
moduleName: 'cssobj_core',
amd: {id: 'cssobj_core'},
plugins: [
replace({
include: lib,
delimiters: [ '<@', '@>' ],
sourceMap: true,
values: {
VERSION: pkg.version,
COMMIT: commitHash,
TIME: new Date()
}
})
],
banner: banner,
targets: [
{ format: 'iife', dest: 'dist/cssobj-core.iife.js' },
{ format: 'amd', dest: 'dist/cssobj-core.amd.js' },
{ format: 'umd', dest: 'dist/cssobj-core.umd.js' },
{ format: 'cjs', dest: 'dist/cssobj-core.cjs.js' },
{ format: 'es', dest: 'dist/cssobj-core.es.js' }
]
}