Skip to content

Commit 3fd7b88

Browse files
committed
bump npm package
1 parent 0d8ea59 commit 3fd7b88

File tree

4 files changed

+26
-15
lines changed

4 files changed

+26
-15
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
node_modules
22
dist/
3-
/Dockerfile
4-
node/bin/
3+
/Dockerfile

node/bin/new-dockerfile

Whitespace-only changes.

node/install.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ const { unzipSync } = require("zlib");
55
const packageJson = require("./package.json");
66
const fs = require("fs");
77

8-
function getPlatform() {}
9-
108
async function downloadCli(version, platform) {
119
const ext = platform.os === "win32" ? ".zip" : ".tar.gz";
1210
const response = await fetch(
@@ -18,7 +16,7 @@ async function downloadCli(version, platform) {
1816
try {
1917
buffer = unzipSync(tgz);
2018
} catch (cause) {
21-
throw new Error("Invalid gzip data", { cause });
19+
process.exit(1);
2220
}
2321

2422
function str(i, n) {
@@ -29,20 +27,22 @@ async function downloadCli(version, platform) {
2927
}
3028
let offset = 0;
3129
const dst = platform.exe;
30+
fs.mkdirSync("bin", { recursive: true });
3231
while (offset < buffer.length) {
33-
const name = str(offset, 100).replace("package/", "");
3432
const size = parseInt(str(offset + 124, 12), 8);
3533
offset += 512;
3634
if (!isNaN(size)) {
3735
write(dst, buffer.subarray(offset, offset + size));
38-
if (name === platform.exe) {
39-
try {
40-
fs.chmodSync(dst, 0o755);
41-
} catch (error) {}
42-
}
4336
offset += (size + 511) & ~511;
4437
}
4538
}
39+
try {
40+
fs.chmodSync(dst, 0o755);
41+
} catch (error) {
42+
process.exit(1);
43+
}
44+
45+
process.exit(0);
4646
}
4747

4848
const fetch = "fetch" in globalThis ? webFetch : nodeFetch;
@@ -145,13 +145,13 @@ const platforms = [
145145
os: "win32",
146146
arch: "x64",
147147
bin: "new-dockerfile-windows-x86_64",
148-
exe: "bin/new-dockerfile.exe",
148+
exe: "bin/new-dockerfile",
149149
},
150150
{
151151
os: "win32",
152152
arch: "arm64",
153153
bin: "new-dockerfile-windows-arm64",
154-
exe: "bin/new-dockerfile.exe",
154+
exe: "bin/new-dockerfile",
155155
},
156156
];
157157

@@ -205,4 +205,10 @@ if (supportedPlatforms.length === 0) {
205205
}
206206

207207
// Read version from package.json
208+
209+
function wait() {
210+
setTimeout(wait, 1000);
211+
}
212+
208213
downloadCli(packageJson.config.bin_version, supportedPlatforms[0]);
214+
wait();

node/package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
{
22
"name": "new-dockerfile",
3-
"version": "0.1.3",
3+
"version": "0.1.8",
44
"config": {
55
"bin_version": "0.1.0"
66
},
77
"description": "Autogenerate Dockerfiles from your project source code",
88
"main": "index.js",
99
"bin": {
10-
"new-dockerfile": "bin/new-dockerfile"
10+
"new-dockerfile": "./bin/new-dockerfile"
1111
},
1212
"scripts": {
1313
"postinstall": "node install.js"
1414
},
15+
"files": [
16+
"README.md",
17+
"LICENSE",
18+
"install.js",
19+
"bin/new-dockerfile"
20+
],
1521
"os": [
1622
"darwin",
1723
"linux",

0 commit comments

Comments
 (0)