create-payload-app 4.0.0-internal.af6aad0 → 4.0.0-internal.b8a92d2
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/lib/agent-config.d.ts +2 -5
- package/dist/lib/agent-config.d.ts.map +1 -1
- package/dist/lib/agent-config.js +1 -8
- package/dist/lib/agent-config.js.map +1 -1
- package/dist/lib/create-project.d.ts.map +1 -1
- package/dist/lib/create-project.js +51 -8
- package/dist/lib/create-project.js.map +1 -1
- package/dist/lib/get-package-manager.d.ts +9 -0
- package/dist/lib/get-package-manager.d.ts.map +1 -1
- package/dist/lib/get-package-manager.js +20 -0
- package/dist/lib/get-package-manager.js.map +1 -1
- package/dist/lib/tanstack/template-files.d.ts +2 -2
- package/dist/lib/tanstack/template-files.d.ts.map +1 -1
- package/dist/lib/tanstack/template-files.js +2 -2
- package/dist/lib/tanstack/template-files.js.map +1 -1
- package/dist/lib/update-payload-in-project.d.ts.map +1 -1
- package/dist/lib/update-payload-in-project.js +7 -2
- package/dist/lib/update-payload-in-project.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +0 -1
- package/dist/main.js.map +1 -1
- package/dist/template/src/app/(frontend)/styles.css +7 -0
- package/dist/template/src/app/(payload)/admin/importMap.js +17 -0
- package/dist/template/src/payload-types.ts +72 -1
- package/dist/template/src/payload.config.ts +8 -0
- package/dist/template-tanstack/routes/_payload.tsx +22 -5
- package/dist/template-tanstack/src/payload.css +1 -0
- package/dist/utils/messages.js +1 -1
- package/dist/utils/messages.js.map +1 -1
- package/package.json +2 -2
- package/dist/ast-integration.spec.js +0 -132
- package/dist/ast-integration.spec.js.map +0 -1
- package/dist/lib/agent-config.spec.js +0 -23
- package/dist/lib/agent-config.spec.js.map +0 -1
- package/dist/lib/ast/package-json.spec.js +0 -139
- package/dist/lib/ast/package-json.spec.js.map +0 -1
- package/dist/lib/ast/payload-config.spec.js +0 -365
- package/dist/lib/ast/payload-config.spec.js.map +0 -1
- package/dist/lib/ast/utils.spec.js +0 -226
- package/dist/lib/ast/utils.spec.js.map +0 -1
- package/dist/lib/configure-payload-tsconfig.spec.js +0 -135
- package/dist/lib/configure-payload-tsconfig.spec.js.map +0 -1
- package/dist/lib/create-project.spec.js +0 -199
- package/dist/lib/create-project.spec.js.map +0 -1
- package/dist/lib/init-tanstack-default-template.spec.js +0 -119
- package/dist/lib/init-tanstack-default-template.spec.js.map +0 -1
- package/dist/lib/init-tanstack.spec.js +0 -394
- package/dist/lib/init-tanstack.spec.js.map +0 -1
- package/dist/lib/manage-env-files.spec.js +0 -118
- package/dist/lib/manage-env-files.spec.js.map +0 -1
- package/dist/lib/tanstack/detect.spec.js +0 -227
- package/dist/lib/tanstack/detect.spec.js.map +0 -1
- package/dist/lib/tanstack/prepare.spec.js +0 -288
- package/dist/lib/tanstack/prepare.spec.js.map +0 -1
- package/dist/lib/tanstack/transform-root-route.spec.js +0 -484
- package/dist/lib/tanstack/transform-root-route.spec.js.map +0 -1
- package/dist/lib/tanstack/transform-router.spec.js +0 -264
- package/dist/lib/tanstack/transform-router.spec.js.map +0 -1
- package/dist/lib/tanstack/transform-vite-config.spec.js +0 -456
- package/dist/lib/tanstack/transform-vite-config.spec.js.map +0 -1
- package/dist/lib/update-payload-in-project.spec.js +0 -258
- package/dist/lib/update-payload-in-project.spec.js.map +0 -1
- package/dist/lib/wrap-next-config.spec.js +0 -167
- package/dist/lib/wrap-next-config.spec.js.map +0 -1
- package/dist/main.spec.js +0 -102
- package/dist/main.spec.js.map +0 -1
- package/dist/template-tanstack/src/payload-foundation.css +0 -10
- package/dist/utils/resolvePackageVersion.spec.js +0 -77
- package/dist/utils/resolvePackageVersion.spec.js.map +0 -1
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import fse from 'fs-extra';
|
|
2
|
-
import * as os from 'node:os';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
5
|
-
import { getTanStackAppDetails } from './detect.js';
|
|
6
|
-
describe('getTanStackAppDetails', ()=>{
|
|
7
|
-
let projectDir;
|
|
8
|
-
beforeEach(()=>{
|
|
9
|
-
projectDir = fse.mkdtempSync(path.join(os.tmpdir(), 'create-payload-app-tanstack-'));
|
|
10
|
-
});
|
|
11
|
-
afterEach(()=>{
|
|
12
|
-
fse.removeSync(projectDir);
|
|
13
|
-
});
|
|
14
|
-
function writeFixture({ additionalFiles, dependencies, devDependencies, hasRootRoute = true, hasRouter = true, router = 'export function getRouter() {}', vite }) {
|
|
15
|
-
fse.writeJsonSync(path.join(projectDir, 'package.json'), {
|
|
16
|
-
dependencies,
|
|
17
|
-
devDependencies,
|
|
18
|
-
name: 'tanstack-fixture'
|
|
19
|
-
});
|
|
20
|
-
fse.ensureDirSync(path.join(projectDir, 'src/routes'));
|
|
21
|
-
if (hasRouter) {
|
|
22
|
-
fse.writeFileSync(path.join(projectDir, 'src/router.tsx'), router);
|
|
23
|
-
}
|
|
24
|
-
if (hasRootRoute) {
|
|
25
|
-
fse.writeFileSync(path.join(projectDir, 'src/routes/__root.tsx'), 'export {}');
|
|
26
|
-
}
|
|
27
|
-
if (vite) {
|
|
28
|
-
fse.writeFileSync(path.join(projectDir, 'vite.config.ts'), vite);
|
|
29
|
-
}
|
|
30
|
-
for (const [relativePath, content] of Object.entries(additionalFiles ?? {})){
|
|
31
|
-
fse.outputFileSync(path.join(projectDir, relativePath), content);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
it('should detect a conventional TanStack Start project', async ()=>{
|
|
35
|
-
writeFixture({
|
|
36
|
-
dependencies: {
|
|
37
|
-
'@tanstack/react-router': 'latest',
|
|
38
|
-
'@tanstack/react-start': 'latest'
|
|
39
|
-
},
|
|
40
|
-
vite: `const config = defineConfig({ plugins: [tanstackStart(), viteReact()] })\nexport default config`
|
|
41
|
-
});
|
|
42
|
-
const result = await getTanStackAppDetails({
|
|
43
|
-
projectDir
|
|
44
|
-
});
|
|
45
|
-
expect(result).toMatchObject({
|
|
46
|
-
compatible: true,
|
|
47
|
-
detected: true,
|
|
48
|
-
details: {
|
|
49
|
-
isPayloadInstalled: false,
|
|
50
|
-
kind: 'start',
|
|
51
|
-
projectDir,
|
|
52
|
-
rootRoutePath: path.join(projectDir, 'src/routes/__root.tsx'),
|
|
53
|
-
routerPath: path.join(projectDir, 'src/router.tsx'),
|
|
54
|
-
routesDir: path.join(projectDir, 'src/routes'),
|
|
55
|
-
sourceDir: path.join(projectDir, 'src'),
|
|
56
|
-
viteConfigPath: path.join(projectDir, 'vite.config.ts')
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
it('should detect a conventional Router-only project', async ()=>{
|
|
61
|
-
writeFixture({
|
|
62
|
-
dependencies: {
|
|
63
|
-
'@tanstack/react-router': 'latest',
|
|
64
|
-
payload: 'latest'
|
|
65
|
-
},
|
|
66
|
-
devDependencies: {
|
|
67
|
-
'@tanstack/router-plugin': 'latest'
|
|
68
|
-
},
|
|
69
|
-
vite: `const config = defineConfig({ plugins: [tanstackRouter({ target: 'react' }), viteReact()] })\nexport default config`
|
|
70
|
-
});
|
|
71
|
-
expect(await getTanStackAppDetails({
|
|
72
|
-
projectDir
|
|
73
|
-
})).toMatchObject({
|
|
74
|
-
compatible: true,
|
|
75
|
-
detected: true,
|
|
76
|
-
details: {
|
|
77
|
-
isPayloadInstalled: true,
|
|
78
|
-
kind: 'router-only'
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
it('should detect a Router-only project that also depends on Next.js', async ()=>{
|
|
83
|
-
writeFixture({
|
|
84
|
-
dependencies: {
|
|
85
|
-
'@tanstack/react-router': 'latest',
|
|
86
|
-
next: 'latest'
|
|
87
|
-
},
|
|
88
|
-
devDependencies: {
|
|
89
|
-
'@tanstack/router-plugin': 'latest'
|
|
90
|
-
},
|
|
91
|
-
vite: `const config = defineConfig({ plugins: [tanstackRouter({ target: 'react' }), viteReact()] })\nexport default config`
|
|
92
|
-
});
|
|
93
|
-
await expect(getTanStackAppDetails({
|
|
94
|
-
projectDir
|
|
95
|
-
})).resolves.toMatchObject({
|
|
96
|
-
compatible: true,
|
|
97
|
-
detected: true,
|
|
98
|
-
details: {
|
|
99
|
-
kind: 'router-only'
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
it('should ignore projects that only use TanStack Query', async ()=>{
|
|
104
|
-
writeFixture({
|
|
105
|
-
dependencies: {
|
|
106
|
-
'@tanstack/react-query': 'latest'
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
await expect(getTanStackAppDetails({
|
|
110
|
-
projectDir
|
|
111
|
-
})).resolves.toEqual({
|
|
112
|
-
detected: false
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
it('should report a missing root route in a recognized host', async ()=>{
|
|
116
|
-
writeFixture({
|
|
117
|
-
dependencies: {
|
|
118
|
-
'@tanstack/react-router': 'latest'
|
|
119
|
-
},
|
|
120
|
-
devDependencies: {
|
|
121
|
-
'@tanstack/router-plugin': 'latest'
|
|
122
|
-
},
|
|
123
|
-
hasRootRoute: false,
|
|
124
|
-
vite: 'export default defineConfig({ plugins: [tanstackRouter()] })'
|
|
125
|
-
});
|
|
126
|
-
await expect(getTanStackAppDetails({
|
|
127
|
-
projectDir
|
|
128
|
-
})).resolves.toMatchObject({
|
|
129
|
-
compatible: false,
|
|
130
|
-
detected: true,
|
|
131
|
-
reason: expect.stringContaining('src/routes/__root')
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
it('should report a router without getRouter in a recognized host', async ()=>{
|
|
135
|
-
writeFixture({
|
|
136
|
-
dependencies: {
|
|
137
|
-
'@tanstack/react-router': 'latest'
|
|
138
|
-
},
|
|
139
|
-
devDependencies: {
|
|
140
|
-
'@tanstack/router-plugin': 'latest'
|
|
141
|
-
},
|
|
142
|
-
router: 'export const router = createRouter({})',
|
|
143
|
-
vite: 'export default defineConfig({ plugins: [tanstackRouter()] })'
|
|
144
|
-
});
|
|
145
|
-
await expect(getTanStackAppDetails({
|
|
146
|
-
projectDir
|
|
147
|
-
})).resolves.toMatchObject({
|
|
148
|
-
compatible: false,
|
|
149
|
-
detected: true,
|
|
150
|
-
reason: expect.stringContaining('getRouter')
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
it('should report unsupported Solid hosts', async ()=>{
|
|
154
|
-
writeFixture({
|
|
155
|
-
dependencies: {
|
|
156
|
-
'@tanstack/solid-router': 'latest',
|
|
157
|
-
'@tanstack/solid-start': 'latest'
|
|
158
|
-
},
|
|
159
|
-
vite: 'export default defineConfig({ plugins: [tanstackStart()] })'
|
|
160
|
-
});
|
|
161
|
-
await expect(getTanStackAppDetails({
|
|
162
|
-
projectDir
|
|
163
|
-
})).resolves.toMatchObject({
|
|
164
|
-
compatible: false,
|
|
165
|
-
detected: true,
|
|
166
|
-
reason: expect.stringContaining('Solid')
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
it('should report ambiguous TanStack Start and Next.js markers', async ()=>{
|
|
170
|
-
writeFixture({
|
|
171
|
-
dependencies: {
|
|
172
|
-
'@tanstack/react-router': 'latest',
|
|
173
|
-
'@tanstack/react-start': 'latest',
|
|
174
|
-
next: 'latest'
|
|
175
|
-
},
|
|
176
|
-
vite: 'export default defineConfig({ plugins: [tanstackStart()] })'
|
|
177
|
-
});
|
|
178
|
-
await expect(getTanStackAppDetails({
|
|
179
|
-
projectDir
|
|
180
|
-
})).resolves.toMatchObject({
|
|
181
|
-
compatible: false,
|
|
182
|
-
detected: true,
|
|
183
|
-
reason: expect.stringContaining('Next.js')
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
it.each([
|
|
187
|
-
{
|
|
188
|
-
additionalFiles: {
|
|
189
|
-
'vite.config.mts': 'export default defineConfig({ plugins: [tanstackStart(), viteReact()] })'
|
|
190
|
-
},
|
|
191
|
-
reason: 'Found multiple supported Vite config files: vite.config.mts, vite.config.ts.',
|
|
192
|
-
role: 'Vite config'
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
additionalFiles: {
|
|
196
|
-
'src/router.ts': 'export function getRouter() {}'
|
|
197
|
-
},
|
|
198
|
-
reason: 'Found multiple supported router files: src/router.ts, src/router.tsx.',
|
|
199
|
-
role: 'router'
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
additionalFiles: {
|
|
203
|
-
'src/routes/__root.ts': 'export {}'
|
|
204
|
-
},
|
|
205
|
-
reason: 'Found multiple supported root route files: src/routes/__root.ts, src/routes/__root.tsx.',
|
|
206
|
-
role: 'root route'
|
|
207
|
-
}
|
|
208
|
-
])('should reject multiple supported $role candidates', async ({ additionalFiles, reason })=>{
|
|
209
|
-
writeFixture({
|
|
210
|
-
additionalFiles,
|
|
211
|
-
dependencies: {
|
|
212
|
-
'@tanstack/react-router': 'latest',
|
|
213
|
-
'@tanstack/react-start': 'latest'
|
|
214
|
-
},
|
|
215
|
-
vite: 'export default defineConfig({ plugins: [tanstackStart(), viteReact()] })'
|
|
216
|
-
});
|
|
217
|
-
await expect(getTanStackAppDetails({
|
|
218
|
-
projectDir
|
|
219
|
-
})).resolves.toEqual({
|
|
220
|
-
compatible: false,
|
|
221
|
-
detected: true,
|
|
222
|
-
reason
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
//# sourceMappingURL=detect.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/tanstack/detect.spec.ts"],"sourcesContent":["import fse from 'fs-extra'\nimport * as os from 'node:os'\nimport path from 'path'\nimport { afterEach, beforeEach, describe, expect, it } from 'vitest'\n\nimport { getTanStackAppDetails } from './detect.js'\n\ntype Fixture = {\n additionalFiles?: Record<string, string>\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n hasRootRoute?: boolean\n hasRouter?: boolean\n router?: string\n vite?: string\n}\n\ndescribe('getTanStackAppDetails', () => {\n let projectDir: string\n\n beforeEach(() => {\n projectDir = fse.mkdtempSync(path.join(os.tmpdir(), 'create-payload-app-tanstack-'))\n })\n\n afterEach(() => {\n fse.removeSync(projectDir)\n })\n\n function writeFixture({\n additionalFiles,\n dependencies,\n devDependencies,\n hasRootRoute = true,\n hasRouter = true,\n router = 'export function getRouter() {}',\n vite,\n }: Fixture) {\n fse.writeJsonSync(path.join(projectDir, 'package.json'), {\n dependencies,\n devDependencies,\n name: 'tanstack-fixture',\n })\n fse.ensureDirSync(path.join(projectDir, 'src/routes'))\n\n if (hasRouter) {\n fse.writeFileSync(path.join(projectDir, 'src/router.tsx'), router)\n }\n if (hasRootRoute) {\n fse.writeFileSync(path.join(projectDir, 'src/routes/__root.tsx'), 'export {}')\n }\n if (vite) {\n fse.writeFileSync(path.join(projectDir, 'vite.config.ts'), vite)\n }\n for (const [relativePath, content] of Object.entries(additionalFiles ?? {})) {\n fse.outputFileSync(path.join(projectDir, relativePath), content)\n }\n }\n\n it('should detect a conventional TanStack Start project', async () => {\n writeFixture({\n dependencies: { '@tanstack/react-router': 'latest', '@tanstack/react-start': 'latest' },\n vite: `const config = defineConfig({ plugins: [tanstackStart(), viteReact()] })\\nexport default config`,\n })\n\n const result = await getTanStackAppDetails({ projectDir })\n\n expect(result).toMatchObject({\n compatible: true,\n detected: true,\n details: {\n isPayloadInstalled: false,\n kind: 'start',\n projectDir,\n rootRoutePath: path.join(projectDir, 'src/routes/__root.tsx'),\n routerPath: path.join(projectDir, 'src/router.tsx'),\n routesDir: path.join(projectDir, 'src/routes'),\n sourceDir: path.join(projectDir, 'src'),\n viteConfigPath: path.join(projectDir, 'vite.config.ts'),\n },\n })\n })\n\n it('should detect a conventional Router-only project', async () => {\n writeFixture({\n dependencies: { '@tanstack/react-router': 'latest', payload: 'latest' },\n devDependencies: { '@tanstack/router-plugin': 'latest' },\n vite: `const config = defineConfig({ plugins: [tanstackRouter({ target: 'react' }), viteReact()] })\\nexport default config`,\n })\n\n expect(await getTanStackAppDetails({ projectDir })).toMatchObject({\n compatible: true,\n detected: true,\n details: { isPayloadInstalled: true, kind: 'router-only' },\n })\n })\n\n it('should detect a Router-only project that also depends on Next.js', async () => {\n writeFixture({\n dependencies: {\n '@tanstack/react-router': 'latest',\n next: 'latest',\n },\n devDependencies: { '@tanstack/router-plugin': 'latest' },\n vite: `const config = defineConfig({ plugins: [tanstackRouter({ target: 'react' }), viteReact()] })\\nexport default config`,\n })\n\n await expect(getTanStackAppDetails({ projectDir })).resolves.toMatchObject({\n compatible: true,\n detected: true,\n details: { kind: 'router-only' },\n })\n })\n\n it('should ignore projects that only use TanStack Query', async () => {\n writeFixture({ dependencies: { '@tanstack/react-query': 'latest' } })\n\n await expect(getTanStackAppDetails({ projectDir })).resolves.toEqual({ detected: false })\n })\n\n it('should report a missing root route in a recognized host', async () => {\n writeFixture({\n dependencies: { '@tanstack/react-router': 'latest' },\n devDependencies: { '@tanstack/router-plugin': 'latest' },\n hasRootRoute: false,\n vite: 'export default defineConfig({ plugins: [tanstackRouter()] })',\n })\n\n await expect(getTanStackAppDetails({ projectDir })).resolves.toMatchObject({\n compatible: false,\n detected: true,\n reason: expect.stringContaining('src/routes/__root'),\n })\n })\n\n it('should report a router without getRouter in a recognized host', async () => {\n writeFixture({\n dependencies: { '@tanstack/react-router': 'latest' },\n devDependencies: { '@tanstack/router-plugin': 'latest' },\n router: 'export const router = createRouter({})',\n vite: 'export default defineConfig({ plugins: [tanstackRouter()] })',\n })\n\n await expect(getTanStackAppDetails({ projectDir })).resolves.toMatchObject({\n compatible: false,\n detected: true,\n reason: expect.stringContaining('getRouter'),\n })\n })\n\n it('should report unsupported Solid hosts', async () => {\n writeFixture({\n dependencies: { '@tanstack/solid-router': 'latest', '@tanstack/solid-start': 'latest' },\n vite: 'export default defineConfig({ plugins: [tanstackStart()] })',\n })\n\n await expect(getTanStackAppDetails({ projectDir })).resolves.toMatchObject({\n compatible: false,\n detected: true,\n reason: expect.stringContaining('Solid'),\n })\n })\n\n it('should report ambiguous TanStack Start and Next.js markers', async () => {\n writeFixture({\n dependencies: {\n '@tanstack/react-router': 'latest',\n '@tanstack/react-start': 'latest',\n next: 'latest',\n },\n vite: 'export default defineConfig({ plugins: [tanstackStart()] })',\n })\n\n await expect(getTanStackAppDetails({ projectDir })).resolves.toMatchObject({\n compatible: false,\n detected: true,\n reason: expect.stringContaining('Next.js'),\n })\n })\n\n it.each([\n {\n additionalFiles: {\n 'vite.config.mts':\n 'export default defineConfig({ plugins: [tanstackStart(), viteReact()] })',\n },\n reason: 'Found multiple supported Vite config files: vite.config.mts, vite.config.ts.',\n role: 'Vite config',\n },\n {\n additionalFiles: { 'src/router.ts': 'export function getRouter() {}' },\n reason: 'Found multiple supported router files: src/router.ts, src/router.tsx.',\n role: 'router',\n },\n {\n additionalFiles: { 'src/routes/__root.ts': 'export {}' },\n reason:\n 'Found multiple supported root route files: src/routes/__root.ts, src/routes/__root.tsx.',\n role: 'root route',\n },\n ])('should reject multiple supported $role candidates', async ({ additionalFiles, reason }) => {\n writeFixture({\n additionalFiles,\n dependencies: {\n '@tanstack/react-router': 'latest',\n '@tanstack/react-start': 'latest',\n },\n vite: 'export default defineConfig({ plugins: [tanstackStart(), viteReact()] })',\n })\n\n await expect(getTanStackAppDetails({ projectDir })).resolves.toEqual({\n compatible: false,\n detected: true,\n reason,\n })\n })\n})\n"],"names":["fse","os","path","afterEach","beforeEach","describe","expect","it","getTanStackAppDetails","projectDir","mkdtempSync","join","tmpdir","removeSync","writeFixture","additionalFiles","dependencies","devDependencies","hasRootRoute","hasRouter","router","vite","writeJsonSync","name","ensureDirSync","writeFileSync","relativePath","content","Object","entries","outputFileSync","result","toMatchObject","compatible","detected","details","isPayloadInstalled","kind","rootRoutePath","routerPath","routesDir","sourceDir","viteConfigPath","payload","next","resolves","toEqual","reason","stringContaining","each","role"],"mappings":"AAAA,OAAOA,SAAS,WAAU;AAC1B,YAAYC,QAAQ,UAAS;AAC7B,OAAOC,UAAU,OAAM;AACvB,SA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AAEgC,MAAM,EAAE;QACxFjC,aAAa;YACXC;YACAC,cAAc;gBACZ,0BAA0B;gBAC1B,yBAAyB;YAC3B;YACAK,MAAM;QACR;QAEA,MAAMf,OAAOE,sBAAsB;YAAEC;QAAW,IAAIoC,QAAQ,CAACC,OAAO,CAAC;YACnEb,YAAY;YACZC,UAAU;YACVa;QACF;IACF;AACF"}
|
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
import fse from 'fs-extra';
|
|
2
|
-
import os from 'node:os';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
5
|
-
import { applyPreparedWrites, prepareTanStackInit } from './prepare.js';
|
|
6
|
-
const routerContent = `import { createRouter } from '@tanstack/react-router'
|
|
7
|
-
|
|
8
|
-
import { routeTree } from './routeTree.gen'
|
|
9
|
-
|
|
10
|
-
export function getRouter() {
|
|
11
|
-
return createRouter({
|
|
12
|
-
routeTree,
|
|
13
|
-
defaultPreload: 'intent',
|
|
14
|
-
})
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
declare module '@tanstack/react-router' {
|
|
18
|
-
interface Register {
|
|
19
|
-
router: ReturnType<typeof getRouter>
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
23
|
-
const rootRouteContent = `import { createRootRoute, HeadContent, Scripts } from '@tanstack/react-router'
|
|
24
|
-
import appCss from '../styles.css?url'
|
|
25
|
-
|
|
26
|
-
export const Route = createRootRoute({
|
|
27
|
-
head: () => ({
|
|
28
|
-
links: [{ rel: 'stylesheet', href: appCss }],
|
|
29
|
-
meta: [{ title: 'Host app' }],
|
|
30
|
-
}),
|
|
31
|
-
shellComponent: RootDocument,
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
function RootDocument({ children }: { children: React.ReactNode }) {
|
|
35
|
-
return (
|
|
36
|
-
<html lang="en">
|
|
37
|
-
<head>
|
|
38
|
-
<HeadContent />
|
|
39
|
-
</head>
|
|
40
|
-
<body>
|
|
41
|
-
{children}
|
|
42
|
-
<Scripts />
|
|
43
|
-
</body>
|
|
44
|
-
</html>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
`;
|
|
48
|
-
const viteConfigContent = `import { tanstackStart } from '@tanstack/react-start/plugin/vite'
|
|
49
|
-
import viteReact from '@vitejs/plugin-react'
|
|
50
|
-
import { defineConfig } from 'vite'
|
|
51
|
-
|
|
52
|
-
export default defineConfig({
|
|
53
|
-
plugins: [tanstackStart(), viteReact()],
|
|
54
|
-
})
|
|
55
|
-
`;
|
|
56
|
-
const templateFiles = {
|
|
57
|
-
'routes/_payload.tsx': 'export const payloadLayout = true\n',
|
|
58
|
-
'routes/_payload/admin.$.tsx': 'export const payloadAdminSplat = true\n',
|
|
59
|
-
'routes/_payload/admin.index.tsx': 'export const payloadAdminIndex = true\n',
|
|
60
|
-
'routes/_payload/api.$.ts': 'export const payloadApi = true\n',
|
|
61
|
-
'routes/_payload/importMap.js': 'export const importMap = {}\n',
|
|
62
|
-
'routes/_payload/server.functions.ts': 'export const payloadServerFunctions = true\n',
|
|
63
|
-
'src/collections/Folders.ts': "export const Folders = { slug: 'folders' }\n",
|
|
64
|
-
'src/collections/Media.ts': "export const Media = { slug: 'media' }\n",
|
|
65
|
-
'src/collections/Tags.ts': "export const Tags = { slug: 'tags' }\n",
|
|
66
|
-
'src/collections/Users.ts': "export const Users = { slug: 'users' }\n",
|
|
67
|
-
'src/payload-foundation.css': '@layer payload-default, payload;\n',
|
|
68
|
-
'src/payload.config.ts': 'export default { collections: [] }\n'
|
|
69
|
-
};
|
|
70
|
-
describe('prepareTanStackInit', ()=>{
|
|
71
|
-
let appDetails;
|
|
72
|
-
let projectDir;
|
|
73
|
-
let templateRoot;
|
|
74
|
-
beforeEach(()=>{
|
|
75
|
-
projectDir = fse.mkdtempSync(path.join(os.tmpdir(), 'cpa-prepare-tanstack-project-'));
|
|
76
|
-
templateRoot = fse.mkdtempSync(path.join(os.tmpdir(), 'cpa-prepare-tanstack-template-'));
|
|
77
|
-
writeFiles({
|
|
78
|
-
root: projectDir,
|
|
79
|
-
files: {
|
|
80
|
-
'src/router.tsx': routerContent,
|
|
81
|
-
'src/routes/__root.tsx': rootRouteContent,
|
|
82
|
-
'vite.config.ts': viteConfigContent
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
writeFiles({
|
|
86
|
-
files: templateFiles,
|
|
87
|
-
root: templateRoot
|
|
88
|
-
});
|
|
89
|
-
appDetails = {
|
|
90
|
-
isPayloadInstalled: false,
|
|
91
|
-
kind: 'start',
|
|
92
|
-
projectDir,
|
|
93
|
-
rootRoutePath: path.join(projectDir, 'src/routes/__root.tsx'),
|
|
94
|
-
routerPath: path.join(projectDir, 'src/router.tsx'),
|
|
95
|
-
routesDir: path.join(projectDir, 'src/routes'),
|
|
96
|
-
sourceDir: path.join(projectDir, 'src'),
|
|
97
|
-
viteConfigPath: path.join(projectDir, 'vite.config.ts')
|
|
98
|
-
};
|
|
99
|
-
});
|
|
100
|
-
afterEach(()=>{
|
|
101
|
-
fse.removeSync(projectDir);
|
|
102
|
-
fse.removeSync(templateRoot);
|
|
103
|
-
});
|
|
104
|
-
it('should prepare every host transformation and Payload-owned file without writing to disk', async ()=>{
|
|
105
|
-
const before = snapshotDirectory(projectDir);
|
|
106
|
-
const result = await prepareTanStackInit({
|
|
107
|
-
appDetails,
|
|
108
|
-
templateRoot
|
|
109
|
-
});
|
|
110
|
-
expect(result.success).toBe(true);
|
|
111
|
-
expect(snapshotDirectory(projectDir)).toEqual(before);
|
|
112
|
-
if (!result.success) {
|
|
113
|
-
throw new Error(result.reason);
|
|
114
|
-
}
|
|
115
|
-
expect(result.writes.map(({ filePath })=>path.relative(projectDir, filePath)).sort()).toEqual([
|
|
116
|
-
'src/collections/Folders.ts',
|
|
117
|
-
'src/collections/Media.ts',
|
|
118
|
-
'src/collections/Tags.ts',
|
|
119
|
-
'src/collections/Users.ts',
|
|
120
|
-
'src/payload-foundation.css',
|
|
121
|
-
'src/payload.config.ts',
|
|
122
|
-
'src/router.tsx',
|
|
123
|
-
'src/routes/__root.tsx',
|
|
124
|
-
'src/routes/_payload.tsx',
|
|
125
|
-
'src/routes/_payload/admin.$.tsx',
|
|
126
|
-
'src/routes/_payload/admin.index.tsx',
|
|
127
|
-
'src/routes/_payload/api.$.ts',
|
|
128
|
-
'src/routes/_payload/importMap.js',
|
|
129
|
-
'src/routes/_payload/server.functions.ts',
|
|
130
|
-
'vite.config.ts'
|
|
131
|
-
]);
|
|
132
|
-
expect(getPreparedContent({
|
|
133
|
-
filePath: appDetails.viteConfigPath,
|
|
134
|
-
writes: result.writes
|
|
135
|
-
})).toContain('withPayload(');
|
|
136
|
-
expect(getPreparedContent({
|
|
137
|
-
filePath: appDetails.routerPath,
|
|
138
|
-
writes: result.writes
|
|
139
|
-
})).toContain('parseSearch: payloadParseSearch');
|
|
140
|
-
expect(getPreparedContent({
|
|
141
|
-
filePath: appDetails.rootRoutePath,
|
|
142
|
-
writes: result.writes
|
|
143
|
-
})).toContain('withPayloadRoot(');
|
|
144
|
-
expect(getPreparedContent({
|
|
145
|
-
filePath: path.join(appDetails.routesDir, '_payload/api.$.ts'),
|
|
146
|
-
writes: result.writes
|
|
147
|
-
})).toBe(templateFiles['routes/_payload/api.$.ts']);
|
|
148
|
-
});
|
|
149
|
-
it('should reject a non-identical Payload-owned file collision without writing to disk', async ()=>{
|
|
150
|
-
fse.outputFileSync(path.join(appDetails.routesDir, '_payload.tsx'), 'custom route\n');
|
|
151
|
-
const before = snapshotDirectory(projectDir);
|
|
152
|
-
const result = await prepareTanStackInit({
|
|
153
|
-
appDetails,
|
|
154
|
-
templateRoot
|
|
155
|
-
});
|
|
156
|
-
expect(result).toEqual({
|
|
157
|
-
reason: `A different file already exists at ${path.join(appDetails.routesDir, '_payload.tsx')}.`,
|
|
158
|
-
success: false
|
|
159
|
-
});
|
|
160
|
-
expect(snapshotDirectory(projectDir)).toEqual(before);
|
|
161
|
-
});
|
|
162
|
-
it('should reject a host file that cannot be transformed without writing to disk', async ()=>{
|
|
163
|
-
fse.writeFileSync(appDetails.routerPath, 'export function getRouter() {}\n');
|
|
164
|
-
const before = snapshotDirectory(projectDir);
|
|
165
|
-
const result = await prepareTanStackInit({
|
|
166
|
-
appDetails,
|
|
167
|
-
templateRoot
|
|
168
|
-
});
|
|
169
|
-
expect(result).toEqual({
|
|
170
|
-
reason: `Could not transform ${appDetails.routerPath}: Could not identify the createRouter import.`,
|
|
171
|
-
success: false
|
|
172
|
-
});
|
|
173
|
-
expect(snapshotDirectory(projectDir)).toEqual(before);
|
|
174
|
-
});
|
|
175
|
-
it('should reject a missing required template file without writing to disk', async ()=>{
|
|
176
|
-
fse.removeSync(path.join(templateRoot, 'src/payload.config.ts'));
|
|
177
|
-
const before = snapshotDirectory(projectDir);
|
|
178
|
-
const result = await prepareTanStackInit({
|
|
179
|
-
appDetails,
|
|
180
|
-
templateRoot
|
|
181
|
-
});
|
|
182
|
-
expect(result).toEqual({
|
|
183
|
-
reason: `Required TanStack template file is missing: ${path.join(templateRoot, 'src/payload.config.ts')}.`,
|
|
184
|
-
success: false
|
|
185
|
-
});
|
|
186
|
-
expect(snapshotDirectory(projectDir)).toEqual(before);
|
|
187
|
-
});
|
|
188
|
-
it('should reject a missing nested Payload route without writing to disk', async ()=>{
|
|
189
|
-
const missingFilePath = path.join(templateRoot, 'routes/_payload/server.functions.ts');
|
|
190
|
-
fse.removeSync(missingFilePath);
|
|
191
|
-
const before = snapshotDirectory(projectDir);
|
|
192
|
-
const result = await prepareTanStackInit({
|
|
193
|
-
appDetails,
|
|
194
|
-
templateRoot
|
|
195
|
-
});
|
|
196
|
-
expect(result).toEqual({
|
|
197
|
-
reason: `Required TanStack template file is missing: ${missingFilePath}.`,
|
|
198
|
-
success: false
|
|
199
|
-
});
|
|
200
|
-
expect(snapshotDirectory(projectDir)).toEqual(before);
|
|
201
|
-
});
|
|
202
|
-
it('should reject a missing collection without writing to disk', async ()=>{
|
|
203
|
-
const missingFilePath = path.join(templateRoot, 'src/collections/Folders.ts');
|
|
204
|
-
fse.removeSync(missingFilePath);
|
|
205
|
-
const before = snapshotDirectory(projectDir);
|
|
206
|
-
const result = await prepareTanStackInit({
|
|
207
|
-
appDetails,
|
|
208
|
-
templateRoot
|
|
209
|
-
});
|
|
210
|
-
expect(result).toEqual({
|
|
211
|
-
reason: `Required TanStack template file is missing: ${missingFilePath}.`,
|
|
212
|
-
success: false
|
|
213
|
-
});
|
|
214
|
-
expect(snapshotDirectory(projectDir)).toEqual(before);
|
|
215
|
-
});
|
|
216
|
-
it('should accept an identical Payload-owned file and omit it from the write set', async ()=>{
|
|
217
|
-
const identicalFilePath = path.join(appDetails.routesDir, '_payload.tsx');
|
|
218
|
-
fse.outputFileSync(identicalFilePath, templateFiles['routes/_payload.tsx']);
|
|
219
|
-
const before = snapshotDirectory(projectDir);
|
|
220
|
-
const result = await prepareTanStackInit({
|
|
221
|
-
appDetails,
|
|
222
|
-
templateRoot
|
|
223
|
-
});
|
|
224
|
-
expect(result.success).toBe(true);
|
|
225
|
-
expect(snapshotDirectory(projectDir)).toEqual(before);
|
|
226
|
-
if (!result.success) {
|
|
227
|
-
throw new Error(result.reason);
|
|
228
|
-
}
|
|
229
|
-
expect(result.writes.some(({ filePath })=>filePath === identicalFilePath)).toBe(false);
|
|
230
|
-
});
|
|
231
|
-
});
|
|
232
|
-
describe('applyPreparedWrites', ()=>{
|
|
233
|
-
let projectDir;
|
|
234
|
-
beforeEach(()=>{
|
|
235
|
-
projectDir = fse.mkdtempSync(path.join(os.tmpdir(), 'cpa-apply-tanstack-writes-'));
|
|
236
|
-
});
|
|
237
|
-
afterEach(()=>{
|
|
238
|
-
fse.removeSync(projectDir);
|
|
239
|
-
});
|
|
240
|
-
it('should create parent directories and write the exact prepared content', async ()=>{
|
|
241
|
-
const writes = [
|
|
242
|
-
{
|
|
243
|
-
content: 'export const value = "preserve exact quotes"\n',
|
|
244
|
-
filePath: path.join(projectDir, 'nested/deep/file.ts')
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
content: '@layer payload;\n',
|
|
248
|
-
filePath: path.join(projectDir, 'src/payload-foundation.css')
|
|
249
|
-
}
|
|
250
|
-
];
|
|
251
|
-
await applyPreparedWrites({
|
|
252
|
-
writes
|
|
253
|
-
});
|
|
254
|
-
expect(fse.readFileSync(writes[0].filePath, 'utf8')).toBe(writes[0].content);
|
|
255
|
-
expect(fse.readFileSync(writes[1].filePath, 'utf8')).toBe(writes[1].content);
|
|
256
|
-
});
|
|
257
|
-
});
|
|
258
|
-
function getPreparedContent({ filePath, writes }) {
|
|
259
|
-
const write = writes.find((candidate)=>candidate.filePath === filePath);
|
|
260
|
-
if (!write) {
|
|
261
|
-
throw new Error(`No prepared write found for ${filePath}.`);
|
|
262
|
-
}
|
|
263
|
-
return write.content;
|
|
264
|
-
}
|
|
265
|
-
function snapshotDirectory(root) {
|
|
266
|
-
if (!fse.pathExistsSync(root)) {
|
|
267
|
-
return {};
|
|
268
|
-
}
|
|
269
|
-
return fse.readdirSync(root).sort().reduce((snapshot, entry)=>{
|
|
270
|
-
const filePath = path.join(root, entry);
|
|
271
|
-
const relativePath = path.relative(root, filePath);
|
|
272
|
-
if (fse.statSync(filePath).isDirectory()) {
|
|
273
|
-
for (const [nestedPath, content] of Object.entries(snapshotDirectory(filePath))){
|
|
274
|
-
snapshot[path.join(relativePath, nestedPath)] = content;
|
|
275
|
-
}
|
|
276
|
-
} else {
|
|
277
|
-
snapshot[relativePath] = fse.readFileSync(filePath, 'utf8');
|
|
278
|
-
}
|
|
279
|
-
return snapshot;
|
|
280
|
-
}, {});
|
|
281
|
-
}
|
|
282
|
-
function writeFiles({ files, root }) {
|
|
283
|
-
for (const [relativePath, content] of Object.entries(files)){
|
|
284
|
-
fse.outputFileSync(path.join(root, relativePath), content);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
//# sourceMappingURL=prepare.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/tanstack/prepare.spec.ts"],"sourcesContent":["import fse from 'fs-extra'\nimport os from 'node:os'\nimport path from 'node:path'\nimport { afterEach, beforeEach, describe, expect, it } from 'vitest'\n\nimport type { TanStackAppDetails } from '../../types.js'\n\nimport { applyPreparedWrites, prepareTanStackInit } from './prepare.js'\n\nconst routerContent = `import { createRouter } from '@tanstack/react-router'\n\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n return createRouter({\n routeTree,\n defaultPreload: 'intent',\n })\n}\n\ndeclare module '@tanstack/react-router' {\n interface Register {\n router: ReturnType<typeof getRouter>\n }\n}\n`\n\nconst rootRouteContent = `import { createRootRoute, HeadContent, Scripts } from '@tanstack/react-router'\nimport appCss from '../styles.css?url'\n\nexport const Route = createRootRoute({\n head: () => ({\n links: [{ rel: 'stylesheet', href: appCss }],\n meta: [{ title: 'Host app' }],\n }),\n shellComponent: RootDocument,\n})\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n return (\n <html lang=\"en\">\n <head>\n <HeadContent />\n </head>\n <body>\n {children}\n <Scripts />\n </body>\n </html>\n )\n}\n`\n\nconst viteConfigContent = `import { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport { defineConfig } from 'vite'\n\nexport default defineConfig({\n plugins: [tanstackStart(), viteReact()],\n})\n`\n\nconst templateFiles = {\n 'routes/_payload.tsx': 'export const payloadLayout = true\\n',\n 'routes/_payload/admin.$.tsx': 'export const payloadAdminSplat = true\\n',\n 'routes/_payload/admin.index.tsx': 'export const payloadAdminIndex = true\\n',\n 'routes/_payload/api.$.ts': 'export const payloadApi = true\\n',\n 'routes/_payload/importMap.js': 'export const importMap = {}\\n',\n 'routes/_payload/server.functions.ts': 'export const payloadServerFunctions = true\\n',\n 'src/collections/Folders.ts': \"export const Folders = { slug: 'folders' }\\n\",\n 'src/collections/Media.ts': \"export const Media = { slug: 'media' }\\n\",\n 'src/collections/Tags.ts': \"export const Tags = { slug: 'tags' }\\n\",\n 'src/collections/Users.ts': \"export const Users = { slug: 'users' }\\n\",\n 'src/payload-foundation.css': '@layer payload-default, payload;\\n',\n 'src/payload.config.ts': 'export default { collections: [] }\\n',\n}\n\ndescribe('prepareTanStackInit', () => {\n let appDetails: TanStackAppDetails\n let projectDir: string\n let templateRoot: string\n\n beforeEach(() => {\n projectDir = fse.mkdtempSync(path.join(os.tmpdir(), 'cpa-prepare-tanstack-project-'))\n templateRoot = fse.mkdtempSync(path.join(os.tmpdir(), 'cpa-prepare-tanstack-template-'))\n\n writeFiles({\n root: projectDir,\n files: {\n 'src/router.tsx': routerContent,\n 'src/routes/__root.tsx': rootRouteContent,\n 'vite.config.ts': viteConfigContent,\n },\n })\n writeFiles({ files: templateFiles, root: templateRoot })\n\n appDetails = {\n isPayloadInstalled: false,\n kind: 'start',\n projectDir,\n rootRoutePath: path.join(projectDir, 'src/routes/__root.tsx'),\n routerPath: path.join(projectDir, 'src/router.tsx'),\n routesDir: path.join(projectDir, 'src/routes'),\n sourceDir: path.join(projectDir, 'src'),\n viteConfigPath: path.join(projectDir, 'vite.config.ts'),\n }\n })\n\n afterEach(() => {\n fse.removeSync(projectDir)\n fse.removeSync(templateRoot)\n })\n\n it('should prepare every host transformation and Payload-owned file without writing to disk', async () => {\n const before = snapshotDirectory(projectDir)\n\n const result = await prepareTanStackInit({ appDetails, templateRoot })\n\n expect(result.success).toBe(true)\n expect(snapshotDirectory(projectDir)).toEqual(before)\n\n if (!result.success) {\n throw new Error(result.reason)\n }\n\n expect(result.writes.map(({ filePath }) => path.relative(projectDir, filePath)).sort()).toEqual(\n [\n 'src/collections/Folders.ts',\n 'src/collections/Media.ts',\n 'src/collections/Tags.ts',\n 'src/collections/Users.ts',\n 'src/payload-foundation.css',\n 'src/payload.config.ts',\n 'src/router.tsx',\n 'src/routes/__root.tsx',\n 'src/routes/_payload.tsx',\n 'src/routes/_payload/admin.$.tsx',\n 'src/routes/_payload/admin.index.tsx',\n 'src/routes/_payload/api.$.ts',\n 'src/routes/_payload/importMap.js',\n 'src/routes/_payload/server.functions.ts',\n 'vite.config.ts',\n ],\n )\n expect(\n getPreparedContent({ filePath: appDetails.viteConfigPath, writes: result.writes }),\n ).toContain('withPayload(')\n expect(\n getPreparedContent({ filePath: appDetails.routerPath, writes: result.writes }),\n ).toContain('parseSearch: payloadParseSearch')\n expect(\n getPreparedContent({ filePath: appDetails.rootRoutePath, writes: result.writes }),\n ).toContain('withPayloadRoot(')\n expect(\n getPreparedContent({\n filePath: path.join(appDetails.routesDir, '_payload/api.$.ts'),\n writes: result.writes,\n }),\n ).toBe(templateFiles['routes/_payload/api.$.ts'])\n })\n\n it('should reject a non-identical Payload-owned file collision without writing to disk', async () => {\n fse.outputFileSync(path.join(appDetails.routesDir, '_payload.tsx'), 'custom route\\n')\n const before = snapshotDirectory(projectDir)\n\n const result = await prepareTanStackInit({ appDetails, templateRoot })\n\n expect(result).toEqual({\n reason: `A different file already exists at ${path.join(appDetails.routesDir, '_payload.tsx')}.`,\n success: false,\n })\n expect(snapshotDirectory(projectDir)).toEqual(before)\n })\n\n it('should reject a host file that cannot be transformed without writing to disk', async () => {\n fse.writeFileSync(appDetails.routerPath, 'export function getRouter() {}\\n')\n const before = snapshotDirectory(projectDir)\n\n const result = await prepareTanStackInit({ appDetails, templateRoot })\n\n expect(result).toEqual({\n reason: `Could not transform ${appDetails.routerPath}: Could not identify the createRouter import.`,\n success: false,\n })\n expect(snapshotDirectory(projectDir)).toEqual(before)\n })\n\n it('should reject a missing required template file without writing to disk', async () => {\n fse.removeSync(path.join(templateRoot, 'src/payload.config.ts'))\n const before = snapshotDirectory(projectDir)\n\n const result = await prepareTanStackInit({ appDetails, templateRoot })\n\n expect(result).toEqual({\n reason: `Required TanStack template file is missing: ${path.join(templateRoot, 'src/payload.config.ts')}.`,\n success: false,\n })\n expect(snapshotDirectory(projectDir)).toEqual(before)\n })\n\n it('should reject a missing nested Payload route without writing to disk', async () => {\n const missingFilePath = path.join(templateRoot, 'routes/_payload/server.functions.ts')\n fse.removeSync(missingFilePath)\n const before = snapshotDirectory(projectDir)\n\n const result = await prepareTanStackInit({ appDetails, templateRoot })\n\n expect(result).toEqual({\n reason: `Required TanStack template file is missing: ${missingFilePath}.`,\n success: false,\n })\n expect(snapshotDirectory(projectDir)).toEqual(before)\n })\n\n it('should reject a missing collection without writing to disk', async () => {\n const missingFilePath = path.join(templateRoot, 'src/collections/Folders.ts')\n fse.removeSync(missingFilePath)\n const before = snapshotDirectory(projectDir)\n\n const result = await prepareTanStackInit({ appDetails, templateRoot })\n\n expect(result).toEqual({\n reason: `Required TanStack template file is missing: ${missingFilePath}.`,\n success: false,\n })\n expect(snapshotDirectory(projectDir)).toEqual(before)\n })\n\n it('should accept an identical Payload-owned file and omit it from the write set', async () => {\n const identicalFilePath = path.join(appDetails.routesDir, '_payload.tsx')\n fse.outputFileSync(identicalFilePath, templateFiles['routes/_payload.tsx'])\n const before = snapshotDirectory(projectDir)\n\n const result = await prepareTanStackInit({ appDetails, templateRoot })\n\n expect(result.success).toBe(true)\n expect(snapshotDirectory(projectDir)).toEqual(before)\n\n if (!result.success) {\n throw new Error(result.reason)\n }\n\n expect(result.writes.some(({ filePath }) => filePath === identicalFilePath)).toBe(false)\n })\n})\n\ndescribe('applyPreparedWrites', () => {\n let projectDir: string\n\n beforeEach(() => {\n projectDir = fse.mkdtempSync(path.join(os.tmpdir(), 'cpa-apply-tanstack-writes-'))\n })\n\n afterEach(() => {\n fse.removeSync(projectDir)\n })\n\n it('should create parent directories and write the exact prepared content', async () => {\n const writes = [\n {\n content: 'export const value = \"preserve exact quotes\"\\n',\n filePath: path.join(projectDir, 'nested/deep/file.ts'),\n },\n {\n content: '@layer payload;\\n',\n filePath: path.join(projectDir, 'src/payload-foundation.css'),\n },\n ]\n\n await applyPreparedWrites({ writes })\n\n expect(fse.readFileSync(writes[0]!.filePath, 'utf8')).toBe(writes[0]!.content)\n expect(fse.readFileSync(writes[1]!.filePath, 'utf8')).toBe(writes[1]!.content)\n })\n})\n\nfunction getPreparedContent({\n filePath,\n writes,\n}: {\n filePath: string\n writes: { content: string; filePath: string }[]\n}) {\n const write = writes.find((candidate) => candidate.filePath === filePath)\n\n if (!write) {\n throw new Error(`No prepared write found for ${filePath}.`)\n }\n\n return write.content\n}\n\nfunction snapshotDirectory(root: string): Record<string, string> {\n if (!fse.pathExistsSync(root)) {\n return {}\n }\n\n return fse\n .readdirSync(root)\n .sort()\n .reduce<Record<string, string>>((snapshot, entry) => {\n const filePath = path.join(root, entry)\n const relativePath = path.relative(root, filePath)\n\n if (fse.statSync(filePath).isDirectory()) {\n for (const [nestedPath, content] of Object.entries(snapshotDirectory(filePath))) {\n snapshot[path.join(relativePath, nestedPath)] = content\n }\n } else {\n snapshot[relativePath] = fse.readFileSync(filePath, 'utf8')\n }\n\n return snapshot\n }, {})\n}\n\nfunction writeFiles({ files, root }: { files: Record<string, string>; root: string }) {\n for (const [relativePath, content] of Object.entries(files)) {\n fse.outputFileSync(path.join(root, relativePath), content)\n }\n}\n"],"names":["fse","os","path","afterEach","beforeEach","describe","expect","it","applyPreparedWrites","prepareTanStackInit","routerContent","rootRouteContent","viteConfigContent","templateFiles","appDetails","projectDir","templateRoot","mkdtempSync","join","tmpdir","writeFiles","root","files","isPayloadInstalled","kind","rootRoutePath","routerPath","routesDir","sourceDir","viteConfigPath","removeSync","before","snapshotDirectory","result","success","toBe","toEqual","Error","reason","writes","map","filePath","relative","sort","getPreparedContent","toContain","outputFileSync","writeFileSync","missingFilePath","identicalFilePath","some","content","readFileSync","write","find","candidate","pathExistsSync","readdirSync","reduce","snapshot","entry","relativePath","statSync","isDirectory","nestedPath","Object","entries"],"mappings":"AAAA,OAAOA,SAAS,WAAU;AAC1B,OAAOC,QAAQ,UAAS;AACxB,OAAOC,UAAU,YAAW;AAC5B,SAASC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ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