menu

NodeGui

A library for building cross-platform native desktop applications with Node.js and CSS.

Channels
Team

Announcing Packer 📦 for NodeGUI and React NodeGUI 🎉

September 2, 2019 at 5:25pm

Announcing Packer 📦 for NodeGUI and React NodeGUI 🎉

September 2, 2019 at 5:25pm (Edited 3 months ago)

Packer 📦

Packer is a npm module that allows you to package apps built with NodeGUI or React NodeGUI into a standalone executable. Packer works on Mac, Windows and Linux
This is a initial MVP release of the module.
On MacOS - Packer will output a dmg file On Linux - Packer will output an AppImage which is something similar to a .app file in MacOS On Windows - Packer outputs a folder containing the executable and all the dlls.
Currently if you need to produce a build you need to run the packer in different OS environments. That is, cross platform builds are not supported in this release.

Usage

  • First step is to install the packer as a dev dependency. You can do so by:
npm install --save-dev @nodegui/packer
  • Next you can run the init command:This will produce the deploy directory containing the template. You can modify this to suite your needs. Like add icons, change the name, description and add other native features or dependencies. Make sure you commit this directory.
npx nodegui-packer --init MyApp
  • Next you can run the pack command:This command essential takes the dist folder as the input and puts it in the suitable location inside the standalone executable. Also it runs the correct deployment tool (macdeployqt incase of mac, etc) and packs in the dependencies.The output of the command is found under the build directory. You should gitignore the build directory.
npx nodegui-packer --pack <path to dist>

How does it work ?

Packer uses Qt's packaging tools in all three platforms.

Requirements

  • Needs Qode v1.0.4 and up (NodeGUI v0.1.7 and up)

Future enhancements:

  1. Cross platform builds.
  2. Better documentation.
  3. Reduce / Remove unnecessary dynamic libraries.
  4. Reduce qode binary size.
Please feel free to help out with this in anyway you can.

October 3, 2019 at 5:04am
Packing for react-nodegui
This requires a bit of restructuring of the repo. Since Packer executes the src/index file when the executable is run, I recommend renaming src/index.ts to src/exports.ts and creating your app root at src/index.tsx.
Remember to change your imports to something like: import { Renderer, View, Button, Window, LineEdit, Text } from "./exports";
Edited
  • reply
  • like

October 7, 2019 at 5:50am
Packing for react-nodegui
This requires a bit of restructuring of the repo. Since Packer executes the src/index file when the executable is run, I recommend renaming src/index.ts to src/exports.ts and creating your app root at src/index.tsx.
Remember to change your imports to something like: import { Renderer, View, Button, Window, LineEdit, Text } from "./exports";
Hi lacy, isnt the app root for react nodegui starter already at src/index.js. ? sorry but i might have not understood properly.
  • reply
  • like

October 7, 2019 at 5:29pm
No worries! Thanks for getting back to me, I found the react-nodegui-starter that essentially already had what I was looking for. Originally I was working with the react-nodegui repo and renamed this file: https://github.com/nodegui/react-nodegui/blob/master/src/index.ts
like-fill
1
  • reply
  • like