-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
42 lines (33 loc) · 1 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
38
39
40
41
42
const cp = require('child_process');
const build = require('extra-build');
const owner = 'nodef';
// Publish a root package to NPM, GitHub.
function publishRootPackage(ds, ver, typ) {
var _package = build.readDocument('package.json');
var _readme = build.readDocument('README.md');
var m = build.readMetadata('.');
m.version = ver;
build.writeMetadata('.', m);
build.publish('.');
try { build.publishGithub('.', owner); }
catch {}
build.writeDocument(_package);
build.writeDocument(_readme);
}
// Publish root packages to NPM, GitHub.
function publishRootPackages(ds, ver) {
cp.execSync(`chmod +x index.sh`);
publishRootPackage(ds, ver, '');
}
// Pushish root, sub packages to NPM, GitHub.
function publishPackages(ds) {
var m = build.readMetadata('.');
var ver = build.nextUnpublishedVersion(m.name, m.version);
publishRootPackages(ds, ver);
}
// Finally.
function main(a) {
if (a[2]==='publish-packages') publishPackages([]);
else bundleScript([]);
}
main(process.argv);