Turn binaries into applications.
Embler can be used with pkg
to turn a Node.js project into an app, without having to resort to Electron. Useful for making a web interface, or a basic menubar app.
Supports macOS app
, dmg
, zip
and tar.gz
. dmg
requires macOS
npm install embler
- Specify options in your
package.json
like so:{ "name": "affinity-photo", "author": "Serif", "version": "1.7.0", "scripts": { "build": "embler", }, "embler": { "realName": "Affinity Photo", "appId": "com.seriflabs.affinityphoto", "mac": { "binary": "dist/affinity-photo-mac-bin", "icon": "icon.png", "formats": ["app", "dmg", "zip", "tar.gz"], } } }
- Run
npm run build
- Run
npm install pkg
- Configure
pkg
andembler
to your liking (Usage example above) - Set the
scripts.build
,bin
andembler.mac.binary
properties in yourpackage.json
like so:
{
"bin": "index.js",
"scripts": {
"build": "pkg . --target macos --output dist/test-bin-macos && embler"
},
"embler": {
"mac": {
"binary": "dist/test-bin-macos"
}
}
}
- Run
npm run build
index.js
is now an app.
Supply options via json
file:
const embler = require('embler')
await embler.build('embler.json')
Supply options directly:
const embler = require('embler')
await embler.build({
name: "my-app",
author: "kasper.space",
version: "2.4.1",
embler: {
realName: "My App",
// ...
}
})
- Required unless
embler.name
is specified - The app's name. For example used for the app's process name
- Recommended to not use spaces or non-basic special characters
- Required unless
embler.author
is specified - The app's author
- Required unless
embler.version
is specified - The version of the app
- Recommended
- The app's name. This is the name users will see
- Spaces and special characters are allowed in this one
- Recommended
- The application id
- Human-readable copyright line
- The output folder
- Whether the app will just run in the background app. On macOS, it won't show up in the Dock
- Overrides
name
- Overrides
author
- Overrides
version
- Object which contains macOS-specific options
- Required
- Path to the binary which will run when the app is opened
- Recommended
- The app's category. Shown in
/Applications
in Finder whenView > Use Groups
is enabled usingView > Sort By > Application Category
- Valid categories are listed in Apple's documentation
- Recommended
- Path to your app's icon
.icns
or.png
- Array of the formats Pakaer will output
- Supports
app
,dmg
,zip
andtar.gz
. Creatingdmg
requires macOS
- Path to a custom background image for the
dmg
- The resolution should be 660x400
- To support retina displays, have an extra image at double resolution that ends with
@2x
. For example, you could havedmgbg.png
anddmgbg@2x.png
- Turn this to false to disable dark mode support.
- In this object, you may add or overwrite
Info.plist
entries. Example:"customInfo": { "CFBundleDevelopmentRegion": "en" }
- Install Node.js
- Run
npm install
- Set up ESLint support for your code editor
To be able to run/test Embler:
- Go to
./test
(This is where you test Embler) - Run
npm install
- Run
npm run compile
(Compilesindex.js
to binary)
To test Embler:
cd ./test
npm run pack
- Update CHANGELOG.md
- Bump the version number, commit and tag:
npm version <version>
- Publish to npm:
npm publish
- Create GitHub release with release notes