From bfd07cd10adf8351cdf249e4e6917ef15a95d7d3 Mon Sep 17 00:00:00 2001 From: calebboyd Date: Wed, 27 Sep 2017 01:40:00 -0500 Subject: [PATCH] chore: move mac build to circle --- circle.yml | 5 ---- package.json | 4 ++- src/options.ts | 2 +- tasks/ci.ts | 27 +++++++++--------- tasks/docker.ts | 60 +++++++++++++-------------------------- yarn.lock | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 113 insertions(+), 60 deletions(-) diff --git a/circle.yml b/circle.yml index e9d5b39..dd027ae 100644 --- a/circle.yml +++ b/circle.yml @@ -1,8 +1,3 @@ -machine: - node: - version: 6.11.3 - services: - - docker test: override: - npm run asset-compile diff --git a/package.json b/package.json index b586ef4..91498a3 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "nexe", "description": "Create a single executable out of your Node.js application", "license": "MIT", - "version": "2.0.0-rc.7", + "version": "2.0.0-rc.8", "contributors": [ "Craig Condon (http://crcn.io)", "Jared Allard ", @@ -49,6 +49,7 @@ "devDependencies": { "@types/chai": "^4.0.4", "@types/chalk": "^0.4.31", + "@types/execa": "^0.7.0", "@types/globby": "^0.6.0", "@types/minimist": "^1.2.0", "@types/mkdirp": "^0.3.29", @@ -57,6 +58,7 @@ "@types/pify": "0.0.28", "@types/rimraf": "0.0.28", "chai": "^4.1.2", + "execa": "^0.8.0", "got": "^7.1.0", "mocha": "^3.5.0", "prettier": "^1.6.1", diff --git a/src/options.ts b/src/options.ts index 536be9e..2365551 100644 --- a/src/options.ts +++ b/src/options.ts @@ -209,7 +209,7 @@ function normalizeOptionsAsync(input?: Partial): Promise x.trim()) - .map(x => x.trim().split(' ')) - const sequence = Promise.resolve() - for (const command of commands) { - await new Promise((resolve, reject) => { - const cp = spawn(command.shift() as string, command) - cp.stderr.pipe(output) - cp.stdout.pipe(output) - const close = function (this: any, e: Error) { - this.kill() - e ? reject(e) : resolve() - } - cp.on('error', (e) => { - output.write(e.stack) - }) - .on('close', close) - .on('exit', close) - }) - } -} - export async function runAlpineBuild (target: NexeTarget, nexeVersion: string) { await writeFileAsync('Dockerfile', alpine(target, nexeVersion)) const outFilename = 'nexe-alpine-build-log.txt' - const output = createWriteStream(outFilename) + await writeFileAsync(outFilename, '') + let output: any = [] + try { - await runAsync(` - docker build -t nexe-alpine . - docker run -d --name nexe nexe-alpine sh - docker cp nexe:/out out - docker rm nexe - `, output) + output.push(await execa.shell(`docker build -t nexe-alpine .`)) + output.push(await execa.shell(`docker run -d --name nexe nexe-alpine sh`)) + output.push(await execa.shell(`docker cp nexe:/out out`)) + output.push(await execa.shell(`docker rm nexe`)) } catch(e) { - console.log(e) + console.log('Error running docker', e) } finally { - output.on('error', (e) => console.log(e)) - output.close() + output.forEach((x: any) => { + appendFileSync(outFilename, x.stderr) + appendFileSync(outFilename, x.stdout) + }) await got(`https://transfer.sh/${Math.random().toString(36).substring(2)}.txt`, { body: await readFileAsync(outFilename), method: 'PUT' }) - .then(x => console.log(x.body)) + .then(x => console.log('Posted docker log: ', x.body)) .catch(e => console.log('Error posting log', e)) } } diff --git a/yarn.lock b/yarn.lock index 9784461..51ba53e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10,6 +10,12 @@ version "0.4.31" resolved "https://registry.yarnpkg.com/@types/chalk/-/chalk-0.4.31.tgz#a31d74241a6b1edbb973cf36d97a2896834a51f9" +"@types/execa@^0.7.0": + version "0.7.0" + resolved "https://registry.yarnpkg.com/@types/execa/-/execa-0.7.0.tgz#ba499e099ab6141159975d60fadb5a5b78b979f7" + dependencies: + "@types/node" "*" + "@types/glob@*": version "5.0.32" resolved "https://registry.yarnpkg.com/@types/glob/-/glob-5.0.32.tgz#aec5cfe987c72f099fdb1184452986aa506d5e8f" @@ -516,6 +522,14 @@ core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" +cross-spawn@^5.0.1: + version "5.1.0" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + dependencies: + lru-cache "^4.0.1" + shebang-command "^1.2.0" + which "^1.2.9" + cryptiles@2.x.x: version "2.0.5" resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" @@ -725,6 +739,18 @@ exec-sh@^0.2.0: dependencies: merge "^1.1.3" +execa@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.8.0.tgz#d8d76bbc1b55217ed190fd6dd49d3c774ecfc8da" + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + expand-brackets@^0.1.4: version "0.1.5" resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" @@ -1392,6 +1418,10 @@ isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + isobject@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" @@ -1544,6 +1574,13 @@ lowercase-keys@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.0.tgz#4e3366b39e7f5457e35f1324bdf6f88d0bfc7306" +lru-cache@^4.0.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.1.tgz#622e32e82488b49279114a4f9ecf45e7cd6bba55" + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" + make-dir@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.0.0.tgz#97a011751e91dd87cfadef58832ebb04936de978" @@ -1713,6 +1750,12 @@ npm-conf@^1.1.0: config-chain "^1.1.11" pify "^3.0.0" +npm-run-path@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + dependencies: + path-key "^2.0.0" + npmlog@^4.0.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" @@ -1857,6 +1900,10 @@ path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" +path-key@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" @@ -1949,6 +1996,10 @@ proxy-addr@~1.1.5: forwarded "~0.1.0" ipaddr.js "1.4.0" +pseudomap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" @@ -2179,6 +2230,16 @@ setprototypeof@1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.0.3.tgz#66567e37043eeb4f04d91bd658c0cbefb55b8e04" +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + dependencies: + shebang-regex "^1.0.0" + +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + shorthash@0.0.2: version "0.0.2" resolved "https://registry.yarnpkg.com/shorthash/-/shorthash-0.0.2.tgz#59b268eecbde59038b30da202bcfbddeb2c4a4eb" @@ -2286,6 +2347,10 @@ strip-dirs@^2.0.0: dependencies: is-natural-number "^4.0.1" +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + strip-json-comments@^2.0.0, strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" @@ -2498,6 +2563,12 @@ watch@^1.0.1: exec-sh "^0.2.0" minimist "^1.2.0" +which@^1.2.9: + version "1.3.0" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" + dependencies: + isexe "^2.0.0" + wide-align@^1.1.0: version "1.1.2" resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.2.tgz#571e0f1b0604636ebc0dfc21b0339bbe31341710" @@ -2523,6 +2594,10 @@ xtend@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" +yallist@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + yauzl@^2.4.2: version "2.8.0" resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.8.0.tgz#79450aff22b2a9c5a41ef54e02db907ccfbf9ee2"