-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathassemble-package.js
63 lines (54 loc) · 1.81 KB
/
assemble-package.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
var path = require('path');
var fs = require('fs');
var wrench = require('wrench');
var licenseText = fs.readFileSync('LICENSE.txt', {enc: 'utf-8'});
var bundle = require('./node-package/create-bundle.js');
var masterBundle = bundle.base(__dirname)
.code('/* ' + licenseText + ' */')
.js([
// Replacement for jsonary.js, assembled from individual files
'jsonary/_compatability.js',
'jsonary/_header.js',
'jsonary/uri.js',
'jsonary/uri-templates/uri-templates.js',
'jsonary/utils.js',
'jsonary/monitors.js',
'jsonary/request.js',
'jsonary/patch.js',
'jsonary/data.js',
'jsonary/schema.js',
'jsonary/schemamatch.js',
'jsonary/schemaset.js',
'jsonary/main.js',
'jsonary/_footer.js',
'jsonary/jsonary.render.js'
])
.code('var Jsonary = this.Jsonary;')
// http://json-schema.org/ meta-schemas
.js('jsonary/_cache-json-schema-org.js')
// Renderers
.js('renderers/list-links.js')
.css('renderers/common.css')
.js('renderers/plain.jsonary.js')
.css('renderers/plain.jsonary.css')
.js('renderers/string-formats.js');
console.log("Writing jsonary-core");
masterBundle.compileJs('node-package/core/jsonary-core.js', true);
masterBundle.compileCss('node-package/core/jsonary-core.css');
console.log("Writing jsonary-super-bundle");
var superBundle = require('./node-package').superBundle();
superBundle.writeJs('node-package/super-bundle/jsonary-super-bundle.js', true, true);
console.log("Jsonary bundles complete");
console.log("Copying files");
// copy license
fs.writeFileSync('node-package/LICENSE.txt', licenseText, {enc: 'utf-8'});
// copy plugins
wrench.copyDirSyncRecursive('plugins', 'node-package/plugins', {
forceDelete: true,
excludeHiddenUnix: true
});
// copy renderers
wrench.copyDirSyncRecursive('renderers/contributed', 'node-package/renderers', {
forceDelete: true,
excludeHiddenUnix: true
});