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.
Files changed (86) hide show
  1. package/.editorconfig +17 -0
  2. package/.github/CHANGELOG.md +77 -35
  3. package/.github/CODE_OF_CONDUCT.md +55 -0
  4. package/.github/{ISSUE_REQUEST_TEMPLATE.md → ISSUE_TEMPLATE.md} +1 -0
  5. package/.github/workflows/cd.yml +3 -3
  6. package/.github/workflows/ci.yml +9 -5
  7. package/README.md +81 -23
  8. package/bin/nwbuild.cjs +102 -0
  9. package/dist/index.cjs +1 -0
  10. package/lib/Version.cjs +81 -0
  11. package/lib/downloader.cjs +177 -0
  12. package/lib/index.cjs +1078 -0
  13. package/lib/{platformOverrides.js → platformOverrides.cjs} +61 -36
  14. package/lib/utils.cjs +293 -0
  15. package/lib/versions.cjs +206 -0
  16. package/package.json +57 -29
  17. package/src/constants/Platform.js +16 -0
  18. package/src/constants/Platforms.js +143 -0
  19. package/src/constants/index.js +7 -0
  20. package/src/index.js +2 -0
  21. package/src/utilities/checkCache.js +30 -0
  22. package/src/utilities/detectCurrentPlatform.js +24 -0
  23. package/src/utilities/index.js +4 -0
  24. package/{example/icons → test/demo}/icon.icns +0 -0
  25. package/{example/icons → test/demo}/icon.ico +0 -0
  26. package/test/demo/index.cjs +14 -0
  27. package/test/demo/index.html +10 -0
  28. package/{example/nwapp → test/demo}/package.json +7 -6
  29. package/test/downloader.cjs +131 -0
  30. package/test/expected/README.md +1 -1
  31. package/test/expected/merged +1 -1
  32. package/test/expected/oneOveriddenRestNot/README.md +1 -1
  33. package/test/expected/oneOveriddenRestNot/osx32.json +7 -7
  34. package/test/expected/oneOveriddenRestNot/osx64.json +7 -7
  35. package/test/expected/osx-plist/README.md +1 -1
  36. package/test/expected/platformOverrides/README.md +1 -1
  37. package/test/expected/platformOverrides/linux32.json +12 -12
  38. package/test/expected/platformOverrides/linux64.json +8 -8
  39. package/test/expected/platformOverrides/osx32.json +10 -10
  40. package/test/expected/platformOverrides/osx64.json +10 -10
  41. package/test/expected/platformOverrides/win32.json +10 -10
  42. package/test/expected/platformOverrides/win64.json +10 -10
  43. package/test/fixtures/README.md +1 -1
  44. package/test/fixtures/invalid.json +1 -1
  45. package/test/fixtures/manifest/README.md +1 -1
  46. package/test/fixtures/manifest/versions.json +9 -3
  47. package/test/fixtures/nwapp/README.md +1 -1
  48. package/test/fixtures/nwapp/images/imagefile.img +1 -1
  49. package/test/fixtures/nwapp/index.html +5 -2
  50. package/test/fixtures/nwapp/javascript/bower_packages/simple/package.json +1 -1
  51. package/test/fixtures/nwapp/javascript/jsfile.js +1 -1
  52. package/test/fixtures/nwapp/package.json +1 -1
  53. package/test/fixtures/oneOveriddenRestNot/README.md +1 -1
  54. package/test/fixtures/oneOveriddenRestNot/package.json +13 -13
  55. package/test/fixtures/osx-plist/README.md +1 -1
  56. package/test/fixtures/platformOverrides/README.md +1 -1
  57. package/test/fixtures/platformOverrides/package.json +68 -48
  58. package/test/fixtures/testVersions.html +73 -16
  59. package/test/nwBuilder.cjs +339 -0
  60. package/test/unit/checkCache.test.js +19 -0
  61. package/test/unit/checkCacheDir/v0.64.1/linux64/nw1.app +0 -0
  62. package/test/unit/checkCacheDir/v0.64.1/linux64/nw2.app +0 -0
  63. package/test/unit/detectCurrentPlatform.test.js +58 -0
  64. package/test/utils.cjs +310 -0
  65. package/test/versions.cjs +485 -0
  66. package/bin/nwbuild +0 -98
  67. package/demo.js +0 -22
  68. package/example/icons/README.md +0 -7
  69. package/example/nwapp/Credits.html +0 -9
  70. package/example/nwapp/README.md +0 -7
  71. package/example/nwapp/images/README.md +0 -7
  72. package/example/nwapp/images/kitten.jpg +0 -0
  73. package/example/nwapp/index.html +0 -22
  74. package/example/package.json +0 -7
  75. package/index.js +0 -1
  76. package/lib/Version.js +0 -60
  77. package/lib/detectCurrentPlatform.js +0 -17
  78. package/lib/downloader.js +0 -192
  79. package/lib/index.js +0 -873
  80. package/lib/platforms.js +0 -76
  81. package/lib/utils.js +0 -249
  82. package/lib/versions.js +0 -198
  83. package/test/downloader.js +0 -87
  84. package/test/nwBuilder.js +0 -237
  85. package/test/utils.js +0 -232
  86. package/test/versions.js +0 -330
@@ -0,0 +1,485 @@
1
+ var test = require("tape"),
2
+ nock = require("nock");
3
+
4
+ var versions = require("../lib/versions.cjs");
5
+
6
+ var root = "http://nwjs.io";
7
+ var dlUrl = "http://dl.nwjs.io/";
8
+ var expectedLegacyVersions = ["0.10.2", "0.10.0-rc1", "0.9.3"];
9
+
10
+ test("getLatestVersion", async function (t) {
11
+ await t.plan(3);
12
+
13
+ nock(root)
14
+ .get("/versions.json")
15
+ .replyWithFile(200, "./test/fixtures/manifest/versions.json");
16
+ nock(root)
17
+ .get("/versions.json")
18
+ .replyWithFile(200, "./test/fixtures/manifest/versions.json");
19
+
20
+ await versions
21
+ .getLatestVersion("http://dl.nwjs.io/", root + "/versions.json")
22
+ .then(function (result) {
23
+ t.equal(result.version, "0.15.2");
24
+ t.equal(result.name, "nwjs");
25
+ t.deepEqual(result.platforms, {
26
+ "linux32-normal":
27
+ "http://dl.nwjs.io/v0.15.2/nwjs-v0.15.2-linux-ia32.tar.gz",
28
+ "linux32-sdk":
29
+ "http://dl.nwjs.io/v0.15.2/nwjs-sdk-v0.15.2-linux-ia32.tar.gz",
30
+ "linux64-normal":
31
+ "http://dl.nwjs.io/v0.15.2/nwjs-v0.15.2-linux-x64.tar.gz",
32
+ "linux64-sdk":
33
+ "http://dl.nwjs.io/v0.15.2/nwjs-sdk-v0.15.2-linux-x64.tar.gz",
34
+ "osx64-normal": "http://dl.nwjs.io/v0.15.2/nwjs-v0.15.2-osx-x64.zip",
35
+ "osx64-sdk": "http://dl.nwjs.io/v0.15.2/nwjs-sdk-v0.15.2-osx-x64.zip",
36
+ "win32-normal": "http://dl.nwjs.io/v0.15.2/nwjs-v0.15.2-win-ia32.zip",
37
+ "win32-sdk": "http://dl.nwjs.io/v0.15.2/nwjs-sdk-v0.15.2-win-ia32.zip",
38
+ "win64-normal": "http://dl.nwjs.io/v0.15.2/nwjs-v0.15.2-win-x64.zip",
39
+ "win64-sdk": "http://dl.nwjs.io/v0.15.2/nwjs-sdk-v0.15.2-win-x64.zip",
40
+ });
41
+ });
42
+ });
43
+
44
+ test("getVersions", async function (t) {
45
+ await t.plan(6);
46
+
47
+ await nock(root)
48
+ .get("/versions.json")
49
+ .replyWithFile(200, "./test/fixtures/manifest/versions.json");
50
+ await nock(dlUrl).get("/").replyWithFile(200, "./test/fixtures/testVersions.html");
51
+ await expectedLegacyVersions.forEach(function (expectedVersion) {
52
+ nock(dlUrl)
53
+ .head(
54
+ "/v" +
55
+ expectedVersion +
56
+ "/node-webkit-v" +
57
+ expectedVersion +
58
+ "-win-ia32.zip",
59
+ )
60
+ .replyWithFile(200, "./test/fixtures/testVersions.html"); // needs to reply with *any* content
61
+ });
62
+
63
+ await versions
64
+ .getVersions(dlUrl, root + "/versions.json")
65
+ .then(function (result) {
66
+ var expectedVersions = [
67
+ {
68
+ version: "0.15.2",
69
+ name: "nwjs",
70
+ platforms: {
71
+ "linux32-normal":
72
+ "http://dl.nwjs.io/v0.15.2/nwjs-v0.15.2-linux-ia32.tar.gz",
73
+ "linux32-sdk":
74
+ "http://dl.nwjs.io/v0.15.2/nwjs-sdk-v0.15.2-linux-ia32.tar.gz",
75
+ "linux64-normal":
76
+ "http://dl.nwjs.io/v0.15.2/nwjs-v0.15.2-linux-x64.tar.gz",
77
+ "linux64-sdk":
78
+ "http://dl.nwjs.io/v0.15.2/nwjs-sdk-v0.15.2-linux-x64.tar.gz",
79
+ "osx64-normal":
80
+ "http://dl.nwjs.io/v0.15.2/nwjs-v0.15.2-osx-x64.zip",
81
+ "osx64-sdk":
82
+ "http://dl.nwjs.io/v0.15.2/nwjs-sdk-v0.15.2-osx-x64.zip",
83
+ "win32-normal":
84
+ "http://dl.nwjs.io/v0.15.2/nwjs-v0.15.2-win-ia32.zip",
85
+ "win32-sdk":
86
+ "http://dl.nwjs.io/v0.15.2/nwjs-sdk-v0.15.2-win-ia32.zip",
87
+ "win64-normal":
88
+ "http://dl.nwjs.io/v0.15.2/nwjs-v0.15.2-win-x64.zip",
89
+ "win64-sdk":
90
+ "http://dl.nwjs.io/v0.15.2/nwjs-sdk-v0.15.2-win-x64.zip",
91
+ },
92
+ isLegacy: false,
93
+ },
94
+ {
95
+ version: "0.13.2",
96
+ name: "nwjs",
97
+ platforms: {
98
+ "linux32-nacl":
99
+ "http://dl.nwjs.io/v0.13.2/nwjs-nacl-v0.13.2-linux-ia32.tar.gz",
100
+ "linux32-normal":
101
+ "http://dl.nwjs.io/v0.13.2/nwjs-v0.13.2-linux-ia32.tar.gz",
102
+ "linux32-sdk":
103
+ "http://dl.nwjs.io/v0.13.2/nwjs-sdk-v0.13.2-linux-ia32.tar.gz",
104
+ "osx64-nacl":
105
+ "http://dl.nwjs.io/v0.13.2/nwjs-nacl-v0.13.2-osx-x64.zip",
106
+ "osx64-normal":
107
+ "http://dl.nwjs.io/v0.13.2/nwjs-v0.13.2-osx-x64.zip",
108
+ "osx64-sdk":
109
+ "http://dl.nwjs.io/v0.13.2/nwjs-sdk-v0.13.2-osx-x64.zip",
110
+ "win64-nacl":
111
+ "http://dl.nwjs.io/v0.13.2/nwjs-nacl-v0.13.2-win-x64.zip",
112
+ "win64-normal":
113
+ "http://dl.nwjs.io/v0.13.2/nwjs-v0.13.2-win-x64.zip",
114
+ "win64-sdk":
115
+ "http://dl.nwjs.io/v0.13.2/nwjs-sdk-v0.13.2-win-x64.zip",
116
+ },
117
+ isLegacy: false,
118
+ },
119
+ {
120
+ version: "0.12.3",
121
+ name: "nwjs",
122
+ platforms: {
123
+ "linux32-macappstore":
124
+ "http://dl.nwjs.io/v0.12.3/nwjs-v0.12.3-linux-ia32.tar.gz",
125
+ "linux32-normal":
126
+ "http://dl.nwjs.io/v0.12.3/nwjs-v0.12.3-linux-ia32.tar.gz",
127
+ "linux64-macappstore":
128
+ "http://dl.nwjs.io/v0.12.3/nwjs-v0.12.3-linux-x64.tar.gz",
129
+ "linux64-normal":
130
+ "http://dl.nwjs.io/v0.12.3/nwjs-v0.12.3-linux-x64.tar.gz",
131
+ "osx32-macappstore":
132
+ "http://dl.nwjs.io/v0.12.3/nwjs-v0.12.3-osx-ia32.zip",
133
+ "osx32-normal":
134
+ "http://dl.nwjs.io/v0.12.3/nwjs-v0.12.3-osx-ia32.zip",
135
+ "osx64-macappstore":
136
+ "http://dl.nwjs.io/v0.12.3/nwjs-v0.12.3-osx-x64.zip",
137
+ "osx64-normal":
138
+ "http://dl.nwjs.io/v0.12.3/nwjs-v0.12.3-osx-x64.zip",
139
+ "win32-macappstore":
140
+ "http://dl.nwjs.io/v0.12.3/nwjs-v0.12.3-win-ia32.zip",
141
+ "win32-normal":
142
+ "http://dl.nwjs.io/v0.12.3/nwjs-v0.12.3-win-ia32.zip",
143
+ "win64-macappstore":
144
+ "http://dl.nwjs.io/v0.12.3/nwjs-v0.12.3-win-x64.zip",
145
+ "win64-normal":
146
+ "http://dl.nwjs.io/v0.12.3/nwjs-v0.12.3-win-x64.zip",
147
+ },
148
+ isLegacy: false,
149
+ },
150
+ {
151
+ version: "0.10.2",
152
+ name: "node-webkit",
153
+ platforms: {
154
+ "linux32-sdk":
155
+ "http://dl.nwjs.io/v0.10.2/node-webkit-v0.10.2-linux-ia32.tar.gz",
156
+ "linux64-sdk":
157
+ "http://dl.nwjs.io/v0.10.2/node-webkit-v0.10.2-linux-x64.tar.gz",
158
+ "osx32-sdk":
159
+ "http://dl.nwjs.io/v0.10.2/node-webkit-v0.10.2-osx-ia32.zip",
160
+ "osx64-sdk":
161
+ "http://dl.nwjs.io/v0.10.2/node-webkit-v0.10.2-osx-x64.zip",
162
+ "win32-sdk":
163
+ "http://dl.nwjs.io/v0.10.2/node-webkit-v0.10.2-win-ia32.zip",
164
+ "win64-sdk":
165
+ "http://dl.nwjs.io/v0.10.2/node-webkit-v0.10.2-win-x64.zip",
166
+ },
167
+ isLegacy: true,
168
+ },
169
+ {
170
+ version: "0.10.0-rc1",
171
+ name: "node-webkit",
172
+ platforms: {
173
+ "linux32-sdk":
174
+ "http://dl.nwjs.io/v0.10.0-rc1/node-webkit-v0.10.0-rc1-linux-ia32.tar.gz",
175
+ "linux64-sdk":
176
+ "http://dl.nwjs.io/v0.10.0-rc1/node-webkit-v0.10.0-rc1-linux-x64.tar.gz",
177
+ "osx32-sdk":
178
+ "http://dl.nwjs.io/v0.10.0-rc1/node-webkit-v0.10.0-rc1-osx-ia32.zip",
179
+ "osx64-sdk":
180
+ "http://dl.nwjs.io/v0.10.0-rc1/node-webkit-v0.10.0-rc1-osx-x64.zip",
181
+ "win32-sdk":
182
+ "http://dl.nwjs.io/v0.10.0-rc1/node-webkit-v0.10.0-rc1-win-ia32.zip",
183
+ "win64-sdk":
184
+ "http://dl.nwjs.io/v0.10.0-rc1/node-webkit-v0.10.0-rc1-win-x64.zip",
185
+ },
186
+ isLegacy: true,
187
+ },
188
+ {
189
+ version: "0.9.3",
190
+ name: "node-webkit",
191
+ platforms: {
192
+ "linux32-sdk":
193
+ "http://dl.nwjs.io/v0.9.3/node-webkit-v0.9.3-linux-ia32.tar.gz",
194
+ "linux64-sdk":
195
+ "http://dl.nwjs.io/v0.9.3/node-webkit-v0.9.3-linux-x64.tar.gz",
196
+ "osx32-sdk":
197
+ "http://dl.nwjs.io/v0.9.3/node-webkit-v0.9.3-osx-ia32.zip",
198
+ "osx64-sdk":
199
+ "http://dl.nwjs.io/v0.9.3/node-webkit-v0.9.3-osx-x64.zip",
200
+ "win32-sdk":
201
+ "http://dl.nwjs.io/v0.9.3/node-webkit-v0.9.3-win-ia32.zip",
202
+ "win64-sdk":
203
+ "http://dl.nwjs.io/v0.9.3/node-webkit-v0.9.3-win-x64.zip",
204
+ },
205
+ isLegacy: true,
206
+ },
207
+ ];
208
+
209
+ for (var i = 0; i < expectedVersions.length; i++) {
210
+ t.deepEqual(result[i], expectedVersions[i]);
211
+ }
212
+ })
213
+ .catch(function (err) {
214
+ console.error(err.stack);
215
+ t.fail(err);
216
+ });
217
+ });
218
+
219
+ test("getVersions (custom download URL)", async function (t) {
220
+ await t.plan(6);
221
+
222
+ await nock(root)
223
+ .get("/versions.json")
224
+ .replyWithFile(200, "./test/fixtures/manifest/versions.json");
225
+ await nock("http://abc.xyz/")
226
+ .get("/")
227
+ .replyWithFile(200, "./test/fixtures/testVersions.html");
228
+ await expectedLegacyVersions.forEach(function (expectedVersion) {
229
+ nock("http://abc.xyz/")
230
+ .head(
231
+ "/v" +
232
+ expectedVersion +
233
+ "/node-webkit-v" +
234
+ expectedVersion +
235
+ "-win-ia32.zip",
236
+ )
237
+ .replyWithFile(200, "./test/fixtures/testVersions.html"); // needs to reply with *any* content
238
+ });
239
+
240
+ await versions
241
+ .getVersions("http://abc.xyz/", root + "/versions.json")
242
+ .then(function (result) {
243
+ var expectedVersions = [
244
+ {
245
+ version: "0.15.2",
246
+ name: "nwjs",
247
+ platforms: {
248
+ "linux32-normal":
249
+ "http://abc.xyz/v0.15.2/nwjs-v0.15.2-linux-ia32.tar.gz",
250
+ "linux32-sdk":
251
+ "http://abc.xyz/v0.15.2/nwjs-sdk-v0.15.2-linux-ia32.tar.gz",
252
+ "linux64-normal":
253
+ "http://abc.xyz/v0.15.2/nwjs-v0.15.2-linux-x64.tar.gz",
254
+ "linux64-sdk":
255
+ "http://abc.xyz/v0.15.2/nwjs-sdk-v0.15.2-linux-x64.tar.gz",
256
+ "osx64-normal": "http://abc.xyz/v0.15.2/nwjs-v0.15.2-osx-x64.zip",
257
+ "osx64-sdk": "http://abc.xyz/v0.15.2/nwjs-sdk-v0.15.2-osx-x64.zip",
258
+ "win32-normal": "http://abc.xyz/v0.15.2/nwjs-v0.15.2-win-ia32.zip",
259
+ "win32-sdk": "http://abc.xyz/v0.15.2/nwjs-sdk-v0.15.2-win-ia32.zip",
260
+ "win64-normal": "http://abc.xyz/v0.15.2/nwjs-v0.15.2-win-x64.zip",
261
+ "win64-sdk": "http://abc.xyz/v0.15.2/nwjs-sdk-v0.15.2-win-x64.zip",
262
+ },
263
+ isLegacy: false,
264
+ },
265
+ {
266
+ version: "0.13.2",
267
+ name: "nwjs",
268
+ platforms: {
269
+ "linux32-nacl":
270
+ "http://abc.xyz/v0.13.2/nwjs-nacl-v0.13.2-linux-ia32.tar.gz",
271
+ "linux32-normal":
272
+ "http://abc.xyz/v0.13.2/nwjs-v0.13.2-linux-ia32.tar.gz",
273
+ "linux32-sdk":
274
+ "http://abc.xyz/v0.13.2/nwjs-sdk-v0.13.2-linux-ia32.tar.gz",
275
+ "osx64-nacl":
276
+ "http://abc.xyz/v0.13.2/nwjs-nacl-v0.13.2-osx-x64.zip",
277
+ "osx64-normal": "http://abc.xyz/v0.13.2/nwjs-v0.13.2-osx-x64.zip",
278
+ "osx64-sdk": "http://abc.xyz/v0.13.2/nwjs-sdk-v0.13.2-osx-x64.zip",
279
+ "win64-nacl":
280
+ "http://abc.xyz/v0.13.2/nwjs-nacl-v0.13.2-win-x64.zip",
281
+ "win64-normal": "http://abc.xyz/v0.13.2/nwjs-v0.13.2-win-x64.zip",
282
+ "win64-sdk": "http://abc.xyz/v0.13.2/nwjs-sdk-v0.13.2-win-x64.zip",
283
+ },
284
+
285
+ isLegacy: false,
286
+ },
287
+ {
288
+ version: "0.12.3",
289
+ name: "nwjs",
290
+ platforms: {
291
+ "linux32-macappstore":
292
+ "http://abc.xyz/v0.12.3/nwjs-v0.12.3-linux-ia32.tar.gz",
293
+ "linux32-normal":
294
+ "http://abc.xyz/v0.12.3/nwjs-v0.12.3-linux-ia32.tar.gz",
295
+ "linux64-macappstore":
296
+ "http://abc.xyz/v0.12.3/nwjs-v0.12.3-linux-x64.tar.gz",
297
+ "linux64-normal":
298
+ "http://abc.xyz/v0.12.3/nwjs-v0.12.3-linux-x64.tar.gz",
299
+ "osx32-macappstore":
300
+ "http://abc.xyz/v0.12.3/nwjs-v0.12.3-osx-ia32.zip",
301
+ "osx32-normal": "http://abc.xyz/v0.12.3/nwjs-v0.12.3-osx-ia32.zip",
302
+ "osx64-macappstore":
303
+ "http://abc.xyz/v0.12.3/nwjs-v0.12.3-osx-x64.zip",
304
+ "osx64-normal": "http://abc.xyz/v0.12.3/nwjs-v0.12.3-osx-x64.zip",
305
+ "win32-macappstore":
306
+ "http://abc.xyz/v0.12.3/nwjs-v0.12.3-win-ia32.zip",
307
+ "win32-normal": "http://abc.xyz/v0.12.3/nwjs-v0.12.3-win-ia32.zip",
308
+ "win64-macappstore":
309
+ "http://abc.xyz/v0.12.3/nwjs-v0.12.3-win-x64.zip",
310
+ "win64-normal": "http://abc.xyz/v0.12.3/nwjs-v0.12.3-win-x64.zip",
311
+ },
312
+ isLegacy: false,
313
+ },
314
+ {
315
+ version: "0.10.2",
316
+ name: "node-webkit",
317
+ platforms: {
318
+ "linux32-sdk":
319
+ "http://abc.xyz/v0.10.2/node-webkit-v0.10.2-linux-ia32.tar.gz",
320
+ "linux64-sdk":
321
+ "http://abc.xyz/v0.10.2/node-webkit-v0.10.2-linux-x64.tar.gz",
322
+ "osx32-sdk":
323
+ "http://abc.xyz/v0.10.2/node-webkit-v0.10.2-osx-ia32.zip",
324
+ "osx64-sdk":
325
+ "http://abc.xyz/v0.10.2/node-webkit-v0.10.2-osx-x64.zip",
326
+ "win32-sdk":
327
+ "http://abc.xyz/v0.10.2/node-webkit-v0.10.2-win-ia32.zip",
328
+ "win64-sdk":
329
+ "http://abc.xyz/v0.10.2/node-webkit-v0.10.2-win-x64.zip",
330
+ },
331
+ isLegacy: true,
332
+ },
333
+ {
334
+ version: "0.10.0-rc1",
335
+ name: "node-webkit",
336
+ platforms: {
337
+ "linux32-sdk":
338
+ "http://abc.xyz/v0.10.0-rc1/node-webkit-v0.10.0-rc1-linux-ia32.tar.gz",
339
+ "linux64-sdk":
340
+ "http://abc.xyz/v0.10.0-rc1/node-webkit-v0.10.0-rc1-linux-x64.tar.gz",
341
+ "osx32-sdk":
342
+ "http://abc.xyz/v0.10.0-rc1/node-webkit-v0.10.0-rc1-osx-ia32.zip",
343
+ "osx64-sdk":
344
+ "http://abc.xyz/v0.10.0-rc1/node-webkit-v0.10.0-rc1-osx-x64.zip",
345
+ "win32-sdk":
346
+ "http://abc.xyz/v0.10.0-rc1/node-webkit-v0.10.0-rc1-win-ia32.zip",
347
+ "win64-sdk":
348
+ "http://abc.xyz/v0.10.0-rc1/node-webkit-v0.10.0-rc1-win-x64.zip",
349
+ },
350
+ isLegacy: true,
351
+ },
352
+ {
353
+ version: "0.9.3",
354
+ name: "node-webkit",
355
+ platforms: {
356
+ "linux32-sdk":
357
+ "http://abc.xyz/v0.9.3/node-webkit-v0.9.3-linux-ia32.tar.gz",
358
+ "linux64-sdk":
359
+ "http://abc.xyz/v0.9.3/node-webkit-v0.9.3-linux-x64.tar.gz",
360
+ "osx32-sdk":
361
+ "http://abc.xyz/v0.9.3/node-webkit-v0.9.3-osx-ia32.zip",
362
+ "osx64-sdk": "http://abc.xyz/v0.9.3/node-webkit-v0.9.3-osx-x64.zip",
363
+ "win32-sdk":
364
+ "http://abc.xyz/v0.9.3/node-webkit-v0.9.3-win-ia32.zip",
365
+ "win64-sdk": "http://abc.xyz/v0.9.3/node-webkit-v0.9.3-win-x64.zip",
366
+ },
367
+ isLegacy: true,
368
+ },
369
+ ];
370
+
371
+ for (var i = 0; i < expectedVersions.length; i++) {
372
+ t.deepEqual(result[i], expectedVersions[i]);
373
+ }
374
+ })
375
+ .catch(function (err) {
376
+ console.error(err.stack);
377
+ t.fail(err);
378
+ });
379
+ });
380
+
381
+ test("getVersion", async function (t) {
382
+ await t.plan(3);
383
+
384
+ await nock(root)
385
+ .get("/versions.json")
386
+ .replyWithFile(200, "./test/fixtures/manifest/versions.json");
387
+ await versions
388
+ .getVersion({
389
+ desiredVersion: "0.13.2",
390
+ downloadUrl: "http://dl.nwjs.io/",
391
+ manifestUrl: root + "/versions.json",
392
+ })
393
+ .then(function (result) {
394
+ t.equal(result.version, "0.13.2");
395
+ t.equal(result.name, "nwjs");
396
+ t.deepEqual(result.platforms, {
397
+ "linux32-nacl":
398
+ "http://dl.nwjs.io/v0.13.2/nwjs-nacl-v0.13.2-linux-ia32.tar.gz",
399
+ "linux32-normal":
400
+ "http://dl.nwjs.io/v0.13.2/nwjs-v0.13.2-linux-ia32.tar.gz",
401
+ "linux32-sdk":
402
+ "http://dl.nwjs.io/v0.13.2/nwjs-sdk-v0.13.2-linux-ia32.tar.gz",
403
+ "osx64-nacl": "http://dl.nwjs.io/v0.13.2/nwjs-nacl-v0.13.2-osx-x64.zip",
404
+ "osx64-normal": "http://dl.nwjs.io/v0.13.2/nwjs-v0.13.2-osx-x64.zip",
405
+ "osx64-sdk": "http://dl.nwjs.io/v0.13.2/nwjs-sdk-v0.13.2-osx-x64.zip",
406
+ "win64-nacl": "http://dl.nwjs.io/v0.13.2/nwjs-nacl-v0.13.2-win-x64.zip",
407
+ "win64-normal": "http://dl.nwjs.io/v0.13.2/nwjs-v0.13.2-win-x64.zip",
408
+ "win64-sdk": "http://dl.nwjs.io/v0.13.2/nwjs-sdk-v0.13.2-win-x64.zip",
409
+ });
410
+ });
411
+ });
412
+
413
+ test("getVersion should fail for non-existent version", async function (t) {
414
+ await t.plan(1);
415
+
416
+ await nock(root)
417
+ .get("/versions.json")
418
+ .replyWithFile(200, "./test/fixtures/manifest/versions.json");
419
+ await versions
420
+ .getVersion({
421
+ desiredVersion: "0.13.3",
422
+ downloadUrl: "http://dl.nwjs.io/",
423
+ manifestUrl: root + "/versions.json",
424
+ })
425
+ .then(function () {
426
+ t.fail("Shouldn't go in here");
427
+ })
428
+ .catch(function () {
429
+ t.ok("Should fail");
430
+ });
431
+ });
432
+
433
+ test("getVersion (legacy)", async function (t) {
434
+ await t.plan(3);
435
+
436
+ await nock(dlUrl).get("/").replyWithFile(200, "./test/fixtures/testVersions.html");
437
+ await nock(dlUrl)
438
+ .head("/v0.10.2/node-webkit-v0.10.2-win-ia32.zip")
439
+ .replyWithFile(200, "./test/fixtures/testVersions.html"); // needs to reply with *any* content
440
+
441
+ await versions
442
+ .getVersion({
443
+ desiredVersion: "0.10.2",
444
+ downloadUrl: "http://dl.nwjs.io/",
445
+ flavor: "sdk",
446
+ })
447
+ .then(function (result) {
448
+ t.equal(result.version, "0.10.2");
449
+ t.equal(result.name, "node-webkit");
450
+ t.deepEqual(result.platforms, {
451
+ "linux32-sdk":
452
+ "http://dl.nwjs.io/v0.10.2/node-webkit-v0.10.2-linux-ia32.tar.gz",
453
+ "linux64-sdk":
454
+ "http://dl.nwjs.io/v0.10.2/node-webkit-v0.10.2-linux-x64.tar.gz",
455
+ "osx32-sdk":
456
+ "http://dl.nwjs.io/v0.10.2/node-webkit-v0.10.2-osx-ia32.zip",
457
+ "osx64-sdk":
458
+ "http://dl.nwjs.io/v0.10.2/node-webkit-v0.10.2-osx-x64.zip",
459
+ "win32-sdk":
460
+ "http://dl.nwjs.io/v0.10.2/node-webkit-v0.10.2-win-ia32.zip",
461
+ "win64-sdk":
462
+ "http://dl.nwjs.io/v0.10.2/node-webkit-v0.10.2-win-x64.zip",
463
+ });
464
+ })
465
+ .catch(function (err) {
466
+ t.end(err);
467
+ });
468
+ });
469
+
470
+ test("getVersion (legacy) should fail for non-existent version", async function (t) {
471
+ await t.plan(1);
472
+
473
+ await nock(dlUrl).get("/").replyWithFile(200, "./test/fixtures/testVersions.html");
474
+ await versions
475
+ .getVersion({
476
+ desiredVersion: "0.10.1",
477
+ downloadUrl: "http://dl.nwjs.io/",
478
+ })
479
+ .then(function () {
480
+ t.fail("shouldn't go in here");
481
+ })
482
+ .catch(function () {
483
+ t.ok("Should fail");
484
+ });
485
+ });
package/bin/nwbuild DELETED
@@ -1,98 +0,0 @@
1
- #!/usr/bin/env node
2
- var optimist = require('optimist');
3
- var updateNotifier = require('update-notifier');
4
- var NwBuilder = require('./../lib');
5
- var path = require('path');
6
- var detectCurrentPlatform = require('../lib/detectCurrentPlatform.js');
7
-
8
- var currentPlatform = detectCurrentPlatform();
9
-
10
- var argv = optimist
11
- .usage('Usage:\n nwbuild [options] [path] [-- <args>]')
12
-
13
- .alias('p', 'platforms')
14
- .default('p', currentPlatform)
15
- .describe('p', 'Platforms to build, comma-sperated, can be: \n win32, win64, osx32, osx64, linux32, linux64 or \nwin, osx, linux')
16
-
17
- .alias('v', 'version')
18
- .default('v', 'latest')
19
- .describe('v', 'The NW.js version, eg. 0.8.4')
20
-
21
- .alias('r', 'run')
22
- .default('r', false)
23
- .describe('r', 'Runs NW.js for the current platform')
24
- .boolean('r')
25
-
26
- .alias('o', 'buildDir')
27
- .default('o', './build')
28
- .describe('o', 'The build folder')
29
-
30
- .alias('f', 'forceDownload')
31
- .default('f', false)
32
- .describe('f', 'Force download of NW.js')
33
- .boolean('f')
34
-
35
- .alias('n', 'name')
36
- .describe('n', 'The Name of your NW.js app.')
37
-
38
- .describe('cacheDir', 'The cache folder')
39
-
40
- .default('quiet', false)
41
- .describe('quiet', 'Disables logging')
42
- .boolean('quiet')
43
-
44
- .describe(' <args>', 'Pass custom arguments to the NW.js instance \n(-r, --run mode only)')
45
-
46
- .wrap(100)
47
-
48
- .argv;
49
-
50
- // Howto Help
51
- if (argv.h || argv.help) {
52
- optimist.showHelp();
53
- process.exit(0);
54
- }
55
-
56
- // Error if there are no files
57
- var files = argv._[0];
58
- if(!files) {
59
- optimist.showHelp();
60
- process.exit(1);
61
- }
62
-
63
- var options = {
64
- appName: argv.name,
65
- files: path.resolve(process.cwd(), files) + '/**/*',
66
- flavor: argv.flavor || 'sdk',
67
- platforms: argv.platforms ? argv.platforms.split(',') : [currentPlatform],
68
- currentPlatform: currentPlatform,
69
- version: argv.version,
70
- macIcns: argv.macIcns || false,
71
- winIco: argv.winIco || false,
72
- cacheDir: argv.cacheDir ? path.resolve(process.cwd(), argv.cacheDir) : path.resolve(__dirname, '..', 'cache'),
73
- buildDir: path.resolve(process.cwd(), argv.buildDir),
74
- forceDownload: argv.forceDownload,
75
- // get all argv arguments after --
76
- argv: process.argv.slice(process.argv.findIndex(function firstDash(el) {
77
- return el === '--'
78
- }) + 1)
79
- };
80
-
81
- // Initialize Builder
82
- var nw = new NwBuilder(options);
83
-
84
- // Logging
85
- if(!(argv.quiet || argv.quite)) {
86
- nw.on('log', console.log);
87
- }
88
-
89
- // Build or Run the app
90
- var np = (argv.r ? nw.run() : nw.build());
91
- np.then(function() {
92
- process.exit(0);
93
- }).catch (function(error) {
94
- if (error) {
95
- console.error(error);
96
- process.exit(1);
97
- }
98
- });
package/demo.js DELETED
@@ -1,22 +0,0 @@
1
- const NwBuilder = require('./lib');
2
- const detectCurrentPlatform = require('./lib/detectCurrentPlatform');
3
-
4
- const nw = new NwBuilder({
5
- version: '0.64.1',
6
- files: './example/nwapp/**',
7
- macIcns: './icons/icon.icns',
8
- macPlist: {mac_bundle_id: 'myPkg'},
9
- platforms: [
10
- detectCurrentPlatform(),
11
- // 'linux64',
12
- // 'osx64',
13
- // 'win64',
14
- ]
15
- });
16
-
17
-
18
- nw.on('log', (msg) => console.log('nw-builder', msg));
19
-
20
- nw.run()
21
- .then(() => process.exit(0))
22
- .catch((error) => console.log(error))
@@ -1,7 +0,0 @@
1
- This directory contains app icons passed to nw-builder.
2
-
3
- ---
4
-
5
- ## See something which could be improved?
6
-
7
- Great, see [CONTRIBUTING.md](../../CONTRIBUTING.md).
@@ -1,9 +0,0 @@
1
- <style type="text/css">
2
- html,body,.body {
3
- overflow: hidden;
4
- }
5
- </style>
6
- <div class="body">
7
- <h1>me, myself and i.</h1>
8
- <p>much has been done.</p>
9
- </div>
@@ -1,7 +0,0 @@
1
- This directory contains the actual example app code.
2
-
3
- ---
4
-
5
- ## See something which could be improved?
6
-
7
- Great, see [CONTRIBUTING.md](../../CONTRIBUTING.md).
@@ -1,7 +0,0 @@
1
- Any images used within the example app are stored in this directory.
2
-
3
- ---
4
-
5
- ## See something which could be improved?
6
-
7
- Great, see [CONTRIBUTING.md](../../CONTRIBUTING.md).
Binary file
@@ -1,22 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Hello World from nw-builder!</title>
5
- </head>
6
- <body>
7
- <h1>Hello World!</h1>
8
- We are using node.js <script>document.write(process.version)</script>
9
-
10
- <h2>Here is a required node_module</h2>
11
- <ul>
12
- <script>
13
- for (var counter=0; counter<xs.length; counter++) {
14
- document.write("<li>" + counter + "</li>");
15
- }
16
- </script>
17
- </ul>
18
-
19
- <h2>And here is a cute kitten:</h2>
20
- <img src="images/kitten.jpg">
21
- </body>
22
- </html>
@@ -1,7 +0,0 @@
1
- {
2
- "name": "example",
3
- "private": true,
4
- "scripts": {
5
- "start": "node index.js"
6
- }
7
- }
package/index.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require('./lib');