-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.js
executable file
·75 lines (67 loc) · 1.67 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
73
74
75
const b = require('substance-bundler')
const fs = require('fs')
const path = require('path')
const exec = require('substance-bundler/extensions/exec')
b.task('clean', () => {
b.rm('dist')
b.rm('tmp')
})
b.task('lib:cjs', () => {
b.js('./src/index.js', {
targets: [{
dest: 'dist/substance-pages.cjs.js',
format: 'cjs'
}],
external: [
'substance'
],
commonjs: true,
json: true
})
})
b.task('lib:browser', () => {
b.js('./src/index.js', {
targets: [{
dest: 'dist/substance-pages.js',
format: 'umd',
moduleName: 'substancePages',
globals: {
'substance': 'window.substance',
}
}],
external: ['substance'],
json: true
})
})
b.task('lib', ['lib:cjs', 'lib:browser'])
b.task('tests', ['lib:browser'], () => {
b.copy('node_modules/substance-test/dist', 'dist/test/substance-test')
b.copy('node_modules/substance/dist', 'dist/test/substance')
b.copy('test/index.html', 'dist/test/')
b.js('test/**/*.test.js', {
dest: 'dist/test/tests.js',
format: 'umd', moduleName: 'tests',
external: {
'substance': 'window.substance',
'substance-pages': 'window.substancePages',
'substance-test': 'window.substanceTest'
},
})
})
b.task('demo', ['clean', 'lib:cjs'], () => {
const generate = require('./lib/generate')
generate(b, {
pages: 'demo/*.html',
partials: 'demo/partials/*',
out: 'dist/demo',
rootDir: 'demo',
assets: [
'demo/demo.css'
],
labels: 'demo/labels/en.json',
debug: true
})
})
b.task('default', ['clean', 'lib', 'demo', 'tests'])
b.setServerPort(4010)
b.serve({ static: true, route: '/', folder: './dist/' })