@onkernel/cli 0.7.0 → 0.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.
- package/README.md +2 -1
- package/lib.js +49 -9
- package/package.json +19 -19
package/README.md
CHANGED
|
@@ -117,7 +117,7 @@ Create an API key from the [Kernel dashboard](https://dashboard.onkernel.com).
|
|
|
117
117
|
- `--with-timestamps`, `-t` - Include timestamps in each log line
|
|
118
118
|
|
|
119
119
|
- `kernel deploy history [app_name]` - Show deployment history
|
|
120
|
-
- `--
|
|
120
|
+
- `--limit <n>` - Max deployments to return (default: 100; 0 = all)
|
|
121
121
|
|
|
122
122
|
### App Management
|
|
123
123
|
|
|
@@ -133,6 +133,7 @@ Create an API key from the [Kernel dashboard](https://dashboard.onkernel.com).
|
|
|
133
133
|
- `--version <version>` - Filter by version
|
|
134
134
|
|
|
135
135
|
- `kernel app history <app_name>` - Show deployment history for an app
|
|
136
|
+
- `--limit <n>` - Max deployments to return (default: 100; 0 = all)
|
|
136
137
|
|
|
137
138
|
### Logs
|
|
138
139
|
|
package/lib.js
CHANGED
|
@@ -19,31 +19,61 @@ const getArchive = () => {
|
|
|
19
19
|
|
|
20
20
|
const binDir = path.join(__dirname, "bin");
|
|
21
21
|
|
|
22
|
-
async function extractTar(tarPath, binaries, dir) {
|
|
22
|
+
async function extractTar(tarPath, binaries, dir, wrappedIn) {
|
|
23
23
|
try {
|
|
24
|
+
const filesToExtract = wrappedIn
|
|
25
|
+
? binaries.map((bin) =>
|
|
26
|
+
path.join(wrappedIn, bin).replace(/\\/g, "/"),
|
|
27
|
+
)
|
|
28
|
+
: binaries;
|
|
29
|
+
|
|
24
30
|
await tar.x({
|
|
25
31
|
file: tarPath,
|
|
26
32
|
cwd: dir,
|
|
27
|
-
filter: (path) =>
|
|
33
|
+
filter: (path) => filesToExtract.includes(path),
|
|
28
34
|
});
|
|
29
|
-
|
|
35
|
+
|
|
36
|
+
// If wrapped, move files from wrapped directory to bin directory
|
|
37
|
+
if (wrappedIn) {
|
|
38
|
+
const wrappedDir = path.join(dir, wrappedIn);
|
|
39
|
+
for (const binary of binaries) {
|
|
40
|
+
const srcPath = path.join(wrappedDir, binary);
|
|
41
|
+
const destPath = path.join(dir, binary);
|
|
42
|
+
if (fs.existsSync(srcPath)) {
|
|
43
|
+
fs.renameSync(srcPath, destPath);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// Clean up empty wrapped directory
|
|
47
|
+
try {
|
|
48
|
+
fs.rmSync(wrappedDir, { recursive: true, force: true });
|
|
49
|
+
} catch (err) {
|
|
50
|
+
// Ignore cleanup errors
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
console.log(`Successfully extracted ${binaries} to "${dir}"`);
|
|
30
55
|
} catch (err) {
|
|
31
56
|
throw new Error(`Extraction failed: ${err.message}`);
|
|
32
57
|
}
|
|
33
58
|
}
|
|
34
59
|
|
|
35
|
-
async function extractZip(zipPath, binaries, dir) {
|
|
60
|
+
async function extractZip(zipPath, binaries, dir, wrappedIn) {
|
|
36
61
|
try {
|
|
37
62
|
const zipData = fs.readFileSync(zipPath);
|
|
38
63
|
const zip = await JSZip.loadAsync(zipData);
|
|
64
|
+
|
|
39
65
|
for (const binary of binaries) {
|
|
40
|
-
|
|
66
|
+
const binaryPath = wrappedIn
|
|
67
|
+
? path.join(wrappedIn, binary).replace(/\\/g, "/")
|
|
68
|
+
: binary;
|
|
69
|
+
|
|
70
|
+
if (!zip.files[binaryPath]) {
|
|
41
71
|
throw new Error(
|
|
42
|
-
`Error: ${
|
|
72
|
+
`Error: ${binaryPath} does not exist in ${zipPath}`,
|
|
43
73
|
);
|
|
44
74
|
}
|
|
45
75
|
|
|
46
|
-
const content = await zip.files[
|
|
76
|
+
const content = await zip.files[binaryPath].async("nodebuffer");
|
|
47
77
|
if (!fs.existsSync(dir)) {
|
|
48
78
|
fs.mkdirSync(dir, { recursive: true });
|
|
49
79
|
}
|
|
@@ -94,11 +124,21 @@ const install = async () => {
|
|
|
94
124
|
fs.chmodSync(bin, 0o755);
|
|
95
125
|
return;
|
|
96
126
|
case "zip":
|
|
97
|
-
return extractZip(
|
|
127
|
+
return extractZip(
|
|
128
|
+
archivePath,
|
|
129
|
+
archive.bins,
|
|
130
|
+
binDir,
|
|
131
|
+
archive.wrappedIn,
|
|
132
|
+
);
|
|
98
133
|
case "tar":
|
|
99
134
|
case "tar.gz":
|
|
100
135
|
case "tgz":
|
|
101
|
-
return extractTar(
|
|
136
|
+
return extractTar(
|
|
137
|
+
archivePath,
|
|
138
|
+
archive.bins,
|
|
139
|
+
binDir,
|
|
140
|
+
archive.wrappedIn,
|
|
141
|
+
);
|
|
102
142
|
case "tar.zst":
|
|
103
143
|
case "tzst":
|
|
104
144
|
case "tar.xz":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onkernel/cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Kernel CLI",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"postinstall": "node install.js",
|
|
@@ -33,75 +33,75 @@
|
|
|
33
33
|
},
|
|
34
34
|
"archives": {
|
|
35
35
|
"darwin-arm64": {
|
|
36
|
-
"name": "kernel_0.7.
|
|
37
|
-
"url": "https://github.com/onkernel/cli/releases/download/v0.7.
|
|
36
|
+
"name": "kernel_0.7.2_darwin_arm64.tar.gz",
|
|
37
|
+
"url": "https://github.com/onkernel/cli/releases/download/v0.7.2/kernel_0.7.2_darwin_arm64.tar.gz",
|
|
38
38
|
"bins": [
|
|
39
39
|
"kernel"
|
|
40
40
|
],
|
|
41
41
|
"format": "tar.gz",
|
|
42
42
|
"checksum": {
|
|
43
43
|
"algorithm": "sha256",
|
|
44
|
-
"digest": "
|
|
44
|
+
"digest": "770db33a65d604a60b30e506d87a813c0848386f86e991607818d3484d7f6201"
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"darwin-x64": {
|
|
48
|
-
"name": "kernel_0.7.
|
|
49
|
-
"url": "https://github.com/onkernel/cli/releases/download/v0.7.
|
|
48
|
+
"name": "kernel_0.7.2_darwin_amd64.tar.gz",
|
|
49
|
+
"url": "https://github.com/onkernel/cli/releases/download/v0.7.2/kernel_0.7.2_darwin_amd64.tar.gz",
|
|
50
50
|
"bins": [
|
|
51
51
|
"kernel"
|
|
52
52
|
],
|
|
53
53
|
"format": "tar.gz",
|
|
54
54
|
"checksum": {
|
|
55
55
|
"algorithm": "sha256",
|
|
56
|
-
"digest": "
|
|
56
|
+
"digest": "e0146c2c318177eccedfa660b0637c1b8828ee8c5f1e4c42c8ab3b0615977e0e"
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
"linux-arm64": {
|
|
60
|
-
"name": "kernel_0.7.
|
|
61
|
-
"url": "https://github.com/onkernel/cli/releases/download/v0.7.
|
|
60
|
+
"name": "kernel_0.7.2_linux_arm64.tar.gz",
|
|
61
|
+
"url": "https://github.com/onkernel/cli/releases/download/v0.7.2/kernel_0.7.2_linux_arm64.tar.gz",
|
|
62
62
|
"bins": [
|
|
63
63
|
"kernel"
|
|
64
64
|
],
|
|
65
65
|
"format": "tar.gz",
|
|
66
66
|
"checksum": {
|
|
67
67
|
"algorithm": "sha256",
|
|
68
|
-
"digest": "
|
|
68
|
+
"digest": "e7e94b4d5be9ef11ce7893081a5eb1a1d9063bc52080e90ec9d6ae761003f4f8"
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
"linux-x64": {
|
|
72
|
-
"name": "kernel_0.7.
|
|
73
|
-
"url": "https://github.com/onkernel/cli/releases/download/v0.7.
|
|
72
|
+
"name": "kernel_0.7.2_linux_amd64.tar.gz",
|
|
73
|
+
"url": "https://github.com/onkernel/cli/releases/download/v0.7.2/kernel_0.7.2_linux_amd64.tar.gz",
|
|
74
74
|
"bins": [
|
|
75
75
|
"kernel"
|
|
76
76
|
],
|
|
77
77
|
"format": "tar.gz",
|
|
78
78
|
"checksum": {
|
|
79
79
|
"algorithm": "sha256",
|
|
80
|
-
"digest": "
|
|
80
|
+
"digest": "9fdc0d06462a590b685e32558a16c9f9d7a633ce675149c46325cbb41eb2465f"
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
"win32-arm64": {
|
|
84
|
-
"name": "kernel_0.7.
|
|
85
|
-
"url": "https://github.com/onkernel/cli/releases/download/v0.7.
|
|
84
|
+
"name": "kernel_0.7.2_windows_arm64.tar.gz",
|
|
85
|
+
"url": "https://github.com/onkernel/cli/releases/download/v0.7.2/kernel_0.7.2_windows_arm64.tar.gz",
|
|
86
86
|
"bins": [
|
|
87
87
|
"kernel.exe"
|
|
88
88
|
],
|
|
89
89
|
"format": "tar.gz",
|
|
90
90
|
"checksum": {
|
|
91
91
|
"algorithm": "sha256",
|
|
92
|
-
"digest": "
|
|
92
|
+
"digest": "e992abb9e18254e009b5d0d112aefaba56c727491c544f4287712f10198373ab"
|
|
93
93
|
}
|
|
94
94
|
},
|
|
95
95
|
"win32-x64": {
|
|
96
|
-
"name": "kernel_0.7.
|
|
97
|
-
"url": "https://github.com/onkernel/cli/releases/download/v0.7.
|
|
96
|
+
"name": "kernel_0.7.2_windows_amd64.tar.gz",
|
|
97
|
+
"url": "https://github.com/onkernel/cli/releases/download/v0.7.2/kernel_0.7.2_windows_amd64.tar.gz",
|
|
98
98
|
"bins": [
|
|
99
99
|
"kernel.exe"
|
|
100
100
|
],
|
|
101
101
|
"format": "tar.gz",
|
|
102
102
|
"checksum": {
|
|
103
103
|
"algorithm": "sha256",
|
|
104
|
-
"digest": "
|
|
104
|
+
"digest": "6b4f22bce45ab584c8b5350b81f87e41cf702f82f2af4409001300b8262fe203"
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
}
|