GithubHelp home page GithubHelp logo

develar / app-builder Goto Github PK

View Code? Open in Web Editor NEW
113.0 113.0 60.0 1.17 MB

Generic helper tool to build app in a distributable format

License: MIT License

Go 89.28% Shell 9.78% JavaScript 0.25% Makefile 0.68%
electron snap

app-builder's People

Contributors

0xjac avatar 3v1n0 avatar alduino avatar beyondkmp avatar cjp256 avatar dennisameling avatar develar avatar github-actions[bot] avatar iffy avatar julusian avatar jwheare avatar kxxt avatar marbemac avatar mimi89999 avatar mmaietta avatar mquevill avatar nekator avatar okmiim avatar om26er avatar passy avatar rhysd avatar rxliuli avatar serge1peshcoff avatar slhultgren avatar somaticit avatar theogravity avatar wavesoft avatar wgcv avatar yzewei avatar zhaoterryy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

app-builder's Issues

x509 Issues downloading electron - behind corporate proxy

I'm using app-builder (via electron-builder) so I'm not sure where to submit a bug request.

I'm behind a corporate firewall using self-signed certificates. Is there a way to pass in a custom certificate via environment so that this error will go away:

⨯ Get https://github-production-release-asset-2e65be.s3.amazonaws.com/9384267/6e845480-b4d5-11e8-9663-1856684e7cf5?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20180911%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20180911T135523Z&X-Amz-Expires=300&X-Amz-Signature=d4a4176b1532a316db82e34058e8c00169423291e49809bae1f1db0a30ffd6d6&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Delectron-v2.0.9-darwin-x64.zip&response-content-type=application%2Foctet-stream: x509: certificate signed by unknown authority

github.com/develar/app-builder/pkg/download.(*Downloader).follow.func1
/Users/develar/go/src/github.com/develar/app-builder/pkg/download/downloader.go:167
github.com/develar/app-builder/pkg/download.(*Downloader).follow
/Users/develar/go/src/github.com/develar/app-builder/pkg/download/downloader.go:200
github.com/develar/app-builder/pkg/download.(*Downloader).Download
/Users/develar/go/src/github.com/develar/app-builder/pkg/download/downloader.go:75
github.com/develar/app-builder/pkg/electron.(*ElectronDownloader).doDownload
/Users/develar/go/src/github.com/develar/app-builder/pkg/electron/electronDownloader.go:191
github.com/develar/app-builder/pkg/electron.(*ElectronDownloader).Download
/Users/develar/go/src/github.com/develar/app-builder/pkg/electron/electronDownloader.go:171
github.com/develar/app-builder/pkg/electron.downloadElectron.func1.1
/Users/develar/go/src/github.com/develar/app-builder/pkg/electron/electronDownloader.go:71
github.com/develar/app-builder/pkg/util.MapAsyncConcurrency.func2
/Users/develar/go/src/github.com/develar/app-builder/pkg/util/async.go:67
runtime.goexit
/usr/local/Cellar/go/1.10.3/libexec/src/runtime/asm_amd64.s:2361

I currently do have the vars: SL_CERT_DIR and SSL_CERT_FILE set correctly.

(If this is an electron-builder issue and not an app-builder issue i apologize).

403 error from Electron release download in Github Actions

Hi 👋

I'm seeing frequent errors when using this lib (via electron-builder) in Github Actions.

Strangely, the Linux (Ubuntu) build almost never fails but the Windows and Mac builds fail most of the time.

Here's the relevant error message:

$ /Users/runner/work/celo-web-wallet/celo-web-wallet/node_modules/.bin/electron-builder --mac --publish always
  • electron-builder  version=22.10.5 os=19.6.0
  • loaded configuration  file=/Users/runner/work/celo-web-wallet/celo-web-wallet/electron-builder.yml
  • installing production dependencies  platform=darwin arch=x64 appDir=/Users/runner/work/celo-web-wallet/celo-web-wallet/dist
  • packaging       platform=darwin arch=x64 electron=13.1.1 appOutDir=dist-electron/mac
  • Unpacking electron zip  zipPath=undefined
  • downloading     url=https://github.com/electron/electron/releases/download/v13.1.1/electron-v13.1.1-darwin-x64.zip size=79 MB parts=6
  • downloaded      url=https://github.com/electron/electron/releases/download/v13.1.1/electron-v13.1.1-darwin-x64.zip duration=1.723s
  • downloading     url=*** size=3.2 kB parts=1
  ⨯ part download request failed with status code 403
github.com/develar/app-builder/pkg/download.(*Part).doRequest
	/Volumes/data/Documents/app-builder/pkg/download/Part.go:126
github.com/develar/app-builder/pkg/download.(*Part).download
	/Volumes/data/Documents/app-builder/pkg/download/Part.go:47
github.com/develar/app-builder/pkg/download.(*Downloader).DownloadResolved.func1.1
	/Volumes/data/Documents/app-builder/pkg/download/downloader.go:155
github.com/develar/app-builder/pkg/util.MapAsyncConcurrency.func2
	/Volumes/data/Documents/app-builder/pkg/util/async.go:68
runtime.goexit
error Command failed with exit code 1.

Crash while building linux after changing icon.icns

I found what may be the same crash reported in electron-userland/electron-builder#5844

I recently changed my app's macos icon (the build works and the icon displays correctly), and now when I build for linux, the build crashes here:

maxIconInfo := result[len(result)-1]

The error message is panic: runtime error: index out of range [-1], meaning this result slice is empty.

Here's the old icon: https://s3.amazonaws.com/community.amazingmarvin.com/old_icon.icns
and the new icon: https://s3.amazonaws.com/community.amazingmarvin.com/new_icon.icns

Interestingly the old icon shows correctly in Finder whereas the new icon shows a generic image icon, so possibly the file format is invalid somehow (though using an online icns->png converter works):
image

Update useragent

The useragent set by this package is "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0.3 Safari/604.5.6". As far as I can tell, this is hardcoded and cannot be changed through any option or similar.

Unfortunately, the age of the browser versions that are set is interfering with our corporate proxy, which blocks old browsers. Would it be possible to have the useragent updated to something more modern? As we use this package only indirectly through another (Electron-Builder) simply making it customizable would not help us.

One suggestion might be to make some options customizable through environment variables? I suspect that could come in handy for people having other issues than just the useragent.

Generate icon set from single source svg/png

It would be awesome to have mac/icns behaviour extended to another targets.

User may provide single source image:

  • .svg - recommended format.
  • .png - minimum as 256x256 px (up to 1024x1024 px).

app-builder generates:

  • .icns icon container for macOS - current implementation
  • .ico for Windows (from original .svg/.png, not from .icns)
  • size.png - set of icons for Linux packages.
  • name-scale.png - set of icons for AppX.

Related issue:

Is app-builder-bin being built with Go 1.14?

We're seeing the distributed version of app-builder-bin for macOS fail with an error that existed in Go 1.14: SIGILL on the VZEROUPPER instruction, as was discussed here: golang/go#37459 (comment)

Basically any binary built by that version of Go would fail when run on older amd64 processors on the VZEROUPPER instruction with a SIGILL (illegal instruction) panic.

We encountered this here: macports/macports-ports#7195 (comment)

Pertinent log files:

So basically, I'd like to know if the app-builder-bin binary being distributed in npm is being built with Go 1.14 instead of the very latest version, 1.14.3.

proxyconnect tcp: dial tcp :0: connect: can't assign requested address

electron-builder: 22.14.13
node: v14.17.4
electron: 17.0.0
target: macOS, pkg
Host OS: macOS

We started having this issue after upgrading to Electron 17

• electron-builder  version=22.14.13 os=21.2.0
  • loaded configuration  file=package.json ("build" field)
  • writing effective config  file=dist/builder-effective-config.yaml
  • skipped dependencies rebuild  reason=npmRebuild is set to false
  • packaging       platform=darwin arch=x64 electron=17.0.0 appOutDir=dist/mac
  ⨯ Get "https://github.com/electron/electron/releases/download/v17.0.0/electron-v17.0.0-darwin-x64.zip": proxyconnect tcp: dial tcp :0: connect: can't assign requested address
github.com/develar/app-builder/pkg/download.(*Downloader).follow.func1
        /Volumes/data/Documents/app-builder/pkg/download/downloader.go:206
github.com/develar/app-builder/pkg/download.(*Downloader).follow
        /Volumes/data/Documents/app-builder/pkg/download/downloader.go:234
github.com/develar/app-builder/pkg/download.(*Downloader).DownloadNoRetry
        /Volumes/data/Documents/app-builder/pkg/download/downloader.go:128
github.com/develar/app-builder/pkg/download.(*Downloader).Download
        /Volumes/data/Documents/app-builder/pkg/download/downloader.go:112
github.com/develar/app-builder/pkg/electron.(*ElectronDownloader).doDownload
        /Volumes/data/Documents/app-builder/pkg/electron/electronDownloader.go:192
github.com/develar/app-builder/pkg/electron.(*ElectronDownloader).Download
        /Volumes/data/Documents/app-builder/pkg/electron/electronDownloader.go:177
github.com/develar/app-builder/pkg/electron.downloadElectron.func1.1
        /Volumes/data/Documents/app-builder/pkg/electron/electronDownloader.go:73
github.com/develar/app-builder/pkg/util.MapAsyncConcurrency.func2
        /Volumes/data/Documents/app-builder/pkg/util/async.go:68
runtime.goexit
        /usr/local/Cellar/go/1.16.5/libexec/src/runtime/asm_amd64.s:1371  
  ⨯ /Users/mmartinez/Documents/workspace/agent-desktop-native/node_modules/app-builder-bin/mac/app-builder_amd64 exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE  failedTask=build stackTrace=Error: /Users/mmartinez/Documents/workspace/agent-desktop-native/node_modules/app-builder-bin/mac/app-builder_amd64 exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
    at ChildProcess.<anonymous> (/Users/mmartinez/Documents/workspace/agent-desktop-native/node_modules/builder-util/src/util.ts:250:14)
    at Object.onceWrapper (events.js:520:26)
    at ChildProcess.emit (events.js:400:28)
    at maybeClose (internal/child_process.js:1055:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)

Thanks in advance.

cannot execute pnpm.cjs: %1 is not a valid Win32 application.

app-builder-bin version: 3.5.13
node version: 14.17.3

I'm trying to build my Electron app using electron-builder (v22.11.7), but it is failing with the error in the title. It appears the issue occurs in this library, which is why I am posting it here.

The full logs are available at the Github action but I've copied what seems relevant at the end of the issue.

My guess is that the issue is happening in https://github.com/develar/app-builder/blob/master/pkg/node-modules/rebuild.go#L361.

I've made a minimum reproduction of it at https://github.com/Alduino/app-builder-navw32a-repro. The logs are in its gh actions. The issue occurs both using workspaces and without, and with two different libraries ([email protected], [email protected]).

Relevant logs (from the reproduction as they are shorter)
> [email protected] postinstall D:\a\app-builder-navw32a-repro\app-builder-navw32a-repro
> electron-builder install-app-deps

  • electron-builder  version=22.11.7
  • spawning        command=D:\a\app-builder-navw32a-repro\app-builder-navw32a-repro\node_modules\.pnpm\[email protected]\node_modules\app-builder-bin\win\x64\app-builder.exe node-dep-tree --dir D:\a\app-builder-navw32a-repro\app-builder-navw32a-repro
  • exited          command=app-builder.exe code=0 pid=4212 out=[{"dir":"D:\\a\\app-builder-navw32a-repro\\app-builder-navw32a-repro\\node_modules","deps":[{"name":"register-scheme","version":"0.0.2"}]}]
  • spawning        command=D:\a\app-builder-navw32a-repro\app-builder-navw32a-repro\node_modules\.pnpm\[email protected]\node_modules\app-builder-bin\win\x64\app-builder.exe rebuild-node-modules cwd=D:\a\app-builder-navw32a-repro\app-builder-navw32a-repro
  • map async       taskCount=1
  • map async       taskCount=1
  • rebuilding native dependencies  [email protected] platform=win32 arch=x64
  • map async       taskCount=1
  • execute command  command='C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\bin\pnpm.cjs' rebuild --verbose [email protected] workingDirectory=
  ⨯ cannot execute  cause=fork/exec C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\bin\pnpm.cjs: %1 is not a valid Win32 application.
                    command='C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\bin\pnpm.cjs' rebuild --verbose [email protected]
                    workingDir=
  • exited          command=app-builder.exe code=2 pid=7004
 ERROR  Command failed with exit code 1.

Split one edit page into multiple pages

I have an edit page including multiple fields

I want split the edit page into multiple pages

First page edit first two fields, and keep other fields as read only
2nd page edit other two fields, and keep other fields as read only
etc

And create tabs so that user can switch among them.

Any suggestion?

Unable to install napi builds via prebuild-install

When using electron-builder to build electron projects, it calls out to prebuild-install to ensure that the correct native versions are installed.
When the module uses the nan api, this is needed to switch from the node to electron version of dependencies. When the modules uses the napi api, this logs a warning

yarn electron-builder install-app-deps
yarn run v1.22.5
  • electron-builder  version=22.9.1
  • rebuilding native dependencies  [email protected] platform=linux arch=x64
  • install prebuilt binary  name=sharp version=0.27.0 platform=linux arch=x64
  • build native dependency from sources  name=sharp
                                          version=0.27.0
                                          platform=linux
                                          arch=x64
                                          reason=prebuild-install failed with error (run with env DEBUG=electron-builder to get more information)
                                          error=prebuild-install info begin Prebuild-install version 6.0.0
    prebuild-install info looking for cached prebuild @ /home/julus/.npm/_prebuilds/e2913c-sharp-v0.27.0-electron-v80-linux-x64.tar.gz
    prebuild-install http request GET https://github.com/lovell/sharp/releases/download/v0.27.0/sharp-v0.27.0-electron-v80-linux-x64.tar.gz
    prebuild-install http 404 https://github.com/lovell/sharp/releases/download/v0.27.0/sharp-v0.27.0-electron-v80-linux-x64.tar.gz
    prebuild-install WARN install No prebuilt binaries found (target=9.4.0 runtime=electron arch=x64 libc= platform=linux)
    
  • rebuilding native dependency  name=sharp version=0.27.0
Done in 1.35s.

If I try to install for another platform I instead get an error that stops me from building the package.

yarn electron-builder install-app-deps --platform darwin
yarn run v1.22.5
  • electron-builder  version=22.9.1
  • rebuilding native dependencies  [email protected] platform=darwin arch=x64
  • install prebuilt binary  name=sharp version=0.27.0 platform=darwin arch=x64
  ⨯ cannot build native dependency  reason=prebuild-install failed with error and build from sources not possible because platform or arch not compatible
                                    cause=exit status 1
                                    errorOut=prebuild-install info begin Prebuild-install version 6.0.0
    prebuild-install info looking for cached prebuild @ /home/julus/.npm/_prebuilds/1b1e4c-sharp-v0.27.0-electron-v80-darwin-x64.tar.gz
    prebuild-install http request GET https://github.com/lovell/sharp/releases/download/v0.27.0/sharp-v0.27.0-electron-v80-darwin-x64.tar.gz
    prebuild-install http 404 https://github.com/lovell/sharp/releases/download/v0.27.0/sharp-v0.27.0-electron-v80-darwin-x64.tar.gz
    prebuild-install WARN install No prebuilt binaries found (target=9.4.0 runtime=electron arch=x64 libc= platform=darwin)
    
                                    command=/usr/bin/node /home/julus/Projects/companion-build/test/node_modules/prebuild-install/bin.js --platform=darwin --arch=x64 --target=9.4.0 --runtime=electron --verbose --force
                                    workingDir=/home/julus/Projects/companion-build/test/node_modules/sharp

The problem here is that prebuild-install is being forced to install binaries for --target=9.4.0 --runtime=electron instead of --target=3 --runtime=napi.
This should be influenced by the presence and value of binary.napi_versions in the package.json.

To reproduce, in an empty folder (make sure to update platform to be something you are not running on)

yarn init
yarn add electron@9 [email protected]
yarn add --dev electron-builder
yarn electron-builder install-app-deps --platform darwin

It also easily reproducable with node-hid@^2.1.1, @julusian/jpeg-turbo@^1.0.1 and likely more.

app-builder exited : segmentation violation code

Hi, I get an error when i try to run my app with
npm install && npm run dist

I get the following error:

> electron-builder

  • electron-builder version=20.8.0
  • loaded configuration file=package.json ("build" field)
  • writing effective config file=dist/electron-builder-effective-config.yaml
  • rebuilding native production dependencies platform=linux arch=x64
  • packaging       platform=linux arch=x64 electron=1.8.4 appOutDir=dist/linux-unpacked
  • asar using is disabled — it is strongly not recommended solution=enable asar and use asarUnpack to unpack files that must be externally available
  • building        target=snap arch=x64 file=dist/my-app_5.1.3_amd64.snap
  • building        target=AppImage arch=x64 file=dist/my-app-5.1.3-x86_64.AppImage
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5feaaa]

goroutine 99 [running]:
github.com/develar/app-builder/pkg/util.MapAsyncConcurrency.func1(0xc420216070, 0xc420216000, 0xc420214060, 0xc420214000, 0x0)
	/Users/develar/go/src/github.com/develar/app-builder/pkg/util/async.go:55 +0x7a
created by github.com/develar/app-builder/pkg/util.MapAsyncConcurrency
	/Users/develar/go/src/github.com/develar/app-builder/pkg/util/async.go:41 +0x181

Error: /home/user/projects/my-app-project/node_modules/app-builder-bin-linux/x64/app-builder exited with code 2
    at ChildProcess.childProcess.once.code (/home/user/projects/my-app-project/node_modules/builder-util/src/util.ts:251:14)
    at Object.onceWrapper (events.js:317:30)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
From previous event:
    at runCallback (timers.js:794:20)
    at tryOnImmediate (timers.js:752:5)
    at processImmediate [as _immediateCallback] (timers.js:729:5)
From previous event:
    at AppImageTarget.copyIcons (/home/user/projects/my-app-project/node_modules/electron-builder-lib/src/targets/AppImageTarget.ts:101:45)
    at <anonymous>


Support for more prebuild systems

This application is doing a lot of work to invoke prebuild-install correctly, but does not for any other prebuild system. It falls back to relying on either npm rebuild or invoking yarn run install for dependencies.

However, when cross-compiling (eg for arm mac from intel), it is not setting npm_config_platform or npm_config_arch, so the yarn run install gets run for the host architecture rather than the target architecture. Or the other related variables.
It feels like those variables should be defined when invoking either npm rebuild or yarn run install.

I am also wondering why does prebuild-install need such special treatment? It listens to those same variables, so it feels like it should be possible to let it use the same code flow. A good example of why is https://github.com/lovell/sharp, because it does a pre-step of downloading the correct libvips dll/so files, before invoking prebuild-install. Which means that this application is only doing half of the rebuild for that library

Usage with ELECTRON_MIRROR produces incorrect download URL

Running with

image

leads to

image

Notice the "middle URL" is 12.0.9 however the link on GitHub is https://github.com/electron/electron/releases/download/v12.0.9/electron-v12.0.9-win32-x64.zip

Notice the v12.0.9

Change my ENV to

image

Allows app-builder build to successfully download the runtimes and output an application


I see it's added

return "https://github.com/electron/electron/releases/download/v"

I suspect

v = os.Getenv("ELECTRON_MIRROR")
should gain the same

This change would make it consistent with electron/get which adds the v prefix https://github.com/electron/get/blob/a7ed0a066eb81cb1eaa86942db12e6ed48155f98/src/utils.ts#L32

Support for running on Apple Silicon (arm64)

Currently, the binary shipped in app-builder-bin is only built for x86_64, would it be possible to have it be a universal binary with support for arm64 as well?

$ file node_modules/app-builder-bin/mac/app-builder
node_modules/app-builder-bin/mac/app-builder: Mach-O 64-bit executable x86_64

'app-builder node-dep-tree --dir' can't get correct result

$: /Users/tester/development/app-builder-bin/mac/app-builder node-dep-tree --dir=/Users/tester/Desktop/test-app-builder/app

  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=0 unresolved=object-keys
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=0 unresolved=browserify-optional
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=0 unresolved=through
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=0 unresolved=esprima
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=0 unresolved=source-map
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=0 unresolved=amdefine
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/app/node_modules round=0 unresolved=base64-js
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/app/node_modules round=0 unresolved=pako, tiny-inflate
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=1 unresolved=, tiny-inflate
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=0 unresolved=pako, tiny-inflate
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=0 unresolved=through2
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=0 unresolved=quote-stream, has, through2
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=0 unresolved=readable-stream
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=0 unresolved=readable-stream
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=0 unresolved=source-map
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=0 unresolved=prelude-ls, type-check
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=0 unresolved=prelude-ls
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/app/node_modules round=0 unresolved=object-keys, acorn, foreach
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=1 unresolved=object-keys, ,
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=0 unresolved=inherits
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=0 unresolved=safe-buffer
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=0 unresolved=escodegen
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=0 unresolved=safe-buffer
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=0 unresolved=readable-stream
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=0 unresolved=base64-js
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/app/node_modules round=0 unresolved=through
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/app/node_modules round=0 unresolved=esprima
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=1 unresolved=esprima
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/app/node_modules round=0 unresolved=source-map
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/node_modules round=1 unresolved=source-map
  • unresolved deps  nodeModuleDir=/Users/tester/Desktop/test-app-builder/app/node_modules round=0 unresolved=amdefine

Folder Structure:

test-app-builder
    package.json
    app
        package.json

two package.json content:

{
  "name": "test-app-builder",
  "version": "0.0.1",
  "dependencies": {
    "fontkit": "^1.8.0"
  }
}

Execute command:

/Users/tester/development/app-builder-bin/mac/app-builder node-dep-tree --dir=/Users/tester/Desktop/test-app-builder/app

Result is:

[
    {
        "dir": "/Users/tester/Desktop/test-app-builder/node_modules",
        "deps": [
            "amdefine",
            "ast-transform",
            "ast-types",
            "base64-js",
            "browser-resolve",
            "browserify-optional",
            "buffer-equal",
            "core-util-is",
            "deep-is",
            "escodegen",
            "esprima",
            "estraverse",
            "esutils",
            "fast-levenshtein",
            "function-bind",
            "has",
            "inherits",
            "isarray",
            "levn",
            "minimist",
            "object-keys",
            "optionator",
            "pako",
            "prelude-ls",
            "process-nextick-args",
            "quote-stream",
            "readable-stream",
            "safe-buffer",
            "source-map",
            "string_decoder",
            "through",
            "through2",
            "tiny-inflate",
            "type-check",
            "util-deprecate",
            "wordwrap",
            "xtend"
        ]
    },
    {
        "dir": "/Users/tester/Desktop/test-app-builder/app/node_modules",
        "deps": [
            "acorn",
            "amdefine",
            "ast-transform",
            "ast-types",
            "babel-runtime",
            "base64-js",
            "brfs",
            "brotli",
            "browser-resolve",
            "browserify-optional",
            "buffer-equal",
            "buffer-from",
            "clone",
            "concat-stream",
            "convert-source-map",
            "core-js",
            "core-util-is",
            "deep-equal",
            "deep-is",
            "define-properties",
            "dfa",
            "duplexer2",
            "escodegen",
            "esprima",
            "estraverse",
            "esutils",
            "falafel",
            "fast-levenshtein",
            "fontkit",
            "foreach",
            "function-bind",
            "has",
            "inherits",
            "is-arguments",
            "is-date-object",
            "is-regex",
            "isarray",
            "levn",
            "magic-string",
            "merge-source-map",
            "minimist",
            "object-inspect",
            "object-is",
            "object-keys",
            "optionator",
            "pako",
            "path-parse",
            "prelude-ls",
            "process-nextick-args",
            "quote-stream",
            "readable-stream",
            "regenerator-runtime",
            "regexp.prototype.flags",
            "resolve",
            "restructure",
            "safe-buffer",
            "shallow-copy",
            "source-map",
            "static-eval",
            "static-module",
            "string_decoder",
            "through",
            "through2",
            "tiny-inflate",
            "type-check",
            "typedarray",
            "unicode-properties",
            "unicode-trie",
            "util-deprecate",
            "vlq",
            "wordwrap",
            "xtend"
        ]
    },
    {
        "dir": "/Users/tester/Desktop/test-app-builder/node_modules/ast-transform/node_modules",
        "deps": [
            "escodegen",
            "esprima",
            "estraverse",
            "esutils",
            "source-map"
        ]
    },
    {
        "dir": "/Users/tester/Desktop/test-app-builder/node_modules/browser-resolve/node_modules",
        "deps": [
            "resolve"
        ]
    },
    {
        "dir": "/Users/tester/Desktop/test-app-builder/app/node_modules/ast-transform/node_modules",
        "deps": [
            "escodegen",
            "esprima",
            "estraverse",
            "esutils",
            "source-map"
        ]
    },
    {
        "dir": "/Users/tester/Desktop/test-app-builder/app/node_modules/browser-resolve/node_modules",
        "deps": [
            "resolve"
        ]
    },
    {
        "dir": "/Users/tester/Desktop/test-app-builder/app/node_modules/falafel/node_modules",
        "deps": [
            "isarray"
        ]
    },
    {
        "dir": "/Users/tester/Desktop/test-app-builder/app/node_modules/merge-source-map/node_modules",
        "deps": [
            "source-map"
        ]
    },
    {
        "dir": "/Users/tester/Desktop/test-app-builder/app/node_modules/unicode-properties/node_modules",
        "deps": [
            "unicode-trie"
        ]
    }
]

When we set --dir=/Users/tester/Desktop/test-app-builder/app, we expect that the result should not includes /Users/tester/Desktop/test-app-builder/node_modules/

Problems building for arm64 Raspberry - Icons Related.

  • electron-builder 22.11.7
  • electron 13.1.2
  • Node.js v14.17.0

Target

  • ARM64 - Raspberry Pi:

Building my Electron app inside a RaspberryPi 4 ARM64 it fails while copying and/or converting my icons inside resources/icons and crashes with a message that is not very clear.

snapcraft is not installed, please: sudo snap install snapcraft --classic

More logs with the error that Can say more about the app-builder-bin failing with the icons part.

• exited          command=app-builder code=0 pid=9793
  • packaging       platform=linux arch=arm64 electron=13.1.2 appOutDir=release/linux-arm64-unpacked
  • spawning        command=/root/countr-desktop-next/node_modules/app-builder-bin/linux/arm64/app-builder unpack-electron --configuration [{"platform":"linux","arch":"arm64","version":"13.1.2"}] --output /root/countr-desktop-next/release/linux-arm64-unpacked --distMacOsAppName Electron.app
  • map async       taskCount=2
  • map async       taskCount=1
  • map async       taskCount=73
  • exited          command=app-builder code=0 pid=10276
  • building        target=snap arch=arm64 file=release/countr-desktop_4.0.1_arm64.snap
  • spawning        command=/root/countr-desktop-next/node_modules/app-builder-bin/linux/arm64/app-builder icon --format set --root /root/countr-desktop-next/resources --root /root/countr-desktop-next --out /root/countr-desktop-next/release/.icon-set --input icons/ --fallback-input /root/countr-desktop-next/node_modules/app-builder-lib/templates/icons/electron-linux
  • path resolved   path=/root/countr-desktop-next/resources/icons outputFormat=set
  • map async       taskCount=8
  • exited          command=app-builder code=0 pid=10283 out={"icons":[{"file":"/root/countr-desktop-next/resources/icons/24x24.png","size":24},{"file":"/root/countr-desktop-next/resources/icons/32x32.png","size":32},{"file":"/root/countr-desktop-next/resources/icons/48x48.png","size":48},{"file":"/root/countr-desktop-next/resources/icons/64x64.png","size":64},{"file":"/root/countr-desktop-next/resources/icons/96x96.png","size":96},{"file":"/root/countr-desktop-next/resources/icons/128x128.png","size":128},{"file":"/root/countr-desktop-next/resources/icons/256x256.png","size":256},{"file":"/root/countr-desktop-next/resources/icons/512x512.png","size":512}],"isFallback":false}
  • application Linux category is set to default "Utility"  reason=linux.category is not set and cannot map from macOS docs=https://www.electron.build/configuration/linux
  • spawning        command=/root/countr-desktop-next/node_modules/app-builder-bin/linux/arm64/app-builder snap --app /root/countr-desktop-next/release/linux-arm64-unpacked --stage /root/countr-desktop-next/release/__snap-arm64 --arch arm64 --output /root/countr-desktop-next/release/countr-desktop_4.0.1_arm64.snap --executable countr-desktop --icon /root/countr-desktop-next/resources/icons/512x512.png --extraAppArgs=--no-sandbox
  • copy files      from=/root/countr-desktop-next/resources/icons/512x512.png to=/root/countr-desktop-next/release/__snap-arm64/snap/gui/icon.png isUseHardLinks=true
  • exit status 1   
  ⨯ snapcraft is not installed, please: sudo snap install snapcraft --classic  
  • exited          command=app-builder code=1 pid=10288
  • async task error  error=/root/countr-desktop-next/node_modules/app-builder-bin/linux/arm64/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
  ⨯ /root/countr-desktop-next/node_modules/app-builder-bin/linux/arm64/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE  stackTrace=
                                                                                                                                           Error: /root/countr-desktop-next/node_modules/app-builder-bin/linux/arm64/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
                                                                                                                                               at ChildProcess.<anonymous> (/root/countr-desktop-next/node_modules/builder-util/src/util.ts:243:14)
                                                                                                                                               at Object.onceWrapper (events.js:483:26)
                                                                                                                                               at ChildProcess.emit (events.js:376:20)
                                                                                                                                               at maybeClose (internal/child_process.js:1055:16)
                                                                                                                                               at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] package-pi: `yarn build && electron-builder build --linux --arm64 --publish never

File Package.json - Build section

"build": {
    "buildDependenciesFromSource": true,
    "productName": "Countr-Desktop",
    "appId": "com.en.countr.desktop",
    "compression": "normal",
    "files": [
      "resources/**/*",
      "app/img/",
      "app/dist/",
      "app/app.html",
      "app/main.prod.js",
      "app/main.prod.js.map"
    ],
    "linux": {
      "target": {
        "target": "snap",
        "arch": "arm64"
      },
    },
    "directories": {
      "buildResources": "resources",
      "output": "release"
    }
  }

node-dep-tree hangs on windows when using an absolute path

I am trying to build an app using electron-builder, and it is hanging. The logs show that it gets stuck after spawning the command:

C:\Users\chdrie\Documents\Programs\JavaScript\mas-demo-client\node_modules\app-builder-bin\win\x64\app-builder.exe node-dep-tree --dir C:\Users\chdrie\Documents\Programs\JavaScript\mas-demo-client

Running this command in a separate powershell window confirms that it does indeed hang. However, if I pass a relative path to the --dir flag, the command succeeds. To clarify, if I cd \, the following command works:

C:\Users\chdrie\Documents\Programs\JavaScript\mas-demo-client\node_modules\app-builder-bin\win\x64\app-builder.exe node-dep-tree --dir Users\chdrie\Documents\Programs\JavaScript\mas-demo-client

Any assistance would be appreciated.

Add support for recommended dependencies

Hello,
Debian packages can have recommended dependencies. I think that making libappindicator1 recommended would be the best solution for #51, but currently there is no support for that.

Snap apps not working with absolute paths in user-dirs.dirs

I have the following ~/.config/user-dirs.dirs file in my home directory:

XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOCUMENTS_DIR="/media/Shared storage/Documents"
XDG_DOWNLOAD_DIR="/media/Shared storage/Downloads"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="/media/Shared storage/Pictures"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_VIDEOS_DIR="/media/Shared storage/Videos"

When I install an app built by app-builder from snap, then nothing is running and no errors in the terminal. This is perplexing.

After a long debug I came to the conclusion that the launch crashes here

desktop-common.sh tries to delete directory /media/Shared storage/Documents and sends all error messages into /dev/null

Support LZO compression for snap builds

Currently snaps packages are compressed using xz with no way to override that. For the much needed performance fixes the snap package format now supports archives to be compressed using LZO compression.

The current call of app-builder looks like this

args = append(args, *options.output, "-no-progress", "-quiet", "-noappend", "-comp", "xz", "-no-xattrs", "-no-fragments", "-all-root")
, we need to add a command line parameter to override the compression format.

error: run rcedit-ia32.exe in wine x64

error
image

image

environment
node: 12.14
wine: wine-4.0.3
linux: redhat 7.3

recurrence

git clone https://github.com/electron/electron-quick-start demo
cd demo
yarn
yarn add -D electron-builder

then add build :"electron-builder --win --dir --ia32" to scripts
then run npm run build

[Feature Request]: Add an option to force using prebuilt binaries

I don't know GO lang but I tried to read the code, and from what I understood is that the value of hasPrebuildInstall will be true if there is a prebuild-install dependency in package.json:

for name := range info.Dependencies {
if name == "prebuild-install" {
jsonWriter.WriteMore()
jsonWriter.WriteObjectField("hasPrebuildInstall")
jsonWriter.WriteBool(true)
break
}
}

Then if the value hasPrebuildInstall is not true, the function installUsingPrebuild will not try to download the prebuilt binary.

if !dependency.HasPrebuildInstall {
return nil, nil
}

It would be nice if there was an option to somehow pass an array of modules to installUsingPrebuild and the function will try to use their prebuilt binaries regardless of the value of hasPrebuildInstall (regardless of whether they use prebuild-install or no)

certificate-info Doesn't return end of certificate tree

After debugging why our app was not auto updating after getting a new code signing certificate I discovered the Subject's name that is then used as the Publisher-Name was not correct.

My certificate path is the following:

  1. Sectigo(AAA)
      2. USERTrust RSA Cert Authority - Comdo CA Limited
       3. Sectigo RSA Code Signing CA - the USERTRUST Network
        4. Nexus Dev LLC {That us}

Digging through the app-builder code I discovered what was the issue.
When the certificate is read, it goes down the tree and gets the first cert that has ExtKeyUsageCodeSigning then returns that one. However, the 3rd cert, Sectigo RSA Code Signing, is marked with that usage and then gets returned. This caused a huge issue as now the auto update is using the 4th but since app-update.yml is using the 3rd, the update verification fails. The code that checks the update's certificate and the code that generates the app-update do not use the same method and a mismatch occurs.

I am not sure this is a solution that will work for everyone but does for me. Since the 3rd is a CA, I do a logic check for isCA.

for _, cert := range certificates { for _, usage := range cert.ExtKeyUsage { if usage == x509.ExtKeyUsageCodeSigning { if cert.IsCA == false { firstCert = cert break certLoop } } } }

I understand that manually setting publisher-name is better, and that has already been done, but I think some additional logic could be used to better verify the correct certificate is used considering how important code signing is.

Unable to build arm64 native modules on Mac

This is an issue that impacts electron-builder for arm64 Apple Silicon macs. Tested on v22.10.5

Using app-builder to generate .node files does not assemble them for the correct process architecture.
Example:

➜  shell git:(master) yarn postinstall                                      
yarn run v1.22.10
$ npm run install:native

> [email protected] install:native /Development/shell
> electron-builder node-gyp-rebuild; electron-builder install-app-deps

  • loaded configuration  file=/Development/shell/electron-builder.js
  • executing node-gyp rebuild  platform=darwin arch=arm64
  • electron-builder  version=22.10.5
  • loaded configuration  file=/Development/shell/electron-builder.js
  • rebuilding native dependencies  [email protected] platform=darwin arch=arm64
  • rebuilding native dependency  name=electron-deeplink version=1.0.6
✨  Done in 11.66s.

➜  shell git:(master) find . -name "*.node"  -print0 | xargs -0 -n 1 lipo -i
Non-fat file: ./node_modules/electron-deeplink/build/Release/electron-deeplink.node is architecture: x86_64
Non-fat file: ./build/Release/uta_native.node is architecture: x86_64
Non-fat file: ./build/Release/app.node is architecture: x86_64

All node modules are built as x64 despite being on an arm64 device. The console log says executing node-gyp rebuild platform=darwin arch=arm64 but the output is not arm64.

If one attempts to force the arch, it still fails to produce the correct asset:

➜  shell git:(master) yarn electron-builder install-app-deps  --arch arm64                              
yarn run v1.22.10
$ /Development/shell/node_modules/.bin/electron-builder install-app-deps --arch arm64
  • electron-builder  version=22.10.5
  • loaded configuration  file=/Development/shell/electron-builder.js
  • rebuilding native dependencies  [email protected] platform=darwin arch=arm64
  • rebuilding native dependency  name=electron-deeplink version=1.0.6
✨  Done in 3.69s.
➜  shell git:(master) find . -name "*.node"  -print0 | xargs -0 -n 1 lipo -i
Non-fat file: ./node_modules/electron-deeplink/build/Release/electron-deeplink.node is architecture: x86_64

In comparison, if using electron-rebuild, all modules are properly generated for arm64 by default

➜  shell git:(master) yarn electron-rebuild --arch arm64 -f
....verbose output
➜  shell git:(master) ✗ find . -name "*.node"  -print0 | xargs -0 -n 1 lipo -i
Non-fat file: ./bin/darwin-arm64-85/shell.node is architecture: arm64
Non-fat file: ./node_modules/electron-deeplink/bin/darwin-arm64-85/electron-deeplink.node is architecture: arm64
Non-fat file: ./node_modules/electron-deeplink/build/Release/electron-deeplink.node is architecture: arm64
Non-fat file: ./build/Release/uta_native.node is architecture: arm64
Non-fat file: ./build/Release/app.node is architecture: arm64

File associations not working for AppImage builds

I found this issue whilst using electron-builder but it looks as though the issue is actually found in here within app-builder. See electron-builder issue for details.

When defining file associations for opening custom file extensions within the application it does not correctly associate them for AppImage builds. This looks to be due to packaging the mime-type into the wrong location in the AppImage for installing the AppImage using AppImageLauncher (the recommended install method). It is unclear why this works, but if the mime-type file is at /usr/share/mime/packages rather than /usr/share/mime, the mime type gets installed correctly. Interestingly, in .deb builds it seems to be added to /usr/share/mime/packages already. This is also the location that the mime-type file exists within the Freecad AppImage where file associations work as intended.

Here is a reproducer using just the electron quick start application and electron builder. On builds other than AppImage, files with extension example get associated correctly. On AppImage builds they do not. If you extract the AppImage using appimagetool and move the mime-type file from /usr/share/mime to /usr/share/mime/packages and repackage the image, you will see the file association work correctly.

It looks as though the issue exists at this line.

CVE-2021-38297 security vulnerability GO

Electron app is throwing vulnerabilities for the go version 1.16.5 on paths:

  • node_modules/app-builder-bin/linux/x64/app-builder
  • node_modules/app-builder-bin/linux/ia32/app-builder
  • node_modules/app-builder-bin/linux/arm64/app-builder
  • node_modules/app-builder-bin/linux/arm/app-builder

electron version : "12.2.3"
electron-builder version: "22.14.5"
builder-util version: "22.14.5"
app-builder-bin version: "3.7.1"

download-artifact fails on Windows

On Windows with Windows Defender enabled (the default behavior), download-artifact always fails with the error below:

cannot move downloaded into final location (another process downloaded faster?)  path=xxx\winCodeSign\winCodeSign-2.6.0
                                                                                     tempFile=xxx\winCodeSign\087033947
                                                                                     error=rename xxx\winCodeSign\087033947 xxx\winCodeSign\winCodeSign-2.6.0: Access is denied.

I found the related code here:

func RenameToFinalFile(tempFile string, filePath string, logger *zap.Logger) {
err := os.Rename(tempFile, filePath)
if err != nil {
logger.Warn("cannot move downloaded into final location (another process downloaded faster?)", zap.String("tempFile", tempFile), zap.Error(err))
}

I guess it's because the files are being used by Windows Defender when app-builder tries to move it. Could you retry the operation later or sleep a while before trying to move the files just downloaded? I'm glad to send a PR if you agree with it.

I can confirm this error disappears if Windows Defender is disabled. But we could not ask every user to disable Windows Defender before using a tool depending on app-builder, so I guess this is something app-builder should take care of.

Thanks in advance.

app-builder.exe exited with code 1 saying that the requested address is not valid

  • electron-builder: ^20.28.4
  • Target: Windows 7 x64
  • electron 2.0.11
  • webpack 4.15.1
  • @babel/core 6.26.3
  • electron-builder version=20.28.4
  • loaded configuration file=package.json ("build" field)
  • writing effective config file=build\builder-effective-config.yaml
  • rebuilding native production dependencies platform=win32 arch=x64
  • packaging       platform=win32 arch=x64 electron=2.0.11 appOutDir=build\win-unpacked
  ⨯ Get https://github.com/electron/electron/releases/download/v2.0.11/electron-v2.0.11-win32-x64.zip: proxyconnect tcp: dial tcp :0: connectex: The requested address is not valid in its context.
github.com/develar/app-builder/pkg/download.(*Downloader).follow.func1
        /Users/develar/go/src/github.com/develar/app-builder/pkg/download/downloader.go:167
github.com/develar/app-builder/pkg/download.(*Downloader).follow
        /Users/develar/go/src/github.com/develar/app-builder/pkg/download/downloader.go:200
github.com/develar/app-builder/pkg/download.(*Downloader).Download
        /Users/develar/go/src/github.com/develar/app-builder/pkg/download/downloader.go:75
github.com/develar/app-builder/pkg/electron.(*ElectronDownloader).doDownload
        /Users/develar/go/src/github.com/develar/app-builder/pkg/electron/electronDownloader.go:191
github.com/develar/app-builder/pkg/electron.(*ElectronDownloader).Download
        /Users/develar/go/src/github.com/develar/app-builder/pkg/electron/electronDownloader.go:171
github.com/develar/app-builder/pkg/electron.downloadElectron.func1.1
        /Users/develar/go/src/github.com/develar/app-builder/pkg/electron/electronDownloader.go:71
github.com/develar/app-builder/pkg/util.MapAsyncConcurrency.func2
        /Users/develar/go/src/github.com/develar/app-builder/pkg/util/async.go:67
runtime.goexit
        /usr/local/Cellar/go/1.10.3/libexec/src/runtime/asm_amd64.s:2361

Error: d:\work\electron-test\node_modules\app-builder-bin\win\x64\app-builder.exe exited with code 1
    at ChildProcess.childProcess.once.code (d:\work\electron-test\node_modules\builder-util\src\util.ts:254:14)
    at Object.onceWrapper (events.js:317:30)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
From previous event:
    at unpack (d:\work\electron-test\node_modules\app-builder-lib\out\electron\ElectronFramework.js:191:18)
    at Object.prepareApplicationStageDirectory (d:\work\electron-test\node_modules\app-builder-lib\src\electron\ElectronFramework.ts:148:50)
    at d:\work\electron-test\node_modules\app-builder-lib\src\platformPackager.ts:179:21
    at Generator.next (<anonymous>)
From previous event:
    at WinPackager.doPack (d:\work\electron-test\node_modules\app-builder-lib\src\platformPackager.ts:166:165)
    at d:\work\electron-test\node_modules\app-builder-lib\src\platformPackager.ts:112:16
    at Generator.next (<anonymous>)
From previous event:
    at WinPackager.pack (d:\work\electron-test\node_modules\app-builder-lib\src\platformPackager.ts:110:95)
    at d:\work\electron-test\node_modules\app-builder-lib\src\packager.ts:376:24
    at Generator.next (<anonymous>)
    at xfs.stat (d:\work\electron-test\node_modules\fs-extra-p\node_modules\fs-extra\lib\mkdirs\mkdirs.js:56:16)
    at d:\work\electron-test\node_modules\graceful-fs\polyfills.js:287:18
    at FSReqWrap.oncomplete (fs.js:153:5)
From previous event:
    at Packager.doBuild (d:\work\electron-test\node_modules\app-builder-lib\src\packager.ts:344:39)
    at d:\work\electron-test\node_modules\app-builder-lib\src\packager.ts:314:57
    at Generator.next (<anonymous>)
    at d:\work\electron-test\node_modules\graceful-fs\graceful-fs.js:99:16
    at d:\work\electron-test\node_modules\graceful-fs\graceful-fs.js:43:10
    at FSReqWrap.oncomplete (fs.js:135:15)
From previous event:
    at Packager._build (d:\work\electron-test\node_modules\app-builder-lib\src\packager.ts:285:133)
    at d:\work\electron-test\node_modules\app-builder-lib\src\packager.ts:281:23
    at Generator.next (<anonymous>)
From previous event:
    at Packager.build (d:\work\electron-test\node_modules\app-builder-lib\src\packager.ts:238:14)
    at build (d:\work\electron-test\node_modules\app-builder-lib\src\index.ts:58:28)
    at build (d:\work\electron-test\node_modules\electron-builder\src\builder.ts:227:10)
    at then (d:\work\electron-test\node_modules\electron-builder\src\cli\cli.ts:42:48)
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
    at Object.args [as handler] (d:\work\electron-test\node_modules\electron-builder\src\cli\cli.ts:42:48)
    at Object.runCommand (d:\work\electron-test\node_modules\yargs\lib\command.js:238:44)
    at Object.parseArgs [as _parseArgs] (d:\work\electron-test\node_modules\yargs\yargs.js:1085:24)
    at Object.get [as argv] (d:\work\electron-test\node_modules\yargs\yargs.js:1000:21)
    at Object.<anonymous> (d:\work\electron-test\node_modules\electron-builder\src\cli\cli.ts:25:28)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `cross-env DEBUG=electron-builder node .electron-vue/build.js && electron-builder`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\electron-test\AppData\Roaming\npm-cache\_logs\2018-10-08T02_36_58_756Z-debug.log

Amazon S3 region detection seems to be broken

First of all, my S3 region is not default (is not us-east-1).

I tried running command similar to this one:

app-builder.exe publish-s3 --bucket bucket-name --key test.txt --file "D:\test.txt"

and it fails with

AccessDenied: Access Denied status code: 403, request id: 0A932DFCA22D0A12, host id: sLVlhIFpvh7QQqaiPsjQeV9/Jli9sIk8c44X89eStgAkvXArYSsAKLLblZDnX8m8lSaZ9k/nm/s=
github.com/develar/app-builder/pkg/publisher.getBucketRegion       
/Volumes/data/Documents/app-builder/pkg/publisher/s3.go:99

However it runs ok when I explicitly specify correct --region option.

Also, to check if my creds are ok (btw I have permission s3:GetBucketLocation) I created sample script using aws nodejs sdk and it succesfully recieved region info.

I suspect, that it may be related to this part:

awsSession, err := session.NewSession(awsConfig, &aws.Config{
    // any region required
    Region:     aws.String("us-east-1"), // <---- is it really required?
    HTTPClient: httpClient,
})

... but I`m not sure.

AWS region issue

electron-builder uses this module which is how I got here.

When deploying to a region that I am not in, I have to change my system time to match the region

Example:
if I am in California and try to deploy to us-east-2, I get a SignatureDoesNotMatch error because the timestamp is wrong.

missing support of 'noproxy' directive from .npmrc

In my project, we have a strict proxy configuration. app-builder (used via electron-builder) needs to download some elements to do its job, and for this it must use the proxy. At the end, to publish the build installer, we use a local server, that doesn't need the proxy.
So it sounded natural to declare the publish server's URL in .npmrc/noproxy to bypass the proxy.
This doesn't work, and we can see why in the following code :

func proxyFromNpm() (*url.URL, error) {

The code reads the 'proxy' directive, but not the 'noproxy'...

Workaround : in the build scripts, I have separated the electron-builder call in two parts, such like :

  1. electron-builder -p never
  2. cross-env NO_PROXY=* electron-builder -p always -pd <release_dir>

The second line works because the special case NO_PROXY=* disable any proxy processing as seen here :
https://github.com/develar/app-builder/blob/master/pkg/util/proxy.go#L17

Encode plist files in XML instead of binary to mitigate App Store build crashes

I'm using electron-builder to build distributables for my Electron app. Currently, app-builder is producing Info.plist files in binary format. This seems to be causing mas and mas-dev builds to crash at runtime. I'm not sure if there's any official documentation that states MAS builds should have XML formatted plists, but it is mentioned as necessary for entitlement plist files for notarization (see here).

I've detailed the steps I've taken to get working mas/mas-dev builds here: electron/osx-sign#223 (comment).

Changing the following:

err := plist.NewEncoderForFormat(&out, plist.BinaryFormat).Encode(data)

to have plist.XMLFormat passed instead should do the trick, I hope.

Can't publish Snap with snapcraft version 4.0.4

electron-builder version: 22.7.0

Snapcraft 4.0.4 throws an error if the --target-arch parameter is passed when multipass is used;

Error: --target-arch cannot be used with build provider 'multipass'

Full stack trace

This is the specific snapcraft commit: canonical/snapcraft@19393ef. Note that it says it never worked, so whatever app-builder is intending to do here might not be working.

I chatted to some of the Ubuntu team on Freenode and they said:

--target-arch, aka crossbuilding, only works with --destructive-build at the moment

A workaround I found is to set this environment variable: SNAP_DESTRUCTIVE_MODE="true". app-builder passes --destructive-mode to the snap/snapcraft command if that environment variable (and value) is present.

My understanding is that destructive mode means snap effectively doesn't use multipass/VMs and can mess up the host it's ran on. See https://snapcraft.io/blog/faster-snap-development-additional-tips-and-tricks

"blockmap" with "deflate" and no output file creates invalid ZIP

I'm using electron-builder to create ZIP files, which uses app-builder internally. Specifically, it calls app-builder with the "blockmap" and "deflate" options and no output file. Sometimes when I run command-line unzip on the generated ZIP files, they give an error like:

Archive:  MyApp-2.0.0-mac.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.

I'm not a Go developer, but it looks to me like when blockmap is run with no output file, pkg/blockmap/blockmap.go is simply appending the compressed blockmap data to the end of the existing ZIP file. I found a really great comment at thejoshwolfe/yauzl#48 (comment) that discusses why appending data to the end of a ZIP file isn't valid.

I'd suggest using the end-of-central-directory comment to store the blockmap data, but it looks like the data can be longer than the max allowed comment length, so I'm not sure what would be the best approach.

Also xref electron-userland/electron-builder#3779, which helped me track this down.

Under which license is app-builder?

Hi! 👋

I'd love to make a contribution but would quite like to know which license the code in this repo is under. Mind adding a LICENSE file? :)

Cheers!

Include more information on invalid `package.json` dependency files

Hi Vladimir and thank you for the amazing work!

Somehow, when packaging on CI environments (both Mac and Windows), electron-builder fails to parse a dependency's package.json. I've written a few scripts to try and debug this issue on CI (including dumping the entire directory) but I've not be able to find the invalid package. I can't reproduce it locally so I'm out of ideas.

Would it be possible to include more information when parsing a dependency's package.json fails, like including the path to the package.json? Or, perhaps make the JSON parsing slightly more flexible?

Thanks for taking the time to look at this.

return nil, errors.WithStack(err)

insomnia-app: [package] Packaging app
insomnia-app:   • electron-builder version=20.39.0
insomnia-app:   • artifacts will be published reason=tag is defined tag=v6.4.0
insomnia-app:   • rebuilding native production dependencies platform=darwin arch=x64
insomnia-app:   • packaging       platform=darwin arch=x64 electron=4.1.4 appOutDir=dist/mac
insomnia-app:   ⨯ node_modules.Dependency.Dependencies: ReadMapCB: expect { or n, but found [, error found in #10 byte of ...|cies"  : [],
insomnia-app:   "repo|..., bigger context ...|g>",
insomnia-app:   "contributors"  : [],
insomnia-app:   "dependencies"  : [],
insomnia-app:   "repository"    : {"type": "git", "url": "git|...
insomnia-app: github.com/develar/app-builder/pkg/node-modules.readPackageJson
insomnia-app: 	/Volumes/data/Documents/app-builder/pkg/node-modules/tree.go:388
insomnia-app: github.com/develar/app-builder/pkg/node-modules.(*Collector).resolveDependency
insomnia-app: 	/Volumes/data/Documents/app-builder/pkg/node-modules/tree.go:308
insomnia-app: github.com/develar/app-builder/pkg/node-modules.(*Collector).processDependencies
insomnia-app: 	/Volumes/data/Documents/app-builder/pkg/node-modules/tree.go:228
insomnia-app: github.com/develar/app-builder/pkg/node-modules.(*Collector).readDependencyTree
insomnia-app: 	/Volumes/data/Documents/app-builder/pkg/node-modules/tree.go:193
insomnia-app: github.com/develar/app-builder/pkg/node-modules.(*Collector).readDependencyTree
insomnia-app: 	/Volumes/data/Documents/app-builder/pkg/node-modules/tree.go:209
insomnia-app: github.com/develar/app-builder/pkg/node-modules.(*Collector).readDependencyTree
insomnia-app: 	/Volumes/data/Documents/app-builder/pkg/node-modules/tree.go:209
insomnia-app: github.com/develar/app-builder/pkg/node-modules.(*Collector).readDependencyTree
insomnia-app: 	/Volumes/data/Documents/app-builder/pkg/node-modules/tree.go:209
insomnia-app: github.com/develar/app-builder/pkg/node-modules.ConfigureCommand.func1
insomnia-app: 	/Volumes/data/Documents/app-builder/pkg/node-modules/tree.go:45
insomnia-app: github.com/alecthomas/kingpin.(*actionMixin).applyActions
insomnia-app: 	/Volumes/data/go/pkg/mod/github.com/alecthomas/[email protected]+incompatible/actions.go:28
insomnia-app: github.com/alecthomas/kingpin.(*Application).applyActions
insomnia-app: 	/Volumes/data/go/pkg/mod/github.com/alecthomas/[email protected]+incompatible/app.go:557
insomnia-app: github.com/alecthomas/kingpin.(*Application).execute
insomnia-app: 	/Volumes/data/go/pkg/mod/github.com/alecthomas/[email protected]+incompatible/app.go:390
insomnia-app: github.com/alecthomas/kingpin.(*Application).Parse
insomnia-app: 	/Volumes/data/go/pkg/mod/github.com/alecthomas/[email protected]+incompatible/app.go:222
insomnia-app: main.main
insomnia-app: 	/Volumes/data/Documents/app-builder/main.go:78
insomnia-app: runtime.main
insomnia-app: 	/usr/local/Cellar/go/1.12/libexec/src/runtime/proc.go:200
insomnia-app: runtime.goexit

handle 404 cases caused by using electron mirror

if we want to download electron 14.2.5 binaries, and donot set mirror: the code in https://github.com/develar/app-builder/blob/master/pkg/electron/electronDownloader.go#L85 will use the url: https://github.com/electron/electron/releases/download/v,and the final result is https://github.com/electron/electron/releases/download/v14.2.5/xxxxxxx.zip

if we have a custom mirror: https://npmmirror.com/mirrors/electron

the code will result the url: https://npmmirror.com/mirrors/electron/14.2.5 <- this is a 404 url

so we need set the mirror to: https://npmmirror.com/mirrors/electron/v, and this will result the electron postinstall script download a 404...

image

first, nowadays, electron's release all use vA.B.C versions, so the download link is: https://github.com/electron/electron/releases/download/v18.0.0-alpha.1/electron-v18.0.0-alpha.1-darwin-arm64-dsym.zip

this is how @electron/get handle it:

  1. get base url without the suffix /v
    https://github.com/electron/get/blob/main/src/artifact-utils.ts#L45
  2. normalize version with a prefix v
    https://github.com/electron/get/blob/b5a4b714538838f27cb1b65fcee27b1abaac013a/src/utils.ts#L32

electron-builder Appx code signing fails due to mangled Publisher string from app-builder BloodyMsString

(With apologies: I'm cross-posting this from electron-userland/electron-builder#4931. It's not clear which package is at fault.)

  • Electron Version: 8.2.5
  • Electron Type (current, beta, nightly): current
  • electron-builder version: 22.6.0
  • Target: Windows, Appx

Here's my package.json:

{
  ...
  "scripts": {
    "dist": "electron-builder"
  },
  "build": {
    "appId": "com.foo.Ghost",
    "win": {
      "target": "appx",
      "certificateFile": "code_signing_cert.pfx",
      "certificatePassword": "",
      ...
    },
    "appx": {
      "publisher": "CN=Bob Doe, O=Bob Doe, STREET=123 Fake Street, L=London, S=London, PostalCode=A10 B42, C=GB",
      ...
    }
  }
}

When I run npm run dist, I get:

> [email protected] dist C:\Users\bob\ghost\windows
> electron-builder

  ??? electron-builder  version=22.6.0 os=10.0.18363
  ??? loaded configuration  file=package.json ("build" field)
  ??? packaging       platform=win32 arch=x64 electron=8.2.5 appOutDir=dist\win-unpacked
  ??? empty password will be used for code signing  reason=CSC_KEY_PASSWORD is not defined
  ??? building        target=AppX arch=x64 file=dist\ghost 1.2.3.appx
  ??? Exit code: 1. Command failed: C:\Users\bob\AppData\Local\electron-builder\Cache\winCodeSign\winCodeSign-2.6.0\windows-10\x64\makeappx.exe pack /o /f C:\Users\bob\ghost\windows\dist\__appx-x64\mapping.txt /p f752f546c70b4ddfb91866a64ac91f3b56a77ab121ff76d2e85b3cc2bcc8683d (sha256 hash) 1.2.3.appx

Microsoft (R) MakeAppx Tool

Copyright (C) 2013 Microsoft.  All rights reserved.



The path (/p) parameter is: "\\?\C:\Users\bob\ghost\windows\dist\ghost 1.2.3.appx"

The mapping file (/f) parameter is: "C:\Users\bob\ghost\windows\dist\__appx-x64\mapping.txt"

Reading mapping file "C:\Users\bob\ghost\windows\dist\__appx-x64\mapping.txt"

Packing 76 file(s) listed in "C:\Users\bob\ghost\windows\dist\__appx-x64\mapping.txt" (mapping file) to "\\?\C:\Users\bob\ghost\windows\dist\ghost 1.2.3.appx" (output file name).

Memory limit defaulting to 3193556992 bytes.

Using "C:\Users\bob\ghost\windows\dist\__appx-x64\AppxManifest.xml" as the manifest for the package.

MakeAppx : error: Error info: /*[local-name()="Package" and namespace-uri()="http://schemas.microsoft.com/appx/manifest/foundation/windows10"]/*[local-name()="Identity" and namespace-uri()="http://schemas.microsoft.com/appx/manifest/foundation/windows10"][1]/@Publisher

'CN=Bob Doe,O=Bob Doe,POSTALCODE=A10 B42,STREET=123 Fake Street,L=London,ST=London,C=GB' violates pattern constraint of '(CN|L|O|OU|E|C|S|STREET|T|G|I|SN|DC|SERIALNUMBER|Description|PostalCode|POBox|Phone|X21Address|dnQualifier|(OID\.(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))+))=(([^,+="<>#;])+|".*")(, ((CN|L|O|OU|E|C|S|STREET|T|G|I|SN|DC|SERIALNUMBER|Description|PostalCode|POBox|Phone|X21Address|dnQualifier|(OID\.(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))+))=(([^,+="<>#;])+|".*")))*'.

The attribute 'Publisher' with value 'CN=Bob Doe,O=Bob Doe,POSTALCODE=A10 B42,STREET=123 Fake Street,L=London,ST=London,C=GB' failed to parse.

MakeAppx : error: Package creation failed.

MakeAppx : error: 0x80080204 - The specified package format is not valid: The package manifest is not valid.

The important line here is this error originating from makeappx.exe:

'CN=Bob Doe,O=Bob Doe,POSTALCODE=A10 B42,STREET=123 Fake Street,L=London,ST=London,C=GB' violates pattern constraint of '(CN|L|O|OU|E|C|S|STREET|T|G|I|SN|DC|SERIALNUMBER|Description|PostalCode|POBox|Phone|X21Address|dnQualifier|(OID.(0|[1-9][0-9])(.(0|[1-9][0-9]))+))=(([^,+="<>#;])+|".")(, ((CN|L|O|OU|E|C|S|STREET|T|G|I|SN|DC|SERIALNUMBER|Description|PostalCode|POBox|Phone|X21Address|dnQualifier|(OID.(0|[1-9][0-9])(.(0|[1-9][0-9]))+))=(([^,+="<>#;])+|".")))*'.

It's not wrong: the publisher string doesn't match the regex. It fails in at least two respects:

  • The publisher string is using , as the separator, without any space. The regex appears to demand , as the separator.
  • The publisher string is using capitalized names. For example, the publisher string has POSTALCODE where the regex appears to demand PostalCode.

makeappx reads the publisher string from C:\Users\bob\ghost\windows\dist\__appx-x64\AppxManifest.xml, which is generated by electron-builder.electron-builder does NOT gets the publisher string from my packagejson.build.appx.publisher. Instead, electron-builder gets the Subject in the certificate file at packagejson.build.win.certificateFile, then transforms it and puts it in the generated AppxManifest.xml. We can inspect the Subject of this certificate with certutil -dump, which shows:

PS C:\Users\bob\ghost\windows> certutil -dump .\code_signing_cert.pfx
Enter PFX password:
... omitting irrelevant lines ...
Subject: CN=Bob Doe, O=Bob Doe, STREET=123 Fake Street, L=London, S=London, PostalCode=A10 B42, C=GB

Note carefully the difference:

# Subject in my certificate file
CN=Bob Doe, O=Bob Doe, STREET=123 Fake Street, L=London, S=London, PostalCode=A10 B42, C=GB

# Subject being passed to makeappx by electron-builder
CN=Bob Doe,O=Bob Doe,POSTALCODE=A10 B42,STREET=123 Fake Street,L=London,ST=London,C=GB

The subject in the certificate, as reported by certutil, does match the regex demanded by makeappx. The mangled subject passed to makeappx does not. So what's going on here?

The mangled name comes from the app-builder package:

util.WriteStringProperty("bloodyMicrosoftSubjectDn", BloodyMsString(firstCert.Subject.ToRDNSequence()), jsonWriter)

This BloodyMsString function being defined here.

The purpose of BloodyMsString appears to be creating the Publisher string for the AppxManifest.xml. Maybe there's a reason for mangling there that I don't understand. But if I manually edit the AppXManifest.xml to have the correct Subject, then run makeappx and signtool manually, everything succeeds.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.