@infisical/cli 0.31.7 → 0.31.9
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/README.md +4 -7
- package/infisical-cli-0.31.9.tgz +0 -0
- package/package.json +5 -4
- package/src/index.cjs +81 -18
- package/infisical-cli-0.31.7.tgz +0 -0
package/README.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
<h1 align="center">Infisical</h1>
|
|
1
|
+
<h1 align="center">Infisical CLI</h1>
|
|
2
2
|
<p align="center">
|
|
3
|
-
<p align="center"><b>
|
|
3
|
+
<p align="center"><b>Embrace shift-left security with the Infisical CLI and strengthen your DevSecOps practices by seamlessly managing secrets across your workflows, pipelines, and applications.</b></p>
|
|
4
4
|
</p>
|
|
5
5
|
|
|
6
6
|
<h4 align="center">
|
|
7
7
|
<a href="https://infisical.com/slack">Slack</a> |
|
|
8
|
+
<a href="https://www.npmjs.com/package/@infisical/sdk">Node.js SDK</a> |
|
|
8
9
|
<a href="https://infisical.com/">Infisical Cloud</a> |
|
|
9
10
|
<a href="https://infisical.com/docs/self-hosting/overview">Self-Hosting</a> |
|
|
10
11
|
<a href="https://infisical.com/docs/documentation/getting-started/introduction">Docs</a> |
|
|
@@ -12,7 +13,6 @@
|
|
|
12
13
|
<a href="https://infisical.com/careers">Hiring (Remote/SF)</a>
|
|
13
14
|
</h4>
|
|
14
15
|
|
|
15
|
-
|
|
16
16
|
<h4 align="center">
|
|
17
17
|
<a href="https://github.com/Infisical/infisical/blob/main/LICENSE">
|
|
18
18
|
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="Infisical is released under the MIT license." />
|
|
@@ -36,10 +36,7 @@
|
|
|
36
36
|
|
|
37
37
|
### Introduction
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
We're on a mission to make security tooling more accessible to everyone, not just security teams, and that means redesigning the entire developer experience from ground up.
|
|
42
|
-
|
|
39
|
+
The Infisical CLI is a powerful command line tool that can be used to retrieve, modify, export and inject secrets into any process or application as environment variables. You can use it across various environments, whether it’s local development, CI/CD, staging, or production.
|
|
43
40
|
|
|
44
41
|
### Installation
|
|
45
42
|
|
|
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.9",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"infisical",
|
|
7
7
|
"cli",
|
|
8
8
|
"command-line"
|
|
9
9
|
],
|
|
10
10
|
"bin": {
|
|
11
|
-
"infisical": "bin/infisical"
|
|
11
|
+
"infisical": "./bin/infisical"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
},
|
|
17
17
|
"author": "Infisical Inc, <daniel@infisical.com>",
|
|
18
18
|
"scripts": {
|
|
19
|
-
"
|
|
19
|
+
"preinstall": "node src/index.cjs"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"tar": "^6.2.0"
|
|
22
|
+
"tar": "^6.2.0",
|
|
23
|
+
"yauzl": "^3.2.0"
|
|
23
24
|
}
|
|
24
25
|
}
|
package/src/index.cjs
CHANGED
|
@@ -4,13 +4,20 @@ 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
|
+
|
|
7
9
|
const packageJSON = require("../package.json");
|
|
8
10
|
|
|
9
|
-
const supportedPlatforms = ["linux", "darwin", "win32", "freebsd"];
|
|
11
|
+
const supportedPlatforms = ["linux", "darwin", "win32", "freebsd", "windows"];
|
|
10
12
|
const outputDir = "bin";
|
|
11
13
|
|
|
12
14
|
const getPlatform = () => {
|
|
13
|
-
|
|
15
|
+
let platform = process.platform;
|
|
16
|
+
|
|
17
|
+
if (platform === "win32") {
|
|
18
|
+
platform = "windows";
|
|
19
|
+
}
|
|
20
|
+
|
|
14
21
|
if (!supportedPlatforms.includes(platform)) {
|
|
15
22
|
console.error("Your platform doesn't seem to be of type darwin, linux or windows");
|
|
16
23
|
process.exit(1);
|
|
@@ -53,12 +60,55 @@ const getArchitecture = () => {
|
|
|
53
60
|
return arch;
|
|
54
61
|
};
|
|
55
62
|
|
|
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
|
+
let fileName = entry.fileName;
|
|
81
|
+
|
|
82
|
+
if (entry.fileName.endsWith(".exe")) {
|
|
83
|
+
fileName = "infisical.exe";
|
|
84
|
+
} else if (entry.fileName.includes("infisical")) {
|
|
85
|
+
fileName = "infisical";
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const outputPath = path.join(targetPath, fileName);
|
|
89
|
+
const writeStream = fs.createWriteStream(outputPath);
|
|
90
|
+
|
|
91
|
+
readStream.pipe(writeStream);
|
|
92
|
+
writeStream.on("close", () => {
|
|
93
|
+
zipfile.readEntry();
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
zipfile.on("end", resolve);
|
|
100
|
+
zipfile.on("error", reject);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
56
105
|
async function main() {
|
|
57
106
|
const PLATFORM = getPlatform();
|
|
58
107
|
const ARCH = getArchitecture();
|
|
59
108
|
const NUMERIC_RELEASE_VERSION = packageJSON.version;
|
|
60
109
|
const LATEST_RELEASE_VERSION = `v${NUMERIC_RELEASE_VERSION}`;
|
|
61
|
-
const
|
|
110
|
+
const EXTENSION = PLATFORM === "windows" ? "zip" : "tar.gz";
|
|
111
|
+
const downloadLink = `https://github.com/Infisical/infisical/releases/download/infisical-cli/${LATEST_RELEASE_VERSION}/infisical_${NUMERIC_RELEASE_VERSION}_${PLATFORM}_${ARCH}.${EXTENSION}`;
|
|
62
112
|
|
|
63
113
|
// Ensure the output directory exists
|
|
64
114
|
if (!fs.existsSync(outputDir)) {
|
|
@@ -77,22 +127,35 @@ async function main() {
|
|
|
77
127
|
throw new Error(`Failed to fetch: ${response.status} - ${response.statusText}`);
|
|
78
128
|
}
|
|
79
129
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
130
|
+
if (EXTENSION === "zip") {
|
|
131
|
+
// For ZIP files, we need to buffer the whole thing first
|
|
132
|
+
const buffer = await response.arrayBuffer();
|
|
133
|
+
await extractZip(Buffer.from(buffer), outputDir);
|
|
134
|
+
} else {
|
|
135
|
+
// For tar.gz files, we stream
|
|
136
|
+
await new Promise((resolve, reject) => {
|
|
137
|
+
const outStream = stream.Readable.fromWeb(response.body)
|
|
138
|
+
.pipe(zlib.createGunzip())
|
|
139
|
+
.pipe(
|
|
140
|
+
tar.x({
|
|
141
|
+
C: path.join(outputDir),
|
|
142
|
+
filter: path => path === "infisical"
|
|
143
|
+
})
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
outStream.on("error", reject);
|
|
147
|
+
outStream.on("close", resolve);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
93
150
|
|
|
94
|
-
//
|
|
95
|
-
if (PLATFORM
|
|
151
|
+
// Platform-specific tasks
|
|
152
|
+
if (PLATFORM === "windows") {
|
|
153
|
+
// We create an empty file called 'infisical'. This file has no functionality, except allowing NPM to correctly create the symlink.
|
|
154
|
+
// Reason why this doesn't work without the empty file, is because the files downloaded are a .ps1, .exe, and .cmd file. None of these match the binary name from the package.json['bin'] field.
|
|
155
|
+
// This is a bit hacky, but it assures that the symlink is correctly created.
|
|
156
|
+
fs.closeSync(fs.openSync(path.join(outputDir, "infisical"), "w"));
|
|
157
|
+
} else {
|
|
158
|
+
// Unix systems only need chmod
|
|
96
159
|
fs.chmodSync(path.join(outputDir, "infisical"), "755");
|
|
97
160
|
}
|
|
98
161
|
} catch (error) {
|
package/infisical-cli-0.31.7.tgz
DELETED
|
Binary file
|