-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.js
42 lines (31 loc) · 970 Bytes
/
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
38
39
40
41
42
const build = require('extra-build');
const owner = 'ifct2017';
const repo = build.readMetadata('.').name.replace(/@.+\//g, '');
// Publish a root package to NPM, GitHub.
function publishRootPackage(ver) {
var _package = build.readDocument('package.json');
var m = build.readMetadata('.');
m.version = ver;
build.writeMetadata('.', m);
build.publish('.');
try { build.publishGithub('.', owner); }
catch {}
build.writeDocument(_package);
}
// Publish root, sub packages to NPM, GitHub.
function publishPackages() {
var m = build.readMetadata('.');
var ver = build.nextUnpublishedVersion(m.name, m.version);
publishRootPackage(ver);
}
// Publish docs.
function publishDocs() {
var m = build.readMetadata('.');
build.updateGithubRepoDetails({owner, repo, topics: m.keywords});
}
// Finally.
function main(a) {
if (a[2]==='publish-docs') publishDocs();
else if (a[2]==='publish-packages') publishPackages();
}
main(process.argv);