-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake.js
72 lines (61 loc) · 1.97 KB
/
make.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
const b = require('substance-bundler')
const path = require('path')
const compileSchema = require('texture-xml-utils/bundler/compileSchema')
const generateSchemaDocumentation = require('texture-xml-utils/bundler/generateSchemaDocumentation')
const DIST = 'dist/'
const TMP = 'tmp/'
b.task('clean', function () {
b.rm(DIST)
b.rm(TMP)
})
b.task('default', ['publish'])
b.task('publish', ['clean', 'build'])
b.task('build', ['build:schema', 'build:plugin'])
b.task('build:schema', ['build:schema:jats-archiving-1.0', 'build:schema:jats-archiving-1.1', 'build:schema:jats-archiving-1.2'])
b.task('build:schema:jats-archiving-1.0', () => {
let rngFile = path.join(__dirname, 'rng', 'jats-archiving-rng-1.0', 'JATS-archivearticle1.rng')
let name = 'JATS-archiving-1.0'
_buildSchema(name, rngFile)
})
b.task('build:schema:jats-archiving-1.1', () => {
let rngFile = path.join(__dirname, 'rng', 'JATS-Archiving-1-1-MathML3-DTD-RNG', 'JATS-archivearticle1-mathml3.rng')
let name = 'JATS-archiving-1.1'
_buildSchema(name, rngFile)
})
b.task('build:schema:jats-archiving-1.2', () => {
let rngFile = path.join(__dirname, 'rng', 'JATS-Archiving-1-2-MathML3-RNG', 'JATS-archivearticle1-mathml3.rng')
let name = 'JATS-archiving-1.2'
_buildSchema(name, rngFile)
})
b.task('build:plugin', () => {
b.js('src/texture-plugin-jats.js', {
output: [
{
file: DIST + 'texture-plugin-jats.js',
format: 'umd',
name: 'TexturePluginJATS',
globals: {
'substance': 'substance',
'substance-texture': 'texture'
}
}, {
file: DIST + 'texture-plugin-jats.cjs.js',
format: 'cjs'
}
],
external: [ 'substance', 'substance-texture' ]
})
b.minify(DIST + 'texture-plugin-jats.js', {
debug: false
})
})
function _buildSchema (name, rngFile) {
compileSchema(b, rngFile, {
name,
dest: TMP + `${name}.data.js`
})
generateSchemaDocumentation(b, rngFile, {
name,
dest: TMP + `${name}.md`
})
}