create-feltdb 0.8.2 → 0.8.4

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/create.js CHANGED
@@ -79,8 +79,10 @@ export async function createProject(options) {
79
79
  }
80
80
  fs.writeFileSync(path.join(projectDir, 'package.json'), JSON.stringify(packageJson, null, 2));
81
81
  // Create feltdb.config.json
82
+ const deploymentMode = runtime === 'browser' ? 'browser' : runtime === 'node' ? 'local' : 'remote';
82
83
  const feltdbConfig = {
83
84
  namespace: applicationName,
85
+ mode: deploymentMode,
84
86
  runtime,
85
87
  storage: runtime === 'browser' ? 'indexeddb' : runtime === 'managed' ? 'managed' : 'durable',
86
88
  distributed,
@@ -195,13 +197,6 @@ ${hasAgents ? ` agent WorkspaceAssistant {
195
197
  }
196
198
  fs.writeFileSync(path.join(projectDir, 'tsconfig.json'), JSON.stringify(tsconfig, null, 2));
197
199
  // Create main application files
198
- const runtimeOptions = runtime === 'browser'
199
- ? "{ namespace: import.meta.env.VITE_FELTDB_NAMESPACE || '" + applicationName + "', browser: true }"
200
- : runtime === 'managed'
201
- ? "{ namespace: '" + applicationName + "', server: { url: import.meta.env.VITE_FELTDB_MANAGED_URL || '', applicationId: import.meta.env.VITE_FELTDB_MANAGED_APPLICATION_ID, environment: 'production' } }"
202
- : runtime === 'self-hosted'
203
- ? "{ namespace: import.meta.env.VITE_FELTDB_NAMESPACE || '" + applicationName + "', server: { url: import.meta.env.VITE_FELTDB_URL || 'http://localhost:7700', token: import.meta.env.VITE_FELTDB_API_KEY || '' } }"
204
- : "{ namespace: import.meta.env.VITE_FELTDB_NAMESPACE || '" + applicationName + "', memory: true }";
205
200
  const feltdbTs = `import { configureDevelopmentRuntimeBridge, createFeltDB } from '@feltdb/core';
206
201
 
207
202
  configureDevelopmentRuntimeBridge({
@@ -214,7 +209,7 @@ configureDevelopmentRuntimeBridge({
214
209
  applicationUrl: import.meta.env.VITE_FELTDB_APPLICATION_URL,
215
210
  });
216
211
 
217
- export const db = createFeltDB(${runtimeOptions});
212
+ export const db = createFeltDB();
218
213
 
219
214
  // Collections
220
215
  export const projects = db.collection('Project');
@@ -1198,7 +1193,7 @@ root.render(
1198
1193
  }
1199
1194
  fs.writeFileSync(path.join(projectDir, 'feltdb.flow'), fs.readFileSync(path.join(canonicalTemplate, 'feltdb.flow'), 'utf8').replace('app FeltDBStarter', `app ${appName}`));
1200
1195
  const databasePath = path.join(srcDir, 'feltdb.ts');
1201
- fs.writeFileSync(databasePath, fs.readFileSync(databasePath, 'utf8').replace(/export const managedRuntime[\s\S]*?\n\} : \{ namespace: import\.meta\.env\.VITE_FELTDB_NAMESPACE \|\| 'feltdb-starter', browser: true \}\);/, `export const managedRuntime = ${runtime === 'managed'};\nexport const db = createFeltDB(${runtimeOptions});`));
1196
+ fs.writeFileSync(databasePath, fs.readFileSync(databasePath, 'utf8').replace(/export const managedRuntime[\s\S]*?\n\} : \{ namespace: import\.meta\.env\.VITE_FELTDB_NAMESPACE \|\| 'feltdb-starter', browser: true \}\);/, `export const managedRuntime = ${runtime === 'managed'};\nexport const db = createFeltDB();`));
1202
1197
  }
1203
1198
  }
1204
1199
  else {
@@ -1234,18 +1229,27 @@ main().catch(console.error);
1234
1229
  const envExample = `# FeltDB Configuration
1235
1230
  # Copy this file to .env.local and update the values
1236
1231
 
1237
- # API key for authenticated self-hosted browser access
1238
- VITE_FELTDB_API_KEY=
1239
-
1240
- # FeltDB Server URL (self-hosted or managed runtime)
1241
- VITE_FELTDB_URL=http://localhost:7700
1242
-
1243
- # Managed example: https://runtime.your-app.feltdb.com
1244
- VITE_FELTDB_MANAGED_URL=
1245
- VITE_FELTDB_MANAGED_APPLICATION_ID=
1246
- # Server/control-plane only. Never rename with a VITE_ prefix.
1247
- FELTDB_MANAGED_CONTROL_API_KEY=
1248
- FELTDB_TOKEN=
1232
+ # Canonical application-plane deployment configuration consumed by createFeltDB()
1233
+ # Supported public modes: browser, local, remote
1234
+ VITE_FELTDB_MODE=${deploymentMode}
1235
+ VITE_FELTDB_NAMESPACE=${applicationName}
1236
+ VITE_FELTDB_ENVIRONMENT=development
1237
+
1238
+ # FeltDB Server URL (self-hosted or managed runtime)
1239
+ VITE_FELTDB_URL=http://localhost:7700
1240
+
1241
+ # Optional credential for authenticated remote browser access
1242
+ VITE_FELTDB_TOKEN=
1243
+ # Legacy alias accepted by older tooling
1244
+ VITE_FELTDB_API_KEY=
1245
+
1246
+ # Managed example: https://runtime.your-app.feltdb.com
1247
+ VITE_FELTDB_MANAGED_URL=
1248
+ VITE_FELTDB_MANAGED_APPLICATION_ID=
1249
+ VITE_FELTDB_APPLICATION_ID=
1250
+ # Server/control-plane only. Never rename with a VITE_ prefix.
1251
+ FELTDB_MANAGED_CONTROL_API_KEY=
1252
+ FELTDB_TOKEN=
1249
1253
 
1250
1254
  # Override the default self-hosted container image
1251
1255
  # By default the server image is built locally from the bundled source.
@@ -100,6 +100,17 @@ export async function configureManagedAccount(options) {
100
100
  }
101
101
  const environment = [
102
102
  '# Generated by create-feltdb managed setup. Do not commit this file.',
103
+ 'FELTDB_MODE=remote',
104
+ `FELTDB_URL=${apiUrl}`,
105
+ `FELTDB_APPLICATION_ID=${application.id}`,
106
+ `FELTDB_NAMESPACE=${application.namespace || options.namespace}`,
107
+ 'FELTDB_ENVIRONMENT=production',
108
+ '# Browser-safe deployment identity aliases.',
109
+ 'VITE_FELTDB_MODE=remote',
110
+ `VITE_FELTDB_URL=${apiUrl}`,
111
+ `VITE_FELTDB_APPLICATION_ID=${application.id}`,
112
+ `VITE_FELTDB_NAMESPACE=${application.namespace || options.namespace}`,
113
+ 'VITE_FELTDB_ENVIRONMENT=production',
103
114
  `VITE_FELTDB_MANAGED_URL=${apiUrl}`,
104
115
  `VITE_FELTDB_MANAGED_APPLICATION_ID=${application.id}`,
105
116
  '# Control-plane credential. Never prefix this with VITE_ or expose it to browser code.',
@@ -1,4 +1,4 @@
1
1
  // One release train keeps generated applications installable. The repository
2
2
  // validation script checks these values against every workspace manifest.
3
- export const FELTDB_PACKAGE_VERSION = '0.8.2';
3
+ export const FELTDB_PACKAGE_VERSION = '0.8.4';
4
4
  export const feltdbPackageRange = `^${FELTDB_PACKAGE_VERSION}`;