iecode-homebrew 0.0.0-stage → 0.1.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/package.json CHANGED
@@ -1,6 +1,31 @@
1
1
  {
2
2
  "name": "iecode-homebrew",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.2",
4
+ "private": false,
5
+ "description": "Bun commands for the IECODE DS/DSi and 3DS homebrew toolchains",
6
+ "license": "UNLICENSED",
7
+ "bin": {
8
+ "iecode-homebrew": "./src/cli.ts"
9
+ },
10
+ "files": [
11
+ "src",
12
+ "tsconfig.json"
13
+ ],
14
+ "type": "module",
15
+ "publishConfig": {
16
+ "access": "public",
17
+ "registry": "https://registry.npmjs.org"
18
+ },
19
+ "scripts": {
20
+ "homebrew": "bun ./src/cli.ts",
21
+ "typecheck": "tsc --noEmit",
22
+ "test": "bun test"
23
+ },
24
+ "devDependencies": {
25
+ "@types/bun": "1.4.2",
26
+ "typescript": "7.0.2"
27
+ },
28
+ "engines": {
29
+ "bun": ">=1.4.2"
30
+ }
31
+ }
@@ -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/tsconfig.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "include": ["src/**/*.ts"]
4
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.