使用packer 打包nodegui 应用
packer 是nodegui 团队提供的专门用来打包noodegui 应用程序的工具
安装packer
- yarn 方式安装
yarn add @nodegui/packer
- 效果
[fsevents] Success: "/Users/dalong/Documents/GitHub/nodegui-starter/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node" is installed via remote
> @nodegui/nodegui@0.1.8 install /Users/dalong/Documents/GitHub/nodegui-starter/node_modules/@nodegui/nodegui
> npm -v
6.9.0
> @nodegui/qode@1.0.4 postinstall /Users/dalong/Documents/GitHub/nodegui-starter/node_modules/@nodegui/qode
> node install.js
Local Qode 1.0.4 archive doesnt exists
Extracting binaries
> @nodegui/nodegui@0.1.8 postinstall /Users/dalong/Documents/GitHub/nodegui-starter/node_modules/@nodegui/nodegui
> npm run build:addon
> @nodegui/nodegui@0.1.8 build:addon /Users/dalong/Documents/GitHub/nodegui-starter/node_modules/@nodegui/nodegui
> node-gyp -j 8 configure build
CC(target) Release/obj.target/nothing/../../node-addon-api/src/nothing.o
TOUCH 8d54a0613d50a84adae49a5312f848b52b1b3ed9.intermediate
ACTION binding_gyp_qtnode_target_symlink_qt_headers 8d54a0613d50a84adae49a5312f848b52b1b3ed9.intermediate
LIBTOOL-STATIC Release/nothing.a
CXX(target) Release/obj.target/qtnode/src/cpp/main.o
CXX(target) Release/obj.target/qtnode/src/cpp/Extras/Utils/nutils.o
CXX(target) Release/obj.target/qtnode/src/cpp/core/FlexLayout/flexlayout.o
CXX(target) Release/obj.target/qtnode/src/cpp/core/FlexLayout/flexitem.o
CXX(target) Release/obj.target/qtnode/src/cpp/core/YogaWidget/nodestyle.o
CXX(target) Release/obj.target/qtnode/src/cpp/core/Events/eventsmap.o
CXX(target) Release/obj.target/qtnode/src/cpp/core/Events/eventwidget.o
CXX(target) Release/obj.target/qtnode/src/cpp/core/YogaWidget/yogawidget.o
CXX(target) Release/obj.target/qtnode/src/cpp/QtGui/QApplication/qapplication_wrap.o
CXX(target) Release/obj.target/qtnode/src/cpp/QtGui/QClipboard/qclipboard_wrap.o
CXX(target) Release/obj.target/qtnode/src/cpp/QtGui/QEvent/QKeyEvent/qkeyevent_wrap.o
CXX(target) Release/obj.target/qtnode/src/cpp/QtGui/QPixmap/qpixmap_wrap.o
CXX(target) Release/obj.target/qtnode/src/cpp/QtGui/QIcon/qicon_wrap.o
CXX(target) Release/obj.target/qtnode/src/cpp/QtGui/QCursor/qcursor_wrap.o
CXX(target) Release/obj.target/qtnode/src/cpp/core/FlexLayout/flexlayout_wrap.o
CXX(target) Release/obj.target/qtnode/src/cpp/QtWidgets/QWidget/qwidget_wrap.o
CXX(target) Release/obj.target/qtnode/src/cpp/QtWidgets/QGridLayout/qgridlayout_wrap.o
CXX(target) Release/obj.target/qtnode/src/cpp/QtWidgets/QDial/qdial_wrap.o
CXX(target) Release/obj.target/qtnode/src/cpp/QtWidgets/QLabel/qlabel_wrap.o
CXX(target) Release/obj.target/qtnode/src/cpp/QtWidgets/QLayout/qlayout_wrap.o
CXX(target) Release/obj.target/qtnode/src/cpp/QtWidgets/QMainWindow/qmainwindow_wrap.o
CXX(target) Release/obj.target/qtnode/src/cpp/QtWidgets/QPushButton/qpushbutton_wrap.o
CXX(target) Release/obj.target/qtnode/src/cpp/QtWidgets/QSpinBox/qspinbox_wrap.o
CXX(target) Release/obj.target/qtnode/src/cpp/QtWidgets/QCheckBox/qcheckbox_wrap.o
CXX(target) Release/obj.target/qtnode/src/cpp/QtWidgets/QProgressBar/qprogressbar_wrap.o
CXX(target) Release/obj.target/qtnode/src/cpp/QtWidgets/QRadioButton/qradiobutton_wrap.o
CXX(target) Release/obj.target/qtnode/src/cpp/QtWidgets/QLineEdit/qlineedit_wrap.o
CXX(target) Release/obj.target/qtnode/src/cpp/QtWidgets/QPlainTextEdit/qplaintextedit_wrap.o
CXX(target) Release/obj.target/qtnode/src/cpp/QtWidgets/QScrollArea/qscrollarea_wrap.o
打包应用
具体应用可以参考https://www.cnblogs.com/rongfengliang/p/11487743.html
- 初始化应用
npx nodegui-packer --init dalongdemo
效果:
- 打包应用
npx nodegui-packer --pack ./dist
效果
- 运行应用
说明
如果大家对于桌面性能要求比较高,同时还希望使用web 的方式开发跨平台的桌面应用nodegui 是一个不错的选择
参考资料
https://github.com/nodegui/packer
https://github.com/nodegui/nodegui.git
https://nodegui.github.io/nodegui/#/