create-bloop 0.0.5 → 0.0.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.
package/dist/index.js CHANGED
@@ -4990,7 +4990,7 @@ async function main() {
4990
4990
  }
4991
4991
  console.log(`
4992
4992
  Creating ${projectName}...`);
4993
- const templatesDir = path.join(DIRNAME, "templates", template);
4993
+ const templatesDir = path.join(DIRNAME, "..", "templates", template);
4994
4994
  if (!fs.existsSync(templatesDir)) {
4995
4995
  console.error(`Error: Template "${template}" not found.`);
4996
4996
  console.error(`Expected at: ${templatesDir}`);
@@ -5016,7 +5016,8 @@ function copyDir(src, dest) {
5016
5016
  const entries = fs.readdirSync(src, { withFileTypes: true });
5017
5017
  for (const entry of entries) {
5018
5018
  const srcPath = path.join(src, entry.name);
5019
- const destPath = path.join(dest, entry.name);
5019
+ const destName = entry.name === "gitignore" ? ".gitignore" : entry.name;
5020
+ const destPath = path.join(dest, destName);
5020
5021
  if (entry.isDirectory()) {
5021
5022
  copyDir(srcPath, destPath);
5022
5023
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-bloop",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Create a new Bloop game",
5
5
  "type": "module",
6
6
  "bin": "./dist/index.js",
@@ -0,0 +1,2 @@
1
+ node_modules
2
+ dist
@@ -13,8 +13,8 @@
13
13
  "vite": "^7.2.2"
14
14
  },
15
15
  "dependencies": {
16
- "@bloopjs/bloop": "^0.0.78",
17
- "@bloopjs/toodle": "^0.0.100",
18
- "@bloopjs/web": "^0.0.78"
16
+ "@bloopjs/bloop": "^0.0.80",
17
+ "@bloopjs/toodle": "^0.1.3",
18
+ "@bloopjs/web": "^0.0.80"
19
19
  }
20
20
  }
@@ -1,19 +1,16 @@
1
1
  import "./style.css";
2
2
  import { Toodle } from "@bloopjs/toodle";
3
3
  import { start } from "@bloopjs/web";
4
- import { draw } from "./draw";
4
+ import { draw as drawFn } from "./draw";
5
5
  import { game } from "./game";
6
6
 
7
- // temp - use a monorepo dev wasm url instead of cdn
8
- const monorepoWasmUrl = new URL("/bloop-wasm/bloop.wasm", window.location.href);
9
-
10
7
  // 1. Set up simulation
11
8
  const app = await start({
12
9
  game,
13
- engineWasmUrl: monorepoWasmUrl,
14
10
  });
15
11
 
16
12
  // 2. Set up rendering
13
+ let draw = drawFn;
17
14
  const canvas = document.querySelector("canvas");
18
15
  if (!canvas) throw new Error("Canvas element not found");
19
16
  const toodle = await Toodle.attach(canvas);
@@ -24,7 +21,8 @@ requestAnimationFrame(function frame() {
24
21
 
25
22
  // 3. Set up Hot Module Replacement (HMR)
26
23
  import.meta.hot?.accept("./game", async (newModule) => {
27
- await app.acceptHmr(newModule?.game, {
28
- wasmUrl: monorepoWasmUrl,
29
- });
24
+ await app.acceptHmr(newModule?.game);
25
+ });
26
+ import.meta.hot?.accept("./draw", async (newModule) => {
27
+ draw = newModule?.draw;
30
28
  });
@@ -0,0 +1,2 @@
1
+ node_modules
2
+ dist
@@ -15,8 +15,8 @@
15
15
  "vite": "^7.2.2"
16
16
  },
17
17
  "dependencies": {
18
- "@bloopjs/bloop": "^0.0.78",
19
- "@bloopjs/toodle": "^0.1.1",
20
- "@bloopjs/web": "^0.0.78"
18
+ "@bloopjs/bloop": "^0.0.80",
19
+ "@bloopjs/toodle": "^0.1.3",
20
+ "@bloopjs/web": "^0.0.80"
21
21
  }
22
22
  }
@@ -1,5 +1,11 @@
1
1
  import { unwrap } from "@bloopjs/bloop";
2
- import type { Color, QuadNode, SceneNode, Text, Toodle } from "@bloopjs/toodle";
2
+ import type {
3
+ Color,
4
+ QuadNode,
5
+ SceneNode,
6
+ TextNode,
7
+ Toodle,
8
+ } from "@bloopjs/toodle";
3
9
  import { Colors } from "@bloopjs/toodle";
4
10
  import {
5
11
  BLOCK_SIZE,
@@ -33,11 +39,11 @@ export interface DrawState {
33
39
  p1: PoseQuads;
34
40
  p2: PoseQuads;
35
41
  viewport: SceneNode;
36
- p1Score: Text.TextNode;
37
- p2Score: Text.TextNode;
42
+ p1Score: TextNode;
43
+ p2Score: TextNode;
38
44
  // Title elements (under titleScreen)
39
- titleText: Text.TextNode;
40
- subtitleText: Text.TextNode;
45
+ titleText: TextNode;
46
+ subtitleText: TextNode;
41
47
  }
42
48
 
43
49
  export function createDrawState(toodle: Toodle): DrawState {
@@ -5,16 +5,10 @@ import { createChromaticAberrationEffect } from "./chromatic-aberration";
5
5
  import { createDrawState, draw as drawFn } from "./draw";
6
6
  import { game } from "./game";
7
7
 
8
- // In dev, vite serves wasm from /bloop-wasm/. In prod, it's bundled at ./bloop.wasm
9
- const wasmUrl = import.meta.env.DEV
10
- ? new URL("/bloop-wasm/bloop.wasm", window.location.href)
11
- : new URL("./bloop.wasm", import.meta.url);
12
-
13
8
  let draw = drawFn;
14
9
 
15
10
  const app = await start({
16
11
  game,
17
- engineWasmUrl: wasmUrl,
18
12
  startRecording: false,
19
13
  debugUi: {
20
14
  initiallyVisible: false,
@@ -113,14 +107,10 @@ game.system("title-input", {
113
107
  // HMR support
114
108
  if (import.meta.hot) {
115
109
  import.meta.hot.accept("./game", async (newModule) => {
116
- if (newModule?.game) {
117
- await app.acceptHmr(newModule.game, { wasmUrl });
118
- }
110
+ await app.acceptHmr(newModule?.game);
119
111
  });
120
112
 
121
113
  import.meta.hot.accept("./draw", async (newModule) => {
122
- if (newModule?.draw && newModule?.createDrawState) {
123
- draw = newModule.draw;
124
- }
114
+ draw = newModule?.draw;
125
115
  });
126
116
  }
@@ -33,7 +33,7 @@ async function loadTape(bytes: Uint8Array, fileName: string) {
33
33
  // Start the app with recording disabled (we're loading a tape)
34
34
  const app = await start({
35
35
  game,
36
- engineWasmUrl: wasmUrl,
36
+ wasmUrl: wasmUrl,
37
37
  debugUi: true,
38
38
  startRecording: false,
39
39
  });