GithubHelp home page GithubHelp logo

electron / electron-packager Goto Github PK

View Code? Open in Web Editor NEW
93.0 3.0 7.0 3.87 MB

Customize and package your Electron app with OS-specific bundles (.app, .exe, etc.) via JS or CLI

Home Page: https://npm.im/@electron/packager

License: BSD 2-Clause "Simplified" License

JavaScript 48.41% Shell 0.82% TypeScript 50.77%
electron javascript electron-packager hacktoberfest

electron-packager's Introduction

@electron/packager

Package your Electron app into OS-specific bundles (.app, .exe, etc.) via JavaScript or the command line.

CircleCI Build Status electron-nightly Canary Coverage Status npm Discord

Supported Platforms | Installation | Usage | API | Contributing | Support | Related Apps/Libraries | FAQ | Release Notes


About

Electron Packager is a command line tool and Node.js library that bundles Electron-based application source code with a renamed Electron executable and supporting files into folders ready for distribution.

For creating distributables like installers and Linux packages, consider using either Electron Forge (which uses Electron Packager internally), or one of the related Electron tools, which utilizes Electron Packager-created folders as a basis.

Note that packaged Electron applications can be relatively large. A zipped, minimal Electron application is approximately the same size as the zipped prebuilt binary for a given target platform, target arch, and Electron version (files named electron-v${version}-${platform}-${arch}.zip).

Supported Platforms

Electron Packager is known to run on the following host platforms:

  • Windows (32/64 bit)
  • macOS (formerly known as OS X)
  • Linux (x86/x86_64)

It generates executables/bundles for the following target platforms:

  • Windows (also known as win32, for x86, x86_64, and arm64 architectures)
  • macOS (also known as darwin) / Mac App Store (also known as mas)* (for x86_64, arm64, and universal architectures)
  • Linux (for x86, x86_64, armv7l, arm64, and mips64el architectures)

* Note for macOS / Mac App Store target bundles: the .app bundle can only be signed when building on a host macOS platform.

Installation

This module requires Node.js 16.13.0 or higher to run.

npm install --save-dev @electron/packager

It is not recommended to install @electron/packager globally.

Usage

Via JavaScript

JavaScript API usage can be found in the API documentation.

From the command line

Running Electron Packager from the command line has this basic form:

npx @electron/packager <sourcedir> <appname> --platform=<platform> --arch=<arch> [optional flags...]

Note: npx can be substituted for yarn or npm exec depending on what package manager and the version you have installed.

This will:

  • Find or download the correct release of Electron
  • Use that version of Electron to create an app in <out>/<appname>-<platform>-<arch> (this can be customized via an optional flag)

--platform and --arch can be omitted, in two cases:

  • If you specify --all instead, bundles for all valid combinations of target platforms/architectures will be created.
  • Otherwise, a single bundle for the host platform/architecture will be created.

For an overview of the other optional flags, run electron-packager --help or see usage.txt. For detailed descriptions, see the API documentation.

For flags that are structured as objects, you can pass each option as via dot notation as such:

npx @electron/packager --flag.foo="bar"
# will pass in { flag: { foo: "bar"} } as an option to the Electron Packager API

If appname is omitted, this will use the name specified by "productName" or "name" in the nearest package.json.

Characters in the Electron app name which are not allowed in all target platforms' filenames (e.g., /), will be replaced by hyphens (-).

You should be able to launch the app on the platform you built for. If not, check your settings and try again.

Be careful not to include node_modules you don't want into your final app. If you put them in the devDependencies section of package.json, by default none of the modules related to those dependencies will be copied in the app bundles. (This behavior can be turned off with the prune: false API option or --no-prune CLI flag.) In addition, folders like .git and node_modules/.bin will be ignored by default. You can use --ignore to ignore files and folders via a regular expression (not a glob pattern). Examples include --ignore=\.gitignore or --ignore="\.git(ignore|modules)".

Example

Let's assume that you have made an app based on the electron-quick-start repository on a macOS host platform with the following file structure:

foobar
├── package.json
├── index.html
├── […other files, like the app's LICENSE…]
└── script.js

…and that the following is true:

  • @electron/packager is installed locally
  • productName in package.json has been set to Foo Bar
  • The electron module is in the devDependencies section of package.json, and set to the exact version of 1.4.15.
  • npm install for the Foo Bar app has been run at least once

When one runs the following command for the first time in the foobar directory:

npx @electron/packager .

@electron/packager will do the following:

  • Use the current directory for the sourcedir
  • Infer the appname from the productName in package.json
  • Infer the appVersion from the version in package.json
  • Infer the platform and arch from the host, in this example, darwin platform and x64 arch.
  • Download the darwin x64 build of Electron 1.4.15 (and cache the downloads in ~/.electron)
  • Build the macOS Foo Bar.app
  • Place Foo Bar.app in foobar/Foo Bar-darwin-x64/ (since an out directory was not specified, it used the current working directory)

The file structure now looks like:

foobar
├── Foo Bar-darwin-x64
│   ├── Foo Bar.app
│   │   └── […Mac app contents…]
│   ├── LICENSE [the Electron license]
│   └── version
├── […other application bundles, like "Foo Bar-win32-x64" (sans quotes)…]
├── package.json
├── index.html
├── […other files, like the app's LICENSE…]
└── script.js

The Foo Bar.app folder generated can be executed by a system running macOS, which will start the packaged Electron app. This is also true of the Windows x64 build on a system running a new enough version of Windows for a 64-bit system (via Foo Bar-win32-x64/Foo Bar.exe), and so on.

Related

Distributable Creators

Windows:

macOS:

Linux:

Plugins

These Node modules utilize Electron Packager API hooks:

electron-packager's People

Contributors

anaisbetts avatar ckerr avatar dependabot-preview[bot] avatar dependabot[bot] avatar develar avatar dsanders11 avatar electron-roller[bot] avatar erickzhao avatar erikian avatar feross avatar hitman401 avatar hokein avatar inukshuk avatar jhen0409 avatar junosuarez avatar kevinsawicki avatar kfranqueiro avatar kwolfy avatar mafintosh avatar malept avatar marshallofsound avatar max-mapper avatar rahatarmanahmed avatar rameshv avatar sethlu avatar sindresorhus avatar stefanbuck avatar vertedinde avatar zaggino avatar zeke 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

Watchers

 avatar  avatar  avatar

electron-packager's Issues

Set product name, file description copyright on Windows

Currently the .exe is branded as "Electron" and that shows up when right-clicking the app in the task bar, the task manager and several other key places.

This should be implemented in electron-packager as soon as the issue is resolved in rcedit and node-rcedit, because they currently cannot change those resources (CompanyName, FileDescription, LegalCopyright, ProductName).

I'll keep you posted on this.

Dependency on mv

Out of curiosity, is there a convincing reason for this package's dependency on mv? As far as I can tell, it only seems to use it once - for a rename of the exe file on Windows, which I'd think could just as easily use fs.rename.

Sorry this is such a nit-pick. If you see fit to remove it I can submit a PR.

rcedit.exe is not working on Windows

I have the following options for my grunt task:

windowsBuild: {
    options: {
        name: 'Cameron',
        dir: 'app',
        out: 'dist',
        version: '0.25.3',
        platform: 'win32',
        arch: 'ia32',
        icon: 'icon.ico'
    }
}

but the icon isn't applied to the final dist app... I just get the default Electron icon.

The ico file is valid and at the specified location!

Tried on Windows 7.

Not all details are changed

When using this packager, the File description, Product name, and Copyright are still Election and GitHub even though I used Cameron for the app name, it changed the exe to Cameron.exe but the other details are unchanged.

image

Can these be added to the packager as options?

`--overwrite` option

To overwrite the file if it exists. Currently it just throws. Useful if you build to the same folder and want the previous build replaced.

Windows rename error

Hi, I am getting the following error on windows 8.1. The target platform is obviously win32.
EXDEV, rename 'C:\Users\Justin\AppData\Local\Temp\electron-tmp-download\electron
-v0.25.3-win32-ia32.zip'

My electron-packager outputted app opens the electron "default app" shell

I'm not even sure what I should put here for information, so I guess:

Mac (Latest), node (0.12), npm (latest), electron-packager (git, master), Electron (0.28).

Here's my directory:

.
├── .gitignore
├── LICENSE.md
├── README.md
├── assets
│   ├── linux
│   │   └── icon.ico
│   ├── macos
│   │   ├── installer.png
│   │   ├── lowbrow.icns
│   │   └── mount.icns
│   └── win
├── bower.json
├── package.json
├── packager.json
├── releases
│   └── macos
│       ├── Lowbrow.dmg
│       └── x64
│           └── Lowbrow.app
│               └── Contents
│                   ├── Frameworks
│                   │   ├── Electron Framework.framework
│                   │   │   ├── Electron Framework -> Versions/Current/Electron Framework
│                   │   │   ├── Libraries -> Versions/Current/Libraries
│                   │   │   ├── Resources -> Versions/Current/Resources
│                   │   │   └── Versions
│                   │   │       ├── A
│                   │   │       │   ├── Electron Framework
│                   │   │       │   ├── Libraries
│                   │   │       │   │   ├── Libraries -> Versions/Current/Libraries
│                   │   │       │   │   ├── ffmpegsumo.so
│                   │   │       │   │   └── libnode.dylib
│                   │   │       │   └── Resources
│                   │   │       │       ├── Info.plist
│                   │   │       │       ├── Inspector
│                   │   │       │       ├── MainMenu.nib
│                   │   │       │       ├── content_shell.pak
│                   │   │       │       ├── crash_report_sender.app
│                   │   │       │       │   └── Contents
│                   │   │       │       │       ├── Info.plist
│                   │   │       │       │       ├── MacOS
│                   │   │       │       │       │   └── crash_report_sender
│                   │   │       │       │       ├── PkgInfo
│                   │   │       │       │       └── Resources
│                   │   │       │       │           ├── Breakpad.nib
│                   │   │       │       │           ├── English.lproj
│                   │   │       │       │           │   └── Localizable.strings
│                   │   │       │       │           └── crash_report_sender.icns
│                   │   │       │       ├── crashpad_handler
│                   │   │       │       ├── icudtl.dat
│                   │   │       │       ├── natives_blob.bin
│                   │   │       │       └── snapshot_blob.bin
│                   │   │       └── Current -> A
│                   │   ├── Electron Helper EH.app
│                   │   │   └── Contents
│                   │   │       ├── Info.plist
│                   │   │       ├── MacOS
│                   │   │       │   └── Electron Helper EH
│                   │   │       └── PkgInfo
│                   │   ├── Electron Helper NP.app
│                   │   │   └── Contents
│                   │   │       ├── Info.plist
│                   │   │       ├── MacOS
│                   │   │       │   └── Electron Helper NP
│                   │   │       └── PkgInfo
│                   │   ├── Electron Helper.app
│                   │   │   └── Contents
│                   │   │       ├── Info.plist
│                   │   │       ├── MacOS
│                   │   │       │   └── Electron Helper
│                   │   │       └── PkgInfo
│                   │   ├── Mantle.framework
│                   │   │   ├── Headers -> Versions/Current/Headers
│                   │   │   ├── Mantle -> Versions/Current/Mantle
│                   │   │   ├── Modules -> Versions/Current/Modules
│                   │   │   ├── Resources -> Versions/Current/Resources
│                   │   │   └── Versions
│                   │   │       ├── A
│                   │   │       │   ├── Headers
│                   │   │       │   │   ├── MTLJSONAdapter.h
│                   │   │       │   │   ├── MTLManagedObjectAdapter.h
│                   │   │       │   │   ├── MTLModel+NSCoding.h
│                   │   │       │   │   ├── MTLModel.h
│                   │   │       │   │   ├── MTLValueTransformer.h
│                   │   │       │   │   ├── Mantle.h
│                   │   │       │   │   ├── NSArray+MTLManipulationAdditions.h
│                   │   │       │   │   ├── NSDictionary+MTLManipulationAdditions.h
│                   │   │       │   │   ├── NSObject+MTLComparisonAdditions.h
│                   │   │       │   │   ├── NSValueTransformer+MTLInversionAdditions.h
│                   │   │       │   │   └── NSValueTransformer+MTLPredefinedTransformerAdditions.h
│                   │   │       │   ├── Mantle
│                   │   │       │   ├── Modules
│                   │   │       │   │   └── module.modulemap
│                   │   │       │   └── Resources
│                   │   │       │       └── Info.plist
│                   │   │       └── Current -> A
│                   │   ├── ReactiveCocoa.framework
│                   │   │   ├── Headers -> Versions/Current/Headers
│                   │   │   ├── Modules -> Versions/Current/Modules
│                   │   │   ├── ReactiveCocoa -> Versions/Current/ReactiveCocoa
│                   │   │   ├── Resources -> Versions/Current/Resources
│                   │   │   └── Versions
│                   │   │       ├── A
│                   │   │       │   ├── Headers
│                   │   │       │   │   ├── EXTKeyPathCoding.h
│                   │   │       │   │   ├── EXTScope.h
│                   │   │       │   │   ├── NSArray+RACSequenceAdditions.h
│                   │   │       │   │   ├── NSControl+RACCommandSupport.h
│                   │   │       │   │   ├── NSControl+RACTextSignalSupport.h
│                   │   │       │   │   ├── NSData+RACSupport.h
│                   │   │       │   │   ├── NSDictionary+RACSequenceAdditions.h
│                   │   │       │   │   ├── NSEnumerator+RACSequenceAdditions.h
│                   │   │       │   │   ├── NSFileHandle+RACSupport.h
│                   │   │       │   │   ├── NSIndexSet+RACSequenceAdditions.h
│                   │   │       │   │   ├── NSNotificationCenter+RACSupport.h
│                   │   │       │   │   ├── NSObject+RACAppKitBindings.h
│                   │   │       │   │   ├── NSObject+RACDeallocating.h
│                   │   │       │   │   ├── NSObject+RACLifting.h
│                   │   │       │   │   ├── NSObject+RACPropertySubscribing.h
│                   │   │       │   │   ├── NSObject+RACSelectorSignal.h
│                   │   │       │   │   ├── NSOrderedSet+RACSequenceAdditions.h
│                   │   │       │   │   ├── NSSet+RACSequenceAdditions.h
│                   │   │       │   │   ├── NSString+RACSequenceAdditions.h
│                   │   │       │   │   ├── NSString+RACSupport.h
│                   │   │       │   │   ├── NSText+RACSignalSupport.h
│                   │   │       │   │   ├── NSURLConnection+RACSupport.h
│                   │   │       │   │   ├── NSUserDefaults+RACSupport.h
│                   │   │       │   │   ├── RACBacktrace.h
│                   │   │       │   │   ├── RACBehaviorSubject.h
│                   │   │       │   │   ├── RACChannel.h
│                   │   │       │   │   ├── RACCommand.h
│                   │   │       │   │   ├── RACCompoundDisposable.h
│                   │   │       │   │   ├── RACDisposable.h
│                   │   │       │   │   ├── RACEvent.h
│                   │   │       │   │   ├── RACGroupedSignal.h
│                   │   │       │   │   ├── RACKVOChannel.h
│                   │   │       │   │   ├── RACMulticastConnection.h
│                   │   │       │   │   ├── RACQueueScheduler+Subclass.h
│                   │   │       │   │   ├── RACQueueScheduler.h
│                   │   │       │   │   ├── RACReplaySubject.h
│                   │   │       │   │   ├── RACScheduler+Subclass.h
│                   │   │       │   │   ├── RACScheduler.h
│                   │   │       │   │   ├── RACScopedDisposable.h
│                   │   │       │   │   ├── RACSequence.h
│                   │   │       │   │   ├── RACSerialDisposable.h
│                   │   │       │   │   ├── RACSignal+Operations.h
│                   │   │       │   │   ├── RACSignal.h
│                   │   │       │   │   ├── RACStream.h
│                   │   │       │   │   ├── RACSubject.h
│                   │   │       │   │   ├── RACSubscriber.h
│                   │   │       │   │   ├── RACSubscriptingAssignmentTrampoline.h
│                   │   │       │   │   ├── RACTargetQueueScheduler.h
│                   │   │       │   │   ├── RACTestScheduler.h
│                   │   │       │   │   ├── RACTuple.h
│                   │   │       │   │   ├── RACUnit.h
│                   │   │       │   │   ├── ReactiveCocoa.h
│                   │   │       │   │   └── metamacros.h
│                   │   │       │   ├── Modules
│                   │   │       │   │   └── module.modulemap
│                   │   │       │   ├── ReactiveCocoa
│                   │   │       │   └── Resources
│                   │   │       │       └── Info.plist
│                   │   │       └── Current -> A
│                   │   └── Squirrel.framework
│                   │       ├── .DS_Store
│                   │       ├── Headers -> Versions/Current/Headers
│                   │       ├── Modules -> Versions/Current/Modules
│                   │       ├── Resources -> Versions/Current/Resources
│                   │       ├── Squirrel -> Versions/Current/Squirrel
│                   │       └── Versions
│                   │           ├── .DS_Store
│                   │           ├── A
│                   │           │   ├── .DS_Store
│                   │           │   ├── Headers
│                   │           │   │   ├── NSBundle+SQRLVersionExtensions.h
│                   │           │   │   ├── NSProcessInfo+SQRLVersionExtensions.h
│                   │           │   │   ├── SQRLDownloadedUpdate.h
│                   │           │   │   ├── SQRLUpdate.h
│                   │           │   │   ├── SQRLUpdater.h
│                   │           │   │   └── Squirrel.h
│                   │           │   ├── Modules
│                   │           │   │   └── module.modulemap
│                   │           │   ├── Resources
│                   │           │   │   ├── Info.plist
│                   │           │   │   └── ShipIt
│                   │           │   └── Squirrel
│                   │           └── Current -> A
│                   ├── Info.plist
│                   ├── MacOS
│                   │   └── Electron
│                   ├── PkgInfo
│                   └── Resources
│                       ├── app
│                       │   └── browser
│                       │       └── application.js
│                       ├── atom.asar
│                       ├── atom.icns
│                       └── default_app
│                           ├── default_app.js
│                           ├── index.html
│                           ├── main.js
│                           └── package.json
├── source
│   └── browser
│       └── application.js
├── templates
│   └── application.html
└── tests

89 directories, 160 files

My package.json:

{
  "name": "lowbrow",
  "productName": "Lowbrow",
  "version": "1.0.0",
  "description": "A really minimal browser for development",
  "main": "./source/browser/application.js",
  "author": {
    "name": "Kurtis Rainbolt-Greene",
    "email": "[email protected]",
    "url": "http://www.kurtisrainboltgreene.name"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/krainboltgreene/Lowbrow.app.git"
  },
  "bugs": {
    "url": "https://github.com/krainboltgreene/Lowbrow.app/issues"
  },
  "license": "MIT",
  "readme": {
    "type": "markdown",
    "url": "http://github.com/krainboltgreene/Lowbrow.app/raw/master/README.md"
  },
  "keywords": [
    "browser"
  ],
  "engine": {
    "node": ">=0.12.0"
  },
  "files": [
    "source/browser/application.js",
    "templates/application.html"
  ],
  "private": false,
  "scripts": {
    "run": "electron .",
    "clean": "rm -rf ./releases/*",
    "clean:macos": "rm -rf ./releases/macos",
    "clean:win": "rm -rf ./releases/win",
    "build": "npm run build:macos",
    "build:macos": "npm run clean:macos && npm run build:macos:x64",
    "build:macos:x64": "electron-packager ./source 'Lowbrow' --platform=darwin --arch=x64 --version=0.28.0 --app-version=1.0.0 --out=releases/macos/x64 --icon=assets/macos/lowbrow.icns",
    "pack": "npm run pack:macos",
    "pack:macos": "npm run build:macos && npm run pack:macos:x64",
    "pack:macos:x64": "electron-builder 'releases/macos/x64/Lowbrow.app' --platform=macos --out=releases/macos --config=packager.json"
  },
  "dependencies": {
    "electron-debug": "^0.1.0"
  },
  "devDependencies": {
    "electron-builder": "[email protected]:loopline-systems/electron-builder.git",
    "electron-packager": "[email protected]:maxogden/electron-packager.git",
    "electron-prebuilt": "[email protected]:mafintosh/electron-prebuilt.git"
  }
}

My packager.json:

{
  "macos": {
    "title": "Lowbrow",
    "background": "assets/macos/installer.png",
    "icon": "assets/macos/mount.icns",
    "icon-size": "80",
    "contents": [
      { "x": 438, "y": 344, "type": "link", "path": "/Applications" },
      { "x": 192, "y": "344", "type": "file" }
    ]
  },
  "win": {
    "title": "Lowbrow",
    "icon": "assets/win/icon.ico"
  }
}

How does '--asar=true' works?

When I set asar as true, the packaged app looks like this:

electron/Electron.app/Contents/Resources/
├─┬ app/
│ ├── package.json
│ ├── main.js
│ └── index.html
└─┬ resources/
  └── app.asar

The packager puts all source codes under app, and create an empty app.asar file under resources.


Platform: OS X 10.10.3
Node: 0.12.4
Version: 4.1.3
CLI Arguments:

  • Platform: Darwin
  • Arch: x64
  • Version: 0.28.2
  • Asar: true

--all option

if you pass --all it should compile all possible combinations of arch and platform (that make sense)

npm prune option

would be nice to have an option that runs npm prune --production on the app, then people could add this and atom-shell to dev deps, and it just removes them

electron-packager doesn't rename Electron Helper.app

If you look in Activity Monitor while running an application packaged with electron-packager, you'll see your application under the desired name, but you'll also still see an Electron Helper process.

As far as I can tell, renaming the Electron Helper directories under Frameworks and the binaries under their Contents/MacOS subdirectories resolves this.

provide way to create "installers" (.dmg, .msi, .deb etc)

see this thread for the original discussion: #21 (comment)

electron-packager only creates the executables, it doesn't create the installers. I think this is a good level of complexity for electron-packager, so I think someone else should write a e.g. electron-create-installer module or something similar that is a CLI tool that is Unix Philosophy friendly (like this module and the other electron-* modules I've been working on).

resources/existing solutions:

The part about ignoring modules in readme is incorrect

Be careful not to include node_modules you don't want into your final app. For example, do not include the node_modules/electron-packager folder or node_modules/electron-prebuilt. You can use --ignore=node_modules/electron-prebuilt to ignore of these

This should be rewritten as we now ignore these modules by default. :)

`--asar` should be enabled by default

I don't see why you wouldn't want those and I think most do. We could instead have --no-asar and --no-prune flags. I much prefer us to have sane defaults, which means less config mess for users.

we need some tests!

lots of people are using this but nobody has written a test suite yet to catch regressions!

guidelines:

  • we would prefer https://www.npmjs.com/package/tape
  • keep things simple, focused on catching regressions. we can figure out proper x-platform dockerized integration testing etc in the future.
  • our current 'test' command just runs standard. make sure to keep that (e.g. standard && tape tests/*.js)

default ignores and --ignore not working (windows)

Hi, I'm using latest packager 4.1.0 and building the electron app using (in msysgit bash shell):

npm run bundle-win

in package.json I've defined

"bundle-win": "bundle.sh win32 x64 0.26.0",

which executes following script:

#!/bin/sh
electron-packager . Bracketron --platform=$1 --arch=$2 --version=$3 --ignore=node_modules/electron-rebuild

but the problem is, that neither electron-rebuild or default excludes (892b15f) are being excluded from the build folder (otherwise it builds fine)

repo is here https://github.com/zaggino/brackets-electron

add asar support

maybe via an asar: true option that would simply run asar pack for you

`--out` inconsistency

If I specify --out=dist it will put the contents in:

  • OS X: dist/Foo.app/
  • Windows: dist/Foo-win32/
  • Linux: dist/

Notice how on Linux the contents is put directly into the --out folder. This looks like a bug.

Question about is_win32 flag

I've been digging through the code while working on my all branch, and noticed this block in common.js.

I wouldn't necessarily bat an eye at this in itself, but what strikes me as odd is that it's only set to true specifically in the win32 module. I would think that if anything, this needs to be set to true when the host platform (i.e. os.platform()) is win32, not the target platform.

Can anyone corroborate this?

Add Windows signed binaries support

see #31

It would be awesome to be able to output signed binaries.

I'm not positive if it's possible to sign executables after compilation with the current rcedit strategy we use. TODO: investigate this.

I'm actually pretty unfamiliar with the Visual Studio code signing tools overall. If anyone else knows what they're doing, feel free to pitch in! Otherwise, I'll try to investigate when I get time.

Protocol handlers & file associations on OS X and Windows

Electron-packager should support setting up protocol handlers & file associations for built apps.

Currently, only protocol handlers on OS X are supported.

Adding file associations for OS X won't be hard - just the same plist modification logic as protocol handlers.

As for Windows, it will be a little tougher, as registry has to be modified and electron-packager does not generate installers. In this case, it can add .reg files somewhere in the output dir, and then let the developer decide how to make use of it.

If that's OK, I'll PR when I make progress with the Windows solution.

Package OS X(darwin, x64) application in windows nothing happens

Using electron version: 0.28.1
Electron packager version: 4.1.2
OS: Windows 8.1

Build scripts:

var packager = require('electron-packager');

packager({
    dir: 'app',
    name: 'App',
    platform: 'darwin',
    arch: 'x64',
    version: '0.28.1'
}, function(error, appPath) {
    if (error) {
        throw error;
    }

    console.log(appPath);
});

And run command: node test

Outputs:
image 001

I tried to the package application for OS X from Windows, but it seems nothing happend. (no outputs)
How can i fix it?

ignore filter matching to path in cwd

nsp's filter test regexp matching to a whole path name

/Users/chentsulin/Projects/test/electron-react-boilerplate

will match '/test($|/)' in ignore option:

ignore: [
    '/test($|/)'
]

It will ignore copy of whole app and cause some unexpected behaviors.

windows support

shouldn't be too hard, I just haven't needed this yet

happy to accept a PR for it

Linux package error references mac files?

Packaging app for platform linux x64 using electron v0.28.0
[ { [Error: ENOENT, stat '/Users/krainboltgreene/Code/krainboltgreene/lowbrow/releases/macos/x64/Lowbrow.app/Contents/Frameworks/Electron Framework.framework/Libraries/Libraries']
    errno: -2,
    code: 'ENOENT',
    path: '/Users/krainboltgreene/Code/krainboltgreene/lowbrow/releases/macos/x64/Lowbrow.app/Contents/Frameworks/Electron Framework.framework/Libraries/Libraries' },
  { [Error: ENOENT, stat '/Users/krainboltgreene/Code/krainboltgreene/lowbrow/releases/macos/x64/Lowbrow.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/Libraries']
    errno: -2,
    code: 'ENOENT',
    path: '/Users/krainboltgreene/Code/krainboltgreene/lowbrow/releases/macos/x64/Lowbrow.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/Libraries' },
  { [Error: ENOENT, stat '/Users/krainboltgreene/Code/krainboltgreene/lowbrow/releases/macos/x64/Lowbrow.app/Contents/Frameworks/Electron Framework.framework/Versions/Current/Libraries/Libraries']
    errno: -2,
    code: 'ENOENT',
    path: '/Users/krainboltgreene/Code/krainboltgreene/lowbrow/releases/macos/x64/Lowbrow.app/Contents/Frameworks/Electron Framework.framework/Versions/Current/Libraries/Libraries' } ] undefined

Flag to auto ignore `devDependencies`

First want to make sure this is sensible, but would a flag that ignores all listed devDependencies in the package.json to help with keeping the --ignore flag from being massive be useful? Can send PR if so.

Should ignore comparisons trim opts.dir first?

All of the instances in which common.userIgnoreFilter is called involve ncp operations to copy opts.dir and exclude certain patterns. However, the exclusion logic in userIgnoreFilter currently matches each pattern against each full path.

This can lead to frustrating bugs depending on the full path under which you are working. For example, if you have an ignore filter for '/electron/', but your entire structure is under /Users/myuser/dev/electron/myproject/, then nothing will be copied into your application (due to everything matching the parent electron directory). This same problem won't occur if you were to run under, say, /Users/myuser/dev/js/myproject/ instead.

It seems to me that it'd be generally safer and more useful if userIgnoreFilter trimmed opts.dir from the front of each filename it compares. This would also make it feasible to use patterns starting with ^ to match top-level directory entries within the app directory, which in itself can be useful for cases where you want to match a top-level directory but not directories of the same name underneath other directories (e.g. a top-level util/ but not some/other/lib/util/).

My only reservation is that this change would be somewhat backwards-incompatible (i.e. for strings such as /dirname/ expecting to match a "top-level" directory under the app directory right now).

API docs

Currently only the CLI options are documented. Would be easier for users if the API docs where a separate thing. The API also has some additional options like name and dir.

Setting the path of Electron.app for electron-packager

question from @rv2358:

Hi,
I installed Electron with npm. I now want to check in the Electron.app (with modifications to icon, name etc) into git. So I made a copy of Electron.app in another dir. How do i get electron-packager to use the Electron.app in my git directory vs the one in /usr/local/bin/node_modules/electron-prebuilt ?
Thanks

Dereference seems to causing problems

Electron-packager throws some errors when you try to generate a new app and there is already an .app generated. Even if there platforms are different.

[ { [Error: ENOENT, stat '.../Test.app/Contents/Frameworks/Electron Framework.framework/Frameworks']
    errno: -2,
    code: 'ENOENT',
    path: '/.../Test.app/Contents/Frameworks/Electron Framework.framework/Frameworks' }

And some more ENOENT errors...

Too reproduce run:

electron-packager . Test --platform=darwin --arch=x64 --version=0.26.1

then:

electron-packager . Test --platform=linux --arch=x64 --version=0.26.1

Running electron-packager v4.1.2.
Generating the linux app first and then the mac app seems to be working fine. However the otherway around does not work.

After some investigation it seems that dereference option in ncp is causing the issue.

From https://github.com/AvianFlu/ncp :

options.dereference - boolean=false. If set to true, ncp will follow symbolic links. For example, a symlink in the source tree pointing to a regular file will become a regular file in the destination tree. Broken symlinks will result in errors.

Would be nice if someone could confirm this! :)

No app icon

I'm using this to assemble my application electron-packager build MyApp --out=dist/ --app-version=0.25.1 --icon=assets/icon.ico --prune but the application doesn't show up with an icon.

I can see the icon when using alert(), but not in the dock or in finder.

I'm using the latest version (0.3.3) (but the problem remains in 0.3.1).

Here's the alert and about box.

skarmavbild 2015-05-06 kl 19 09 28

prints

Here's finder

skarmavbild 2015-05-06 kl 19 10 08

and the dock

skarmavbild 2015-05-06 kl 19 09 51

I'm using Electron 0.25.1 with node v0.12.1.

Here's the icon I'm trying to use: http://www.filedropper.com/icon_4

What could be the problem? Thanks.

Handling native extensions

What's the best way to handle native extensions with electron packager?

In my case, I'm interested in building node-zmq which is causing me enough hassles as it is. Making sure that plays well on Windows, Linux, and Darwin is even more fun!

License?

I just noticed this repository has no LICENSE file. package.json says BSD, but which type of BSD license specifically?

Infer from package.json

Would be useful if it could infer the name from the name field in package.json (titelized) and the --version from the "electron-prebuilt" dependency. This to reduce config and not requiring to define this in multiple places. This is just default and users could just override as normal with the cli arguments.

Windows Build ENOENT Error (copying directories)

Hi, I'm trying to build my app for windows from a mac.
These are my scripts, the Electron-packager version is 4.1.2:

"build-mac": "electron-packager ./ MyApp --platform=darwin --arch=x64 --version=0.28.1"
"build-win": "electron-packager ./ MyApp --platform=win32 --arch=x64 --version=0.28.1"
"build-win": "electron-packager ./ MyApp --platform=win32 --arch=ia32 --version=0.28.1"

The build for mac goes right, contrariwise both the builds for Windows gave me this error (just change the arch with x64, I modified slightly the output by masking directory paths):

Geyser:MyApp delvedor$ npm run-script build-win

> [email protected] build-win /.../.../MyApp
> electron-packager ./ MyApp --platform=win32 --arch=ia32 --version=0.28.1

Downloading electron-v0.28.1-win32-ia32.zip
[=================================================>] 100.0% of 38.79 MB (1.12 MB/s)
Packaging app for platform win32 ia32 using electron v0.28.1
[ { [Error: ENOENT, stat '/.../.../MyApp.app/Contents/Frameworks/Electron Framework.framework/Libraries/Libraries']
    errno: -2,
    code: 'ENOENT',
    path: '/.../.../MyApp.app/Contents/Frameworks/Electron Framework.framework/Libraries/Libraries' },
  { [Error: ENOENT, stat '/.../.../MyApp.app/Contents/Frameworks/Electron Framework.framework/Versions/Current/Libraries/Libraries']
    errno: -2,
    code: 'ENOENT',
    path: '/.../.../MyApp.app/Contents/Frameworks/Electron Framework.framework/Versions/Current/Libraries/Libraries' },
  { [Error: ENOENT, stat '/.../.../MyApp.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/Libraries']
    errno: -2,
    code: 'ENOENT',
    path: '/.../.../MyApp.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/Libraries' } ] undefined

npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "run-script" "build-win"
npm ERR! node v0.12.0
npm ERR! npm  v2.7.6
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build-win: `electron-packager ./ MyApp --platform=win32 --arch=ia32 --version=0.28.1`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build-win script 'electron-packager ./ MyApp --platform=win32 --arch=ia32 --version=0.28.1'.
npm ERR! This is most likely a problem with the myapp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     electron-packager ./ MyApp --platform=win32 --arch=ia32 --version=0.28.1
npm ERR! You can get their info via:
npm ERR!     npm owner ls myapp
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!    /.../.../MyApp/npm-debug.log

And this is the npm-debug.log

0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'run-script', 'build-win' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild-win', 'build-win', 'postbuild-win' ]
5 info prebuild-win [email protected]
6 info build-win [email protected]
7 verbose unsafe-perm in lifecycle true
8 info [email protected] Failed to exec build-win script
9 verbose stack Error: [email protected] build-win: `electron-packager ./ MyApp --platform=win32 --arch=x64 --version=0.28.1`
9 verbose stack Exit status 1
9 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:213:16)
9 verbose stack     at EventEmitter.emit (events.js:110:17)
9 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:14:12)
9 verbose stack     at ChildProcess.emit (events.js:110:17)
9 verbose stack     at maybeClose (child_process.js:1008:16)
9 verbose stack     at Process.ChildProcess._handle.onexit (child_process.js:1080:5)
10 verbose pkgid [email protected]
11 verbose cwd /../../MyApp
12 error Darwin 14.3.0
13 error argv "node" "/usr/local/bin/npm" "run-script" "build-win"
14 error node v0.12.0
15 error npm  v2.7.6
16 error code ELIFECYCLE
17 error [email protected] build-win: `electron-packager ./ MyApp --platform=win32 --arch=x64 --version=0.28.1`
17 error Exit status 1
18 error Failed at the [email protected] build-win script 'electron-packager ./ MyApp --platform=win32 --arch=x64 --version=0.28.1'.
18 error This is most likely a problem with the myapp package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error     electron-packager ./ MyApp --platform=win32 --arch=x64 --version=0.28.1
18 error You can get their info via:
18 error     npm owner ls myapp
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]

electron-packager trying to use atom-shell command?

When trying to package my app I get:

> electron-packager ./ TestApp --platform=darwin --arch=x64 --version=0.27.1

Packaging app for platform darwin x64 using electron v0.27.1
[ { [Error: ENOENT: no such file or directory, stat '/Users/dave/{snip}/node_modules/.bin/atom-shell']
    errno: -2,
    code: 'ENOENT',
    syscall: 'stat',
    path: '/Users/dave/{snip}/node_modules/.bin/atom-shell' } ] undefined

I do not have atom-shell installed, I have electron-prebuilt installed instead.

Issue with outputting Win32 versu Win64 apps

electron-packager . ${APP_NAME} --platform=win32 --arch=ia32 --version=${ELECTRON_VERSION} --out=${OUTPUT_DIR}
electron-packager . ${APP_NAME} --platform=win32 --arch=x64 --version=${ELECTRON_VERSION} --out=${OUTPUT_DIR}

Both of these calls export the same root folder ${APP_NAME}-win32

Shouldn't it be expected that the Win64 version would have 64 as a suffix?

what should final output be for Windows?

Mac apps are conveniently distributed as folders, and the OS GUI treats them nicely as a single entity. On Windows (with #20) we end up as a folder, which is not a very natural way to distribute apps.

There's a couple of options I wanted to raise for discussion:

  1. do nothing: we end up with a working folder, and anything else is out of scope of this module and should be handled elsewhere
  2. zip the folder: this is a sort of bare minimum, and a fair number of smaller windows apps are distributed this way. We get a single file to distribute e.g. in a GitHub release, archive, etc. Zip is the idiomatic archive format for Windows.
  3. create an msi: this is the Windows native installer bundler format- e.g., how io.js is distributed, as well as almost all commerical apps. This has the most polish. There are a billion options with msis, but it should be possible to create a generic one that plays nicely with Electron apps and puts them in platform-idiomatic places, etc.

custom icon support

pass in a path to an icon, and it does all the magic needed. would be nice if it handled icns conversion

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.