forked from roryhewitt/akamaiconfigkit-public
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.js
37 lines (33 loc) · 1.27 KB
/
release.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
// build.js
// Very simple build script to run angular build
// Needed because all the cross platform things I tried didn't work
// No command line arguments, we're just going to use the env vars
let fs = require('fs')
let source = "bin/akamaiProperty"
let target = "akamai-property-1.0.2"
var exec = require('child-process-promise').exec;
exec(`pkg ${source} --target node8-linux-x86,node8-linux-x64,node8-win-x86,node8-win-x64,node8-macos-x64 --output ${target}`)
.then(function (result) {
let stdout = result.stdout;
let stderr = result.stderr;
console.log('stdout: ', stdout);
console.log('stderr: ', stderr);
})
.then(() => {
exec(`ls ${target}\*`)
.then(result => {
for (let filename of result.stdout.split('\n')) {
if (!filename) {continue}
let oldname = filename
filename =filename.replace('-win-','-windows-')
filename =filename.replace('-x64','-amd64')
filename =filename.replace('macos','mac')
filename =filename.replace('x86','386')
fs.renameSync(oldname, filename)
require('child_process').execSync(`shasum -a 256 ${filename} | awk '{print $1}' > ${filename}.sig`)
}
})
.catch(function (err) {
console.error('ERROR: ', err);
})
})