Skip to content

Commit

Permalink
fix(dmg): do not use -quiet #854
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Oct 27, 2016
1 parent b4fd630 commit 74e2006
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 101 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"yargs": "^6.3.0"
},
"devDependencies": {
"@develar/semantic-release": "^6.3.13",
"@develar/semantic-release": "^6.3.17",
"@types/ini": "^1.3.29",
"@types/js-yaml": "^3.5.28",
"@types/source-map-support": "^0.2.28",
Expand Down
23 changes: 15 additions & 8 deletions src/targets/dmg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { log, warn } from "../util/log"
import { Target, PlatformPackager } from "../platformPackager"
import { MacOptions, DmgOptions, DmgContent } from "../options/macOptions"
import BluebirdPromise from "bluebird-lst-c"
import { debug, use, exec, statOrNull, isEmptyOrSpaces } from "../util/util"
import { debug, use, exec, statOrNull, isEmptyOrSpaces, spawn } from "../util/util"
import { copy, unlink, outputFile, remove } from "fs-extra-p"
import { executeFinally } from "../util/promise"

Expand Down Expand Up @@ -43,14 +43,13 @@ export class DmgTarget extends Target {

const volumeName = `${appInfo.productFilename} ${appInfo.version}`
//noinspection SpellCheckingInspection
await exec("hdiutil", ["create",
await spawn("hdiutil", addVerboseIfNeed(["create",
"-srcfolder", backgroundDir,
"-srcfolder", path.join(appOutDir, `${packager.appInfo.productFilename}.app`),
"-volname", volumeName,
"-anyowners", "-nospotlight", "-quiet", "-fs", "HFS+", "-fsargs", "-c c=64,a=16,e=16",
"-anyowners", "-nospotlight", "-fs", "HFS+", "-fsargs", "-c c=64,a=16,e=16",
"-format", "UDRW",
tempDmg,
])
]).concat(tempDmg))

const volumePath = path.join("/Volumes", volumeName)
if (await statOrNull(volumePath) != null) {
Expand Down Expand Up @@ -151,8 +150,8 @@ export class DmgTarget extends Target {

const artifactPath = path.join(appOutDir, `${appInfo.productFilename}-${appInfo.version}.dmg`)
//noinspection SpellCheckingInspection
await exec("hdiutil", ["convert", tempDmg, "-format", packager.devMetadata.build.compression === "store" ? "UDRO" : "UDBZ", "-imagekey", "zlib-level=9", "-o", artifactPath])
await exec("hdiutil", ["internet-enable", "-no", artifactPath])
await spawn("hdiutil", addVerboseIfNeed(["convert", tempDmg, "-format", packager.devMetadata.build.compression === "store" ? "UDRO" : "UDBZ", "-imagekey", "zlib-level=9", "-o", artifactPath]))
await exec("hdiutil", addVerboseIfNeed(["internet-enable", "-no"]).concat(artifactPath))

this.packager.dispatchArtifactCreated(artifactPath, `${appInfo.name}-${appInfo.version}.dmg`)
}
Expand Down Expand Up @@ -263,13 +262,21 @@ export async function attachAndExecute(dmgPath: string, readWrite: boolean, task
if (readWrite) {
args.push("-readwrite")
}
addVerboseIfNeed(args)
args.push(dmgPath)
const attachResult = await exec("hdiutil", args, {maxBuffer: 1024 * 1024})
const attachResult = await exec("hdiutil", args, {maxBuffer: 2 * 1024 * 1024})
const deviceResult = attachResult == null ? null : /^(\/dev\/\w+)/.exec(attachResult)
const device = deviceResult == null || deviceResult.length !== 2 ? null : deviceResult[1]
if (device == null) {
throw new Error(`Cannot mount: ${attachResult}`)
}

await executeFinally(task(), () => detach(device))
}

function addVerboseIfNeed(args: Array<string>): Array<string> {
if (debug.enabled) {
args.push("-verbose")
}
return args
}
114 changes: 22 additions & 92 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


"@develar/semantic-release@^6.3.13":
version "6.3.13"
resolved "https://registry.yarnpkg.com/@develar/semantic-release/-/semantic-release-6.3.13.tgz#849dd018d1d845746247dad7818d3fb79f46469c"
"@develar/semantic-release@^6.3.17":
version "6.3.17"
resolved "https://registry.yarnpkg.com/@develar/semantic-release/-/semantic-release-6.3.17.tgz#1a41b85269079860b7e7b491f3c17f83613bb753"
dependencies:
"@semantic-release/commit-analyzer" "^2.0.0"
"@semantic-release/condition-travis" "^5.0.0"
"@semantic-release/error" "^1.0.0"
"@semantic-release/last-release-npm" "^1.2.1"
bluebird-lst-c "^1.0.2"
conventional-changelog "^1.1.0"
conventional-commits-parser "^1.3.0"
debug "^2.2.0"
fs-extra-p "^2.0.3"
git-head "^1.14.0"
github "^5.3.3"
ini "^1.3.4"
lodash "^4.16.4"
nerf-dart "^1.0.0"
nopt "^3.0.6"
normalize-package-data "^2.3.5"
npmlog "^4.0.0"
npm-registry-client "^7.3.0"
parse-github-repo-url "^1.3.0"
rc "^1.1.6"
require-relative "^0.8.7"
run-auto "^2.0.0"
run-series "^1.1.4"
Expand All @@ -33,26 +28,10 @@
dependencies:
conventional-changelog "0.0.17"

"@semantic-release/condition-travis@^5.0.0":
version "5.0.1"
resolved "https://registry.yarnpkg.com/@semantic-release/condition-travis/-/condition-travis-5.0.1.tgz#eb5355c9b594005a406976a97ab3f1a7f967532f"
dependencies:
"@semantic-release/error" "^1.0.0"
semver "^5.0.3"
travis-after-all "^1.3.0"

"@semantic-release/error@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@semantic-release/error/-/error-1.0.0.tgz#bb8f8eeedd5c7f8c46f96b37ef39e1b8c376c1cc"

"@semantic-release/last-release-npm@^1.2.1":
version "1.2.1"
resolved "https://registry.yarnpkg.com/@semantic-release/last-release-npm/-/last-release-npm-1.2.1.tgz#ff748142ecf15354b833a86ba18205f7fce594ee"
dependencies:
"@semantic-release/error" "^1.0.0"
npm-registry-client "^7.0.1"
npmlog "^1.2.1"

"@types/ini@^1.3.29":
version "1.3.29"
resolved "https://registry.yarnpkg.com/@types/ini/-/ini-1.3.29.tgz#1325e981e047d40d13ce0359b821475b97741d2f"
Expand All @@ -62,8 +41,8 @@
resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-3.5.28.tgz#efd7614f8eb1b924c41235ff653b7370da467fac"

"@types/node@*":
version "6.0.45"
resolved "https://registry.yarnpkg.com/@types/node/-/node-6.0.45.tgz#c4842a9d653d767831e4ff495b6008cc0d579966"
version "6.0.46"
resolved "https://registry.yarnpkg.com/@types/node/-/node-6.0.46.tgz#8d9e48572831f05b11cc4c793754d43437219d62"

"@types/source-map-support@^0.2.28":
version "0.2.28"
Expand Down Expand Up @@ -136,10 +115,6 @@ ansi-styles@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-1.0.0.tgz#cb102df1c56f5123eab8b67cd7b98027a0279178"

ansi@^0.3.0, ansi@~0.3.0:
version "0.3.1"
resolved "https://registry.yarnpkg.com/ansi/-/ansi-0.3.1.tgz#0c42d4fb17160d5a9af1e484bace1c66922c1b21"

anymatch@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.0.tgz#a3e52fa39168c825ff57b0248126ce5a8ff95507"
Expand Down Expand Up @@ -175,13 +150,6 @@ archiver@^1.1.0:
tar-stream "^1.5.0"
zip-stream "^1.1.0"

are-we-there-yet@~1.0.0:
version "1.0.6"
resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.0.6.tgz#a2d28c93102aa6cc96245a26cb954de06ec53f0c"
dependencies:
delegates "^1.0.0"
readable-stream "^2.0.0 || ^1.1.13"

are-we-there-yet@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.2.tgz#80e470e95a084794fe1899262c5667c6e88de1b3"
Expand Down Expand Up @@ -1005,8 +973,8 @@ babel-types@^6.13.0, babel-types@^6.16.0, babel-types@^6.18.0, babel-types@^6.7.
to-fast-properties "^1.0.1"

babylon@^6.1.0, babylon@^6.1.21, babylon@^6.11.0:
version "6.13.0"
resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.13.0.tgz#58ed40dd2a8120612be5f318c2c0bedbebde4a0b"
version "6.13.1"
resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.13.1.tgz#adca350e088f0467647157652bafead6ddb8dfdb"

balanced-match@^0.4.1:
version "0.4.2"
Expand Down Expand Up @@ -1477,7 +1445,7 @@ conventional-commits-filter@^1.0.0:
is-subset "^0.1.1"
modify-values "^1.0.0"

conventional-commits-parser@^1.0.0:
conventional-commits-parser@^1.0.0, conventional-commits-parser@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-1.3.0.tgz#e327b53194e1a7ad5dc63479ee9099a52b024865"
dependencies:
Expand Down Expand Up @@ -1882,7 +1850,7 @@ for-in@^0.1.5:
version "0.1.6"
resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.6.tgz#c9f96e89bfad18a545af5ec3ed352a1d9e5b4dc8"

for-own@^0.1.3:
for-own@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.4.tgz#0149b41a39088c7515f51ebe1c1386d45f935072"
dependencies:
Expand Down Expand Up @@ -1960,16 +1928,6 @@ fstream@^1.0.0, fstream@^1.0.2, fstream@~1.0.10:
mkdirp ">=0.5 0"
rimraf "2"

gauge@~1.2.0:
version "1.2.7"
resolved "https://registry.yarnpkg.com/gauge/-/gauge-1.2.7.tgz#e9cec5483d3d4ee0ef44b60a7d99e4935e136d93"
dependencies:
ansi "^0.3.0"
has-unicode "^2.0.0"
lodash.pad "^4.1.0"
lodash.padend "^4.1.0"
lodash.padstart "^4.1.0"

gauge@~2.6.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.6.0.tgz#d35301ad18e96902b4751dcbbe40f4218b942a46"
Expand Down Expand Up @@ -2717,18 +2675,6 @@ lodash.keys@^3.0.0:
lodash.isarguments "^3.0.0"
lodash.isarray "^3.0.0"

lodash.pad@^4.1.0:
version "4.5.1"
resolved "https://registry.yarnpkg.com/lodash.pad/-/lodash.pad-4.5.1.tgz#4330949a833a7c8da22cc20f6a26c4d59debba70"

lodash.padend@^4.1.0:
version "4.6.1"
resolved "https://registry.yarnpkg.com/lodash.padend/-/lodash.padend-4.6.1.tgz#53ccba047d06e158d311f45da625f4e49e6f166e"

lodash.padstart@^4.1.0:
version "4.6.1"
resolved "https://registry.yarnpkg.com/lodash.padstart/-/lodash.padstart-4.6.1.tgz#d2e3eebff0d9d39ad50f5cbd1b52a7bce6bb611b"

lodash.restparam@^3.0.0:
version "3.6.1"
resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805"
Expand All @@ -2750,7 +2696,7 @@ lodash@^3.6.0:
version "3.10.1"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"

lodash@^4.0.0, lodash@^4.14.0, lodash@^4.16.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.5.1, lodash@^4.8.0:
lodash@^4.0.0, lodash@^4.14.0, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.5.1, lodash@^4.8.0:
version "4.16.4"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.16.4.tgz#01ce306b9bad1319f2a5528674f88297aeb70127"

Expand Down Expand Up @@ -2940,10 +2886,6 @@ ncp@~2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ncp/-/ncp-2.0.0.tgz#195a21d6c46e361d2fb1281ba38b91e9df7bdbb3"

nerf-dart@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/nerf-dart/-/nerf-dart-1.0.0.tgz#e6dab7febf5ad816ea81cf5c629c5a0ebde72c1a"

node-pre-gyp@^0.6.29:
version "0.6.31"
resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.31.tgz#d8a00ddaa301a940615dbcc8caad4024d58f6017"
Expand All @@ -2966,7 +2908,7 @@ node-uuid@~1.4.7:
version "1.4.7"
resolved "https://registry.yarnpkg.com/node-uuid/-/node-uuid-1.4.7.tgz#6da5a17668c4b3dd59623bda11cf7fa4c1f60a6f"

nopt@^3.0.1, nopt@^3.0.6, nopt@~3.0.6:
nopt@^3.0.1, nopt@~3.0.6:
version "3.0.6"
resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9"
dependencies:
Expand Down Expand Up @@ -3010,7 +2952,7 @@ normalize-path@^2.0.0, normalize-path@^2.0.1:
hosted-git-info "^2.1.5"
semver "^5.1.0"

npm-registry-client@^7.0.1:
npm-registry-client@^7.3.0:
version "7.3.0"
resolved "https://registry.yarnpkg.com/npm-registry-client/-/npm-registry-client-7.3.0.tgz#f2a390e8b13b78fafe26e9fa9d8bc74e17bcaa50"
dependencies:
Expand All @@ -3026,14 +2968,6 @@ npm-registry-client@^7.0.1:
optionalDependencies:
npmlog "~2.0.0 || ~3.1.0"

npmlog@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-1.2.1.tgz#28e7be619609b53f7ad1dd300a10d64d716268b6"
dependencies:
ansi "~0.3.0"
are-we-there-yet "~1.0.0"
gauge "~1.2.0"

npmlog@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.0.0.tgz#e094503961c70c1774eb76692080e8d578a9f88f"
Expand Down Expand Up @@ -3081,10 +3015,10 @@ object-keys@~0.4.0:
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-0.4.0.tgz#28a6aae7428dd2c3a92f3d95f21335dd204e0336"

object.omit@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.0.tgz#868597333d54e60662940bb458605dd6ae12fe94"
version "2.0.1"
resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa"
dependencies:
for-own "^0.1.3"
for-own "^0.1.4"
is-extendable "^0.1.1"

observable-to-promise@^0.4.0:
Expand Down Expand Up @@ -3999,10 +3933,6 @@ traverse@^0.6.6:
version "0.3.9"
resolved "https://registry.yarnpkg.com/traverse/-/traverse-0.3.9.tgz#717b8f220cc0bb7b44e40514c22b2e8bbc70d8b9"

travis-after-all@^1.3.0:
version "1.4.4"
resolved "https://registry.yarnpkg.com/travis-after-all/-/travis-after-all-1.4.4.tgz#c5a396f18404af634a65057b2c071da58923e49b"

trim-newlines@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613"
Expand Down Expand Up @@ -4057,8 +3987,8 @@ typedarray@~0.0.5:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"

typescript@^2.1.0-dev.20161025:
version "2.1.0-dev.20161026"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.1.0-dev.20161026.tgz#9157eb9af6ee7d8c39ab8b8ba417ccf18c6069e7"
version "2.1.0-dev.20161027"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.1.0-dev.20161027.tgz#f6456102956dee194398fa1ad093b944c8db4f0a"

uc.micro@^1.0.1, uc.micro@^1.0.3:
version "1.0.3"
Expand Down

0 comments on commit 74e2006

Please sign in to comment.