Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yue/yackage
Package your Node.js project into an executable
https://github.com/yue/yackage
Last synced: 15 days ago
JSON representation
Package your Node.js project into an executable
- Host: GitHub
- URL: https://github.com/yue/yackage
- Owner: yue
- License: unlicense
- Created: 2018-03-20T11:26:56.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-07-09T00:56:24.000Z (over 1 year ago)
- Last Synced: 2024-12-11T12:12:02.501Z (23 days ago)
- Language: JavaScript
- Homepage:
- Size: 627 KB
- Stars: 103
- Watchers: 4
- Forks: 8
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yackage
Package your Node.js project into an executable.
This project is targeted for apps built with [Yue library][yue] and
[Yode Node.js runtime][yode].## Install
```
npm i -g yackage
```## Usage
```
Usage: yackage [options] [command]Options:
--platform Target platform (default: $npm_config_platform ||
process.platform)
--arch Target arch (default: $npm_config_arch ||
process.arch)
--app-dir Path to the source code dir of app (default:
current working dir)
--unpack Files to ignore when generating asar package
(default: *.node)
--unpack-dir Dirs to ignore when generating asar package
--no-minify Do not minify the JavaScript source code
--extra-info-plist The extra string to insert into the Info.plist
--identity The identity used for signing app bundle on macOS
--entitlements Path to the entitlements file when signing app
bundle on macOSCommands:
init Create an empty project under current directory
build Build app bundle
dist Build app bundle and generate app distribution
dirty-build Build app bundle without reinstalling modules
```Note that before using Yackage, the target app must have `fetch-yode` listed
as a dependency.## Configuration
Configure your project by adding following fields to `package.json`:
```json
{
"main": "app.js",
"build": {
"appId": "com.app.id"
"productName": "App"
"copyright": "Copyright © 2020 Company",
"minify": true,
"unpack": "+(*.node|*.png)",
"unpackDir": "{assets,build}",
"ignore": [ "assets/*" ],
"icons": {
"win": "assets/icon.ico",
"mac": "assets/icon.icns"
},
"extraInfoPlist": "LSUIElement"
}
}
```## Examples
Generate executable from the app under current working directory:
```sh
cd /path/to/app/
yackage build out
```Generate executable from path under arbitrary path:
```
yackage build out --app-dir /path/to/app
```Generate executable for arbitrary platform:
```
yackage build out --platform win32 --arch ia32
```Generate distributions:
```
yackage dist out --app-dir /path/to/app
```## How yackage works
1. Run `npm pack` to generate tarball for the app.
2. Extract the tarball to temporary directory and run `npm install`.
3. Use `asar` to pacakge the app and its dependencies.
4. Append the generated ASAR archive to Yode.
5. Yode would automatically recognize the ASAR archive appended in the
executable and start with it.### Differences from packaging in Electron
By default yackage would unpack the `.node` files so they are not extracted
dynamically when running, otherwise anti-virus softwares would complain.The unpacked files are placed in the `res` directory instead of the usual
`.unpacked` directory, so the final distribution would look more formal.The `.js` files are compressed with `uglify-js` by default.
The virutal root directory of ASAR archive is `${process.execPath}/asar`. Using
`process.execPath` as virutal root directory directly would confuse Node.js
since it should be a file.## License
Public domain.
[yue]: https://github.com/yue/yue
[yode]: https://github.com/yue/yode
[electron-builder]: https://www.electron.build/configuration/configuration