forked from ecomfe/fonteditor
-
Notifications
You must be signed in to change notification settings - Fork 1
/
edp-build-config-node.js
75 lines (65 loc) · 1.7 KB
/
edp-build-config-node.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
69
70
71
72
73
74
var path = require( 'path' );
var amd2module = require('./node/amd2module');
exports.input = path.resolve(__dirname, './src');;
exports.output = path.resolve(__dirname, '../fonteditor-ttf/lib');
exports.getProcessors = function () {
var NodeModuleProcessor = {
name: 'NodeModuleProcessor',
files: [
'common/lang.js',
'common/string.js',
'common/observable.js',
'common/DOMParser.js',
'math/**/*.js',
'graphics/**/*.js',
'ttf/**/*.js'
],
process: function(file, processContext, callback) {
var depth = new Array(file.path.split('/').length).join('../');
if (file.data.indexOf('define') >= 0) {
file.setData(amd2module(file.data, depth));
}
callback();
}
}
return [
NodeModuleProcessor,
// 清除冗余文件,比如`less`
new OutputCleaner({
files: [
'common/ajaxFile.js',
'common/DataStore.js',
'common/observable.js',
'common/promise.js',
'common/getPixelRatio.js',
'editor/**',
'fonteditor/**',
'render/**',
'template/**'
]
})
];
};
exports.exclude = [
".svn",
"*.conf",
"*.sh",
"*.bat",
"*.md",
"demo",
"agent/*",
"mock",
"test",
"unittest",
"edp-*",
"output",
".DS_Store",
".gitignore",
"package.json",
"node"
];
exports.injectProcessor = function ( processors ) {
for ( var key in processors ) {
global[ key ] = processors[ key ];
}
};