iecode-homebrew 0.0.0-stage → 0.1.1
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/package.json +27 -4
- package/src/cli.test.ts +21 -0
- package/src/cli.ts +24 -0
- package/README.md +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iecode-homebrew",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Bun commands for the IECODE DS/DSi and 3DS homebrew toolchains",
|
|
6
|
+
"bin": {
|
|
7
|
+
"iecode-homebrew": "./src/cli.ts"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"src",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"type": "module",
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"homebrew": "bun ./src/cli.ts",
|
|
19
|
+
"typecheck": "bunx tsc --noEmit",
|
|
20
|
+
"test": "bun test"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/bun": "1.4.2",
|
|
24
|
+
"typescript": "7.0.2"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"bun": ">=1.4.2"
|
|
28
|
+
}
|
|
29
|
+
}
|
package/src/cli.test.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { expect, test } from "bun:test";
|
|
2
|
+
|
|
3
|
+
test("help works without Cargo or the native binary", async () => {
|
|
4
|
+
const child = Bun.spawn([process.execPath, `${import.meta.dir}/cli.ts`, "--help"], {
|
|
5
|
+
env: { ...process.env, PATH: "" },
|
|
6
|
+
stdout: "pipe",
|
|
7
|
+
stderr: "pipe",
|
|
8
|
+
});
|
|
9
|
+
expect(await new Response(child.stdout).text()).toContain("targets|doctor|build");
|
|
10
|
+
expect(await child.exited).toBe(0);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test("configured native binary receives arguments without invoking Cargo", async () => {
|
|
14
|
+
const child = Bun.spawn([process.execPath, `${import.meta.dir}/cli.ts`, "targets"], {
|
|
15
|
+
env: { ...process.env, IECODE_HOMEBREW_BINARY: "/bin/echo", PATH: "" },
|
|
16
|
+
stdout: "pipe",
|
|
17
|
+
stderr: "pipe",
|
|
18
|
+
});
|
|
19
|
+
expect((await new Response(child.stdout).text()).trim()).toBe("targets");
|
|
20
|
+
expect(await child.exited).toBe(0);
|
|
21
|
+
});
|
package/src/cli.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
|
|
4
|
+
const repoRoot = new URL("../../../", import.meta.url).pathname;
|
|
5
|
+
const manifestPath = `${repoRoot}crates/aphrody-homebrew/Cargo.toml`;
|
|
6
|
+
const args = Bun.argv.slice(2);
|
|
7
|
+
|
|
8
|
+
if (args.length === 0 || args[0] === "help" || args[0] === "--help") {
|
|
9
|
+
console.log("Usage: bun run iecode-homebrew <targets|doctor|build nds|build 3ds>");
|
|
10
|
+
process.exit(0);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const binary = process.env.IECODE_HOMEBREW_BINARY || Bun.which("aphrody-homebrew");
|
|
14
|
+
if (!binary && !existsSync(manifestPath)) {
|
|
15
|
+
console.error("Install aphrody-homebrew on PATH or set IECODE_HOMEBREW_BINARY.");
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
const proc = Bun.spawn(
|
|
19
|
+
binary
|
|
20
|
+
? [binary, ...args]
|
|
21
|
+
: ["cargo", "run", "--quiet", "--manifest-path", manifestPath, "--", ...args],
|
|
22
|
+
{ cwd: repoRoot, stdin: "inherit", stdout: "inherit", stderr: "inherit" },
|
|
23
|
+
);
|
|
24
|
+
process.exit(await proc.exited);
|
package/README.md
DELETED