@infisical/cli 0.31.0 → 0.31.7
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/infisical-cli-0.31.7.tgz +0 -0
- package/package.json +4 -6
- package/src/index.cjs +16 -65
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infisical/cli",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.31.
|
|
4
|
+
"version": "0.31.7",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"infisical",
|
|
7
7
|
"cli",
|
|
8
8
|
"command-line"
|
|
9
9
|
],
|
|
10
10
|
"bin": {
|
|
11
|
-
"infisical": "
|
|
11
|
+
"infisical": "bin/infisical"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
@@ -16,11 +16,9 @@
|
|
|
16
16
|
},
|
|
17
17
|
"author": "Infisical Inc, <daniel@infisical.com>",
|
|
18
18
|
"scripts": {
|
|
19
|
-
"
|
|
19
|
+
"postinstall": "node src/index.cjs"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"
|
|
23
|
-
"tar": "^6.2.0",
|
|
24
|
-
"yauzl": "^3.2.0"
|
|
22
|
+
"tar": "^6.2.0"
|
|
25
23
|
}
|
|
26
24
|
}
|
package/src/index.cjs
CHANGED
|
@@ -4,20 +4,13 @@ const stream = require("node:stream");
|
|
|
4
4
|
const tar = require("tar");
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const zlib = require("zlib");
|
|
7
|
-
const yauzl = require("yauzl");
|
|
8
|
-
|
|
9
7
|
const packageJSON = require("../package.json");
|
|
10
8
|
|
|
11
|
-
const supportedPlatforms = ["linux", "darwin", "win32", "freebsd"
|
|
9
|
+
const supportedPlatforms = ["linux", "darwin", "win32", "freebsd"];
|
|
12
10
|
const outputDir = "bin";
|
|
13
11
|
|
|
14
12
|
const getPlatform = () => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (platform === "win32") {
|
|
18
|
-
platform = "windows";
|
|
19
|
-
}
|
|
20
|
-
|
|
13
|
+
const platform = process.platform;
|
|
21
14
|
if (!supportedPlatforms.includes(platform)) {
|
|
22
15
|
console.error("Your platform doesn't seem to be of type darwin, linux or windows");
|
|
23
16
|
process.exit(1);
|
|
@@ -60,47 +53,12 @@ const getArchitecture = () => {
|
|
|
60
53
|
return arch;
|
|
61
54
|
};
|
|
62
55
|
|
|
63
|
-
async function extractZip(buffer, targetPath) {
|
|
64
|
-
return new Promise((resolve, reject) => {
|
|
65
|
-
yauzl.fromBuffer(buffer, { lazyEntries: true }, (err, zipfile) => {
|
|
66
|
-
if (err) return reject(err);
|
|
67
|
-
|
|
68
|
-
zipfile.readEntry();
|
|
69
|
-
zipfile.on("entry", entry => {
|
|
70
|
-
const isExecutable = entry.fileName === "infisical" || entry.fileName === "infisical.exe";
|
|
71
|
-
|
|
72
|
-
if (/\/$/.test(entry.fileName) || !isExecutable) {
|
|
73
|
-
// Directory entry
|
|
74
|
-
zipfile.readEntry();
|
|
75
|
-
} else {
|
|
76
|
-
// File entry
|
|
77
|
-
zipfile.openReadStream(entry, (err, readStream) => {
|
|
78
|
-
if (err) return reject(err);
|
|
79
|
-
|
|
80
|
-
const outputPath = path.join(targetPath, entry.fileName.includes("infisical") ? "infisical" : entry.fileName);
|
|
81
|
-
const writeStream = fs.createWriteStream(outputPath);
|
|
82
|
-
|
|
83
|
-
readStream.pipe(writeStream);
|
|
84
|
-
writeStream.on("close", () => {
|
|
85
|
-
zipfile.readEntry();
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
zipfile.on("end", resolve);
|
|
92
|
-
zipfile.on("error", reject);
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
56
|
async function main() {
|
|
98
57
|
const PLATFORM = getPlatform();
|
|
99
58
|
const ARCH = getArchitecture();
|
|
100
59
|
const NUMERIC_RELEASE_VERSION = packageJSON.version;
|
|
101
60
|
const LATEST_RELEASE_VERSION = `v${NUMERIC_RELEASE_VERSION}`;
|
|
102
|
-
const
|
|
103
|
-
const downloadLink = `https://github.com/Infisical/infisical/releases/download/infisical-cli/${LATEST_RELEASE_VERSION}/infisical_${NUMERIC_RELEASE_VERSION}_${PLATFORM}_${ARCH}.${EXTENSION}`;
|
|
61
|
+
const downloadLink = `https://github.com/Infisical/infisical/releases/download/infisical-cli/${LATEST_RELEASE_VERSION}/infisical_${NUMERIC_RELEASE_VERSION}_${PLATFORM}_${ARCH}.tar.gz`;
|
|
104
62
|
|
|
105
63
|
// Ensure the output directory exists
|
|
106
64
|
if (!fs.existsSync(outputDir)) {
|
|
@@ -119,26 +77,19 @@ async function main() {
|
|
|
119
77
|
throw new Error(`Failed to fetch: ${response.status} - ${response.statusText}`);
|
|
120
78
|
}
|
|
121
79
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
})
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
outStream.on("error", reject);
|
|
139
|
-
outStream.on("close", resolve);
|
|
140
|
-
});
|
|
141
|
-
}
|
|
80
|
+
await new Promise((resolve, reject) => {
|
|
81
|
+
const outStream = stream.Readable.fromWeb(response.body)
|
|
82
|
+
.pipe(zlib.createGunzip())
|
|
83
|
+
.pipe(
|
|
84
|
+
tar.x({
|
|
85
|
+
C: path.join(outputDir),
|
|
86
|
+
filter: path => path === "infisical"
|
|
87
|
+
})
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
outStream.on("error", reject);
|
|
91
|
+
outStream.on("close", resolve);
|
|
92
|
+
});
|
|
142
93
|
|
|
143
94
|
// Give the binary execute permissions if we're not on Windows
|
|
144
95
|
if (PLATFORM !== "win32") {
|