New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nw-builder

Package Overview
Dependencies
Maintainers
3
Versions
160
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nw-builder

Build NW.js desktop applications for MacOS, Windows and Linux.

  • 4.4.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
823
decreased by-33.25%
Maintainers
3
Weekly downloads
 
Created
Source

nw-builder

npm Join the chat at https://gitter.im/nwjs/nw-builder

Build NW.js applications for Mac, Windows and Linux.

For version 3, please go to the corresponding branch.

Major Features

  • Get, run or build applications.
  • Integrate FFmpeg community builds
  • Configure executable fields and icons
  • Support downloading from mirrors

Check out the documentation if you wish to give nw-builder a try.

Please note that the documentation assumes you know how to write NW.js applications.

Alternatives

Migration Guide (v3 -> v4)

We are working on making the migration process smoother. If you encounter any issues with the current guide, please open an issue or start a discussion.

Update nw-builder

With npm:

npm update nw-builder@latest

With yarn:

yarn upgrade nw-builder@latest

With pnpm:

pnpm update nw-builder@latest

Update options

Let's take an example of v3 code and migrate it to v4.

const NwBuilder = require("nw-builder");

const nw = new NwBuilder({
  files: ["./nwapp/**/*", "./other/**/*.js"],
  version: "latest",
  flavor: "normal",
  platforms: ["win32", "win64", "osx32", "osx64", "linux32", "linux64"],
  cacheDir: "./cache",
  buildDir: "./build",
  buildType: "versioned",
  forceDownload: true,
  appName: "nwdemo",
  appVersion: "0.1.0",
  argv: "--nw-stderr-logging",
  macCredits: "./nwapp/credits.html",
  macIcns: "./nwapp/mac.icns",
  macPlist: { ... },
  winVersionString: { ... },
  winIco: "./nwapp/win.ico",
  zip: true,
  macZip: false,
  mergeZip: false,
});

nw.build();

Update the import path

-const NwBuilder = require("nw-builder");
+const nwbuild = require("nw-builder");

Replace the NwBuilder initialization with a function

-const nw = new NwBuilder({
+await nwbuild({

The files property has been renamed to srcDir.

-  files: ["./nwapp/**/*", "./other/**/*.js"],
+  srcDir: "./nwapp/**/* ./other/**/*.js",

Add the mode option and remove the now redundant nw.build function call. The build call is made by nwbuild internally.

+  mode: "build",

-nw.build();

The platforms option has been removed and replaced with platform and arch. Notice that one nwbuild function call now creates one build for one platform and one arch only.

-  platforms: ["win32", "win64", "osx32", "osx64", "linux32", "linux64"],
+  platform: "linux", // "osx" for MacOS "win",  for Windows
+  arch: "x64", // "ia32" for 32 bit or "arm64" for arm based 65 bit architectures

The buildDir option has been rename to outDir.

-  buildDir: "./build",
+  outDir: "./build",

The buildType option has been removed.

-  buildType: "versioned",

The forceDownload option has been changed to cache.

-  forceDownload: true,
+  cache: false,

The appName option has been changed to app.name.

-  appName: "nwdemo",
+  app: { name: "nwdemo" },

The appVersion option has been changed to app.version.

-  appVersion: "0.1.0",
+  app: { version: "0.1.0" },

The macCredit option has been removed.

-  macCredits: "./nwapp/credits.html",

The macIcns option has been replaced with icon.

-  macIcns: "./nwapp/mac.icns",
+  icon: "./nwapp/mac.icns",

The macPlist option has been replaced by app.* options. Consult the documentation for valid properties.

-  macPlist: { ... },
+  app: { ... },

The winVersionString option has been replaced with app. Consult the documentation for valid properties.

-  winVersionString: {
-    'CompanyName': 'Some Company',
-    'FileDescription': 'Process Name',
-    'ProductName': 'Some Product',
-    'LegalCopyright': 'Copyright 2017',
-  }
+  app: {
+    company: "Some Company",
+    fileDescription: "Process Name",
+    productName: "Some Product",
+    legalCopyright: "Copyright (c) 2023",
+  }

The winIco option has been replaced by app.icon.

-  winIco: "./nwapp/win.ico",
+  app: { icon: "./nwapp/win.ico" },

The macZip option has been removed.

-  macZip: false,

The mergeZip option has been removed.

-  mergeZip: false,

The final code should look like this.

const { nwbuild } = require("nw-builder");

await nwbuild({
  srcDir: "./nwapp/**/* ./other/**/*.js",
  mode: "build",
  version: "latest",
  flavor: "normal",
  platform: "linux",
  arch: "x64",
  outDir: "./build",
  cache: false,
  app: { ... },
});

Keywords

FAQs

Package last updated on 16 Oct 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc