🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

wang-nw-builder

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wang-nw-builder

nwjs打包工具

latest
npmnpm
Version
1.0.3
Version published
Weekly downloads
21
200%
Maintainers
1
Weekly downloads
 
Created
Source

wang-nw-builder

这是一个NW.js的打包工具。

  • 快速开始
  • 可选项
  • 示例

快速开始

安装依赖

npm i --save-dev wang-nw-builder

执行打包命令

执行下面的命令即可打包,默认情况下假设 ./dist 目录下包含应用代码以及 package.json 文件:

npm run nwBuilder --srcDir=./dist

启动客户端

启动 ./out 目录下的对应文件

可选项

选项默认值可选项示例说明
srcDir./dist--srcDir=./dist源代码保存目录。
outDir./out--outDir=./out打包成品输出目录。
cacheDir./cache--cacheDir=./cache缓存保存目录。
versionlatestlatest、stable、lts,以及精确版本号,例如: 0.82.0--version=latestnwjs版本号。
flavornormalnormal、sdk--flavor=normal打包后的类型。normal一般用于生产环境;sdk是带控制台的,一般用于开发环境。
platformwinwin、osx、linux--platform=win操作系统平台。非osx系统打包osx文件可能会出问题,建议osx的应用单独在osx系统打包
archx64x64、ia32、arm64--arch=x64操作系统架构。新款苹果m2 CPU使用arm64。
logLevelinfoinfo、debug--logLevel=info日志级别。info指的是仅输出少量日志,debug就是输出详细日志。
downloadUrlhttps://npmmirror.com/mirrors/nwjs--downloadUrl=https://npmmirror.com/mirrors/nwjs文件下载地址。

使用代码的方式进行打包

代码的方式允许我们以可编程的方式进行打包,大大增加了打包的灵活性,其可选项和上文一样。

示例:

import {nwBuilder} from "wang-nw-builder";

nwBuilder({
  srcDir: './test/src',
  version: 'latest',
  flavor: 'normal',//"normal" | "sdk"
  platform: 'osx',//"win" | "osx" | "linux"
  arch: 'x64',//"x64" | "arm64" | "ia32"
  logLevel: 'debug',//"info" | "debug"
  cacheDir: './cache',
  outDir: './out',
  downloadUrl: 'https://npmmirror.com/mirrors/nwjs',
});

示例

https://gitee.com/consolelog/wang-nw-builder-example.git

Keywords

NW.js

FAQs

Package last updated on 09 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts