aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorCyril Sobierajewicz <cyril.sobierajewicz@fretlink.com>2019-05-17 23:59:04 +0200
committerCyril Sobierajewicz <cyril.sobierajewicz@fretlink.com>2019-05-20 13:51:27 +0200
commit03aaa7d3bbf9ff2176fe3b69138f37f5f265d186 (patch)
tree67b540b3965dfe47db1691f5c0d5c78d06b1ea79
parenta4e6dec5fcffa5d51a96722a07668bab02336d5f (diff)
downloadnode-dhall-json-bin-03aaa7d3bbf9ff2176fe3b69138f37f5f265d186.tar.gz
node-dhall-json-bin-03aaa7d3bbf9ff2176fe3b69138f37f5f265d186.tar.zst
node-dhall-json-bin-03aaa7d3bbf9ff2176fe3b69138f37f5f265d186.zip
Add Windows support
-rw-r--r--package-lock.json219
-rw-r--r--package.json10
-rw-r--r--preinstall.js36
3 files changed, 256 insertions, 9 deletions
diff --git a/package-lock.json b/package-lock.json
index 1d1085f..2637fdc 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4,11 +4,44 @@
4 "lockfileVersion": 1, 4 "lockfileVersion": 1,
5 "requires": true, 5 "requires": true,
6 "dependencies": { 6 "dependencies": {
7 "balanced-match": {
8 "version": "1.0.0",
9 "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
10 "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
11 },
7 "base64-js": { 12 "base64-js": {
8 "version": "1.3.0", 13 "version": "1.3.0",
9 "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", 14 "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz",
10 "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==" 15 "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw=="
11 }, 16 },
17 "big-integer": {
18 "version": "1.6.43",
19 "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.43.tgz",
20 "integrity": "sha512-9dULc9jsKmXl0Aeunug8wbF+58n+hQoFjqClN7WeZwGLh0XJUWyJJ9Ee+Ep+Ql/J9fRsTVaeThp8MhiCCrY0Jg=="
21 },
22 "binary": {
23 "version": "0.3.0",
24 "resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz",
25 "integrity": "sha1-n2BVO8XOjDOG87VTz/R0Yq3sqnk=",
26 "requires": {
27 "buffers": "~0.1.1",
28 "chainsaw": "~0.1.0"
29 }
30 },
31 "bluebird": {
32 "version": "3.4.7",
33 "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz",
34 "integrity": "sha1-9y12C+Cbf3bQjtj66Ysomo0F+rM="
35 },
36 "brace-expansion": {
37 "version": "1.1.11",
38 "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
39 "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
40 "requires": {
41 "balanced-match": "^1.0.0",
42 "concat-map": "0.0.1"
43 }
44 },
12 "buffer": { 45 "buffer": {
13 "version": "5.2.1", 46 "version": "5.2.1",
14 "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz", 47 "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz",
@@ -18,11 +51,39 @@
18 "ieee754": "^1.1.4" 51 "ieee754": "^1.1.4"
19 } 52 }
20 }, 53 },
54 "buffer-indexof-polyfill": {
55 "version": "1.0.1",
56 "resolved": "https://registry.npmjs.org/buffer-indexof-polyfill/-/buffer-indexof-polyfill-1.0.1.tgz",
57 "integrity": "sha1-qfuAbOgUXVQoUQznLyeLs2OmOL8="
58 },
59 "buffers": {
60 "version": "0.1.1",
61 "resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz",
62 "integrity": "sha1-skV5w77U1tOWru5tmorn9Ugqt7s="
63 },
64 "chainsaw": {
65 "version": "0.1.0",
66 "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz",
67 "integrity": "sha1-XqtQsor+WAdNDVgpE4iCi15fvJg=",
68 "requires": {
69 "traverse": ">=0.3.0 <0.4"
70 }
71 },
21 "chownr": { 72 "chownr": {
22 "version": "1.1.1", 73 "version": "1.1.1",
23 "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", 74 "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz",
24 "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==" 75 "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g=="
25 }, 76 },
77 "concat-map": {
78 "version": "0.0.1",
79 "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
80 "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
81 },
82 "core-util-is": {
83 "version": "1.0.2",
84 "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
85 "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
86 },
26 "debug": { 87 "debug": {
27 "version": "3.2.6", 88 "version": "3.2.6",
28 "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", 89 "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
@@ -31,6 +92,14 @@
31 "ms": "^2.1.1" 92 "ms": "^2.1.1"
32 } 93 }
33 }, 94 },
95 "duplexer2": {
96 "version": "0.1.4",
97 "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz",
98 "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=",
99 "requires": {
100 "readable-stream": "^2.0.2"
101 }
102 },
34 "follow-redirects": { 103 "follow-redirects": {
35 "version": "1.7.0", 104 "version": "1.7.0",
36 "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.7.0.tgz", 105 "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.7.0.tgz",
@@ -47,11 +116,77 @@
47 "minipass": "^2.2.1" 116 "minipass": "^2.2.1"
48 } 117 }
49 }, 118 },
119 "fs.realpath": {
120 "version": "1.0.0",
121 "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
122 "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
123 },
124 "fstream": {
125 "version": "1.0.12",
126 "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz",
127 "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==",
128 "requires": {
129 "graceful-fs": "^4.1.2",
130 "inherits": "~2.0.0",
131 "mkdirp": ">=0.5 0",
132 "rimraf": "2"
133 }
134 },
135 "glob": {
136 "version": "7.1.4",
137 "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz",
138 "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==",
139 "requires": {
140 "fs.realpath": "^1.0.0",
141 "inflight": "^1.0.4",
142 "inherits": "2",
143 "minimatch": "^3.0.4",
144 "once": "^1.3.0",
145 "path-is-absolute": "^1.0.0"
146 }
147 },
148 "graceful-fs": {
149 "version": "4.1.15",
150 "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
151 "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA=="
152 },
50 "ieee754": { 153 "ieee754": {
51 "version": "1.1.13", 154 "version": "1.1.13",
52 "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", 155 "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz",
53 "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" 156 "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg=="
54 }, 157 },
158 "inflight": {
159 "version": "1.0.6",
160 "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
161 "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
162 "requires": {
163 "once": "^1.3.0",
164 "wrappy": "1"
165 }
166 },
167 "inherits": {
168 "version": "2.0.3",
169 "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
170 "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
171 },
172 "isarray": {
173 "version": "1.0.0",
174 "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
175 "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
176 },
177 "listenercount": {
178 "version": "1.0.1",
179 "resolved": "https://registry.npmjs.org/listenercount/-/listenercount-1.0.1.tgz",
180 "integrity": "sha1-hMinKrWcRyUyFIDJdeZQg0LnCTc="
181 },
182 "minimatch": {
183 "version": "3.0.4",
184 "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
185 "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
186 "requires": {
187 "brace-expansion": "^1.1.7"
188 }
189 },
55 "minimist": { 190 "minimist": {
56 "version": "0.0.8", 191 "version": "0.0.8",
57 "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", 192 "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
@@ -87,11 +222,64 @@
87 "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", 222 "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
88 "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" 223 "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
89 }, 224 },
225 "once": {
226 "version": "1.4.0",
227 "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
228 "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
229 "requires": {
230 "wrappy": "1"
231 }
232 },
233 "path-is-absolute": {
234 "version": "1.0.1",
235 "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
236 "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
237 },
238 "process-nextick-args": {
239 "version": "2.0.0",
240 "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz",
241 "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw=="
242 },
243 "readable-stream": {
244 "version": "2.3.6",
245 "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
246 "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
247 "requires": {
248 "core-util-is": "~1.0.0",
249 "inherits": "~2.0.3",
250 "isarray": "~1.0.0",
251 "process-nextick-args": "~2.0.0",
252 "safe-buffer": "~5.1.1",
253 "string_decoder": "~1.1.1",
254 "util-deprecate": "~1.0.1"
255 }
256 },
257 "rimraf": {
258 "version": "2.6.3",
259 "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz",
260 "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",
261 "requires": {
262 "glob": "^7.1.3"
263 }
264 },
90 "safe-buffer": { 265 "safe-buffer": {
91 "version": "5.1.2", 266 "version": "5.1.2",
92 "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 267 "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
93 "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 268 "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
94 }, 269 },
270 "setimmediate": {
271 "version": "1.0.5",
272 "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
273 "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU="
274 },
275 "string_decoder": {
276 "version": "1.1.1",
277 "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
278 "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
279 "requires": {
280 "safe-buffer": "~5.1.0"
281 }
282 },
95 "tar": { 283 "tar": {
96 "version": "4.4.8", 284 "version": "4.4.8",
97 "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.8.tgz", 285 "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.8.tgz",
@@ -111,6 +299,11 @@
111 "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", 299 "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
112 "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" 300 "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
113 }, 301 },
302 "traverse": {
303 "version": "0.3.9",
304 "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz",
305 "integrity": "sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk="
306 },
114 "unbzip2-stream": { 307 "unbzip2-stream": {
115 "version": "1.3.3", 308 "version": "1.3.3",
116 "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.3.3.tgz", 309 "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.3.3.tgz",
@@ -120,6 +313,32 @@
120 "through": "^2.3.8" 313 "through": "^2.3.8"
121 } 314 }
122 }, 315 },
316 "unzipper": {
317 "version": "0.9.12",
318 "resolved": "https://registry.npmjs.org/unzipper/-/unzipper-0.9.12.tgz",
319 "integrity": "sha512-ioVN0AD0AC03CEsfxfChfOzsE9nhitbv9uLVhtCH0P1trBmntnosFNGVTe9tKV2g4bPxroVe4y8bxUuRMD6IHQ==",
320 "requires": {
321 "big-integer": "^1.6.17",
322 "binary": "~0.3.0",
323 "bluebird": "~3.4.1",
324 "buffer-indexof-polyfill": "~1.0.0",
325 "duplexer2": "~0.1.4",
326 "fstream": "^1.0.12",
327 "listenercount": "~1.0.1",
328 "readable-stream": "~2.3.6",
329 "setimmediate": "~1.0.4"
330 }
331 },
332 "util-deprecate": {
333 "version": "1.0.2",
334 "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
335 "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
336 },
337 "wrappy": {
338 "version": "1.0.2",
339 "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
340 "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
341 },
123 "yallist": { 342 "yallist": {
124 "version": "3.0.3", 343 "version": "3.0.3",
125 "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", 344 "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz",
diff --git a/package.json b/package.json
index c9f735e..f81e02c 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,8 @@
3 "version": "1.0.0", 3 "version": "1.0.0",
4 "description": "NPM package for `dhall-json`, based on https://github.com/justinwoo/npm-psc-package-bin-simple.", 4 "description": "NPM package for `dhall-json`, based on https://github.com/justinwoo/npm-psc-package-bin-simple.",
5 "os": [ 5 "os": [
6 "linux" 6 "linux",
7 "win32"
7 ], 8 ],
8 "cpu": [ 9 "cpu": [
9 "x64" 10 "x64"
@@ -12,8 +13,8 @@
12 "preinstall.js" 13 "preinstall.js"
13 ], 14 ],
14 "bin": { 15 "bin": {
15 "dhall-to-json": "bin/dhall-to-json", 16 "dhall-to-json": "bin/dhall-to-json.exe",
16 "dhall-to-yaml": "bin/dhall-to-yaml" 17 "dhall-to-yaml": "bin/dhall-to-yaml.exe"
17 }, 18 },
18 "scripts": { 19 "scripts": {
19 "preinstall": "node ./preinstall.js" 20 "preinstall": "node ./preinstall.js"
@@ -30,6 +31,7 @@
30 "dependencies": { 31 "dependencies": {
31 "follow-redirects": "^1.7.0", 32 "follow-redirects": "^1.7.0",
32 "tar": "^4.4.8", 33 "tar": "^4.4.8",
33 "unbzip2-stream": "^1.3.3" 34 "unbzip2-stream": "^1.3.3",
35 "unzipper": "^0.9.12"
34 } 36 }
35} 37}
diff --git a/preinstall.js b/preinstall.js
index 1b859fc..071f159 100644
--- a/preinstall.js
+++ b/preinstall.js
@@ -1,10 +1,15 @@
1"use strict"; 1"use strict";
2 2
3const fs = require("fs");
4const path = require("path");
5
3const { https } = require("follow-redirects"); 6const { https } = require("follow-redirects");
4const tar = require("tar"); 7const tar = require("tar");
5const unbz2 = require("unbzip2-stream"); 8const unbz2 = require("unbzip2-stream");
9const unzipper = require("unzipper");
6 10
7const pkg = require("./package.json"); 11const pkg = require("./package.json");
12const bindir = path.join(__dirname, "bin");
8 13
9const trim = str => str && String(str).trim(); 14const trim = str => str && String(str).trim();
10 15
@@ -16,8 +21,29 @@ if (!dhallJsonVersion) throw new Error("Missing DHALL_JSON_VERSION environment v
16 21
17const release = `https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-json-${dhallJsonVersion}`; 22const release = `https://github.com/dhall-lang/dhall-haskell/releases/download/${dhallVersion}/dhall-json-${dhallJsonVersion}`;
18 23
19const url = `${release}-x86_64-linux.tar.bz2`; 24const get = (archive, callback) => {
20https.get(url, res => { 25 const url = `${release}-${archive}`;
21 if (res.statusCode >= 400) throw new Error(`Error fetching ${url}: ${res.statusMessage}`); 26 return https.get(url, res => {
22 res.pipe(unbz2()).pipe(tar.x({ C: __dirname })); 27 if (res.statusCode >= 400) throw new Error(`Error fetching ${url}: ${res.statusMessage}`);
23}); 28 return callback(res);
29 });
30};
31
32if (process.platform === "win32") {
33 get("x86_64-windows.zip", res =>
34 res.pipe(unzipper.Extract({ path: bindir }))
35 );
36} else {
37 get("x86_64-linux.tar.bz2", res =>
38 res.pipe(unbz2()).pipe(tar.x({ C: __dirname }).on("finish", () => {
39 fs.readdir(bindir, (err, names) => {
40 if (err) throw err;
41 for (const name of names) {
42 fs.rename(path.join(bindir, name), path.join(bindir, name + ".exe"), err => {
43 if (err) throw err;
44 });
45 }
46 });
47 }))
48 );
49}