Skip to content

Commit

Permalink
fix: expose UnpackElectron
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Jun 24, 2019
1 parent 0514d72 commit 1c4bfb2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app-builder-bin/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "app-builder-bin",
"description": "app-builder precompiled binaries",
"version": "3.0.0",
"version": "3.0.1",
"files": [
"*.js",
"mac",
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func main() {
return
}

var app = kingpin.New("app-builder", "app-builder").Version("3.0.0")
var app = kingpin.New("app-builder", "app-builder").Version("3.0.1")

node_modules.ConfigureCommand(app)
//codesign.ConfigureCommand(app)
Expand Down
11 changes: 8 additions & 3 deletions pkg/electron/electronUnpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ func ConfigureUnpackCommand(app *kingpin.Application) {
if err != nil {
return err
}
return unpackElectron(configs, *outputDir, *distMacOsAppName, true)
return UnpackElectron(configs, *outputDir, *distMacOsAppName, true)
})
}

func unpackElectron(configs []ElectronDownloadOptions, outputDir string, distMacOsAppName string, isReDownloadOnFileReadError bool) error {
func UnpackElectron(configs []ElectronDownloadOptions, outputDir string, distMacOsAppName string, isReDownloadOnFileReadError bool) error {
cachedElectronZip := make(chan string, 1)
err := util.MapAsync(2, func(taskIndex int) (func() error, error) {
if taskIndex == 0 {
Expand All @@ -48,10 +48,15 @@ func unpackElectron(configs []ElectronDownloadOptions, outputDir string, distMac
}, nil
}
})

if err != nil {
return err
}

if len(distMacOsAppName) == 0 {
distMacOsAppName = "Electron"
}

excludedFiles := make(map[string]bool)
excludedFiles[filepath.Join(outputDir, distMacOsAppName, "Contents", "Resources", "default_app.asar")] = true
excludedFiles[filepath.Join(outputDir, "resources", "default_app.asar")] = true
Expand All @@ -72,7 +77,7 @@ func unpackElectron(configs []ElectronDownloadOptions, outputDir string, distMac
log.WithError(err).WithField("file", zipFile).Warn("cannot delete")
}

return unpackElectron(configs, outputDir, distMacOsAppName, false)
return UnpackElectron(configs, outputDir, distMacOsAppName, false)
} else {
return err
}
Expand Down

0 comments on commit 1c4bfb2

Please sign in to comment.