storage-explorer 0.1.0 → 1.0.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.
- package/README.md +14 -0
- package/bunfig.toml +2 -0
- package/cli.js +98 -0
- package/dist/chunk-fa0pf3pw.js +11 -0
- package/dist/chunk-fa0pf3pw.js.map +24 -0
- package/dist/chunk-veptbhs8.css +1 -0
- package/dist/index.html +1 -1
- package/package.json +16 -2
- package/src/App.tsx +390 -0
- package/src/features/buckets/BucketPanel.tsx +93 -0
- package/src/features/objects/ObjectExplorer.tsx +129 -0
- package/src/features/objects/PathBreadcrumb.tsx +50 -0
- package/src/features/profiles/ProfileSidebar.tsx +167 -0
- package/src/frontend.tsx +26 -0
- package/{dist/chunk-js4y3bna.css → src/index.css} +134 -111
- package/src/index.html +13 -0
- package/src/index.ts +22 -0
- package/src/logo.svg +1 -0
- package/src/server/http/response.ts +12 -0
- package/src/server/routes/s3Routes.ts +17 -0
- package/src/server/s3/client.ts +14 -0
- package/src/server/s3/handlers.ts +96 -0
- package/src/server/s3/mappers.ts +73 -0
- package/src/server/s3/types.ts +15 -0
- package/src/server/s3/validate.ts +103 -0
- package/src/shared/api/s3Api.ts +56 -0
- package/src/shared/hooks/useProfilesStorage.ts +175 -0
- package/src/shared/types/s3.ts +42 -0
- package/dist/chunk-vtsn1g38.js +0 -1022
- package/dist/index-3xfxtfws.js +0 -238
- package/dist/index-3xfxtfws.js.map +0 -24
- package/dist/index-67w6q0ny.css +0 -1
- package/dist/index-9t8tyk25.js +0 -238
- package/dist/index-9t8tyk25.js.map +0 -24
- package/dist/index-b7b12360.css +0 -1
- package/dist/index-bz8f0q85.js +0 -238
- package/dist/index-bz8f0q85.js.map +0 -18
- package/dist/index-vw9287sb.js +0 -238
- package/dist/index-vw9287sb.js.map +0 -18
- package/dist/index-xde44bqw.css +0 -1
- package/dist/index.js +0 -29485
package/README.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Read-only AWS S3 / S3-compatible explorer built with Bun + React.
|
|
4
4
|
|
|
5
|
+
## Run with npm / npx
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx storage-explorer
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Requires Bun on your machine because the runtime server uses Bun.
|
|
12
|
+
|
|
13
|
+
Optional flags:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx storage-explorer --port 3000 --host 127.0.0.1
|
|
17
|
+
```
|
|
18
|
+
|
|
5
19
|
## Install
|
|
6
20
|
|
|
7
21
|
```bash
|
package/bunfig.toml
ADDED
package/cli.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
|
+
import { access, readFile } from "node:fs/promises";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = path.dirname(__filename);
|
|
10
|
+
const packageRoot = path.resolve(__dirname, "..");
|
|
11
|
+
const entrypoint = path.resolve(packageRoot, "src", "index.ts");
|
|
12
|
+
|
|
13
|
+
const args = process.argv.slice(2);
|
|
14
|
+
|
|
15
|
+
let hostArg;
|
|
16
|
+
let portArg;
|
|
17
|
+
|
|
18
|
+
if (args.includes("-h") || args.includes("--help")) {
|
|
19
|
+
console.log("storage-explorer\n");
|
|
20
|
+
console.log("Runs the Storage Explorer server using Bun.");
|
|
21
|
+
console.log("\nUsage:");
|
|
22
|
+
console.log(" npx storage-explorer [--port 3000] [--host 127.0.0.1]");
|
|
23
|
+
console.log("\nOptions:");
|
|
24
|
+
console.log(" -h, --help Show help");
|
|
25
|
+
console.log(" -v, --version Show package version");
|
|
26
|
+
console.log(" --port <number> Port to listen on (default: 3000)");
|
|
27
|
+
console.log(" --host <addr> Host to bind (default: 127.0.0.1)");
|
|
28
|
+
process.exit(0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (args.includes("-v") || args.includes("--version")) {
|
|
32
|
+
const packageJsonPath = path.resolve(packageRoot, "package.json");
|
|
33
|
+
const packageJson = JSON.parse(await readFile(packageJsonPath, "utf8"));
|
|
34
|
+
console.log(packageJson.version ?? "unknown");
|
|
35
|
+
process.exit(0);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
39
|
+
const arg = args[i];
|
|
40
|
+
|
|
41
|
+
if (arg === "--port") {
|
|
42
|
+
const value = Number(args[i + 1]);
|
|
43
|
+
if (!Number.isFinite(value) || value <= 0 || value > 65535) {
|
|
44
|
+
console.error("Invalid --port value.");
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
portArg = String(value);
|
|
48
|
+
i += 1;
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (arg === "--host") {
|
|
53
|
+
const value = args[i + 1];
|
|
54
|
+
if (!value) {
|
|
55
|
+
console.error("Missing --host value.");
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
hostArg = value;
|
|
59
|
+
i += 1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
await access(entrypoint);
|
|
65
|
+
} catch {
|
|
66
|
+
console.error("Missing src/index.ts in package.");
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const child = spawn("bun", [entrypoint], {
|
|
71
|
+
stdio: "inherit",
|
|
72
|
+
env: {
|
|
73
|
+
...process.env,
|
|
74
|
+
NODE_ENV: process.env.NODE_ENV ?? "production",
|
|
75
|
+
...(portArg ? { PORT: portArg } : {}),
|
|
76
|
+
...(hostArg ? { HOST: hostArg } : {}),
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
child.on("error", error => {
|
|
81
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
82
|
+
console.error("Bun is required to run storage-explorer.");
|
|
83
|
+
console.error("Install Bun: https://bun.sh/docs/installation");
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
88
|
+
process.exit(1);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
child.on("exit", (code, signal) => {
|
|
92
|
+
if (signal) {
|
|
93
|
+
process.kill(process.pid, signal);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
process.exit(code ?? 0);
|
|
98
|
+
});
|