@amirulabu/create-recurring-rabbit-app 0.2.46 → 0.2.48

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
@@ -11,16 +11,24 @@ import crypto from 'crypto';
11
11
 
12
12
  async function copyTemplateFiles(templateDir, targetDir) {
13
13
  const copyRecursive = async (src, dest) => {
14
- const stat = await fs.stat(src);
15
- if (stat.isDirectory()) {
16
- const entries = await fs.readdir(src);
17
- await fs.mkdir(dest, { recursive: true });
18
- for (const entry of entries) {
19
- await copyRecursive(path6.join(src, entry), path6.join(dest, entry));
14
+ try {
15
+ const stat = await fs.stat(src);
16
+ if (stat.isDirectory()) {
17
+ const entries = await fs.readdir(src);
18
+ await fs.mkdir(dest, { recursive: true });
19
+ for (const entry of entries) {
20
+ const srcPath = path6.join(src, entry);
21
+ const destPath = path6.join(dest, entry);
22
+ await copyRecursive(srcPath, destPath);
23
+ }
24
+ } else {
25
+ const destParentDir = path6.dirname(dest);
26
+ await fs.mkdir(destParentDir, { recursive: true });
27
+ await fs.copyFile(src, dest);
20
28
  }
21
- } else {
22
- await fs.mkdir(path6.dirname(dest), { recursive: true });
23
- await fs.copyFile(src, dest);
29
+ } catch (error) {
30
+ console.error(`Failed to copy ${src} to ${dest}:`, error);
31
+ throw error;
24
32
  }
25
33
  };
26
34
  await copyRecursive(templateDir, targetDir);
@@ -28,6 +36,30 @@ async function copyTemplateFiles(templateDir, targetDir) {
28
36
  async function copyDirectory(src, dest) {
29
37
  await copyTemplateFiles(src, dest);
30
38
  }
39
+ async function verifyTemplateCopy(templateDir, targetDir) {
40
+ const verifyRecursive = async (src, dest) => {
41
+ const srcStat = await fs.stat(src);
42
+ if (srcStat.isDirectory()) {
43
+ const destPath = dest;
44
+ const destExists = await fs.access(destPath).then(() => true).catch(() => false);
45
+ if (!destExists) {
46
+ throw new Error(`Directory not copied: ${destPath}`);
47
+ }
48
+ const entries = await fs.readdir(src);
49
+ for (const entry of entries) {
50
+ const srcEntryPath = path6.join(src, entry);
51
+ const destEntryPath = path6.join(dest, entry);
52
+ await verifyRecursive(srcEntryPath, destEntryPath);
53
+ }
54
+ } else {
55
+ const destExists = await fs.access(dest).then(() => true).catch(() => false);
56
+ if (!destExists) {
57
+ throw new Error(`File not copied: ${dest}`);
58
+ }
59
+ }
60
+ };
61
+ await verifyRecursive(templateDir, targetDir);
62
+ }
31
63
  async function generatePackageJson(targetDir, config) {
32
64
  const packageJsonPath = path6.join(targetDir, "package.json");
33
65
  const packageJson = {
@@ -64,14 +96,14 @@ async function generatePackageJson(targetDir, config) {
64
96
  "@paralleldrive/cuid2": "^2.2.0",
65
97
  "@radix-ui/react-slot": "^1.0.2",
66
98
  "@tanstack/react-query": "^5.0.0",
67
- "@tanstack/react-router": "~1.121.0",
99
+ "@tanstack/react-router": "~1.157.0",
68
100
  "@tanstack/react-query-devtools": "^5.0.0",
69
- "@tanstack/react-start": "~1.121.0",
101
+ "@tanstack/react-start": "~1.157.0",
70
102
  "@trpc/client": "^11.8.1",
71
103
  "@trpc/react-query": "^11.8.1",
72
104
  "@trpc/server": "^11.8.1",
73
105
  "@t3-oss/env-core": "^0.10.0",
74
- "better-auth": "^1.2.12",
106
+ "better-auth": "~1.2.12",
75
107
  "better-sqlite3": "^12.0.0",
76
108
  "class-variance-authority": "^0.7.0",
77
109
  clsx: "^2.1.0",
@@ -117,24 +149,32 @@ async function generatePackageJson(targetDir, config) {
117
149
  pnpm: {
118
150
  overrides: {
119
151
  zod: "^3.22.4",
120
- "@tanstack/react-router": "~1.121.0",
121
- "@tanstack/react-start-client": "~1.121.0",
122
- "@tanstack/react-start-plugin": "~1.121.0",
123
- "@tanstack/react-start-server": "~1.121.0",
124
- "@tanstack/router-core": "~1.121.0",
125
- "@tanstack/router-generator": "~1.121.0",
126
- "@tanstack/router-plugin": "~1.121.0",
127
- "@tanstack/start-client-core": "~1.121.0",
128
- "@tanstack/start-plugin-core": "~1.121.0",
129
- "@tanstack/start-server-core": "~1.121.0",
130
- "@tanstack/server-functions-plugin": "~1.121.0",
131
- "@tanstack/directive-functions-plugin": "~1.121.0",
132
- "@tanstack/start-api-routes": "~1.121.0",
133
- "@tanstack/start-server-functions-client": "~1.121.0",
134
- "@tanstack/start-server-functions-fetcher": "~1.121.0",
135
- "@tanstack/start-server-functions-handler": "~1.121.0",
136
- "@tanstack/router-utils": "~1.121.0",
137
- "@tanstack/history": "~1.121.0"
152
+ "@tanstack/react-router": "~1.157.0",
153
+ "@tanstack/react-start-client": "~1.157.0",
154
+ "@tanstack/react-start-plugin": "~1.157.0",
155
+ "@tanstack/react-start-server": "~1.157.0",
156
+ "@tanstack/router-core": "~1.157.0",
157
+ "@tanstack/router-generator": "~1.157.0",
158
+ "@tanstack/router-plugin": "~1.157.0",
159
+ "@tanstack/router-vite-plugin": "~1.157.0",
160
+ "@tanstack/solid-start": "~1.157.0",
161
+ "@tanstack/solid-start-client": "~1.157.0",
162
+ "@tanstack/solid-start-server": "~1.157.0",
163
+ "@tanstack/vue-start": "~1.157.0",
164
+ "@tanstack/vue-start-client": "~1.157.0",
165
+ "@tanstack/vue-start-server": "~1.157.0",
166
+ "@tanstack/start-client-core": "~1.157.0",
167
+ "@tanstack/start-plugin-core": "~1.157.0",
168
+ "@tanstack/start-server-core": "~1.157.0",
169
+ "@tanstack/start-storage-context": "~1.157.0",
170
+ "@tanstack/server-functions-plugin": "~1.157.0",
171
+ "@tanstack/directive-functions-plugin": "~1.157.0",
172
+ "@tanstack/start-api-routes": "~1.157.0",
173
+ "@tanstack/start-server-functions-client": "~1.157.0",
174
+ "@tanstack/start-server-functions-fetcher": "~1.157.0",
175
+ "@tanstack/start-server-functions-handler": "~1.157.0",
176
+ "@tanstack/router-utils": "~1.157.0",
177
+ "@tanstack/history": "~1.157.0"
138
178
  }
139
179
  },
140
180
  "lint-staged": {
@@ -595,6 +635,7 @@ async function scaffoldProject(projectName, targetPath) {
595
635
  spinner.succeed("Project directory will be created");
596
636
  spinner.start("Copying template files...");
597
637
  await copyDirectory(TEMPLATE_DIR, projectPath);
638
+ await verifyTemplateCopy(TEMPLATE_DIR, projectPath);
598
639
  projectCreated = true;
599
640
  spinner.succeed("Template files copied");
600
641
  spinner.start("Generating package.json...");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amirulabu/create-recurring-rabbit-app",
3
- "version": "0.2.46",
3
+ "version": "0.2.48",
4
4
  "description": "CLI tool to scaffold micro-SaaS apps with TanStack Start, tRPC, Drizzle, and Better-auth",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,4 +1,8 @@
1
- import { createRouter } from '@tanstack/react-router'
1
+ import { createRouter as createRouterBase } from '@tanstack/react-router'
2
2
  import { routeTree } from './routeTree.gen'
3
3
 
4
- export const router = createRouter({ routeTree })
4
+ export function createRouter() {
5
+ return createRouterBase({
6
+ routeTree,
7
+ })
8
+ }
@@ -27,7 +27,7 @@
27
27
 
28
28
  import { betterAuth } from 'better-auth'
29
29
  import { drizzleAdapter } from 'better-auth/adapters/drizzle'
30
- import { tanstackStartCookies } from 'better-auth/tanstack-start'
30
+ import { reactStartCookies } from 'better-auth/react-start'
31
31
  import { db } from '@/server/db'
32
32
  import { users, sessions, accounts, verifications } from '@/server/db/schema'
33
33
  import { env } from '@/lib/env'
@@ -258,8 +258,8 @@ export const auth = betterAuth({
258
258
  *
259
259
  * Extends better-auth functionality with additional features.
260
260
  *
261
- * IMPORTANT: tanstackStartCookies plugin must be the LAST plugin in the array
261
+ * IMPORTANT: reactStartCookies plugin must be the LAST plugin in the array
262
262
  * to ensure proper cookie handling for TanStack Start.
263
263
  */
264
- plugins: [tanstackStartCookies()],
264
+ plugins: [reactStartCookies()],
265
265
  })
@@ -6,7 +6,9 @@ import { tanstackStart } from '@tanstack/react-start/plugin/vite'
6
6
  export default defineConfig({
7
7
  plugins: [
8
8
  tsconfigPaths(),
9
- tanstackStart(),
9
+ tanstackStart({
10
+ srcDirectory: 'src',
11
+ }),
10
12
  visualizer({
11
13
  filename: 'stats.html',
12
14
  open: process.env.ANALYZE === 'true',
@@ -1,43 +0,0 @@
1
- /* prettier-ignore-start */
2
-
3
- /* eslint-disable */
4
-
5
- // @ts-nocheck
6
-
7
- // noinspection JSUnusedGlobalSymbols
8
-
9
- /**
10
- * This file is auto-generated by TanStack Router.
11
- * Do not edit this file manually.
12
- *
13
- * This is a stub file for type-checking purposes.
14
- * The actual route tree is generated at build/dev time by TanStack Router.
15
- *
16
- * When the dev server runs, this file will be replaced with the full route tree.
17
- */
18
-
19
- import { rootRoute } from './__root'
20
-
21
- // Stub route tree - this allows TypeScript to compile without errors
22
- // The real route tree with proper types will be generated when you run the dev server
23
- export const routeTree = rootRoute.addChildren([])
24
-
25
- // Type augmentation to allow any route ID during development
26
- declare module '@tanstack/react-router' {
27
- interface FileRoutesByPath {
28
- '/': any
29
- '/_client': any
30
- '/_ssr': any
31
- '/api/health': any
32
- '/api/auth/$': any
33
- '/api/auth/_': any
34
- '/api/auth/get-session': any
35
- '/auth/login': any
36
- '/auth/register': any
37
- '/auth/forgot-password': any
38
- '/auth/reset-password': any
39
- '/auth/verify-email': any
40
- '/dashboard/': any
41
- '/dashboard/settings': any
42
- }
43
- }