create-z3 0.0.15 → 0.0.17

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
@@ -1786,6 +1786,9 @@ async function replacePlaceholder(filePath, placeholder, content, options) {
1786
1786
  }
1787
1787
  await fs3.writeFile(filePath, updatedLines.join("\n"), "utf-8");
1788
1788
  }
1789
+ function generateCredentialsValue(enabled) {
1790
+ return enabled ? "true" : "false";
1791
+ }
1789
1792
  function generateAuthProvidersBlock(oauthProviders, emailPasswordEnabled) {
1790
1793
  const parts = [];
1791
1794
  if (emailPasswordEnabled) {
@@ -1856,12 +1859,9 @@ function generateEnvTsRuntimeMapping(providers) {
1856
1859
  }
1857
1860
  function generateOAuthUIProvidersBlock(providers) {
1858
1861
  if (providers.length === 0) {
1859
- return "__REMOVE_SOCIAL_PROP__";
1862
+ return "";
1860
1863
  }
1861
- const providerList = providers.map((id) => `"${id}"`).join(", ");
1862
- return `social={{
1863
- providers: [${providerList}]
1864
- }}`;
1864
+ return providers.map((id) => `"${id}"`).join(", ");
1865
1865
  }
1866
1866
  function generateEnvVarsBlock(providers, framework) {
1867
1867
  if (providers.length === 0) {
@@ -2123,6 +2123,24 @@ var FrameworkInstaller = class {
2123
2123
  spinner.warn("Failed to format code (you may need to run `npm run format` manually)");
2124
2124
  }
2125
2125
  }
2126
+ /**
2127
+ * Lint and fix code using project's ESLint configuration
2128
+ * Runs ESLint with --fix flag to auto-fix issues like import sorting
2129
+ * Non-blocking - continues even if linting fails
2130
+ */
2131
+ async lintCode() {
2132
+ const packageManager = this.detectPackageManager();
2133
+ const spinner = ora("Linting and fixing code...").start();
2134
+ try {
2135
+ await execa(packageManager, ["run", "lint", "--", "--fix"], {
2136
+ cwd: this.targetPath,
2137
+ stdio: "pipe"
2138
+ });
2139
+ spinner.succeed("Code linted and fixed successfully");
2140
+ } catch (error) {
2141
+ spinner.warn("Failed to lint code (you may need to run `npm run lint -- --fix` manually)");
2142
+ }
2143
+ }
2126
2144
  /**
2127
2145
  * Initialize Git repository in target directory
2128
2146
  * Creates initial commit with all files
@@ -2268,7 +2286,10 @@ Please check the URL and your internet connection, then try again.`
2268
2286
  }
2269
2287
  const oauthUISpinner = ora("Configuring OAuth UI...").start();
2270
2288
  try {
2271
- await this.updateOAuthUIConfig(options.oauthProviders);
2289
+ await this.updateOAuthUIConfig(
2290
+ options.oauthProviders,
2291
+ options.emailPasswordAuth
2292
+ );
2272
2293
  if (options.oauthProviders.length > 0) {
2273
2294
  oauthUISpinner.succeed("OAuth UI configuration updated");
2274
2295
  } else {
@@ -2340,6 +2361,8 @@ Please check the URL and your internet connection, then try again.`
2340
2361
  }
2341
2362
  if (options.installDependencies) {
2342
2363
  await this.installDependencies();
2364
+ await this.lintCode();
2365
+ await this.formatCode();
2343
2366
  }
2344
2367
  }
2345
2368
  };
@@ -2381,11 +2404,12 @@ var TanStackInstaller = class extends FrameworkInstaller {
2381
2404
  /**
2382
2405
  * Update OAuth UI configuration in providers file
2383
2406
  * Target file: src/providers.tsx
2384
- * Placeholder: // {{OAUTH_UI_PROVIDERS}}
2407
+ * Placeholders: OAUTH_UI_PROVIDERS and EMAIL_PASSWORD_CREDENTIALS
2385
2408
  *
2386
2409
  * @param selectedProviders - Array of provider IDs to configure
2410
+ * @param emailPasswordEnabled - Whether email/password authentication is enabled
2387
2411
  */
2388
- async updateOAuthUIConfig(selectedProviders) {
2412
+ async updateOAuthUIConfig(selectedProviders, emailPasswordEnabled) {
2389
2413
  const providersFilePath = join2(this.targetPath, "src/providers.tsx");
2390
2414
  const uiConfigBlock = generateOAuthUIProvidersBlock(selectedProviders);
2391
2415
  await replacePlaceholder(
@@ -2393,6 +2417,12 @@ var TanStackInstaller = class extends FrameworkInstaller {
2393
2417
  "// {{OAUTH_UI_PROVIDERS}}",
2394
2418
  uiConfigBlock
2395
2419
  );
2420
+ const credentialsValue = generateCredentialsValue(emailPasswordEnabled);
2421
+ await replacePlaceholder(
2422
+ providersFilePath,
2423
+ "/* {{EMAIL_PASSWORD_CREDENTIALS}} */",
2424
+ credentialsValue
2425
+ );
2396
2426
  }
2397
2427
  /**
2398
2428
  * Update .env.example with OAuth environment variables
@@ -2511,11 +2541,12 @@ var NextJSInstaller = class extends FrameworkInstaller {
2511
2541
  /**
2512
2542
  * Update OAuth UI configuration in auth client file
2513
2543
  * Target file: src/auth/client.tsx (DIFFERENT from TanStack: src/providers.tsx)
2514
- * Placeholder: // {{OAUTH_UI_PROVIDERS}}
2544
+ * Placeholders: OAUTH_UI_PROVIDERS and EMAIL_PASSWORD_CREDENTIALS
2515
2545
  *
2516
2546
  * @param selectedProviders - Array of provider IDs to configure
2547
+ * @param emailPasswordEnabled - Whether email/password authentication is enabled
2517
2548
  */
2518
- async updateOAuthUIConfig(selectedProviders) {
2549
+ async updateOAuthUIConfig(selectedProviders, emailPasswordEnabled) {
2519
2550
  const providersFilePath = join3(this.targetPath, "src/auth/client.tsx");
2520
2551
  const uiConfigBlock = generateOAuthUIProvidersBlock(selectedProviders);
2521
2552
  await replacePlaceholder(
@@ -2523,6 +2554,12 @@ var NextJSInstaller = class extends FrameworkInstaller {
2523
2554
  "// {{OAUTH_UI_PROVIDERS}}",
2524
2555
  uiConfigBlock
2525
2556
  );
2557
+ const credentialsValue = generateCredentialsValue(emailPasswordEnabled);
2558
+ await replacePlaceholder(
2559
+ providersFilePath,
2560
+ "/* {{EMAIL_PASSWORD_CREDENTIALS}} */",
2561
+ credentialsValue
2562
+ );
2526
2563
  }
2527
2564
  /**
2528
2565
  * Update .env.example with OAuth environment variables
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-z3",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "type": "module",
5
5
  "description": "CLI for scaffolding Z3 Stack applications (TanStack/Next.js + Convex + Better Auth)",
6
6
  "bin": {
@@ -98,7 +98,7 @@ export default tseslint.config(
98
98
  "perfectionist/sort-named-imports": "warn",
99
99
  "perfectionist/sort-object-types": "warn",
100
100
  "perfectionist/sort-objects": [
101
- "off",
101
+ "warn",
102
102
  {
103
103
  customGroups: [
104
104
  {
@@ -31,18 +31,14 @@ export default function BetterAuthClientProvider({ children }: { children: React
31
31
  return (
32
32
  <AuthUIProvider
33
33
  authClient={authClient}
34
- credentials={true}
34
+ credentials={/* {{EMAIL_PASSWORD_CREDENTIALS}} */}
35
35
  Link={Link}
36
36
  navigate={router.push}
37
37
  onSessionChange={() => {
38
38
  router.refresh()
39
39
  }}
40
40
  replace={router.replace}
41
- social={{
42
- providers: [
43
- // {{OAUTH_UI_PROVIDERS}}
44
- ],
45
- }}
41
+ // {{OAUTH_UI_PROVIDERS}}
46
42
  >
47
43
  {children}
48
44
  </AuthUIProvider>
@@ -23,10 +23,15 @@ export function Providers({ children }: { children: ReactNode }) {
23
23
  <AuthQueryProvider>
24
24
  <AuthUIProviderTanstack
25
25
  authClient={authClient}
26
+ credentials={/* {{EMAIL_PASSWORD_CREDENTIALS}} */}
26
27
  navigate={(href) => router.navigate({ href })}
27
28
  replace={(href) => router.navigate({ href, replace: true })}
28
29
  Link={({ href, ...props }) => <Link to={href} {...props} />}
29
- // {{OAUTH_UI_PROVIDERS}}
30
+ social={{
31
+ providers: [
32
+ // {{OAUTH_UI_PROVIDERS}}
33
+ ],
34
+ }}
30
35
  >
31
36
  {children}
32
37
  </AuthUIProviderTanstack>