create-shallot 0.9.0 → 0.9.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.
Files changed (2) hide show
  1. package/index.ts +15 -8
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -118,8 +118,9 @@ plugin enablement) in your IDE.
118
118
  bunx shallot build
119
119
  \`\`\`
120
120
 
121
- Builds a web bundle to \`dist/\`. For native targets:
122
- \`bunx shallot build --target windows|mac|linux\` (add \`--release\` for an optimized build).
121
+ Builds a web bundle to \`dist/\`. Native targets
122
+ (\`--target windows|mac|linux\`) build from a shallot source checkout, not the
123
+ installed package: the rust crate they need isn't published to npm.
123
124
  `;
124
125
 
125
126
  const agents = (name: string) => `# ${name}
@@ -137,7 +138,7 @@ A WebGPU game built on \`@dylanebert/shallot\`.
137
138
  \`\`\`bash
138
139
  bunx tsc --noEmit # typecheck — run after every change
139
140
  bunx shallot dev # run with hot reload while you work
140
- bunx shallot build [--target windows|mac|linux] # ship it (web bundle, or a native app)
141
+ bunx shallot build # ship it (web bundle to dist/)
141
142
  bunx shallot verify # prove it: boot headless, check it renders, exit 0/nonzero
142
143
  \`\`\`
143
144
 
@@ -221,18 +222,19 @@ const SCENE = `<scene>
221
222
  </scene>
222
223
  `;
223
224
 
224
- if (import.meta.main) {
225
- const args = process.argv.slice(2);
226
- const name = args.find((a) => !a.startsWith("--"));
225
+ /** `bun create shallot <project-name>` — parse argv, guard the target dir, scaffold, report next steps.
226
+ * Returns the process exit code rather than calling `process.exit` itself, so it's callable directly. */
227
+ export function main(argv: string[]): number {
228
+ const name = argv.find((a) => !a.startsWith("--"));
227
229
  if (!name) {
228
230
  console.error("Usage: bun create shallot <project-name>");
229
- process.exit(1);
231
+ return 1;
230
232
  }
231
233
 
232
234
  const dir = resolve(name);
233
235
  if (existsSync(dir)) {
234
236
  console.error(`Directory "${name}" already exists`);
235
- process.exit(1);
237
+ return 1;
236
238
  }
237
239
 
238
240
  scaffold(dir, template(name));
@@ -243,4 +245,9 @@ if (import.meta.main) {
243
245
  console.log(` cd ${name}`);
244
246
  console.log(" bun install");
245
247
  console.log(" bunx shallot dev");
248
+ return 0;
249
+ }
250
+
251
+ if (import.meta.main) {
252
+ process.exit(main(process.argv.slice(2)));
246
253
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-shallot",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "type": "module",
5
5
  "bin": "./index.ts",
6
6
  "files": ["index.ts"],