nw-builder 3.6.0 → 3.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +17 -0
- package/.github/CHANGELOG.md +77 -35
- package/.github/CODE_OF_CONDUCT.md +55 -0
- package/.github/{ISSUE_REQUEST_TEMPLATE.md → ISSUE_TEMPLATE.md} +1 -0
- package/.github/workflows/cd.yml +3 -3
- package/.github/workflows/ci.yml +9 -5
- package/README.md +81 -23
- package/bin/nwbuild.cjs +102 -0
- package/dist/index.cjs +1 -0
- package/lib/Version.cjs +81 -0
- package/lib/downloader.cjs +177 -0
- package/lib/index.cjs +1078 -0
- package/lib/{platformOverrides.js → platformOverrides.cjs} +61 -36
- package/lib/utils.cjs +293 -0
- package/lib/versions.cjs +206 -0
- package/package.json +57 -29
- package/src/constants/Platform.js +16 -0
- package/src/constants/Platforms.js +143 -0
- package/src/constants/index.js +7 -0
- package/src/index.js +2 -0
- package/src/utilities/checkCache.js +30 -0
- package/src/utilities/detectCurrentPlatform.js +24 -0
- package/src/utilities/index.js +4 -0
- package/{example/icons → test/demo}/icon.icns +0 -0
- package/{example/icons → test/demo}/icon.ico +0 -0
- package/test/demo/index.cjs +14 -0
- package/test/demo/index.html +10 -0
- package/{example/nwapp → test/demo}/package.json +7 -6
- package/test/downloader.cjs +131 -0
- package/test/expected/README.md +1 -1
- package/test/expected/merged +1 -1
- package/test/expected/oneOveriddenRestNot/README.md +1 -1
- package/test/expected/oneOveriddenRestNot/osx32.json +7 -7
- package/test/expected/oneOveriddenRestNot/osx64.json +7 -7
- package/test/expected/osx-plist/README.md +1 -1
- package/test/expected/platformOverrides/README.md +1 -1
- package/test/expected/platformOverrides/linux32.json +12 -12
- package/test/expected/platformOverrides/linux64.json +8 -8
- package/test/expected/platformOverrides/osx32.json +10 -10
- package/test/expected/platformOverrides/osx64.json +10 -10
- package/test/expected/platformOverrides/win32.json +10 -10
- package/test/expected/platformOverrides/win64.json +10 -10
- package/test/fixtures/README.md +1 -1
- package/test/fixtures/invalid.json +1 -1
- package/test/fixtures/manifest/README.md +1 -1
- package/test/fixtures/manifest/versions.json +9 -3
- package/test/fixtures/nwapp/README.md +1 -1
- package/test/fixtures/nwapp/images/imagefile.img +1 -1
- package/test/fixtures/nwapp/index.html +5 -2
- package/test/fixtures/nwapp/javascript/bower_packages/simple/package.json +1 -1
- package/test/fixtures/nwapp/javascript/jsfile.js +1 -1
- package/test/fixtures/nwapp/package.json +1 -1
- package/test/fixtures/oneOveriddenRestNot/README.md +1 -1
- package/test/fixtures/oneOveriddenRestNot/package.json +13 -13
- package/test/fixtures/osx-plist/README.md +1 -1
- package/test/fixtures/platformOverrides/README.md +1 -1
- package/test/fixtures/platformOverrides/package.json +68 -48
- package/test/fixtures/testVersions.html +73 -16
- package/test/nwBuilder.cjs +339 -0
- package/test/unit/checkCache.test.js +19 -0
- package/test/unit/checkCacheDir/v0.64.1/linux64/nw1.app +0 -0
- package/test/unit/checkCacheDir/v0.64.1/linux64/nw2.app +0 -0
- package/test/unit/detectCurrentPlatform.test.js +58 -0
- package/test/utils.cjs +310 -0
- package/test/versions.cjs +485 -0
- package/bin/nwbuild +0 -98
- package/demo.js +0 -22
- package/example/icons/README.md +0 -7
- package/example/nwapp/Credits.html +0 -9
- package/example/nwapp/README.md +0 -7
- package/example/nwapp/images/README.md +0 -7
- package/example/nwapp/images/kitten.jpg +0 -0
- package/example/nwapp/index.html +0 -22
- package/example/package.json +0 -7
- package/index.js +0 -1
- package/lib/Version.js +0 -60
- package/lib/detectCurrentPlatform.js +0 -17
- package/lib/downloader.js +0 -192
- package/lib/index.js +0 -873
- package/lib/platforms.js +0 -76
- package/lib/utils.js +0 -249
- package/lib/versions.js +0 -198
- package/test/downloader.js +0 -87
- package/test/nwBuilder.js +0 -237
- package/test/utils.js +0 -232
- package/test/versions.js +0 -330
package/.editorconfig
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# EditorConfig is awesome: http://EditorConfig.org
|
|
2
|
+
|
|
3
|
+
# Top-most EditorConfig file
|
|
4
|
+
root = true
|
|
5
|
+
|
|
6
|
+
# defaults for all files
|
|
7
|
+
[*]
|
|
8
|
+
charset = utf-8
|
|
9
|
+
end_of_line = lf
|
|
10
|
+
indent_size = 2
|
|
11
|
+
indent_style = space
|
|
12
|
+
insert_final_newline = true
|
|
13
|
+
trim_trailing_whitespace = true
|
|
14
|
+
|
|
15
|
+
# Markdown files uses two trailing spaces to indicate a <br>
|
|
16
|
+
[*.{md,snap}]
|
|
17
|
+
trim_trailing_whitespace = false
|
package/.github/CHANGELOG.md
CHANGED
|
@@ -7,16 +7,59 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [3.7.2] - 2022-06-02
|
|
11
|
+
|
|
12
|
+
## Added
|
|
13
|
+
|
|
14
|
+
- Added options `buildType`, `macCredits`, `macPlist`, `zip`, `zipOptions` to CLI [#575](https://github.com/nwjs-community/nw-builder/pull/575)
|
|
15
|
+
|
|
16
|
+
## Changed
|
|
17
|
+
|
|
18
|
+
- Update lint command [#575](https://github.com/nwjs-community/nw-builder/pull/575)
|
|
19
|
+
|
|
20
|
+
## [3.7.1] - 2022-06-02
|
|
21
|
+
|
|
22
|
+
## Changed
|
|
23
|
+
|
|
24
|
+
- Add `EditorConfig` [#574](https://github.com/nwjs-community/nw-builder/pull/574)
|
|
25
|
+
- Fix build step for Windows x64 platform [#572](https://github.com/nwjs-community/nw-builder/pull/572)
|
|
26
|
+
- Refactor `platforms` object [#571](https://github.com/nwjs-community/nw-builder/pull/571)
|
|
27
|
+
|
|
28
|
+
## [3.7.0] - 2022-05-30
|
|
29
|
+
|
|
30
|
+
## Added
|
|
31
|
+
|
|
32
|
+
- Optional zip file merging for Windows and Linux [#567](https://github.com/nwjs-community/nw-builder/pull/567)
|
|
33
|
+
- Add code of conduct [#560](https://github.com/nwjs-community/nw-builder/pull/560)
|
|
34
|
+
|
|
35
|
+
## Changed
|
|
36
|
+
|
|
37
|
+
- Update contributing guide [#569](https://github.com/nwjs-community/nw-builder/pull/569)
|
|
38
|
+
- Switch from TypeScript to JSDocs [#568](https://github.com/nwjs-community/nw-builder/pull/568)
|
|
39
|
+
- Set window icon with `rcedit` [#566](https://github.com/nwjs-community/nw-builder/pull/566)
|
|
40
|
+
- Refactor `checkCache` [#565](https://github.com/nwjs-community/nw-builder/pull/565)
|
|
41
|
+
- Simplify demo
|
|
42
|
+
- Refactor `detectCurrentPlatform` [#564](https://github.com/nwjs-community/nw-builder/pull/564)
|
|
43
|
+
- Update dependencies [#561](https://github.com/nwjs-community/nw-builder/pull/561) [#532](https://github.com/nwjs-community/nw-builder/pull/532)
|
|
44
|
+
|
|
45
|
+
## Removed
|
|
46
|
+
|
|
10
47
|
## [3.6.0] - 2022-05-18
|
|
48
|
+
|
|
11
49
|
### Added
|
|
50
|
+
|
|
12
51
|
- GitHub Actions for CICD [#552](https://github.com/nwjs-community/nw-builder/pull/552)
|
|
13
52
|
- Support multiple locales on OSX [#389](https://github.com/nwjs-community/nw-builder/pull/389)
|
|
14
53
|
- Pull request and issue template [#553](https://github.com/nwjs-community/nw-builder/pull/553)
|
|
54
|
+
|
|
15
55
|
### Changed
|
|
56
|
+
|
|
16
57
|
- Dependencies [#550](https://github.com/nwjs-community/nw-builder/pull/550)
|
|
17
58
|
- Documentation [#540](https://github.com/nwjs-community/nw-builder/pull/540) [#553](https://github.com/nwjs-community/nw-builder/pull/553) [#555](https://github.com/nwjs-community/nw-builder/pull/555)
|
|
18
59
|
- Improve run mode by detecting current platform to prevent downloading additional binaries
|
|
60
|
+
|
|
19
61
|
### Removed
|
|
62
|
+
|
|
20
63
|
- Travis
|
|
21
64
|
- AppVeyor
|
|
22
65
|
- JSHint
|
|
@@ -44,7 +87,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
44
87
|
|
|
45
88
|
- The `bluebird` dependency. We're now using native promises instead.
|
|
46
89
|
|
|
47
|
-
|
|
48
90
|
## [3.4.0] - 2017-05-28
|
|
49
91
|
|
|
50
92
|
### Added
|
|
@@ -69,37 +111,37 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
69
111
|
|
|
70
112
|
## Old format
|
|
71
113
|
|
|
72
|
-
- 2017-05-22
|
|
73
|
-
- 2017-05-20
|
|
74
|
-
- 2017-05-16
|
|
75
|
-
- 2017-02-12
|
|
76
|
-
- 2016-10-09
|
|
77
|
-
- 2016-10-09
|
|
78
|
-
- 2016-09-14
|
|
79
|
-
- 2016-08-28
|
|
80
|
-
- 2016-08-14
|
|
81
|
-
- 2016-07-31
|
|
82
|
-
- 2016-07-03
|
|
83
|
-
- 2016-07-03
|
|
84
|
-
- 2016-07-02
|
|
85
|
-
- 2016-07-02
|
|
86
|
-
- 2016-07-02
|
|
87
|
-
- 2015-12-18
|
|
88
|
-
- 2015-12-06
|
|
89
|
-
- 2015-06-28
|
|
90
|
-
- 2015-06-14
|
|
91
|
-
- 2015-06-14
|
|
92
|
-
- 2015-05-05
|
|
93
|
-
- 2015-01-29
|
|
94
|
-
- 2015-01-21
|
|
95
|
-
- 2015-01-15
|
|
96
|
-
- 2015-01-15
|
|
97
|
-
- 2014-12-12
|
|
98
|
-
- 2014-12-07
|
|
99
|
-
- 2014-11-14
|
|
100
|
-
- 2014-10-30
|
|
101
|
-
- 2014-08-19
|
|
102
|
-
- 2014-08-01
|
|
103
|
-
- 2014-07-31
|
|
104
|
-
- 2014-04-20
|
|
105
|
-
- 2014-04-13
|
|
114
|
+
- 2017-05-22 `3.2.3` Fix for caching when a version is specified (thanks @piwonesien for the help).
|
|
115
|
+
- 2017-05-20 `3.2.2` Fix: when using the `nwbuild` in run mode, the `-p` option was ignored and the current platform was always used.
|
|
116
|
+
- 2017-05-16 `3.2.1` Fix: NW.js 0.22.0+ apps didn't open.
|
|
117
|
+
- 2017-02-12 `3.2.0` Defaults to HTTPS now, added `manifestUrl` option, and bumped some dependencies.
|
|
118
|
+
- 2016-10-09 `3.1.2` Fix for passing array as files option when running app (plus some security fixes).
|
|
119
|
+
- 2016-10-09 `3.1.1` Fix for flavor feature when using CLI.
|
|
120
|
+
- 2016-09-14 `3.1.0` Ability to select any flavor of NW.js, not just `sdk`.
|
|
121
|
+
- 2016-08-28 `3.0.0` bumping graceful-fs-extra dependency to 2.0.0.
|
|
122
|
+
- 2016-08-14 `2.2.7` fix for macIcns option when using NW.js 0.12.3
|
|
123
|
+
- 2016-07-31 `2.2.6` fix for OS X caching
|
|
124
|
+
- 2016-07-03 `2.2.5` fix for update-notifier usage in bin
|
|
125
|
+
- 2016-07-03 `2.2.4` fix for syntax error in CLI
|
|
126
|
+
- 2016-07-02 `2.2.3` a few small fixes for the run option and more
|
|
127
|
+
- 2016-07-02 `2.2.2` fix for cache check of some legacy versions
|
|
128
|
+
- 2016-07-02 `2.2.1` supports newer NW.js versions (via http://nwjs.io/versions.json), plus other fixes.
|
|
129
|
+
- 2015-12-18 `2.2.0` added `zip` option.
|
|
130
|
+
- 2015-12-06 `2.1.0` added `cacheDir` command-line option, fix for no info being passed back, etc.
|
|
131
|
+
- 2015-06-28 `2.0.2` put upper bound to semver check for windows.
|
|
132
|
+
- 2015-06-14 `2.0.1` safer validation of versions.
|
|
133
|
+
- 2015-06-14 `2.0.0` changed to nw-builder, etc.
|
|
134
|
+
- 2015-05-05 `1.0.12` when using latest NW.js version, it's first validated that it's not an alpha version (fixes [#222](https://github.com/nwjs/nw-builder/issues/222)). Plus a fix for the `winIco` & `macIcns` command line options
|
|
135
|
+
- 2015-01-29 `1.0.8` fixed EMFILE errors (see [#147](https://github.com/nwjs/nw-builder/issues/147) [#148](https://github.com/nwjs/nw-builder/pull/148))
|
|
136
|
+
- 2015-01-21 `1.0.7` fixed about screen when copyright is not supplied
|
|
137
|
+
- 2015-01-15 `1.0.6` fixed downloads for nw.js version 0.12.0-alpha1
|
|
138
|
+
- 2015-01-15 `1.0.5` fixed downloads for NW.js versions < 0.12.0-alpha
|
|
139
|
+
- 2014-12-12 `1.0.0` 64-bit support, improved platform-overrides and no more EMFILE errors.
|
|
140
|
+
- 2014-12-07 `0.4.0` macPlist CFBundleIdentifier is generated from `package.json` (see [#131](https://github.com/nwjs/nw-builder/pull/131))
|
|
141
|
+
- 2014-11-14 `0.3.0` macPlist option improvements (see [#96](https://github.com/nwjs/nw-builder/pull/96))
|
|
142
|
+
- 2014-10-30 `0.2.0` adds support for platform-specific manifest overrides (see [#94](https://github.com/nwjs/nw-builder/pull/94))
|
|
143
|
+
- 2014-08-19 `0.1.2` adds a progress bar to downloads, fixes downloading through a proxy, fixed winIco, bug fixes
|
|
144
|
+
- 2014-08-01 `0.1.0` use app filename for generated executables, optimized version checking, (known issue: `winIco` on windows)
|
|
145
|
+
- 2014-07-31 `0.0.4` fixed compatibility with nodewebkit 0.10.0
|
|
146
|
+
- 2014-04-20 Added run option, bug fixes
|
|
147
|
+
- 2014-04-13 Preview Release
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# "No Ideologies" Code of Conduct
|
|
2
|
+
|
|
3
|
+
The following are the guidelines we expect our community members and maintainers to follow.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Terminology and Scope
|
|
8
|
+
|
|
9
|
+
**What defines a "maintainer"?**
|
|
10
|
+
|
|
11
|
+
- A maintainer is anyone that interacts with the community on behalf of this project. Amount of code written is not a qualifier. A maintainer may include those who solely help in support roles such as in resolving issues, improving documentation, administrating or moderating forums/chatrooms, or any other non-coding specific roles. Maintainers also include those that are responsible for the building and upkeep of the project.
|
|
12
|
+
|
|
13
|
+
**What defines a "community member"?**
|
|
14
|
+
|
|
15
|
+
- Anyone interacting with this project directly, including maintainers.
|
|
16
|
+
|
|
17
|
+
**What is the scope of these guidelines?**
|
|
18
|
+
|
|
19
|
+
- These guidelines apply only to this project and forms of communication directly related to it, such as issue trackers, forums, chatrooms, and in person events specific to this project. If a member is violating these guidelines outside of this project or on other platforms, that is beyond our scope and any grievances should be handled on those platforms.
|
|
20
|
+
|
|
21
|
+
**Discussing the guidelines:**
|
|
22
|
+
|
|
23
|
+
- Discussions around these guidelines, improving, updating, or altering them, is permitted so long as the discussions do not violate any existing guidelines.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Guidelines
|
|
28
|
+
|
|
29
|
+
### Guidelines for community members
|
|
30
|
+
|
|
31
|
+
This project is technical in nature and not based around any particular non-technical ideology. As such, communication that is based primarily around ideologies unrelated to the technologies used by this repository are not permitted.
|
|
32
|
+
|
|
33
|
+
Any discussion or communication that is primarily focused around an ideology, be it about race, gender, politics, religion, or anything else non-technical, is not allowed. Everyone has their own ideological preferences, beliefs, and opinions. We do not seek to marginalize, exclude, or judge anyone for their ideologies. To prevent conflict between those with differing or opposing ideologies, all communication on these subjects are prohibited. Some discussions around these topics may be important, however this project is not the proper channel for these discussions.
|
|
34
|
+
|
|
35
|
+
### Guidelines for maintainers
|
|
36
|
+
|
|
37
|
+
- Maintainers must abide by the same rules as all other community members mentioned above. However, in addition, maintainers are held to a higher standard, explained below.
|
|
38
|
+
- Maintainers should answer all questions politely.
|
|
39
|
+
- If someone is upset or angry about something, it's probably because it's difficult to use, so thank them for bringing it to your attention and address ways to solve the problem. Maintainers should focus on the content of the message, and not on how it was delivered.
|
|
40
|
+
- A maintainer should seek to update members when an issue they brought up is resolved.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Appropriate response to violations
|
|
45
|
+
|
|
46
|
+
How to respond to a community member or maintainer violating a guideline.
|
|
47
|
+
|
|
48
|
+
1. If an issue is created that violates a guideline a maintainer should close and lock the issue, explaining "This issue is in violation of our code of conduct. Please review it before posting again." with a link to this document.
|
|
49
|
+
1. If a member repeatedly violates the guidelines established in this document, they should be politely warned that continuing to violate the rules may result in being banned from the community. This means revoking access and support to interactions relating directly to the project (issue trackers, chatrooms, forums, in person events, etc.). However, they may continue to use the technology in accordance with its license.
|
|
50
|
+
1. If a maintainer is in violation of a guideline, they should be informed of such with a link to this document. If additional actions are required of the maintainer but not taken, then other maintainers should be informed of these inactions.
|
|
51
|
+
1. If a maintainer repeatedly violates the guidelines established in this document, they should be politely warned that continuing to violate the rules may result in being banned from the community. This means revoking access and support to interactions relating directly to the project (issue trackers, chatrooms, forums, in person events, etc.). However, they may continue to use the technology in accordance with its license. In addition, future contributions to this project may be ignored as well.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
Based on version 1.0.3 from https://github.com/CodifiedConduct/coc-no-ideologies
|
package/.github/workflows/cd.yml
CHANGED
|
@@ -2,7 +2,7 @@ name: cd
|
|
|
2
2
|
on:
|
|
3
3
|
push:
|
|
4
4
|
branches:
|
|
5
|
-
|
|
5
|
+
- master
|
|
6
6
|
|
|
7
7
|
jobs:
|
|
8
8
|
publish:
|
|
@@ -16,9 +16,9 @@ jobs:
|
|
|
16
16
|
|
|
17
17
|
- uses: actions/setup-node@v2
|
|
18
18
|
with:
|
|
19
|
-
node-version:
|
|
19
|
+
node-version: "16"
|
|
20
20
|
|
|
21
21
|
- run: pnpm install
|
|
22
22
|
- uses: JS-DevTools/npm-publish@v1
|
|
23
23
|
with:
|
|
24
|
-
token: ${{ secrets.NPM_TOKEN }}
|
|
24
|
+
token: ${{ secrets.NPM_TOKEN }}
|
package/.github/workflows/ci.yml
CHANGED
|
@@ -2,14 +2,18 @@ name: ci
|
|
|
2
2
|
on:
|
|
3
3
|
pull_request:
|
|
4
4
|
branches:
|
|
5
|
-
|
|
5
|
+
- master
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
branches:
|
|
8
|
+
- master
|
|
6
9
|
|
|
7
10
|
jobs:
|
|
8
11
|
test:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
12
|
strategy:
|
|
11
13
|
matrix:
|
|
12
|
-
|
|
14
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
15
|
+
node: [14, 16, 18]
|
|
16
|
+
runs-on: ${{ matrix.os }}
|
|
13
17
|
steps:
|
|
14
18
|
- uses: actions/checkout@v3
|
|
15
19
|
- uses: pnpm/action-setup@v2.2.1
|
|
@@ -23,5 +27,5 @@ jobs:
|
|
|
23
27
|
|
|
24
28
|
- run: pnpm install
|
|
25
29
|
- run: pnpm format
|
|
26
|
-
|
|
27
|
-
- run: pnpm test
|
|
30
|
+
- run: pnpm lint
|
|
31
|
+
- run: pnpm test
|
package/README.md
CHANGED
|
@@ -7,24 +7,36 @@
|
|
|
7
7
|
|
|
8
8
|
Build [NW.js](https://github.com/nwjs/nw.js) applications for Mac, Windows and Linux.
|
|
9
9
|
|
|
10
|
+
## Table of Contents
|
|
11
|
+
|
|
12
|
+
- [Installation](https://github.com/nwutils/nw-builder#installation)
|
|
13
|
+
- [Usage](https://github.com/nwutils/nw-builder#usage)
|
|
14
|
+
- [API Reference](https://github.com/nwutils/nw-builder#api-reference)
|
|
15
|
+
- [Contributing](https://github.com/nwutils/nw-builder#contributing)
|
|
16
|
+
- [License](https://github.com/nwutils/nw-builder#license)
|
|
17
|
+
|
|
10
18
|
## Installation
|
|
11
19
|
|
|
20
|
+
> Tested and runs on Node 14, 16 and 18!
|
|
21
|
+
|
|
12
22
|
Using npm:
|
|
23
|
+
|
|
13
24
|
```javascript
|
|
14
25
|
npm install nw-builder
|
|
15
26
|
```
|
|
16
27
|
|
|
17
28
|
Using yarn:
|
|
29
|
+
|
|
18
30
|
```javascript
|
|
19
31
|
yarn add nw-builder
|
|
20
32
|
```
|
|
21
33
|
|
|
22
34
|
Using pnpm:
|
|
35
|
+
|
|
23
36
|
```javascript
|
|
24
37
|
pnpm add nw-builder
|
|
25
38
|
```
|
|
26
39
|
|
|
27
|
-
|
|
28
40
|
## Usage
|
|
29
41
|
|
|
30
42
|
### CLI
|
|
@@ -48,6 +60,7 @@ Options:
|
|
|
48
60
|
```
|
|
49
61
|
|
|
50
62
|
To run NW.js in dev mode:
|
|
63
|
+
|
|
51
64
|
```
|
|
52
65
|
nwbuild -r path/to/app -- <args>
|
|
53
66
|
```
|
|
@@ -74,12 +87,15 @@ nw.build().then(function () {
|
|
|
74
87
|
```
|
|
75
88
|
|
|
76
89
|
To run NW.js in dev mode:
|
|
90
|
+
|
|
77
91
|
```js
|
|
78
|
-
nw.run()
|
|
79
|
-
|
|
80
|
-
|
|
92
|
+
nw.run()
|
|
93
|
+
.then(function () {
|
|
94
|
+
console.log("all done!");
|
|
95
|
+
})
|
|
96
|
+
.catch(function (error) {
|
|
81
97
|
console.error(error);
|
|
82
|
-
});
|
|
98
|
+
});
|
|
83
99
|
```
|
|
84
100
|
|
|
85
101
|
## API Reference
|
|
@@ -88,20 +104,22 @@ nw.run().then(function () {
|
|
|
88
104
|
|
|
89
105
|
### Options
|
|
90
106
|
|
|
91
|
-
#### options.files
|
|
107
|
+
#### options.files _Required_
|
|
108
|
+
|
|
92
109
|
Type: `String`
|
|
93
110
|
Default value: `null`
|
|
94
111
|
|
|
95
112
|
The path to your node webkit app. It supports [simple-glob](https://github.com/jedmao/simple-glob) so you can do stuff like `['foo/*.js', '!foo/bar.js', 'foo/bar.js']`.
|
|
96
113
|
|
|
97
|
-
|
|
98
114
|
#### options.version
|
|
115
|
+
|
|
99
116
|
Type: `String`
|
|
100
117
|
Default value: `'latest'`
|
|
101
118
|
|
|
102
119
|
The version of NW.js you want to use. Per default it looks up the latest version. [Here is a list](https://github.com/nwjs/nw.js/tags) of all available releases.
|
|
103
120
|
|
|
104
121
|
#### options.flavor
|
|
122
|
+
|
|
105
123
|
Type: `String`
|
|
106
124
|
Default value: `'sdk'`
|
|
107
125
|
|
|
@@ -110,6 +128,7 @@ The flavor of NW.js you want to use. Per default it will be `sdk`. [Here is a li
|
|
|
110
128
|
The value `sdk` is most used for development whereas `normal` for production.
|
|
111
129
|
|
|
112
130
|
#### options.platforms
|
|
131
|
+
|
|
113
132
|
Type `(CLI)`: `String` (comma separated values)
|
|
114
133
|
Type `(API)`: `Array` of `String`
|
|
115
134
|
Default value: [`<current OS>`]
|
|
@@ -121,47 +140,54 @@ The values `['win', 'osx', 'linux']` can also be used and will build both the 32
|
|
|
121
140
|
Be aware that the osx32 version can only be built with legacy version of nwjs. Since > 0.12.0, only 64 bits for osx works.
|
|
122
141
|
|
|
123
142
|
#### options.appName
|
|
143
|
+
|
|
124
144
|
Type: `String`
|
|
125
145
|
Default value: `false`
|
|
126
146
|
|
|
127
147
|
The Name of your NW.js app. If this value is set to null, it will autodetect the `name` from your projects package.json. This will be used to generate a plist file for mac.
|
|
128
148
|
|
|
129
149
|
#### options.appVersion
|
|
150
|
+
|
|
130
151
|
Type: `String`
|
|
131
152
|
Default value: `false`
|
|
132
153
|
|
|
133
154
|
The version of your NW.js app. If this value is set to null, it will autodetect the `version` form your projects package.json. This will be used to generate a plist file for mac.
|
|
134
155
|
|
|
135
156
|
#### options.buildDir
|
|
157
|
+
|
|
136
158
|
Type: `String`
|
|
137
159
|
Default value: `./build`
|
|
138
160
|
|
|
139
161
|
This is where the releases are saved.
|
|
140
162
|
|
|
141
163
|
#### options.cacheDir
|
|
164
|
+
|
|
142
165
|
Type: `String`
|
|
143
166
|
Default value: `./cache`
|
|
144
167
|
|
|
145
168
|
This is where the cached NW.js downloads are.
|
|
146
169
|
|
|
147
170
|
#### options.buildType
|
|
171
|
+
|
|
148
172
|
Type: `String` or `function`
|
|
149
173
|
Default value: `default`
|
|
150
174
|
|
|
151
175
|
How you want to save your build.
|
|
152
176
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
177
|
+
- `default` [appName]
|
|
178
|
+
- `versioned` [appName] -v[appVersion]
|
|
179
|
+
- `timestamped` [appName] - [timestamp];
|
|
180
|
+
- A function with options as scope (e.g `function () {return this.appVersion;}` )
|
|
157
181
|
|
|
158
182
|
#### options.forceDownload
|
|
183
|
+
|
|
159
184
|
Type: `Boolean`
|
|
160
185
|
Default value: `false`
|
|
161
186
|
|
|
162
187
|
This will delete everything in your `build_dir` directory, including the cached downloaded prebuilt binaries.
|
|
163
188
|
|
|
164
189
|
#### options.argv
|
|
190
|
+
|
|
165
191
|
Type `(CLI)`: `String` (comma separated values)
|
|
166
192
|
Type `(API)`: `Array` of `String`
|
|
167
193
|
Default Value: []
|
|
@@ -169,24 +195,28 @@ Default Value: []
|
|
|
169
195
|
Pass Command Line Options when you run an NW.js instance. Ignored in case of build.
|
|
170
196
|
|
|
171
197
|
#### options.macCredits
|
|
198
|
+
|
|
172
199
|
Type: `String`
|
|
173
200
|
Default value: `false`
|
|
174
201
|
|
|
175
202
|
MAC ONLY: The path to your credits.html file. If your don't provide your own it will use the one provided by NW.js
|
|
176
203
|
|
|
177
204
|
#### options.macIcns
|
|
205
|
+
|
|
178
206
|
Type: `String`
|
|
179
207
|
Default value: `false`
|
|
180
208
|
|
|
181
209
|
MAC ONLY: The path to your ICNS icon file. If your don't provide your own it will use the one provided by NW.js
|
|
182
210
|
|
|
183
211
|
#### options.zip
|
|
212
|
+
|
|
184
213
|
Type: `Boolean`
|
|
185
214
|
Default value: `null`
|
|
186
215
|
|
|
187
216
|
WINDOW ONLY: Instead of zipping the application and merging it into the executable the application content is placed next to the application (which speed up the startup time for large apps). The default behaviour is platform specific. For `windows` and `linux`, the application is zipped and merged into the executable. For `mac`, the application is not zipped.
|
|
188
217
|
|
|
189
218
|
#### options.zipOptions
|
|
219
|
+
|
|
190
220
|
Type: `Object`
|
|
191
221
|
Default value: `null`
|
|
192
222
|
|
|
@@ -195,13 +225,14 @@ Allows to configure the underling zip library parameters, like store or compress
|
|
|
195
225
|
See [archiver](http://archiverjs.com/docs/global.html#ZipOptions) documentation for detailed description of properties.
|
|
196
226
|
|
|
197
227
|
#### options.macPlist
|
|
228
|
+
|
|
198
229
|
Type: `String` or `Object`
|
|
199
230
|
Default value: `false`
|
|
200
231
|
|
|
201
232
|
MAC ONLY: Pass a string containing the path to your own plist file. If a string isn't passed, a plist file will be generated from your package.json. Pass an object to overwrite or add properties to the generated plist file.
|
|
202
233
|
|
|
203
|
-
|
|
204
234
|
#### options.winVersionString
|
|
235
|
+
|
|
205
236
|
Type: `Object`
|
|
206
237
|
Default value: `{}`
|
|
207
238
|
|
|
@@ -219,17 +250,26 @@ winVersionString: {
|
|
|
219
250
|
```
|
|
220
251
|
|
|
221
252
|
#### options.winIco
|
|
253
|
+
|
|
222
254
|
Type: `String`
|
|
223
255
|
Default value: `null`
|
|
224
256
|
|
|
225
257
|
WINDOWS ONLY: The path to your ICO icon file. If your don't provide your own it will use the one provided by NW.js. If you are building on MAC or LINUX you must have [Wine](https://www.winehq.org/) installed to use this option.
|
|
226
258
|
|
|
227
259
|
#### options.macZip (DEPRECATED)
|
|
260
|
+
|
|
228
261
|
Type: `Boolean`
|
|
229
262
|
Default value: `null`
|
|
230
263
|
|
|
231
264
|
MAC ONLY: Use a `app.nw` folder instead of `ZIP` file, this significantly improves the startup speed of applications on `mac`, since no decompressing is needed. Builds on other platforms will still use `ZIP` files. The default behaviour of node-webkit-builder is to not use `ZIP` files on the `mac` platform. In case of the `mac` platform the option `macZip` can override the option `zip`.
|
|
232
265
|
|
|
266
|
+
#### options.mergeZip
|
|
267
|
+
|
|
268
|
+
Type: `Boolean`
|
|
269
|
+
Default value: `true`
|
|
270
|
+
|
|
271
|
+
WINDOWS AND LINUX ONLY: Merge the source file package with the Node Webkit executable.
|
|
272
|
+
|
|
233
273
|
### Manifest Options
|
|
234
274
|
|
|
235
275
|
#### platformOverrides
|
|
@@ -290,13 +330,13 @@ For example, when building for Windows, the manifest generated and put into the
|
|
|
290
330
|
|
|
291
331
|
```json
|
|
292
332
|
{
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
333
|
+
"name": "nw-demo",
|
|
334
|
+
"version": "0.1.0",
|
|
335
|
+
"main": "index.html",
|
|
336
|
+
"window": {
|
|
337
|
+
"frame": true,
|
|
338
|
+
"toolbar": false
|
|
339
|
+
}
|
|
300
340
|
}
|
|
301
341
|
```
|
|
302
342
|
|
|
@@ -318,13 +358,31 @@ This project was created by [Steffen Müller](https://github.com/steffenmllr) an
|
|
|
318
358
|
|
|
319
359
|
## Contributing
|
|
320
360
|
|
|
361
|
+
### Getting Started
|
|
362
|
+
|
|
363
|
+
1. Pick and install a Node version manager
|
|
364
|
+
* Linux/OSX - [nvm](https://github.com/nvm-sh/nvm)
|
|
365
|
+
* Windows 8+ - [nvm-windows](https://github.com/coreybutler/nvm-windows)
|
|
366
|
+
* Windows 7 - [nodist](https://github.com/nullivex/nodist)
|
|
367
|
+
* Win/Lin/OSX - [volta](https://volta.sh)
|
|
368
|
+
1. Use your version manager to install Node 14.19, 16.9, 18.2 or above
|
|
369
|
+
1. Run `corepack enable`
|
|
370
|
+
1. `corepack prepare pnpm@7.1.7 --activate`
|
|
371
|
+
1. `pnpm install`
|
|
372
|
+
* If you haven't used `pnpm` before, [here is a cheatsheet](https://dev.to/equiman/npm-vs-yarn-vs-pnpm-commands-cheatsheet-3el8)
|
|
373
|
+
1. `pnpm demo` to test your changes at first glance
|
|
374
|
+
1. `pnpm test` to run unit tests
|
|
375
|
+
1. Don't forget to run `pnpm format && pnpm lint` before commiting your changes
|
|
376
|
+
|
|
377
|
+
### General Guidelines
|
|
378
|
+
|
|
321
379
|
- Whenever possible, open an issue before submitting a pull request.
|
|
322
380
|
- PRs should have short descriptive titles. For example:
|
|
323
|
-
|
|
324
|
-
|
|
381
|
+
- fix(docs): fix typo in `options.platform` description
|
|
382
|
+
- feat(platform): add support for mac m1
|
|
325
383
|
- Ideally, a PR should reference a related issue
|
|
326
|
-
-
|
|
384
|
+
- Ensure there are tests that cover your changes
|
|
327
385
|
|
|
328
386
|
## License
|
|
329
387
|
|
|
330
|
-
MIT
|
|
388
|
+
[MIT](https://github.com/nwutils/nw-builder/blob/master/.github/LICENSE)
|
package/bin/nwbuild.cjs
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const NwBuilder = require("../lib/index.cjs");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const { detectCurrentPlatform } = require("../dist/index.cjs");
|
|
5
|
+
|
|
6
|
+
const currentPlatform = detectCurrentPlatform(process);
|
|
7
|
+
|
|
8
|
+
const argv = require("yargs")
|
|
9
|
+
.command("$0 <path>")
|
|
10
|
+
.usage("Usage:\n $0 [options] [path] [-- <args>]")
|
|
11
|
+
|
|
12
|
+
.alias("p", "platforms")
|
|
13
|
+
.default("p", currentPlatform)
|
|
14
|
+
.describe(
|
|
15
|
+
"p",
|
|
16
|
+
"Platforms to build, comma-sperated, can be: \n win32, win64, osx32, osx64, linux32, linux64 or \nwin, osx, linux",
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
.version(false)
|
|
20
|
+
.alias("v", "version")
|
|
21
|
+
.default("v", "latest")
|
|
22
|
+
.describe("v", "The NW.js version, eg. 0.8.4")
|
|
23
|
+
|
|
24
|
+
.alias("r", "run")
|
|
25
|
+
.default("r", false)
|
|
26
|
+
.describe("r", "Runs NW.js for the current platform")
|
|
27
|
+
.boolean("r")
|
|
28
|
+
|
|
29
|
+
.alias("o", "buildDir")
|
|
30
|
+
.default("o", "./build")
|
|
31
|
+
.describe("o", "The build folder")
|
|
32
|
+
|
|
33
|
+
.alias("f", "forceDownload")
|
|
34
|
+
.default("f", false)
|
|
35
|
+
.describe("f", "Force download of NW.js")
|
|
36
|
+
.boolean("f")
|
|
37
|
+
|
|
38
|
+
.alias("n", "name")
|
|
39
|
+
.describe("n", "The Name of your NW.js app.")
|
|
40
|
+
|
|
41
|
+
.describe("cacheDir", "The cache folder")
|
|
42
|
+
|
|
43
|
+
.default("quiet", false)
|
|
44
|
+
.describe("quiet", "Disables logging")
|
|
45
|
+
.boolean("quiet")
|
|
46
|
+
|
|
47
|
+
.describe(
|
|
48
|
+
" <args>",
|
|
49
|
+
"Pass custom arguments to the NW.js instance \n(-r, --run mode only)",
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
// Howto Help
|
|
53
|
+
.help("h")
|
|
54
|
+
.alias("h", "help")
|
|
55
|
+
|
|
56
|
+
.wrap(100).argv;
|
|
57
|
+
|
|
58
|
+
const options = {
|
|
59
|
+
appName: argv.name,
|
|
60
|
+
files: path.resolve(process.cwd(), argv.path) + "/**/*",
|
|
61
|
+
flavor: argv.flavor || "sdk",
|
|
62
|
+
platforms: argv.platforms ? argv.platforms.split(",") : [currentPlatform],
|
|
63
|
+
currentPlatform: currentPlatform,
|
|
64
|
+
version: argv.version,
|
|
65
|
+
macCredits: argv.macCredits || false,
|
|
66
|
+
macPlist: argv.macPlist || false,
|
|
67
|
+
macIcns: argv.macIcns || false,
|
|
68
|
+
winIco: argv.winIco || false,
|
|
69
|
+
cacheDir: argv.cacheDir
|
|
70
|
+
? path.resolve(process.cwd(), argv.cacheDir)
|
|
71
|
+
: path.resolve(__dirname, "..", "cache"),
|
|
72
|
+
buildDir: path.resolve(process.cwd(), argv.buildDir),
|
|
73
|
+
buildType: argv.buildType || 'default',
|
|
74
|
+
forceDownload: argv.forceDownload,
|
|
75
|
+
// get all argv arguments after --
|
|
76
|
+
argv: process.argv.slice(
|
|
77
|
+
process.argv.findIndex(function firstDash(el) {
|
|
78
|
+
return el === "--";
|
|
79
|
+
}) + 1,
|
|
80
|
+
),
|
|
81
|
+
zip: argv.zip || null,
|
|
82
|
+
zipOptions: argv.zipOptions || null
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Initialize Builder
|
|
86
|
+
const nw = new NwBuilder(options);
|
|
87
|
+
|
|
88
|
+
// Logging
|
|
89
|
+
if (!(argv.quiet || argv.quite)) {
|
|
90
|
+
nw.on("log", console.log);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Build or Run the app
|
|
94
|
+
const np = argv.r ? nw.run() : nw.build();
|
|
95
|
+
np.then(function () {
|
|
96
|
+
process.exit(0);
|
|
97
|
+
}).catch(function (error) {
|
|
98
|
+
if (error) {
|
|
99
|
+
console.error(error);
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
});
|