-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpack_git.js
More file actions
38 lines (31 loc) · 1.1 KB
/
Copy pathpack_git.js
File metadata and controls
38 lines (31 loc) · 1.1 KB
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
const lib = require('../lib/');
const path = require('path');
var argv = require('minimist')(process.argv.slice(2));
if(argv['target'])
process.env.PACKGIT_SOURCE=argv['target'];
if(argv['branch'])
process.env.PACKGIT_BRANCH=argv['branch'];
if(!process.env.PACKGIT_SOURCE) {
console.log("ENV variable PACKGIT_SOURCE must be set or a value passed for --target")
process.exit(1)
}
process.env.PACKGIT_SOURCE=path.resolve(process.env.PACKGIT_SOURCE);
var fs = require('fs');
if (!fs.existsSync(process.env.PACKGIT_SOURCE)) {
console.log("Target folder set with ENV PACKGIT_SOURCE or --target does not exist");
process.exit(1);
}
lib.createDistribution().then(function(success){
console.log('Distribution Created!');
}, function(error){
console.log('Distribution Failed!');
if(error instanceof Error) {
console.log(error.message);
console.log(error.stack);
} else if (error.error instanceof Error) {
console.log(error.error.message);
console.log(error.error.stack);
} else
console.log(JSON.stringify(error));
});