@techstream/quark-create-app 1.8.0 → 1.10.0

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.
Files changed (80) hide show
  1. package/README.md +2 -2
  2. package/package.json +3 -3
  3. package/src/index.js +415 -150
  4. package/src/utils.js +36 -0
  5. package/src/utils.test.js +63 -0
  6. package/templates/base-project/.cursor/rules/quark.mdc +172 -0
  7. package/templates/base-project/.github/copilot-instructions.md +55 -0
  8. package/templates/base-project/.github/workflows/release.yml +37 -8
  9. package/templates/base-project/CLAUDE.md +273 -0
  10. package/templates/base-project/README.md +72 -30
  11. package/templates/base-project/apps/web/next.config.js +5 -1
  12. package/templates/base-project/apps/web/package.json +7 -5
  13. package/templates/base-project/apps/web/public/quark.svg +46 -0
  14. package/templates/base-project/apps/web/railway.json +2 -2
  15. package/templates/base-project/apps/web/src/app/_components/HealthIndicator.js +85 -0
  16. package/templates/base-project/apps/web/src/app/_components/HomeThemeToggle.js +63 -0
  17. package/templates/base-project/apps/web/src/app/_components/QuarkAnimation.js +168 -0
  18. package/templates/base-project/apps/web/src/app/api/health/route.js +56 -17
  19. package/templates/base-project/apps/web/src/app/favicon.ico +0 -0
  20. package/templates/base-project/apps/web/src/app/global-error.js +53 -0
  21. package/templates/base-project/apps/web/src/app/globals.css +121 -15
  22. package/templates/base-project/apps/web/src/app/icon.svg +46 -0
  23. package/templates/base-project/apps/web/src/app/layout.js +1 -0
  24. package/templates/base-project/apps/web/src/app/not-found.js +35 -0
  25. package/templates/base-project/apps/web/src/app/page.js +38 -5
  26. package/templates/base-project/apps/web/src/lib/theme.js +23 -0
  27. package/templates/base-project/apps/web/src/proxy.js +10 -2
  28. package/templates/base-project/package.json +16 -1
  29. package/templates/base-project/packages/db/package.json +4 -4
  30. package/templates/base-project/packages/db/src/client.js +6 -1
  31. package/templates/base-project/packages/db/src/index.js +1 -0
  32. package/templates/base-project/packages/db/src/ping.js +66 -0
  33. package/templates/base-project/scripts/doctor.js +261 -0
  34. package/templates/base-project/turbo.json +2 -1
  35. package/templates/config/package.json +1 -0
  36. package/templates/config/src/index.js +1 -3
  37. package/templates/config/src/validate-env.js +79 -3
  38. package/templates/jobs/package.json +2 -1
  39. package/templates/ui/README.md +67 -0
  40. package/templates/ui/package.json +1 -0
  41. package/templates/ui/src/badge.js +32 -0
  42. package/templates/ui/src/badge.test.js +42 -0
  43. package/templates/ui/src/button.js +64 -15
  44. package/templates/ui/src/button.test.js +34 -5
  45. package/templates/ui/src/card.js +58 -0
  46. package/templates/ui/src/card.test.js +59 -0
  47. package/templates/ui/src/checkbox.js +35 -0
  48. package/templates/ui/src/checkbox.test.js +35 -0
  49. package/templates/ui/src/dialog.js +139 -0
  50. package/templates/ui/src/dialog.test.js +15 -0
  51. package/templates/ui/src/index.js +16 -0
  52. package/templates/ui/src/input.js +15 -0
  53. package/templates/ui/src/input.test.js +27 -0
  54. package/templates/ui/src/label.js +14 -0
  55. package/templates/ui/src/label.test.js +22 -0
  56. package/templates/ui/src/select.js +42 -0
  57. package/templates/ui/src/select.test.js +27 -0
  58. package/templates/ui/src/skeleton.js +14 -0
  59. package/templates/ui/src/skeleton.test.js +22 -0
  60. package/templates/ui/src/table.js +75 -0
  61. package/templates/ui/src/table.test.js +69 -0
  62. package/templates/ui/src/textarea.js +15 -0
  63. package/templates/ui/src/textarea.test.js +27 -0
  64. package/templates/ui/src/theme-constants.js +24 -0
  65. package/templates/ui/src/theme.js +132 -0
  66. package/templates/ui/src/toast.js +229 -0
  67. package/templates/ui/src/toast.test.js +23 -0
  68. package/templates/{base-project/apps/worker → worker}/package.json +2 -2
  69. package/templates/{base-project/apps/worker → worker}/src/index.js +38 -23
  70. package/templates/{base-project/apps/worker → worker}/src/index.test.js +19 -20
  71. package/templates/base-project/apps/web/public/file.svg +0 -1
  72. package/templates/base-project/apps/web/public/globe.svg +0 -1
  73. package/templates/base-project/apps/web/public/next.svg +0 -1
  74. package/templates/base-project/apps/web/public/vercel.svg +0 -1
  75. package/templates/base-project/apps/web/public/window.svg +0 -1
  76. /package/templates/{base-project/apps/worker → worker}/README.md +0 -0
  77. /package/templates/{base-project/apps/worker → worker}/railway.json +0 -0
  78. /package/templates/{base-project/apps/worker → worker}/src/handlers/email.js +0 -0
  79. /package/templates/{base-project/apps/worker → worker}/src/handlers/files.js +0 -0
  80. /package/templates/{base-project/apps/worker → worker}/src/handlers/index.js +0 -0
@@ -362,9 +362,9 @@ describe("throttledError", () => {
362
362
 
363
363
  throttle(new Error("Redis unavailable"));
364
364
 
365
- assert.strictEqual(logger.error.mock.callCount(), 1);
366
- const call = logger.error.mock.calls[0];
367
- assert.ok(call.arguments[0].includes("Connection error"));
365
+ assert.strictEqual(logger.warn.mock.callCount(), 1);
366
+ const call = logger.warn.mock.calls[0];
367
+ assert.ok(call.arguments[0].includes("Waiting for Redis"));
368
368
  });
369
369
 
370
370
  test("suppresses duplicate errors within window", () => {
@@ -372,15 +372,15 @@ describe("throttledError", () => {
372
372
  const throttle = throttledError(logger, 100);
373
373
 
374
374
  throttle(new Error("Redis unavailable"));
375
- assert.strictEqual(logger.error.mock.callCount(), 1);
375
+ assert.strictEqual(logger.warn.mock.callCount(), 1);
376
376
 
377
377
  // Same error within window — should be suppressed
378
378
  throttle(new Error("Redis unavailable"));
379
- assert.strictEqual(logger.error.mock.callCount(), 1);
379
+ assert.strictEqual(logger.warn.mock.callCount(), 1);
380
380
 
381
381
  // Different error within window — should log
382
382
  throttle(new Error("Redis timeout"));
383
- assert.strictEqual(logger.error.mock.callCount(), 2);
383
+ assert.strictEqual(logger.warn.mock.callCount(), 2);
384
384
  });
385
385
 
386
386
  test("logs error again after window expires", async () => {
@@ -388,18 +388,18 @@ describe("throttledError", () => {
388
388
  const throttle = throttledError(logger, 50); // 50ms window
389
389
 
390
390
  throttle(new Error("Redis unavailable"));
391
- assert.strictEqual(logger.error.mock.callCount(), 1);
391
+ assert.strictEqual(logger.warn.mock.callCount(), 1);
392
392
 
393
393
  // Same error within window — suppressed
394
394
  throttle(new Error("Redis unavailable"));
395
- assert.strictEqual(logger.error.mock.callCount(), 1);
395
+ assert.strictEqual(logger.warn.mock.callCount(), 1);
396
396
 
397
397
  // Wait for window to expire
398
398
  await new Promise((resolve) => setTimeout(resolve, 60));
399
399
 
400
400
  // Same error after window — logged again
401
401
  throttle(new Error("Redis unavailable"));
402
- assert.strictEqual(logger.error.mock.callCount(), 2);
402
+ assert.strictEqual(logger.warn.mock.callCount(), 2);
403
403
  });
404
404
 
405
405
  test("includes error details in log", () => {
@@ -410,11 +410,10 @@ describe("throttledError", () => {
410
410
  error.code = "ECONNREFUSED";
411
411
  throttle(error);
412
412
 
413
- const call = logger.error.mock.calls[0];
413
+ const call = logger.warn.mock.calls[0];
414
414
  const args = call.arguments;
415
- assert.strictEqual(args[0], "Connection error (will retry)");
416
- assert.ok(args[1].error.includes("ECONNREFUSED"));
417
- assert.ok(args[1].timestamp); // Should have timestamp
415
+ assert.strictEqual(args[0], "Waiting for Redis");
416
+ assert.ok(args[1].reason.includes("ECONNREFUSED"));
418
417
  });
419
418
 
420
419
  test("uses default 5 second window if not specified", async () => {
@@ -422,14 +421,14 @@ describe("throttledError", () => {
422
421
  const throttle = throttledError(logger); // No window specified
423
422
 
424
423
  throttle(new Error("Test"));
425
- assert.strictEqual(logger.error.mock.callCount(), 1);
424
+ assert.strictEqual(logger.warn.mock.callCount(), 1);
426
425
 
427
426
  throttle(new Error("Test"));
428
- assert.strictEqual(logger.error.mock.callCount(), 1); // Suppressed
427
+ assert.strictEqual(logger.warn.mock.callCount(), 1); // Suppressed
429
428
 
430
429
  // 5 second default window hasn't expired
431
430
  throttle(new Error("Test"));
432
- assert.strictEqual(logger.error.mock.callCount(), 1); // Still suppressed
431
+ assert.strictEqual(logger.warn.mock.callCount(), 1); // Still suppressed
433
432
  });
434
433
  });
435
434
 
@@ -479,7 +478,7 @@ describe("waitForRedis", () => {
479
478
  maxRetries: 2,
480
479
  intervalMs: 10,
481
480
  }),
482
- { message: /Failed to connect to Redis after 2 attempts/ },
481
+ { message: /Redis unavailable at .+ after 2 attempts/ },
483
482
  );
484
483
 
485
484
  assert.strictEqual(healthCheck.mock.callCount(), 2);
@@ -496,7 +495,7 @@ describe("waitForRedis", () => {
496
495
  maxRetries: 5,
497
496
  intervalMs: 10,
498
497
  }),
499
- { message: "Invalid configuration" },
498
+ { message: "Redis health check failed: Invalid configuration" },
500
499
  );
501
500
 
502
501
  // Should fail immediately, not retry 5 times
@@ -514,7 +513,7 @@ describe("waitForRedis", () => {
514
513
  maxRetries: 4,
515
514
  intervalMs: 10,
516
515
  }),
517
- /Failed to connect to Redis after 4 attempts/,
516
+ /Redis unavailable at .+ after 4 attempts/,
518
517
  );
519
518
 
520
519
  assert.strictEqual(healthCheck.mock.callCount(), 4);
@@ -565,7 +564,7 @@ describe("waitForRedis", () => {
565
564
  // Call without explicit config — should use env defaults
566
565
  await assert.rejects(
567
566
  () => waitForRedis(healthCheck),
568
- /Failed to connect to Redis after 2 attempts/,
567
+ /Redis unavailable at .+ after 2 attempts/,
569
568
  );
570
569
 
571
570
  assert.strictEqual(healthCheck.mock.callCount(), 2);
@@ -1 +0,0 @@
1
- <svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>
@@ -1 +0,0 @@
1
- <svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6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4 1000H0z" fill="#fff"/></svg>
@@ -1 +0,0 @@
1
- <svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>