-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathedp-build-config.js
68 lines (62 loc) · 1.17 KB
/
edp-build-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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* @file build配置
* @author edpx-mobile
*/
var c2a = require('c2a');
var cwd = process.cwd();
var fs = require('fs');
var path = require('path');
/**
* 输入目录
*
* @type {string}
*/
exports.input = cwd;
/**
* 输出目录
*
* @type {string}
*/
exports.output = path.resolve(cwd, 'output');
/**
* 排除文件pattern列表
*
* @type {Array}
*/
exports.exclude = [
'src',
'node_modules',
'dep',
'doc',
'test',
'lib/Context.js',
'lib/requester/Kernel.js'
];
/**
* 获取构建processors的方法
*
* @return {Array}
*/
exports.getProcessors = function () {
return [{
files: ['lib/*.js', 'lib/*/*.js'],
name: 'AMD wrap',
from: 'lib/',
to: 'src/',
process: function (file, context, callback) {
file.outputPath = '../' + file.path.replace(this.from, this.to);
file.setData(c2a(file.data) + '\n');
callback();
}
}];
};
/**
* builder主模块注入processor构造器的方法
*
* @param {Object} processors
*/
exports.injectProcessor = function (processors) {
for (var key in processors) {
global[ key ] = processors[ key ];
}
};