create-three-bun-ox 0.1.4 → 0.1.7

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 (3) hide show
  1. package/README.md +7 -1
  2. package/create.js +99 -0
  3. package/package.json +3 -1
package/README.md CHANGED
@@ -31,7 +31,13 @@ The server listens on `PORT` if it is set, otherwise it uses `3000`.
31
31
  Quickstart:
32
32
 
33
33
  ```bash
34
- bun create three-bun-ox
34
+ bunx create-three-bun-ox my-app
35
+ ```
36
+
37
+ Or with npm:
38
+
39
+ ```bash
40
+ npm create three-bun-ox my-app
35
41
  ```
36
42
 
37
43
  You can also use the GitHub repo directly:
package/create.js ADDED
@@ -0,0 +1,99 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { cpSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
4
+ import { basename, join, resolve } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import { execSync } from "node:child_process";
7
+
8
+ const __dirname = fileURLToPath(new URL(".", import.meta.url));
9
+
10
+ const arg = process.argv[2];
11
+
12
+ if (!arg || arg === "--help" || arg === "-h") {
13
+ console.log("Usage: create-three-bun-ox <project-name>");
14
+ process.exit(arg ? 0 : 1);
15
+ }
16
+
17
+ const dest = resolve(arg);
18
+
19
+ if (existsSync(dest)) {
20
+ console.error(`Directory "${basename(dest)}" already exists.`);
21
+ process.exit(1);
22
+ }
23
+
24
+ mkdirSync(dest, { recursive: true });
25
+
26
+ const files = [
27
+ "index.html",
28
+ "server.ts",
29
+ "tsconfig.json",
30
+ ".oxlintrc.json",
31
+ ".oxfmtrc.json",
32
+ "bun.lock",
33
+ ];
34
+
35
+ for (const file of files) {
36
+ cpSync(join(__dirname, file), join(dest, file));
37
+ }
38
+
39
+ cpSync(join(__dirname, "src"), join(dest, "src"), { recursive: true });
40
+
41
+ writeFileSync(
42
+ join(dest, ".gitignore"),
43
+ [
44
+ "node_modules",
45
+ "out",
46
+ "dist",
47
+ "*.tgz",
48
+ ".cache",
49
+ "*.tsbuildinfo",
50
+ ".env",
51
+ ".env.local",
52
+ ".env.development.local",
53
+ ".env.test.local",
54
+ ".env.production.local",
55
+ ].join("\n") + "\n",
56
+ );
57
+
58
+ writeFileSync(
59
+ join(dest, "package.json"),
60
+ JSON.stringify(
61
+ {
62
+ name: basename(dest),
63
+ version: "0.1.0",
64
+ type: "module",
65
+ scripts: {
66
+ dev: "bun --hot ./server.ts",
67
+ start: "bun run dev",
68
+ fmt: "oxfmt server.ts index.html src package.json tsconfig.json .oxlintrc.json .oxfmtrc.json",
69
+ "fmt:fix": "bun run fmt",
70
+ "fmt:check":
71
+ "oxfmt --check server.ts index.html src package.json tsconfig.json .oxlintrc.json .oxfmtrc.json",
72
+ lint: "oxlint server.ts src",
73
+ "lint:fix": "oxlint --fix server.ts src",
74
+ typecheck: "tsc --noEmit",
75
+ },
76
+ dependencies: { three: "0.183.2" },
77
+ devDependencies: {
78
+ "@types/bun": "latest",
79
+ "@types/three": "0.180.0",
80
+ oxfmt: "0.44.0",
81
+ oxlint: "1.59.0",
82
+ typescript: "^6.0.2",
83
+ },
84
+ },
85
+ null,
86
+ 2,
87
+ ) + "\n",
88
+ );
89
+
90
+ console.log("Installing dependencies...");
91
+ try {
92
+ execSync("bun install", { cwd: dest, stdio: "inherit" });
93
+ } catch {
94
+ console.error("Failed to install dependencies. Run `bun install` manually.");
95
+ }
96
+
97
+ console.log(`\nDone! Created ${basename(dest)}`);
98
+ console.log(`\n cd ${arg}`);
99
+ console.log(" bun run dev\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-three-bun-ox",
3
- "version": "0.1.4",
3
+ "version": "0.1.7",
4
4
  "description": "A minimal Bun + Three.js template with oxlint and oxfmt.",
5
5
  "homepage": "https://github.com/spinualexandru/create-three-bun-ox#readme",
6
6
  "bugs": {
@@ -12,7 +12,9 @@
12
12
  "type": "git",
13
13
  "url": "git+https://github.com/spinualexandru/create-three-bun-ox.git"
14
14
  },
15
+ "bin": "create.js",
15
16
  "files": [
17
+ "create.js",
16
18
  "README.md",
17
19
  "index.html",
18
20
  "server.ts",