-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMakefile.dryice.js
77 lines (66 loc) · 1.73 KB
/
Makefile.dryice.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
75
76
77
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var path = require('path');
var fs = require('fs');
var copy = require('dryice').copy;
function buildBrowser() {
console.log('Creating dist/source-map.js');
var project = copy.createCommonJsProject({
roots: [ __dirname ]
});
copy({
source: [
'build/mini-require.js',
copy.source.commonjs({
project: project,
require: [ 'lib/source-map/source-map-generator',
'lib/source-map/source-map-consumer',
'lib/source-map/source-node']
}),
'build/suffix-browser.js'
],
filter: copy.filter.moduleDefines,
dest: 'dist/source-map.js'
});
}
function buildBrowserMin() {
console.log('Creating dist/source-map.min.js');
copy({
source: 'dist/source-map.js',
filter: copy.filter.uglifyjs,
dest: 'dist/source-map.min.js'
});
}
function buildFirefox() {
console.log('Creating dist/source-map-consumer.jsm');
var project = copy.createCommonJsProject({
roots: [ __dirname ]
});
copy({
source: [
'build/prefix-source-map-consumer.jsm',
'build/mini-require.js',
copy.source.commonjs({
project: project,
require: [ 'lib/source-map/source-map-consumer' ]
}),
'build/suffix-source-map-consumer.jsm'
],
filter: copy.filter.moduleDefines,
dest: 'dist/SourceMapConsumer.jsm'
});
}
var dirExists = false;
try {
dirExists = fs.statSync('dist').isDirectory();
} catch (err) {}
if (!dirExists) {
fs.mkdirSync('dist', 0777);
}
buildFirefox();
buildBrowser();
buildBrowserMin();