
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
wang-nw-builder
Advanced tools
这是一个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 | 缓存保存目录。 | |
| version | latest | latest、stable、lts,以及精确版本号,例如: 0.82.0 | --version=latest | nwjs版本号。 |
| flavor | normal | normal、sdk | --flavor=normal | 打包后的类型。normal一般用于生产环境;sdk是带控制台的,一般用于开发环境。 |
| platform | win | win、osx、linux | --platform=win | 操作系统平台。非osx系统打包osx文件可能会出问题,建议osx的应用单独在osx系统打包 |
| arch | x64 | x64、ia32、arm64 | --arch=x64 | 操作系统架构。新款苹果m2 CPU使用arm64。 |
| logLevel | info | info、debug | --logLevel=info | 日志级别。info指的是仅输出少量日志,debug就是输出详细日志。 |
| downloadUrl | https://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',
});
FAQs
nwjs打包工具
The npm package wang-nw-builder receives a total of 21 weekly downloads. As such, wang-nw-builder popularity was classified as not popular.
We found that wang-nw-builder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.