如何在Windows上打包NW.js应用程序 [英] How to package a NW.js application on Windows

查看:121
本文介绍了如何在Windows上打包NW.js应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读有关如何打包NW.js应用程序的说明,其措辞令人困惑,毫无意义.我突出了矛盾的单词沙拉部分.

I am reading the instructions for how to package a NW.js app and the wording is a confusing mess and makes no sense. I highlighted the contradictory word-salad parts.

创建一个zip文件(该文件已内置在XP,Vista和7中)复制所有 将文件保存到zip文件中,保留目录结构并制作 确保package.json文件位于根目录(如果您将 一个包含其中包含您的东西的文件夹的zip文件,那么它不是 正常运行),将文件扩展名从.zip重命名为.nw.默认情况下, 文件扩展名可能被隐藏.您需要(按alt),转到文件夹 选项并取消选中隐藏已知文件类型的扩展名"以使其能够 重命名邮政编码.

Create a zip file (this is built into XP, Vista and 7) Copy all of your files into the zip file, retaining directory structure and making sure that the package.json file is in the root directory (if you make a zip file containing a folder with your stuff in it, then it's not going to work) Rename the file extension from .zip to .nw. By default, file extensions may be hidden. You need to (press alt), go to folder options and uncheck "Hide extensions for known file types" to be able to rename the zip.

是否有一个简单的分步指令集来执行此操作? 我在网上看了一下,找不到适用于Windows操作系统的任何软件.目标是创建一个可执行文件(.exe),使应用程序的内部隐藏在用户面前.

Is there a simple step by step instruction set for how to do this ? I looked online and couldn't find any for Windows OS. The goal is to create an executable file ( .exe ) with the innards of the application hidden from users.

我以前在Mac上做过,但从来没有Windows.官方文档的编写方式太混乱了,到处都是我所理解的.

I've done it on Mac before but never windows. The way the official documentation is written is just too confusing and all over the place for me to understand.

推荐答案

为此,您可以使用 https ://github.com/nwjs/nw-builder

可以通过cli为Mac,Win和Linux构建NW.js应用.它会 下载最新版本的预编译二进制文件,将其解压缩, 创建一个发布文件夹,为指定的目录创建app.nw文件 目录并复制app.nw文件所属的文件.

Lets you build your NW.js apps for mac, win and linux via cli. It will download the prebuilt binaries for a newest version, unpacks it, creates a release folder, create the app.nw file for a specified directory and copies the app.nw file where it belongs.

首先,使用以下命令全局安装node-webkit-builder模块:

First of all, install the node-webkit-builder module globally using:

$ npm install node-webkit-builder -g

一旦安装了模块,就可以按以下方式运行nwbuild命令:

Once the module has been installed, you can run the nwbuild command as follows:

$ nwbuild [options] [path]

路径是项目文件夹的路径,而选项是以下代码中描述的选项:

Whereas path is the path to your project folder, options are the ones described in the following code:

-p Operating System to build ['osx32', 'osx64', 'win32', 'win64']
-v NW.js version [default: "latest"]
-r Runs NW.js project [default: false]
-o The path of the output folder [default: "./build"]
-f Force download of node-webkit [default: false]
--quiet Disables logging

一些例子:

  1. 运行一个项目(在当前平台上):

  1. Run a project (on the current platform):

$ nwbuild -v [version of your nw.js] -r /path/to/the/project

  • 为Win32或/和Win64平台构建项目(可执行文件(.exe)):

  • Build a project (executable file ( .exe )) for Win32 or/and Win64 platforms:

    $ nwbuild -v [version of your nw.js] -p win32,win64 /path/to/the/project
    

  • 如果您的cmd当前在项目文件夹中打开,则说明已写满 项目的路径,您可以只使用点符号

    If your cmd currently open in the project folder, instread write full path to your project you can just use dot symbol

    这篇关于如何在Windows上打包NW.js应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆