qarpeo 0.1.22 → 0.1.23

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.
@@ -9,7 +9,7 @@ import { fileURLToPath } from 'node:url';
9
9
  import { mkdir, writeFile, readFile } from 'node:fs/promises';
10
10
  import { defu } from 'defu';
11
11
 
12
- const version = "0.1.22";
12
+ const version = "0.1.23";
13
13
 
14
14
  function scanSchemaExports(schemaFiles) {
15
15
  const types = [];
@@ -1428,6 +1428,48 @@ const deploy = defineCommand({
1428
1428
  config = JSON.parse(readFileSync(wranglerConfigPath, "utf8"));
1429
1429
  } catch {
1430
1430
  }
1431
+ const rootConfigPath = [resolve(cwd, "wrangler.json"), resolve(cwd, "wrangler.jsonc")].find(
1432
+ (p) => existsSync(p)
1433
+ );
1434
+ let rootConfig = {};
1435
+ if (rootConfigPath) {
1436
+ try {
1437
+ rootConfig = JSON.parse(readFileSync(rootConfigPath, "utf8"));
1438
+ } catch {
1439
+ }
1440
+ }
1441
+ if (rootConfigPath && wranglerConfigPath !== rootConfigPath) {
1442
+ let reconciled = false;
1443
+ if (!rootConfig.durable_objects && config.durable_objects) {
1444
+ delete config.durable_objects;
1445
+ delete config.migrations;
1446
+ reconciled = true;
1447
+ }
1448
+ if (!rootConfig.kv_namespaces && config.kv_namespaces) {
1449
+ delete config.kv_namespaces;
1450
+ reconciled = true;
1451
+ }
1452
+ if (!rootConfig.r2_buckets && config.r2_buckets) {
1453
+ delete config.r2_buckets;
1454
+ reconciled = true;
1455
+ }
1456
+ if (!rootConfig.d1_databases && config.d1_databases) {
1457
+ delete config.d1_databases;
1458
+ reconciled = true;
1459
+ }
1460
+ if (!rootConfig.ai && config.ai) {
1461
+ delete config.ai;
1462
+ delete config.vectorize;
1463
+ reconciled = true;
1464
+ }
1465
+ if (!rootConfig.queues && config.queues) {
1466
+ delete config.queues;
1467
+ reconciled = true;
1468
+ }
1469
+ if (reconciled) {
1470
+ writeFileSync(wranglerConfigPath, JSON.stringify(config, null, 2), "utf8");
1471
+ }
1472
+ }
1431
1473
  const defaultName = config.name || "qarpeo";
1432
1474
  const baseWorkerName = args.name || process.env.QARPEO_WORKER_NAME || process.env.WORKER_NAME || defaultName;
1433
1475
  const originalName = baseWorkerName;
@@ -1588,6 +1630,7 @@ const deploy = defineCommand({
1588
1630
  `
1589
1631
  \u26A1 [qarpeo] Applying D1 migrations for ${d1.database_name} (${isPreview ? "preview" : "remote"})...`
1590
1632
  );
1633
+ const migConfigPath = rootConfigPath || wranglerConfigPath;
1591
1634
  const migArgs = [
1592
1635
  "d1",
1593
1636
  "migrations",
@@ -1595,7 +1638,7 @@ const deploy = defineCommand({
1595
1638
  d1.database_name,
1596
1639
  "--remote",
1597
1640
  "-c",
1598
- wranglerConfigPath
1641
+ migConfigPath
1599
1642
  ];
1600
1643
  spawnBinSync(wranglerBin, migArgs, {
1601
1644
  cwd,
@@ -2404,28 +2447,29 @@ const init = defineCommand({
2404
2447
  }
2405
2448
  }
2406
2449
  }
2407
- if (existsSync(join(cwd, "server/db")) || existsSync(join(cwd, "server/database")) || existsSync(join(cwd, "migrations")) || /db:\s*true|d1:\s*true/i.test(nuxtConfigRaw) || wranglerRaw.includes("d1_databases")) {
2450
+ const cleanNuxtConfig = nuxtConfigRaw.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\/\/.*$/gm, "");
2451
+ if (existsSync(join(cwd, "server/db")) || existsSync(join(cwd, "server/database")) || existsSync(join(cwd, "migrations")) || /db:\s*true|d1:\s*true/i.test(cleanNuxtConfig)) {
2408
2452
  detectedFeatures.db = true;
2409
2453
  }
2410
- if (existsSync(join(cwd, "server/api/storage")) || existsSync(join(cwd, "server/api/blob")) || existsSync(join(cwd, "server/api/upload")) || /blob:\s*true|r2:\s*true|storage:\s*true/i.test(nuxtConfigRaw) || wranglerRaw.includes("r2_buckets")) {
2454
+ if (existsSync(join(cwd, "server/api/storage")) || existsSync(join(cwd, "server/api/blob")) || existsSync(join(cwd, "server/api/upload")) || /blob:\s*true|r2:\s*true|storage:\s*true/i.test(cleanNuxtConfig)) {
2411
2455
  detectedFeatures.blob = true;
2412
2456
  }
2413
- if (/kv:\s*true/i.test(nuxtConfigRaw) || wranglerRaw.includes("kv_namespaces")) {
2457
+ if (/kv:\s*true/i.test(cleanNuxtConfig)) {
2414
2458
  detectedFeatures.kv = true;
2415
2459
  }
2416
- if (existsSync(join(cwd, "server/realtime")) || existsSync(join(cwd, "server/durable-objects")) || /realtime:\s*true|durableObjects:\s*true/i.test(nuxtConfigRaw) || wranglerRaw.includes("durable_objects")) {
2460
+ if (existsSync(join(cwd, "server/realtime")) || existsSync(join(cwd, "server/durable-objects")) || /realtime:\s*true|durableObjects:\s*true/i.test(cleanNuxtConfig)) {
2417
2461
  detectedFeatures.realtime = true;
2418
2462
  }
2419
- if (/ai:\s*true|vectorize:\s*true/i.test(nuxtConfigRaw) || wranglerRaw.includes("vectorize")) {
2463
+ if (/ai:\s*true|vectorize:\s*true/i.test(cleanNuxtConfig)) {
2420
2464
  detectedFeatures.ai = true;
2421
2465
  }
2422
- if (/queue:\s*true/i.test(nuxtConfigRaw) || wranglerRaw.includes("queues")) {
2466
+ if (/queue:\s*true/i.test(cleanNuxtConfig)) {
2423
2467
  detectedFeatures.queue = true;
2424
2468
  }
2425
- if (existsSync(join(cwd, "server/auth")) || /auth:\s*true/i.test(nuxtConfigRaw) || /better-auth/i.test(nuxtConfigRaw)) {
2469
+ if (existsSync(join(cwd, "server/auth")) || /auth:\s*true/i.test(cleanNuxtConfig) || /better-auth/i.test(cleanNuxtConfig)) {
2426
2470
  detectedFeatures.auth = true;
2427
2471
  }
2428
- if (/cms:\s*true|cms:\s*\{/i.test(nuxtConfigRaw) || existsSync(join(cwd, "content"))) {
2472
+ if (/cms:\s*true|cms:\s*\{/i.test(cleanNuxtConfig) || existsSync(join(cwd, "content"))) {
2429
2473
  detectedFeatures.cms = true;
2430
2474
  }
2431
2475
  const selectedFeatures = { ...detectedFeatures };
@@ -2462,7 +2506,7 @@ const init = defineCommand({
2462
2506
  } else {
2463
2507
  for (const feat of AVAILABLE_FEATURES) {
2464
2508
  if (selectedFeatures[feat.key] === void 0) {
2465
- selectedFeatures[feat.key] = feat.default;
2509
+ selectedFeatures[feat.key] = detectedKeys.length === 0 ? feat.default : false;
2466
2510
  }
2467
2511
  }
2468
2512
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qarpeo",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "description": "Zero-config Cloudflare Edge Platform for Nuxt",
5
5
  "keywords": [
6
6
  "analytics-engine",