-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathbuild.js
executable file
·37 lines (33 loc) · 1.34 KB
/
build.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
#!/usr/bin/env node
global.Promise = require('bluebird');
global.Promise.config({})
const path = require('path');
const argv = require('./lib/argv.js');
const fs = require('./lib/fs.js').default;
const logger = require('./lib/logger.js').default;
const api = require('./lib/Api.js').default;
const Bootstrap = require('./lib/Bootstrap.js').default;
const { absolute } = require('./lib/Paths').default;
const versions = require('./lib/Versions.js').default;
(async () => {
return Promise.resolve()
.then(() => argv.removeDist && fs.remove(absolute.dist()))
.then(() => fs.ensureDir(absolute.dist()))
.then(() => fs.list(absolute.src(), { files: false }))
.then(({ value: ranges }) => [...ranges].map(d => d.split(path.sep).pop()))
.mapSeries(range => versions.matching('bootstrap', range)
.then(({ value: versions }) => versions)
.mapSeries(version => {
logger.header(['bootstrap@%s', version]);
const asset = logger.createMultipleTasks(new Bootstrap(version));
return asset.variablesExist()
.then(() => fs.list(absolute.src(range), { files: false }))
.then(({ value: branches }) => [...branches].map(d => d.split(path.sep).pop()))
.mapSeries(branch => asset.compile(branch))
})
)
.then(() => {
logger.header('API JSON');
return api.update();
});
})();