Skip to content

Commit e256cef

Browse files
authored
Change deno quickstart to use package.json instead of deno.json (#4374)
# Description of Changes Deno quickstart template now uses `package.json` instead of `deno.json` so `spacetime dev` can run it. Added `templates/deno-ts/package.json`, removed `deno.json`, and updated the Deno quickstart doc. # API and ABI breaking changes None. # Expected complexity level and risk **1** — Template and docs only. # Testing - [ ] `spacetime dev --template deno-ts` and confirm client runs. - [ ] Spot-check updated Deno quickstart doc.
1 parent ba15373 commit e256cef

2 files changed

Lines changed: 22 additions & 17 deletions

File tree

docs/docs/00100-intro/00200-quickstarts/00275-deno.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ my-spacetime-app/
5252
├── src/
5353
│ ├── main.ts # Deno client script
5454
│ └── module_bindings/ # Auto-generated types
55-
└── deno.json # Deno config and tasks
55+
└── package.json # Scripts and dependencies (dev, start, spacetime:generate)
5656
```
5757

5858
</StepCode>
@@ -102,12 +102,12 @@ spacetimedb.reducer('say_hello', ctx => {
102102
<StepCode>
103103
```bash
104104
# Run with auto-reload during development
105-
deno task dev
105+
pnpm run dev
106+
# or: npm run dev
106107

107108
# Or run once
108-
109-
deno task start
110-
109+
pnpm run start
110+
# or: npm run start
111111
```
112112
</StepCode>
113113
</Step>
@@ -237,29 +237,30 @@ spacetime logs
237237
238238
**Built-in TypeScript:** Deno runs TypeScript directly without transpilation, making startup faster and eliminating the need for build tools.
239239
240-
**Import maps:** The `deno.json` file defines import maps, allowing you to import `spacetimedb` directly without `npm:` prefix in your code.
240+
**Dependencies:** The `package.json` file declares the `spacetimedb` dependency; Deno resolves it from there (and from `node_modules` after `pnpm install` when developing in the SpacetimeDB repo).
241241
242-
**No node_modules:** Deno caches dependencies globally, so there's no `node_modules` folder to manage.
242+
**node_modules:** When using the template from the repo workspace, run `pnpm install` so `spacetimedb` is linked. For a project created with `spacetime init`, Deno resolves the versioned dependency from package.json.
243243
</StepText>
244244
<StepCode>
245245
```bash
246246
# Configure via environment variables
247247
SPACETIMEDB_HOST=ws://localhost:3000 \
248248
SPACETIMEDB_DB_NAME=my-app \
249-
deno task start
249+
pnpm run start
250250
251251
# Or run with explicit permissions
252252
deno run --allow-net --allow-read --allow-write --allow-env --unstable-sloppy-imports src/main.ts
253253
254-
# The deno.json configures tasks and imports
255-
cat deno.json
254+
# package.json defines scripts and the spacetimedb dependency
255+
cat package.json
256256
{
257-
"tasks": {
257+
"scripts": {
258258
"dev": "deno run --watch --allow-net --allow-read --allow-write --allow-env --unstable-sloppy-imports src/main.ts",
259-
"start": "deno run --allow-net --allow-read --allow-write --allow-env --unstable-sloppy-imports src/main.ts"
259+
"start": "deno run --allow-net --allow-read --allow-write --allow-env --unstable-sloppy-imports src/main.ts",
260+
"spacetime:generate": "spacetime generate --lang typescript --out-dir src/module_bindings --module-path spacetimedb"
260261
},
261-
"imports": {
262-
"spacetimedb": "npm:spacetimedb@1.*"
262+
"dependencies": {
263+
"spacetimedb": "workspace:*"
263264
}
264265
}
265266
````
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
{
2-
"tasks": {
2+
"name": "@clockworklabs/deno-ts",
3+
"private": true,
4+
"version": "0.0.1",
5+
"type": "module",
6+
"scripts": {
37
"dev": "deno run --watch --allow-net --allow-read --allow-write --allow-env --unstable-sloppy-imports src/main.ts",
48
"start": "deno run --allow-net --allow-read --allow-write --allow-env --unstable-sloppy-imports src/main.ts",
59
"spacetime:generate": "spacetime generate --lang typescript --out-dir src/module_bindings --module-path spacetimedb"
610
},
7-
"imports": {
8-
"spacetimedb": "npm:spacetimedb@1.*"
11+
"dependencies": {
12+
"spacetimedb": "workspace:*"
913
}
1014
}

0 commit comments

Comments
 (0)