-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
buildIE6Test.js
49 lines (39 loc) · 1.25 KB
/
buildIE6Test.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
var rollup = require('rollup');
var fs = require('fs');
var less = require('semicolon-less')
var istanbul = require('rollup-plugin-istanbul');
//var babel = require('rollup-plugin-babel');
var babel = require("babel-core");
var transform = require('es3ify').transform;
// used to track the cache for subsequent bundles
var cache;
module.exports = rollup.rollup({
entry: 'test/spec.js',
cache: cache,
plugins: [
istanbul({
exclude: ['test/**/*.js']
})
]
}).then(function(bundle) {
// Generate bundle + sourcemap
var result = bundle.generate({
format: 'umd',
moduleName: 'avalon'
});
// Cache our bundle for later use (optional)
cache = bundle;
result.code = result.code.replace(
/Object\.defineProperty\(exports,\s*'__esModule',\s*\{\s*value:\s*true\s*\}\);/,
"exports.__esModule = true").
// replace(/'use strict';?/, '').
replace(/avalon\$1/g, 'avalon')
result = babel.transform(result.code, {
presets: ['avalon'],
compact: false
})
var code = transform(result.code).replace(/\}\)\(undefined,/, '})(this,')
fs.writeFileSync('./dist/avalon.test.js', less(code));
}).catch(function(e) {
console.log('error', e)
})