mirror of
https://github.com/bobwen-dev/htpdate
synced 2025-04-11 23:00:44 +02:00
better build script, better verbose
This commit is contained in:
parent
57b7c1dc1b
commit
6bac44757f
18
index.coffee
18
index.coffee
@ -98,8 +98,13 @@ agent_opt = {
|
||||
keepAliveMsecs: 60000,
|
||||
maxSockets: 1,
|
||||
}
|
||||
proxy = process.env.http_proxy || process.env.https_proxy
|
||||
agent = if proxy not in [undefined, '']
|
||||
proxy = (process.env.http_proxy or process.env.https_proxy or '').trim()
|
||||
agent = if proxy is ''
|
||||
{
|
||||
http: new Agent agent_opt
|
||||
https: new Agent.HttpsAgent agent_opt
|
||||
}
|
||||
else
|
||||
agent_opt = {
|
||||
agent_opt...
|
||||
freeSocketTimeout: 30000
|
||||
@ -109,11 +114,6 @@ agent = if proxy not in [undefined, '']
|
||||
http: new HttpProxyAgent agent_opt
|
||||
https: new HttpsProxyAgent agent_opt
|
||||
}
|
||||
else
|
||||
{
|
||||
http: new Agent agent_opt
|
||||
https: new Agent.HttpsAgent agent_opt
|
||||
}
|
||||
|
||||
req_opt = {
|
||||
method: argv.method.trim().toUpperCase()
|
||||
@ -170,7 +170,7 @@ get_time_delta = (url) ->
|
||||
else
|
||||
details = " DNS:" + "#{r.timings.phases.dns}".padStart 5
|
||||
details += " TCP:" + "#{r.timings.phases.tcp}".padStart 5
|
||||
details += " TSL:" + "#{if r.timings.phases.tls? then r.timings.phases.tls else ''}".padStart 5
|
||||
details += " TSL:" + "#{if r.timings.phases.tls? then r.timings.phases.tls else '-'}".padStart 5
|
||||
details += " Send:" + "#{r.timings.upload - upload_at}".padStart 5
|
||||
details += " Recv:" + "#{r.timings.response - r.timings.upload}".padStart 5
|
||||
console.log "#{step}#{delta_text}#{details}"
|
||||
@ -183,7 +183,7 @@ delay = util.promisify (ms, cb) ->
|
||||
|
||||
|
||||
do ->
|
||||
if proxy not in [undefined, '']
|
||||
if proxy isnt ''
|
||||
msg = ''
|
||||
if argv.http2
|
||||
msg = ", http2 is disabled because the agent library currently used does not support this protocol"
|
||||
|
10
package.json
10
package.json
@ -25,21 +25,21 @@
|
||||
"scripts": {
|
||||
"compile": "npx coffee -bc --no-header ./",
|
||||
"clean": "rm *.js",
|
||||
"b": "npx nexe -i index.js -r node_modules/**/package.json",
|
||||
"b": "npx nexe -i index.js -r \"node_modules/**/package.json\"",
|
||||
"b-win-x86": "npm run b -- -t windows-x86-14.15.3 -o dists/htpdate-windows-x86.exe",
|
||||
"b-win-x64": "npm run b -- -t windows-x64-14.17.0 -o dists/htpdate-windows-x64.exe",
|
||||
"b-linux-x64": "npm run b -- -t linux-x64-14.15.3 -o dists/htpdate-linux-x64",
|
||||
"b-linux-arm64": "npm run b -- -t linux-arm64-14.15.4 -o dists/htpdate-linux-arm64",
|
||||
"b-linux-arm7l": "npm run b -- -t linux-arm7l-14.18.1 -o dists/htpdate-linux-arm7l",
|
||||
"b-linux-armv7l": "npm run b -- -t linux-arm-14.18.1 -o dists/htpdate-linux-armv7l",
|
||||
"b-mac-x64": "npm run b -- -t mac-x64-14.15.3 -o dists/htpdate-mac-x64",
|
||||
"b-all": "npm run b-win-x86 && npm run b-win-x64 && npm run b-linux-x64 && npm run b-linux-arm64 && b-linux-arm7l && npm run b-mac-x64",
|
||||
"b-all": "npm run b-win-x86 && npm run b-win-x64 && npm run b-linux-x64 && npm run b-linux-arm64 && npm run b-linux-armv7l && npm run b-mac-x64",
|
||||
"c-win-x86": "cd dists && cp htpdate-windows-x86.exe htpdate.exe && 7z a htpdate-windows-x86.7z htpdate.exe && rm -rf htpdate.exe",
|
||||
"c-win-x64": "cd dists && cp htpdate-windows-x64.exe htpdate.exe && 7z a htpdate-windows-x64.7z htpdate.exe && rm -rf htpdate.exe",
|
||||
"c-linux-x64": "cd dists && cp htpdate-linux-x64 htpdate && 7z a htpdate-linux-x64.7z htpdate && rm -rf htpdate",
|
||||
"c-linux-arm64": "cd dists && cp htpdate-linux-arm64 htpdate && 7z a htpdate-linux-arm64.7z htpdate && rm -rf htpdate",
|
||||
"c-linux-arm7l": "cd dists && cp htpdate-linux-arm7l htpdate && 7z a htpdate-linux-arm7l.7z htpdate && rm -rf htpdate",
|
||||
"c-linux-armv7l": "cd dists && cp htpdate-linux-armv7l htpdate && 7z a htpdate-linux-armv7l.7z htpdate && rm -rf htpdate",
|
||||
"c-mac-x64": "cd dists && cp htpdate-mac-x64 htpdate && 7z a htpdate-mac-x64.7z htpdate && rm -rf htpdate",
|
||||
"compress": "npm run c-win-x86 && npm run c-win-x64 && npm run c-linux-x64 && npm run c-linux-arm64 && npm run c-linux-arm7l && npm run c-mac-x64",
|
||||
"compress": "npm run c-win-x86 && npm run c-win-x64 && npm run c-linux-x64 && npm run c-linux-arm64 && npm run c-linux-armv7l && npm run c-mac-x64",
|
||||
"build": "npm run compile && npm run b-all && npm run clean",
|
||||
"test": "npx coffee index.coffee www.pool.ntp.org"
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user