diff --git a/templates/basic-ts/package.json b/templates/basic-ts/package.json index fc878eb6eaf..1333ab51786 100644 --- a/templates/basic-ts/package.json +++ b/templates/basic-ts/package.json @@ -7,6 +7,7 @@ "dev": "esbuild src/main.ts --bundle --platform=node --outfile=dist/main.js --format=esm && node dist/main.js", "start": "node dist/main.js", "build": "esbuild src/main.ts --bundle --platform=node --outfile=dist/main.js --format=esm", + "generate": "cargo run -p gen-bindings -- --out-dir src/module_bindings --module-path spacetimedb && prettier --write src/module_bindings", "spacetime:generate": "spacetime generate --lang typescript --out-dir src/module_bindings --module-path spacetimedb", "spacetime:publish:local": "spacetime publish --module-path spacetimedb --server local", "spacetime:publish": "spacetime publish --module-path spacetimedb --server maincloud" diff --git a/templates/basic-ts/spacetimedb/pnpm-lock.yaml b/templates/basic-ts/spacetimedb/pnpm-lock.yaml deleted file mode 100644 index b8b7739cda8..00000000000 --- a/templates/basic-ts/spacetimedb/pnpm-lock.yaml +++ /dev/null @@ -1,51 +0,0 @@ -lockfileVersion: '9.0' - -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - -importers: - - .: - dependencies: - spacetimedb: - specifier: 1.* - version: 1.9.0 - -packages: - - base64-js@1.5.1: - resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} - - fast-text-encoding@1.0.6: - resolution: {integrity: sha512-VhXlQgj9ioXCqGstD37E/HBeqEGV/qOD/kmbVG8h5xKBYvM1L3lR1Zn4555cQ8GkYbJa8aJSipLPndE1k6zK2w==} - - prettier@3.6.2: - resolution: {integrity: sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==} - engines: {node: '>=14'} - hasBin: true - - spacetimedb@1.9.0: - resolution: {integrity: sha512-cl/HeO50A1z6JgUZpA7pJcTspBE4IfH1SJJU8f1DpZ4hYHvQesbbYFHPPIC181s8zexdVAj5NnvFOPwQnSrcXg==} - peerDependencies: - react: ^18.0.0 || ^19.0.0-0 || ^19.0.0 - undici: ^6.19.2 - peerDependenciesMeta: - react: - optional: true - undici: - optional: true - -snapshots: - - base64-js@1.5.1: {} - - fast-text-encoding@1.0.6: {} - - prettier@3.6.2: {} - - spacetimedb@1.9.0: - dependencies: - base64-js: 1.5.1 - fast-text-encoding: 1.0.6 - prettier: 3.6.2 diff --git a/templates/basic-ts/src/main.ts b/templates/basic-ts/src/main.ts index ff4c9cf3594..f46399a68e4 100644 --- a/templates/basic-ts/src/main.ts +++ b/templates/basic-ts/src/main.ts @@ -6,6 +6,14 @@ import { tables, } from './module_bindings/index.js'; +// `spacetime init` and `spacetime dev` write the connection settings to +// `.env.local`. Variables already set in the environment take precedence. +try { + process.loadEnvFile?.('.env.local'); +} catch { + // No `.env.local`: fall back to the defaults below. +} + const HOST = process.env.SPACETIMEDB_HOST ?? 'ws://localhost:3000'; const DB_NAME = process.env.SPACETIMEDB_DB_NAME ?? 'basic-ts'; diff --git a/templates/basic-ts/src/module_bindings/index.ts b/templates/basic-ts/src/module_bindings/index.ts index 6c6ffeb31f4..f018be7d58a 100644 --- a/templates/basic-ts/src/module_bindings/index.ts +++ b/templates/basic-ts/src/module_bindings/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 2.0.0 (commit 098afaf1a5ed935bce5a32c88620e829506effe7). +// This was generated using spacetimedb cli version 2.11.0 (commit e3c44516f104cd029a3b0efdaaedad091367196c). /* eslint-disable */ /* tslint:disable */ @@ -68,7 +68,7 @@ const proceduresSchema = __procedures(); /** The remote SpacetimeDB module schema, both runtime and type information. */ const REMOTE_MODULE = { versionInfo: { - cliVersion: '2.0.0' as const, + cliVersion: '2.11.0' as const, }, tables: tablesSchema.schemaType.tables, reducers: reducersSchema.reducersType.reducers, @@ -88,6 +88,9 @@ export const reducers = __convertToAccessorMap( reducersSchema.reducersType.reducers ); +/** The procedures available in this remote SpacetimeDB module. */ +export const procedures = __convertToAccessorMap(proceduresSchema.procedures); + /** The context type returned in callbacks for all possible events. */ export type EventContext = __EventContextInterface; /** The context type returned in callbacks for reducer events. */