Skip to content

Commit 6edff46

Browse files
fix: add back globing (#749)
1 parent 158d4be commit 6edff46

File tree

11 files changed

+424
-70
lines changed

11 files changed

+424
-70
lines changed

README.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ Module usage
2525
import nwbuild from "nw-builder";
2626

2727
nwbuild({
28-
srcDir: "./nwapp",
28+
// Globing does not matter since a process is spawned against the nwapp directory
29+
srcDir: "./nwapp/**/*",
2930
mode: "run",
3031
version: "0.70.1",
3132
flavor: "sdk",
@@ -47,7 +48,7 @@ package.json usage
4748
"name": "nwdemo",
4849
"main": "./index.html",
4950
"nwbuild": {
50-
"srcDir": "./nwapp",
51+
"srcDir": "./nwapp/**/*",
5152
"mode": "run",
5253
"version": "0.70.1",
5354
"flavor": "sdk"
@@ -63,7 +64,7 @@ Module usage
6364
import nwbuild from "nw-builder";
6465

6566
nwbuild({
66-
srcDir: "./nwapp",
67+
srcDir: "./nwapp/**/*",
6768
mode: "build",
6869
version: "0.70.1",
6970
flavor: "normal",
@@ -88,7 +89,7 @@ package.json usage
8889
"name": "nwdemo",
8990
"main": "./index.html",
9091
"nwbuild": {
91-
"srcDir": "./nwapp",
92+
"srcDir": "./nwapp/**/*",
9293
"mode": "build",
9394
"version": "0.70.1",
9495
"flavor": "normal",
@@ -107,7 +108,7 @@ package.json usage
107108

108109
| Name | Type | Default | Description |
109110
| ----------- | ----------------------------------- | -------------------------- | ------------------------------------------------------------------------------ |
110-
| srcDir | `string` | `./` | Directory to hold NW app files |
111+
| srcDir | `string` | `./` | Directories which hold NW app code |
111112
| mode | `run \| build` | `build` | Run or build application |
112113
| version | `latest \| stable \| string \| lts` | `latest` | NW runtime version |
113114
| flavor | `sdk \| normal` | `normal` | NW runtime build flavor. |
@@ -152,7 +153,7 @@ Let's take an example of v3 code and migrate it to v4.
152153
const NwBuilder = require("nw-builder");
153154

154155
const nw = new NwBuilder({
155-
files: ["./nwapp", "./other/**/*.js"],
156+
files: ["./nwapp/**/*", "./other/**/*.js"],
156157
version: "latest",
157158
flavor: "normal",
158159
platforms: ["win32", "win64", "osx32", "osx64", "linux32", "linux64"],
@@ -190,17 +191,19 @@ Replace the `NwBuilder` initialization with a function
190191
+await nwbuild({
191192
```
192193

193-
The `files` property has been renamed to `srcDir`. As the name suggests, it does not taken in any globbing patterns. Structure of the NW app if left up to the user.
194+
The `files` property has been renamed to `srcDir`.S
194195

195196
```patch
196-
- files: ["./nwapp", "./other/**/*.js"],
197-
+ srcDir: "./nwapp",
197+
- files: ["./nwapp/**/*", "./other/**/*.js"],
198+
+ srcDir: "./nwapp/**/* ./other/**/*.js",
198199
```
199200

200-
Add the `mode` option.
201+
Add the `mode` option and remove the now redundant `nw.build` function call.
201202

202203
```patch
203204
+ mode: "build",
205+
206+
-nw.build();
204207
```
205208

206209
The `platforms` option has been removed and replaced with `platform` and `arch`. Notice that one `nwbuild` function call now creates one build only. Refer to the [documentation](./index.md) for valid `platform` and `arch` values.
@@ -211,6 +214,8 @@ The `platforms` option has been removed and replaced with `platform` and `arch`.
211214
+ arch: "x64",
212215
```
213216

217+
> If platform is Linux then even if Windows or MacOS specific `app.*` properties are defined, only the Linux `app.*` properties will be parsed. Multiple platform `app.*` properties have been shown in this guide to cater to all platforms.
218+
214219
The `buildDir` option has been rename to `outDir`.
215220

216221
```patch

0 commit comments

Comments
 (0)