create-z3 0.0.13 → 0.0.15

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/index.js CHANGED
@@ -6,7 +6,7 @@ import { select, input, checkbox, confirm, Separator } from "@inquirer/prompts";
6
6
  import chalk2 from "chalk";
7
7
  import { readFileSync } from "fs";
8
8
  import { fileURLToPath as fileURLToPath2 } from "url";
9
- import { dirname as dirname2, join as join3 } from "path";
9
+ import { dirname as dirname2, join as join4 } from "path";
10
10
 
11
11
  // src/utils/validation.ts
12
12
  import validateNpmPackageName from "validate-npm-package-name";
@@ -2473,11 +2473,137 @@ var TanStackInstaller = class extends FrameworkInstaller {
2473
2473
  }
2474
2474
  };
2475
2475
 
2476
+ // src/installers/nextjs.ts
2477
+ import { join as join3 } from "path";
2478
+ var NextJSInstaller = class extends FrameworkInstaller {
2479
+ /**
2480
+ * Framework identifier for Next.js
2481
+ */
2482
+ get frameworkName() {
2483
+ return "nextjs";
2484
+ }
2485
+ /**
2486
+ * Update OAuth configuration in Convex auth file
2487
+ * Target file: convex/auth/index.ts (SAME as TanStack)
2488
+ * Placeholders: // {{EMAIL_PASSWORD_AUTH}} and // {{OAUTH_PROVIDERS}}
2489
+ *
2490
+ * @param selectedProviders - Array of provider IDs to configure
2491
+ * @param emailPasswordEnabled - Whether email/password authentication is enabled
2492
+ */
2493
+ async updateOAuthConfig(selectedProviders, emailPasswordEnabled) {
2494
+ const authFilePath = join3(this.targetPath, "convex/auth/index.ts");
2495
+ const authProvidersBlock = generateAuthProvidersBlock(
2496
+ selectedProviders,
2497
+ emailPasswordEnabled
2498
+ );
2499
+ await replacePlaceholder(
2500
+ authFilePath,
2501
+ "// {{OAUTH_PROVIDERS}}",
2502
+ authProvidersBlock
2503
+ );
2504
+ await replacePlaceholder(
2505
+ authFilePath,
2506
+ "// {{EMAIL_PASSWORD_AUTH}}",
2507
+ "",
2508
+ { graceful: true }
2509
+ );
2510
+ }
2511
+ /**
2512
+ * Update OAuth UI configuration in auth client file
2513
+ * Target file: src/auth/client.tsx (DIFFERENT from TanStack: src/providers.tsx)
2514
+ * Placeholder: // {{OAUTH_UI_PROVIDERS}}
2515
+ *
2516
+ * @param selectedProviders - Array of provider IDs to configure
2517
+ */
2518
+ async updateOAuthUIConfig(selectedProviders) {
2519
+ const providersFilePath = join3(this.targetPath, "src/auth/client.tsx");
2520
+ const uiConfigBlock = generateOAuthUIProvidersBlock(selectedProviders);
2521
+ await replacePlaceholder(
2522
+ providersFilePath,
2523
+ "// {{OAUTH_UI_PROVIDERS}}",
2524
+ uiConfigBlock
2525
+ );
2526
+ }
2527
+ /**
2528
+ * Update .env.example with OAuth environment variables
2529
+ * Target file: .env.example (SAME as TanStack)
2530
+ * Placeholder: # {{ENV_OAUTH_VARS}}
2531
+ * Applies NEXT_PUBLIC_ prefix for client-side variables (DIFFERENT parameter from TanStack)
2532
+ *
2533
+ * @param selectedProviders - Array of provider IDs to configure
2534
+ */
2535
+ async updateEnvExample(selectedProviders) {
2536
+ const envFilePath = join3(this.targetPath, ".env.example");
2537
+ const envVarsBlock = generateEnvVarsBlock(selectedProviders, "nextjs");
2538
+ await replacePlaceholder(
2539
+ envFilePath,
2540
+ "# {{ENV_OAUTH_VARS}}",
2541
+ envVarsBlock
2542
+ );
2543
+ }
2544
+ /**
2545
+ * Update README with OAuth provider setup guides
2546
+ * Target file: README.md (SAME as TanStack)
2547
+ * Placeholder: <!-- {{OAUTH_SETUP_GUIDE}} -->
2548
+ * Handles missing placeholder gracefully with warning
2549
+ *
2550
+ * @param selectedProviders - Array of provider IDs to configure
2551
+ */
2552
+ async updateReadme(selectedProviders) {
2553
+ const readmeFilePath = join3(this.targetPath, "README.md");
2554
+ const readmeSection = generateReadmeSection(selectedProviders);
2555
+ await replacePlaceholder(
2556
+ readmeFilePath,
2557
+ "<!-- {{OAUTH_SETUP_GUIDE}} -->",
2558
+ readmeSection,
2559
+ { graceful: true }
2560
+ );
2561
+ }
2562
+ /**
2563
+ * Apply TweakCN theme to global CSS file
2564
+ * Target file: src/app/(frontend)/globals.css (DIFFERENT from TanStack: src/styles/globals.css)
2565
+ * Placeholder: CSS comment with TWEAKCN_THEME variable
2566
+ *
2567
+ * @param themeContent - CSS content to apply
2568
+ */
2569
+ async applyTweakCNTheme(themeContent) {
2570
+ const cssFilePath = join3(this.targetPath, "src/app/(frontend)/globals.css");
2571
+ await replacePlaceholder(
2572
+ cssFilePath,
2573
+ "/* {{TWEAKCN_THEME}} */",
2574
+ themeContent
2575
+ );
2576
+ }
2577
+ /**
2578
+ * Update env.mjs with OAuth provider environment variables
2579
+ * Target file: src/env.mjs (DIFFERENT from TanStack: src/env.ts - Next.js uses env.mjs)
2580
+ * Placeholders: // {{OAUTH_ENV_SERVER_SCHEMA}} and // {{OAUTH_ENV_RUNTIME_MAPPING}}
2581
+ * Adds zod schema validation and runtime mappings for OAuth credentials
2582
+ *
2583
+ * @param selectedProviders - Array of provider IDs to configure
2584
+ */
2585
+ async updateEnvTs(selectedProviders) {
2586
+ const envFilePath = join3(this.targetPath, "src/env.mjs");
2587
+ const serverSchema = generateEnvTsServerSchema(selectedProviders);
2588
+ await replacePlaceholder(
2589
+ envFilePath,
2590
+ "// {{OAUTH_ENV_SERVER_SCHEMA}}",
2591
+ serverSchema
2592
+ );
2593
+ const runtimeMapping = generateEnvTsRuntimeMapping(selectedProviders);
2594
+ await replacePlaceholder(
2595
+ envFilePath,
2596
+ "// {{OAUTH_ENV_RUNTIME_MAPPING}}",
2597
+ runtimeMapping
2598
+ );
2599
+ }
2600
+ };
2601
+
2476
2602
  // src/index.ts
2477
2603
  var __filename = fileURLToPath2(import.meta.url);
2478
2604
  var __dirname = dirname2(__filename);
2479
2605
  var packageJson = JSON.parse(
2480
- readFileSync(join3(__dirname, "../package.json"), "utf-8")
2606
+ readFileSync(join4(__dirname, "../package.json"), "utf-8")
2481
2607
  );
2482
2608
  var program = new Command();
2483
2609
  async function promptOAuthProviders() {
@@ -2633,7 +2759,7 @@ program.name("create-z3").version(packageJson.version).description("CLI for scaf
2633
2759
  if (framework === "tanstack") {
2634
2760
  installer = new TanStackInstaller(createdPath, projectName);
2635
2761
  } else {
2636
- throw new Error("Next.js installer not yet implemented. Please use TanStack Start.");
2762
+ installer = new NextJSInstaller(createdPath, projectName);
2637
2763
  }
2638
2764
  try {
2639
2765
  await installer.initProject(projectOptions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-z3",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "type": "module",
5
5
  "description": "CLI for scaffolding Z3 Stack applications (TanStack/Next.js + Convex + Better Auth)",
6
6
  "bin": {
@@ -0,0 +1,18 @@
1
+ # Since the ".env" file is gitignored, you can use the ".env.example" file to
2
+ # build a new ".env" file when you clone the repo. Keep this file up-to-date
3
+ # when you add new variables to `.env`.
4
+
5
+ # This file will be committed to version control, so make sure not to have any
6
+ # secrets in it. If you are cloning this repo, create a copy of this file named
7
+ # ".env" and populate it with your secrets.
8
+
9
+ # When adding additional environment variables, the schema in "/src/env.js"
10
+ # should be updated accordingly.
11
+
12
+ NEXT_PUBLIC_CONVEX_URL=""
13
+ NEXT_PUBLIC_CONVEX_SITE_URL=""
14
+
15
+ NEXT_PUBLIC_SITE_URL="http://localhost:3000"
16
+ BETTER_AUTH_SECRET=""
17
+
18
+ # {{ENV_OAUTH_VARS}}