@onkernel/cli 0.6.1 → 0.7.0

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.
Files changed (2) hide show
  1. package/lib.js +9 -49
  2. package/package.json +19 -19
package/lib.js CHANGED
@@ -19,61 +19,31 @@ const getArchive = () => {
19
19
 
20
20
  const binDir = path.join(__dirname, "bin");
21
21
 
22
- async function extractTar(tarPath, binaries, dir, wrappedIn) {
22
+ async function extractTar(tarPath, binaries, dir) {
23
23
  try {
24
- const filesToExtract = wrappedIn
25
- ? binaries.map((bin) =>
26
- path.join(wrappedIn, bin).replace(/\\/g, "/"),
27
- )
28
- : binaries;
29
-
30
24
  await tar.x({
31
25
  file: tarPath,
32
26
  cwd: dir,
33
- filter: (path) => filesToExtract.includes(path),
27
+ filter: (path) => binaries.includes(path),
34
28
  });
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}"`);
29
+ console.log(`Successfully extracted binaries to "${dir}"`);
55
30
  } catch (err) {
56
31
  throw new Error(`Extraction failed: ${err.message}`);
57
32
  }
58
33
  }
59
34
 
60
- async function extractZip(zipPath, binaries, dir, wrappedIn) {
35
+ async function extractZip(zipPath, binaries, dir) {
61
36
  try {
62
37
  const zipData = fs.readFileSync(zipPath);
63
38
  const zip = await JSZip.loadAsync(zipData);
64
-
65
39
  for (const binary of binaries) {
66
- const binaryPath = wrappedIn
67
- ? path.join(wrappedIn, binary).replace(/\\/g, "/")
68
- : binary;
69
-
70
- if (!zip.files[binaryPath]) {
40
+ if (!zip.files[binary]) {
71
41
  throw new Error(
72
- `Error: ${binaryPath} does not exist in ${zipPath}`,
42
+ `Error: ${binary} does not exist in ${zipPath}`,
73
43
  );
74
44
  }
75
45
 
76
- const content = await zip.files[binaryPath].async("nodebuffer");
46
+ const content = await zip.files[binary].async("nodebuffer");
77
47
  if (!fs.existsSync(dir)) {
78
48
  fs.mkdirSync(dir, { recursive: true });
79
49
  }
@@ -124,21 +94,11 @@ const install = async () => {
124
94
  fs.chmodSync(bin, 0o755);
125
95
  return;
126
96
  case "zip":
127
- return extractZip(
128
- archivePath,
129
- archive.bins,
130
- binDir,
131
- archive.wrappedIn,
132
- );
97
+ return extractZip(archivePath, archive.bins, binDir);
133
98
  case "tar":
134
99
  case "tar.gz":
135
100
  case "tgz":
136
- return extractTar(
137
- archivePath,
138
- archive.bins,
139
- binDir,
140
- archive.wrappedIn,
141
- );
101
+ return extractTar(archivePath, archive.bins, binDir);
142
102
  case "tar.zst":
143
103
  case "tzst":
144
104
  case "tar.xz":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onkernel/cli",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
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.6.1_darwin_arm64.tar.gz",
37
- "url": "https://github.com/onkernel/cli/releases/download/v0.6.1/kernel_0.6.1_darwin_arm64.tar.gz",
36
+ "name": "kernel_0.7.0_darwin_arm64.tar.gz",
37
+ "url": "https://github.com/onkernel/cli/releases/download/v0.7.0/kernel_0.7.0_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": "63b0cc5c284f8a1579506851a50e24b09f72dcacac8bbbcb92715b7e717322f3"
44
+ "digest": "9fc79f4c834fefa401df23e56e6594da421b310cc6c416c3e79e03679f4e0e81"
45
45
  }
46
46
  },
47
47
  "darwin-x64": {
48
- "name": "kernel_0.6.1_darwin_amd64.tar.gz",
49
- "url": "https://github.com/onkernel/cli/releases/download/v0.6.1/kernel_0.6.1_darwin_amd64.tar.gz",
48
+ "name": "kernel_0.7.0_darwin_amd64.tar.gz",
49
+ "url": "https://github.com/onkernel/cli/releases/download/v0.7.0/kernel_0.7.0_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": "c72560234c0117034f9f3539cee93c61313c16e6ad14fbec8016dea91d197d2d"
56
+ "digest": "fba62ecd2a3c05af1aec0e7881f2f084753f89ea336c5bbc209932bedd7500f9"
57
57
  }
58
58
  },
59
59
  "linux-arm64": {
60
- "name": "kernel_0.6.1_linux_arm64.tar.gz",
61
- "url": "https://github.com/onkernel/cli/releases/download/v0.6.1/kernel_0.6.1_linux_arm64.tar.gz",
60
+ "name": "kernel_0.7.0_linux_arm64.tar.gz",
61
+ "url": "https://github.com/onkernel/cli/releases/download/v0.7.0/kernel_0.7.0_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": "b56a71aacadae54970718e66f43ae07d3897b673a60d19b596cca632ffcb8d5d"
68
+ "digest": "b4eb54277a8c47c2e06a3a189f3387223c4ec51aaa9250739610bf6f6634c1f1"
69
69
  }
70
70
  },
71
71
  "linux-x64": {
72
- "name": "kernel_0.6.1_linux_amd64.tar.gz",
73
- "url": "https://github.com/onkernel/cli/releases/download/v0.6.1/kernel_0.6.1_linux_amd64.tar.gz",
72
+ "name": "kernel_0.7.0_linux_amd64.tar.gz",
73
+ "url": "https://github.com/onkernel/cli/releases/download/v0.7.0/kernel_0.7.0_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": "228b4af7e637963daf1c73a7e45874ad9b3e3ddb7436f3f1167efc2e31d07eff"
80
+ "digest": "0c131586e652e339fcc029a43e10c2319671011bb8efdb5cb3eb78880a10c96d"
81
81
  }
82
82
  },
83
83
  "win32-arm64": {
84
- "name": "kernel_0.6.1_windows_arm64.tar.gz",
85
- "url": "https://github.com/onkernel/cli/releases/download/v0.6.1/kernel_0.6.1_windows_arm64.tar.gz",
84
+ "name": "kernel_0.7.0_windows_arm64.tar.gz",
85
+ "url": "https://github.com/onkernel/cli/releases/download/v0.7.0/kernel_0.7.0_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": "0640b83de4a54790ffc8b61bc1b0fef69aeb24ca81d77cc0b55377ec3f4b39b8"
92
+ "digest": "ef34f9265c9a1d7b8f5faf5d8d39aec98250f6a6081c660cb82aead90ddb87bd"
93
93
  }
94
94
  },
95
95
  "win32-x64": {
96
- "name": "kernel_0.6.1_windows_amd64.tar.gz",
97
- "url": "https://github.com/onkernel/cli/releases/download/v0.6.1/kernel_0.6.1_windows_amd64.tar.gz",
96
+ "name": "kernel_0.7.0_windows_amd64.tar.gz",
97
+ "url": "https://github.com/onkernel/cli/releases/download/v0.7.0/kernel_0.7.0_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": "b769e93f74defdbefb4bb1ae8f6d303e80418b1c7bb82a1b741141d9f767e6be"
104
+ "digest": "3122b084b959eb8f63acffe5d68955de551cbf3f2146955c51b7eca05c7d3556"
105
105
  }
106
106
  }
107
107
  }