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.
Files changed (69) hide show
  1. package/dist/lib/agent-config.d.ts +2 -5
  2. package/dist/lib/agent-config.d.ts.map +1 -1
  3. package/dist/lib/agent-config.js +1 -8
  4. package/dist/lib/agent-config.js.map +1 -1
  5. package/dist/lib/create-project.d.ts.map +1 -1
  6. package/dist/lib/create-project.js +51 -8
  7. package/dist/lib/create-project.js.map +1 -1
  8. package/dist/lib/get-package-manager.d.ts +9 -0
  9. package/dist/lib/get-package-manager.d.ts.map +1 -1
  10. package/dist/lib/get-package-manager.js +20 -0
  11. package/dist/lib/get-package-manager.js.map +1 -1
  12. package/dist/lib/tanstack/template-files.d.ts +2 -2
  13. package/dist/lib/tanstack/template-files.d.ts.map +1 -1
  14. package/dist/lib/tanstack/template-files.js +2 -2
  15. package/dist/lib/tanstack/template-files.js.map +1 -1
  16. package/dist/lib/update-payload-in-project.d.ts.map +1 -1
  17. package/dist/lib/update-payload-in-project.js +7 -2
  18. package/dist/lib/update-payload-in-project.js.map +1 -1
  19. package/dist/main.d.ts.map +1 -1
  20. package/dist/main.js +0 -1
  21. package/dist/main.js.map +1 -1
  22. package/dist/template/src/app/(frontend)/styles.css +7 -0
  23. package/dist/template/src/app/(payload)/admin/importMap.js +17 -0
  24. package/dist/template/src/payload-types.ts +72 -1
  25. package/dist/template/src/payload.config.ts +8 -0
  26. package/dist/template-tanstack/routes/_payload.tsx +22 -5
  27. package/dist/template-tanstack/src/payload.css +1 -0
  28. package/dist/utils/messages.js +1 -1
  29. package/dist/utils/messages.js.map +1 -1
  30. package/package.json +2 -2
  31. package/dist/ast-integration.spec.js +0 -132
  32. package/dist/ast-integration.spec.js.map +0 -1
  33. package/dist/lib/agent-config.spec.js +0 -23
  34. package/dist/lib/agent-config.spec.js.map +0 -1
  35. package/dist/lib/ast/package-json.spec.js +0 -139
  36. package/dist/lib/ast/package-json.spec.js.map +0 -1
  37. package/dist/lib/ast/payload-config.spec.js +0 -365
  38. package/dist/lib/ast/payload-config.spec.js.map +0 -1
  39. package/dist/lib/ast/utils.spec.js +0 -226
  40. package/dist/lib/ast/utils.spec.js.map +0 -1
  41. package/dist/lib/configure-payload-tsconfig.spec.js +0 -135
  42. package/dist/lib/configure-payload-tsconfig.spec.js.map +0 -1
  43. package/dist/lib/create-project.spec.js +0 -199
  44. package/dist/lib/create-project.spec.js.map +0 -1
  45. package/dist/lib/init-tanstack-default-template.spec.js +0 -119
  46. package/dist/lib/init-tanstack-default-template.spec.js.map +0 -1
  47. package/dist/lib/init-tanstack.spec.js +0 -394
  48. package/dist/lib/init-tanstack.spec.js.map +0 -1
  49. package/dist/lib/manage-env-files.spec.js +0 -118
  50. package/dist/lib/manage-env-files.spec.js.map +0 -1
  51. package/dist/lib/tanstack/detect.spec.js +0 -227
  52. package/dist/lib/tanstack/detect.spec.js.map +0 -1
  53. package/dist/lib/tanstack/prepare.spec.js +0 -288
  54. package/dist/lib/tanstack/prepare.spec.js.map +0 -1
  55. package/dist/lib/tanstack/transform-root-route.spec.js +0 -484
  56. package/dist/lib/tanstack/transform-root-route.spec.js.map +0 -1
  57. package/dist/lib/tanstack/transform-router.spec.js +0 -264
  58. package/dist/lib/tanstack/transform-router.spec.js.map +0 -1
  59. package/dist/lib/tanstack/transform-vite-config.spec.js +0 -456
  60. package/dist/lib/tanstack/transform-vite-config.spec.js.map +0 -1
  61. package/dist/lib/update-payload-in-project.spec.js +0 -258
  62. package/dist/lib/update-payload-in-project.spec.js.map +0 -1
  63. package/dist/lib/wrap-next-config.spec.js +0 -167
  64. package/dist/lib/wrap-next-config.spec.js.map +0 -1
  65. package/dist/main.spec.js +0 -102
  66. package/dist/main.spec.js.map +0 -1
  67. package/dist/template-tanstack/src/payload-foundation.css +0 -10
  68. package/dist/utils/resolvePackageVersion.spec.js +0 -77
  69. package/dist/utils/resolvePackageVersion.spec.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/ast/utils.spec.ts"],"sourcesContent":["import { describe, it, expect } from 'vitest'\nimport { Project } from 'ts-morph'\nimport {\n addImportDeclaration,\n cleanupOrphanedImports,\n findImportDeclaration,\n isNamedImportUsed,\n removeImportDeclaration,\n removeNamedImports,\n} from './utils'\n\ndescribe('findImportDeclaration', () => {\n it('finds import by module specifier', () => {\n const project = new Project({ useInMemoryFileSystem: true })\n const sourceFile = project.createSourceFile(\n 'test.ts',\n `import { buildConfig } from 'payload'\nimport { mongooseAdapter } from '@payloadcms/db-mongodb'`,\n )\n\n const result = findImportDeclaration({ sourceFile, moduleSpecifier: '@payloadcms/db-mongodb' })\n\n expect(result).toBeDefined()\n expect(result?.getModuleSpecifierValue()).toBe('@payloadcms/db-mongodb')\n })\n})\n\ndescribe('addImportDeclaration', () => {\n it('adds new import when not present', () => {\n const project = new Project({ useInMemoryFileSystem: true })\n const sourceFile = project.createSourceFile('test.ts', `import { buildConfig } from 'payload'`)\n\n const result = addImportDeclaration({\n sourceFile,\n moduleSpecifier: '@payloadcms/db-postgres',\n namedImports: ['postgresAdapter'],\n })\n\n const imports = result.getImportDeclarations()\n expect(imports).toHaveLength(2)\n expect(imports[1].getModuleSpecifierValue()).toBe('@payloadcms/db-postgres')\n expect(imports[1].getNamedImports()[0].getName()).toBe('postgresAdapter')\n })\n\n it('does not duplicate existing import', () => {\n const project = new Project({ useInMemoryFileSystem: true })\n const sourceFile = project.createSourceFile(\n 'test.ts',\n `import { mongooseAdapter } from '@payloadcms/db-mongodb'`,\n )\n\n const result = addImportDeclaration({\n sourceFile,\n moduleSpecifier: '@payloadcms/db-mongodb',\n namedImports: ['mongooseAdapter'],\n })\n\n const imports = result.getImportDeclarations()\n expect(imports).toHaveLength(1)\n })\n\n it('adds named import to existing module import', () => {\n const project = new Project({ useInMemoryFileSystem: true })\n const sourceFile = project.createSourceFile('test.ts', `import { buildConfig } from 'payload'`)\n\n const result = addImportDeclaration({\n sourceFile,\n moduleSpecifier: 'payload',\n namedImports: ['Field'],\n })\n\n const imports = result.getImportDeclarations()\n expect(imports).toHaveLength(1)\n const namedImports = imports[0].getNamedImports().map((ni) => ni.getName())\n expect(namedImports).toContain('buildConfig')\n expect(namedImports).toContain('Field')\n })\n})\n\ndescribe('removeImportDeclaration', () => {\n it('removes import by module specifier', () => {\n const project = new Project({ useInMemoryFileSystem: true })\n const sourceFile = project.createSourceFile(\n 'test.ts',\n `import { buildConfig } from 'payload'\nimport sharp from 'sharp'`,\n )\n\n const result = removeImportDeclaration({ sourceFile, moduleSpecifier: 'sharp' })\n\n expect(result.removedIndex).toBe(1)\n const imports = result.sourceFile.getImportDeclarations()\n expect(imports).toHaveLength(1)\n expect(imports[0].getModuleSpecifierValue()).toBe('payload')\n })\n\n it('returns undefined removedIndex when import not found', () => {\n const project = new Project({ useInMemoryFileSystem: true })\n const sourceFile = project.createSourceFile('test.ts', `import { buildConfig } from 'payload'`)\n\n const result = removeImportDeclaration({ sourceFile, moduleSpecifier: 'sharp' })\n\n expect(result.removedIndex).toBeUndefined()\n })\n})\n\ndescribe('removeNamedImports', () => {\n it('removes specific named imports', () => {\n const project = new Project({ useInMemoryFileSystem: true })\n const sourceFile = project.createSourceFile(\n 'test.ts',\n `import { mongooseAdapter, SomeOtherType } from '@payloadcms/db-mongodb'`,\n )\n\n const importDecl = findImportDeclaration({\n sourceFile,\n moduleSpecifier: '@payloadcms/db-mongodb',\n })!\n\n const result = removeNamedImports({\n sourceFile,\n importDeclaration: importDecl,\n namedImportsToRemove: ['mongooseAdapter'],\n })\n\n expect(result.fullyRemoved).toBe(false)\n const imports = result.sourceFile.getImportDeclarations()\n expect(imports).toHaveLength(1)\n const namedImports = imports[0].getNamedImports().map((ni) => ni.getName())\n expect(namedImports).toEqual(['SomeOtherType'])\n })\n\n it('removes entire import when no named imports remain', () => {\n const project = new Project({ useInMemoryFileSystem: true })\n const sourceFile = project.createSourceFile(\n 'test.ts',\n `import { buildConfig } from 'payload'\nimport { mongooseAdapter } from '@payloadcms/db-mongodb'`,\n )\n\n const importDecl = findImportDeclaration({\n sourceFile,\n moduleSpecifier: '@payloadcms/db-mongodb',\n })!\n\n const result = removeNamedImports({\n sourceFile,\n importDeclaration: importDecl,\n namedImportsToRemove: ['mongooseAdapter'],\n })\n\n expect(result.fullyRemoved).toBe(true)\n expect(result.index).toBe(1)\n const imports = result.sourceFile.getImportDeclarations()\n expect(imports).toHaveLength(1)\n expect(imports[0].getModuleSpecifierValue()).toBe('payload')\n })\n})\n\ndescribe('isNamedImportUsed', () => {\n it('detects used import in code', () => {\n const project = new Project({ useInMemoryFileSystem: true })\n const sourceFile = project.createSourceFile(\n 'test.ts',\n `import { mongooseAdapter } from '@payloadcms/db-mongodb'\n\nexport default buildConfig({\n db: mongooseAdapter({ url: '' })\n})`,\n )\n\n const isUsed = isNamedImportUsed(sourceFile, 'mongooseAdapter')\n\n expect(isUsed).toBe(true)\n })\n\n it('detects unused import', () => {\n const project = new Project({ useInMemoryFileSystem: true })\n const sourceFile = project.createSourceFile(\n 'test.ts',\n `import { mongooseAdapter } from '@payloadcms/db-mongodb'\nimport { postgresAdapter } from '@payloadcms/db-postgres'\n\nexport default buildConfig({\n db: postgresAdapter({ url: '' })\n})`,\n )\n\n const isUsed = isNamedImportUsed(sourceFile, 'mongooseAdapter')\n\n expect(isUsed).toBe(false)\n })\n})\n\ndescribe('cleanupOrphanedImports', () => {\n it('removes unused imports', () => {\n const project = new Project({ useInMemoryFileSystem: true })\n const sourceFile = project.createSourceFile(\n 'test.ts',\n `import { mongooseAdapter } from '@payloadcms/db-mongodb'\nimport { postgresAdapter } from '@payloadcms/db-postgres'\n\nexport default buildConfig({\n db: postgresAdapter({ url: '' })\n})`,\n )\n\n const result = cleanupOrphanedImports({\n sourceFile,\n moduleSpecifier: '@payloadcms/db-mongodb',\n importNames: ['mongooseAdapter'],\n })\n\n expect(result.removed).toEqual(['mongooseAdapter'])\n expect(result.kept).toEqual([])\n const imports = result.sourceFile.getImportDeclarations()\n expect(imports).toHaveLength(1)\n expect(imports[0].getModuleSpecifierValue()).toBe('@payloadcms/db-postgres')\n })\n\n it('keeps used imports', () => {\n const project = new Project({ useInMemoryFileSystem: true })\n const sourceFile = project.createSourceFile(\n 'test.ts',\n `import { mongooseAdapter } from '@payloadcms/db-mongodb'\n\nexport default buildConfig({\n db: mongooseAdapter({ url: '' })\n})`,\n )\n\n const result = cleanupOrphanedImports({\n sourceFile,\n moduleSpecifier: '@payloadcms/db-mongodb',\n importNames: ['mongooseAdapter'],\n })\n\n expect(result.removed).toEqual([])\n expect(result.kept).toEqual(['mongooseAdapter'])\n const imports = result.sourceFile.getImportDeclarations()\n expect(imports).toHaveLength(1)\n })\n})\n"],"names":["describe","it","expect","Project","addImportDeclaration","cleanupOrphanedImports","findImportDeclaration","isNamedImportUsed","removeImportDeclaration","removeNamedImports","project","useInMemoryFileSystem","sourceFile","createSourceFile","result","moduleSpecifier","toBeDefined","getModuleSpecifierValue","toBe","namedImports","imports","getImportDeclarations","toHaveLength","getNamedImports","getName","map","ni","toContain","removedIndex","toBeUndefined","importDecl","importDeclaration","namedImportsToRemove","fullyRemoved","toEqual","index","isUsed","importNames","removed","kept"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,EAAE,EAAEC,MAAM,QAAQ,SAAQ;AAC7C,SAASC,OAAO,QAAQ,WAAU;AAClC,SACEC,oBAAoB,EACpBC,sBAAsB,EACtBC,qBAAqB,EACrBC,iBAAiB,EACjBC,uBAAuB,EACvBC,kBAAkB,QACb,UAAS;AAEhBT,SAAS,yBAAyB;IAChCC,GAAG,oCAAoC;QACrC,MAAMS,UAAU,IAAIP,QAAQ;YAAEQ,uBAAuB;QAAK;QAC1D,MAAMC,aAAaF,QAAQG,gBAAgB,CACzC,WACA,CAAC;wDACiD,CAAC;QAGrD,MAAMC,SAASR,sBAAsB;YAAEM;YAAYG,iBAAiB;QAAyB;QAE7Fb,OAAOY,QAAQE,W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AI,CAAC;IACtB;AACF;AAEAlB,SAAS,0BAA0B;IACjCC,GAAG,0BAA0B;QAC3B,MAAMS,UAAU,IAAIP,QAAQ;YAAEQ,uBAAuB;QAAK;QAC1D,MAAMC,aAAaF,QAAQG,gBAAgB,CACzC,WACA,CAAC;;;;;EAKL,CAAC;QAGC,MAAMC,SAAST,uBAAuB;YACpCO;YACAG,iBAAiB;YACjBsB,aAAa;gBAAC;aAAkB;QAClC;QAEAnC,OAAOY,OAAOwB,OAAO,EAAEJ,OAAO,CAAC;YAAC;SAAkB;QAClDhC,OAAOY,OAAOyB,IAAI,EAAEL,OAAO,CAAC,EAAE;QAC9B,MAAMd,UAAUN,OAAOF,UAAU,CAACS,qBAAqB;QACvDnB,OAAOkB,SAASE,YAAY,CAAC;QAC7BpB,OAAOkB,OAAO,CAAC,EAAE,CAACH,uBAAuB,IAAIC,IAAI,CAAC;IACpD;IAEAjB,GAAG,sBAAsB;QACvB,MAAMS,UAAU,IAAIP,QAAQ;YAAEQ,uBAAuB;QAAK;QAC1D,MAAMC,aAAaF,QAAQG,gBAAgB,CACzC,WACA,CAAC;;;;EAIL,CAAC;QAGC,MAAMC,SAAST,uBAAuB;YACpCO;YACAG,iBAAiB;YACjBsB,aAAa;gBAAC;aAAkB;QAClC;QAEAnC,OAAOY,OAAOwB,OAAO,EAAEJ,OAAO,CAAC,EAAE;QACjChC,OAAOY,OAAOyB,IAAI,EAAEL,OAAO,CAAC;YAAC;SAAkB;QAC/C,MAAMd,UAAUN,OAAOF,UAAU,CAACS,qBAAqB;QACvDnB,OAAOkB,SAASE,YAAY,CAAC;IAC/B;AACF"}
@@ -1,135 +0,0 @@
1
- import { parse } from 'comment-json';
2
- import fse from 'fs-extra';
3
- import os from 'node:os';
4
- import path from 'node:path';
5
- import { afterEach, beforeEach, describe, expect, it } from 'vitest';
6
- import { configurePayloadTsConfig } from './configure-payload-tsconfig.js';
7
- describe('configurePayloadTsConfig', ()=>{
8
- let configPath;
9
- let payloadConfigPath;
10
- let projectDir;
11
- beforeEach(()=>{
12
- projectDir = fse.mkdtempSync(path.join(os.tmpdir(), 'cpa-payload-tsconfig-'));
13
- configPath = path.join(projectDir, 'tsconfig.json');
14
- payloadConfigPath = path.join(projectDir, 'src/payload.config.ts');
15
- });
16
- afterEach(()=>{
17
- fse.removeSync(projectDir);
18
- });
19
- it('should add the Payload alias without changing existing paths', async ()=>{
20
- writeTsConfig(`{
21
- "compilerOptions": {
22
- "paths": {
23
- "@/*": ["./src/*"]
24
- }
25
- }
26
- }`);
27
- await configurePayloadTsConfig({
28
- configPath,
29
- payloadConfigPath
30
- });
31
- expect(readTsConfig().compilerOptions.paths).toEqual({
32
- '@/*': [
33
- './src/*'
34
- ],
35
- '@payload-config': [
36
- './src/payload.config.ts'
37
- ]
38
- });
39
- });
40
- it('should create paths when compiler options do not define them', async ()=>{
41
- writeTsConfig(`{
42
- "compilerOptions": {
43
- "strict": true
44
- }
45
- }`);
46
- await configurePayloadTsConfig({
47
- configPath,
48
- payloadConfigPath
49
- });
50
- expect(readTsConfig().compilerOptions).toEqual({
51
- paths: {
52
- '@payload-config': [
53
- './src/payload.config.ts'
54
- ]
55
- },
56
- strict: true
57
- });
58
- });
59
- it('should preserve comments while adding the Payload alias', async ()=>{
60
- writeTsConfig(`{
61
- // Keep this compiler explanation.
62
- "compilerOptions": {
63
- "paths": {
64
- // Keep this application alias.
65
- "@/*": ["./src/*"]
66
- }
67
- }
68
- }`);
69
- await configurePayloadTsConfig({
70
- configPath,
71
- payloadConfigPath
72
- });
73
- const content = fse.readFileSync(configPath, 'utf8');
74
- expect(content).toContain('// Keep this compiler explanation.');
75
- expect(content).toContain('// Keep this application alias.');
76
- expect(readTsConfig().compilerOptions.paths['@payload-config']).toEqual([
77
- './src/payload.config.ts'
78
- ]);
79
- });
80
- it('should resolve the Payload alias relative to a non-default baseUrl', async ()=>{
81
- writeTsConfig(`{
82
- "compilerOptions": {
83
- "baseUrl": "./src",
84
- "paths": {}
85
- }
86
- }`);
87
- await configurePayloadTsConfig({
88
- configPath,
89
- payloadConfigPath
90
- });
91
- expect(readTsConfig().compilerOptions.paths['@payload-config']).toEqual([
92
- './payload.config.ts'
93
- ]);
94
- });
95
- it('should leave an existing Payload alias unchanged', async ()=>{
96
- const original = `{
97
- "compilerOptions": {
98
- "paths": {
99
- "@payload-config": ["./custom/payload.ts"]
100
- }
101
- }
102
- }`;
103
- writeTsConfig(original);
104
- await configurePayloadTsConfig({
105
- configPath,
106
- payloadConfigPath
107
- });
108
- expect(fse.readFileSync(configPath, 'utf8')).toBe(original);
109
- });
110
- it('should be idempotent after adding the Payload alias', async ()=>{
111
- writeTsConfig(`{
112
- "compilerOptions": {
113
- "paths": {}
114
- }
115
- }`);
116
- await configurePayloadTsConfig({
117
- configPath,
118
- payloadConfigPath
119
- });
120
- const firstResult = fse.readFileSync(configPath, 'utf8');
121
- await configurePayloadTsConfig({
122
- configPath,
123
- payloadConfigPath
124
- });
125
- expect(fse.readFileSync(configPath, 'utf8')).toBe(firstResult);
126
- });
127
- function readTsConfig() {
128
- return parse(fse.readFileSync(configPath, 'utf8'));
129
- }
130
- function writeTsConfig(content) {
131
- fse.writeFileSync(configPath, content);
132
- }
133
- });
134
-
135
- //# sourceMappingURL=configure-payload-tsconfig.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/lib/configure-payload-tsconfig.spec.ts"],"sourcesContent":["import { parse } from 'comment-json'\nimport fse from 'fs-extra'\nimport os from 'node:os'\nimport path from 'node:path'\nimport { afterEach, beforeEach, describe, expect, it } from 'vitest'\n\nimport { configurePayloadTsConfig } from './configure-payload-tsconfig.js'\n\ndescribe('configurePayloadTsConfig', () => {\n let configPath: string\n let payloadConfigPath: string\n let projectDir: string\n\n beforeEach(() => {\n projectDir = fse.mkdtempSync(path.join(os.tmpdir(), 'cpa-payload-tsconfig-'))\n configPath = path.join(projectDir, 'tsconfig.json')\n payloadConfigPath = path.join(projectDir, 'src/payload.config.ts')\n })\n\n afterEach(() => {\n fse.removeSync(projectDir)\n })\n\n it('should add the Payload alias without changing existing paths', async () => {\n writeTsConfig(`{\n \"compilerOptions\": {\n \"paths\": {\n \"@/*\": [\"./src/*\"]\n }\n }\n}`)\n\n await configurePayloadTsConfig({ configPath, payloadConfigPath })\n\n expect(readTsConfig().compilerOptions.paths).toEqual({\n '@/*': ['./src/*'],\n '@payload-config': ['./src/payload.config.ts'],\n })\n })\n\n it('should create paths when compiler options do not define them', async () => {\n writeTsConfig(`{\n \"compilerOptions\": {\n \"strict\": true\n }\n}`)\n\n await configurePayloadTsConfig({ configPath, payloadConfigPath })\n\n expect(readTsConfig().compilerOptions).toEqual({\n paths: {\n '@payload-config': ['./src/payload.config.ts'],\n },\n strict: true,\n })\n })\n\n it('should preserve comments while adding the Payload alias', async () => {\n writeTsConfig(`{\n // Keep this compiler explanation.\n \"compilerOptions\": {\n \"paths\": {\n // Keep this application alias.\n \"@/*\": [\"./src/*\"]\n }\n }\n}`)\n\n await configurePayloadTsConfig({ configPath, payloadConfigPath })\n\n const content = fse.readFileSync(configPath, 'utf8')\n\n expect(content).toContain('// Keep this compiler explanation.')\n expect(content).toContain('// Keep this application alias.')\n expect(readTsConfig().compilerOptions.paths['@payload-config']).toEqual([\n './src/payload.config.ts',\n ])\n })\n\n it('should resolve the Payload alias relative to a non-default baseUrl', async () => {\n writeTsConfig(`{\n \"compilerOptions\": {\n \"baseUrl\": \"./src\",\n \"paths\": {}\n }\n}`)\n\n await configurePayloadTsConfig({ configPath, payloadConfigPath })\n\n expect(readTsConfig().compilerOptions.paths['@payload-config']).toEqual(['./payload.config.ts'])\n })\n\n it('should leave an existing Payload alias unchanged', async () => {\n const original = `{\n \"compilerOptions\": {\n \"paths\": {\n \"@payload-config\": [\"./custom/payload.ts\"]\n }\n }\n}`\n writeTsConfig(original)\n\n await configurePayloadTsConfig({ configPath, payloadConfigPath })\n\n expect(fse.readFileSync(configPath, 'utf8')).toBe(original)\n })\n\n it('should be idempotent after adding the Payload alias', async () => {\n writeTsConfig(`{\n \"compilerOptions\": {\n \"paths\": {}\n }\n}`)\n\n await configurePayloadTsConfig({ configPath, payloadConfigPath })\n const firstResult = fse.readFileSync(configPath, 'utf8')\n\n await configurePayloadTsConfig({ configPath, payloadConfigPath })\n\n expect(fse.readFileSync(configPath, 'utf8')).toBe(firstResult)\n })\n\n function readTsConfig(): {\n compilerOptions: {\n baseUrl?: string\n paths: Record<string, string[]>\n strict?: boolean\n }\n } {\n return parse(fse.readFileSync(configPath, 'utf8')) as {\n compilerOptions: {\n baseUrl?: string\n paths: Record<string, string[]>\n strict?: boolean\n }\n }\n }\n\n function writeTsConfig(content: string): void {\n fse.writeFileSync(configPath, content)\n }\n})\n"],"names":["parse","fse","os","path","afterEach","beforeEach","describe","expect","it","configurePayloadTsConfig","configPath","payloadConfigPath","projectDir","mkdtempSync","join","tmpdir","removeSync","writeTsConfig","readTsConfig","compilerOptions","paths","toEqual","strict","content","readFileSync","toContain","original","toBe","firstResult","writeFileSync"],"mappings":"AAAA,SAASA,KAAK,QAAQ,eAAc;AACpC,OAAOC,SAAS,WAAU;AAC1B,OAAOC,QAAQ,UAAS;AACxB,OAAOC,UAAU,YAAW;AAC5B,SAASC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,SAAQ;AAEpE,SAASC,wBAAwB,QAAQ,kCAAiC;AAE1EH,SAAS,4BAA4B;IACnC,IAAII;IACJ,IAAIC;IACJ,IAAIC;IAEJP,WAAW;QACTO,aAAaX,IAAIY,WAAW,CAACV,KAAKW,IAAI,CAACZ,GAAGa,MAAM,IAAI;QACpDL,aAAaP,KAAKW,IAAI,CAACF,YAAY;QACnCD,oBAAoBR,KAAKW,IAAI,CAACF,YAAY;IAC5C;IAEAR,UAAU;QACRH,IAAIe,UAAU,CAACJ;IACjB;IAEAJ,GAAG,gEAAgE;QACjES,cAAc,CAAC;;;;;;CAMlB,CAAC;QAEE,MAAMR,yBAAyB;YAAEC;YAAY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yBAAyB;YAAEC;YAAYC;QAAkB;QAE/DJ,OAAON,IAAIuB,YAAY,CAACd,YAAY,SAASiB,IAAI,CAACC;IACpD;IAEA,SAASV;QAOP,OAAOlB,MAAMC,IAAIuB,YAAY,CAACd,YAAY;IAO5C;IAEA,SAASO,cAAcM,OAAe;QACpCtB,IAAI4B,aAAa,CAACnB,YAAYa;IAChC;AACF"}
@@ -1,199 +0,0 @@
1
- import fs from 'fs';
2
- import fse from 'fs-extra';
3
- import globby from 'globby';
4
- import * as os from 'node:os';
5
- import path from 'path';
6
- import { afterEach, beforeAll, beforeEach, describe, expect, it, vitest } from 'vitest';
7
- import { createProject, updatePackageJSONDependencies } from './create-project.js';
8
- import { getValidTemplates } from './templates.js';
9
- describe('createProject', ()=>{
10
- let projectDir;
11
- beforeAll(()=>{
12
- // eslint-disable-next-line no-console
13
- console.log = vitest.fn();
14
- });
15
- beforeEach(()=>{
16
- const tempDirectory = fs.realpathSync(os.tmpdir());
17
- projectDir = `${tempDirectory}/${Math.random().toString(36).substring(7)}`;
18
- });
19
- afterEach(()=>{
20
- if (fse.existsSync(projectDir)) {
21
- fse.rmSync(projectDir, {
22
- recursive: true
23
- });
24
- }
25
- });
26
- describe('#createProject', ()=>{
27
- const args = {
28
- _: [
29
- 'project-name'
30
- ],
31
- '--db': 'mongodb',
32
- '--local-template': 'blank',
33
- '--no-deps': true
34
- };
35
- const packageManager = 'yarn';
36
- it('creates plugin template', async ()=>{
37
- const projectName = 'plugin';
38
- const template = {
39
- name: 'plugin',
40
- type: 'plugin',
41
- description: 'Template for creating a Payload plugin',
42
- url: 'https://github.com/payloadcms/payload/templates/plugin'
43
- };
44
- await createProject({
45
- cliArgs: {
46
- ...args,
47
- '--local-template': 'plugin'
48
- },
49
- packageManager,
50
- projectDir,
51
- projectName,
52
- template
53
- });
54
- const packageJsonPath = path.resolve(projectDir, 'package.json');
55
- const packageJson = fse.readJsonSync(packageJsonPath);
56
- // Check package name and description
57
- expect(packageJson.name).toStrictEqual(projectName);
58
- });
59
- it('updates project name in plugin template importMap file', async ()=>{
60
- const projectName = 'my-custom-plugin';
61
- const template = {
62
- name: 'plugin',
63
- type: 'plugin',
64
- description: 'Template for creating a Payload plugin',
65
- url: 'https://github.com/payloadcms/payload/templates/plugin'
66
- };
67
- await createProject({
68
- cliArgs: {
69
- ...args,
70
- '--local-template': 'plugin'
71
- },
72
- packageManager,
73
- projectDir,
74
- projectName,
75
- template
76
- });
77
- const importMapPath = path.resolve(projectDir, './dev/app/(payload)/admin/importMap.js');
78
- const importMapFile = fse.readFileSync(importMapPath, 'utf-8');
79
- expect(importMapFile).not.toContain('plugin-package-name-placeholder');
80
- expect(importMapFile).toContain('my-custom-plugin');
81
- });
82
- it('creates example', async ()=>{
83
- const projectName = 'custom-server-example';
84
- const example = {
85
- name: 'custom-server',
86
- url: 'https://github.com/payloadcms/payload/examples/custom-server#main'
87
- };
88
- await createProject({
89
- cliArgs: {
90
- ...args,
91
- '--local-template': undefined,
92
- '--local-example': 'custom-server'
93
- },
94
- packageManager,
95
- projectDir,
96
- projectName,
97
- example
98
- });
99
- const packageJsonPath = path.resolve(projectDir, 'package.json');
100
- const packageJson = fse.readJsonSync(packageJsonPath);
101
- // Check package name and description
102
- expect(packageJson.name).toStrictEqual(projectName);
103
- }, 90_000);
104
- describe('creates project from template', ()=>{
105
- const templates = getValidTemplates();
106
- it.each([
107
- [
108
- 'blank',
109
- 'mongodb'
110
- ],
111
- [
112
- 'blank',
113
- 'postgres'
114
- ],
115
- [
116
- 'blank-tanstack',
117
- 'mongodb'
118
- ],
119
- [
120
- 'blank-tanstack',
121
- 'postgres'
122
- ]
123
- ])('update config and deps: %s, %s', async (templateName, db)=>{
124
- const projectName = 'starter-project';
125
- const template = templates.find((t)=>t.name === templateName);
126
- expect(template).toBeDefined();
127
- const cliArgs = {
128
- ...args,
129
- '--db': db,
130
- '--local-template': templateName
131
- };
132
- await createProject({
133
- cliArgs,
134
- dbDetails: {
135
- type: db,
136
- dbUri: `${db}://localhost:27017/create-project-test`
137
- },
138
- packageManager,
139
- projectDir,
140
- projectName,
141
- template: template
142
- });
143
- const packageJsonPath = path.resolve(projectDir, 'package.json');
144
- const packageJson = fse.readJsonSync(packageJsonPath);
145
- // Verify git was initialized
146
- expect(fse.existsSync(path.resolve(projectDir, '.git'))).toBe(true);
147
- // Should only have one db adapter
148
- expect(Object.keys(packageJson.dependencies).filter((n)=>n.startsWith('@payloadcms/db-'))).toHaveLength(1);
149
- const payloadConfigPath = (await globby('**/payload.config.ts', {
150
- absolute: true,
151
- cwd: projectDir
152
- }))?.[0];
153
- const content = fse.readFileSync(payloadConfigPath, 'utf-8');
154
- // Check payload.config.ts doesn't have placeholder comments
155
- expect(content).not.toContain('// database-adapter-import');
156
- expect(content).not.toContain('// database-adapter-config-start');
157
- expect(content).not.toContain('// database-adapter-config-end');
158
- // Verify correct adapter import and usage based on db type
159
- if (db === 'mongodb') {
160
- expect(content).toContain("import { mongooseAdapter } from '@payloadcms/db-mongodb'");
161
- expect(content).toContain('mongooseAdapter');
162
- } else if (db === 'postgres') {
163
- expect(content).toContain("import { postgresAdapter } from '@payloadcms/db-postgres'");
164
- expect(content).toContain('postgresAdapter');
165
- }
166
- });
167
- });
168
- describe('updates package.json', ()=>{
169
- it('updates package name and bumps workspace versions', async ()=>{
170
- const latestVersion = '3.0.0';
171
- const initialJSON = {
172
- name: 'test-project',
173
- version: '1.0.0',
174
- dependencies: {
175
- '@payloadcms/db-mongodb': 'workspace:*',
176
- payload: 'workspace:*',
177
- '@payloadcms/ui': 'workspace:*'
178
- }
179
- };
180
- const correctlyModifiedJSON = {
181
- name: 'test-project',
182
- version: '1.0.0',
183
- dependencies: {
184
- '@payloadcms/db-mongodb': `${latestVersion}`,
185
- payload: `${latestVersion}`,
186
- '@payloadcms/ui': `${latestVersion}`
187
- }
188
- };
189
- updatePackageJSONDependencies({
190
- latestVersion,
191
- packageJson: initialJSON
192
- });
193
- expect(initialJSON).toEqual(correctlyModifiedJSON);
194
- });
195
- });
196
- });
197
- });
198
-
199
- //# sourceMappingURL=create-project.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/lib/create-project.spec.ts"],"sourcesContent":["import fs from 'fs'\nimport fse from 'fs-extra'\nimport globby from 'globby'\nimport * as os from 'node:os'\nimport path from 'path'\nimport { afterEach, beforeAll, beforeEach, describe, expect, it, vitest } from 'vitest'\nimport type { CliArgs, DbType, ProjectExample, ProjectTemplate } from '../types.js'\n\nimport { createProject, updatePackageJSONDependencies } from './create-project.js'\nimport { getValidTemplates } from './templates.js'\n\ndescribe('createProject', () => {\n let projectDir: string\n\n beforeAll(() => {\n // eslint-disable-next-line no-console\n console.log = vitest.fn()\n })\n\n beforeEach(() => {\n const tempDirectory = fs.realpathSync(os.tmpdir())\n projectDir = `${tempDirectory}/${Math.random().toString(36).substring(7)}`\n })\n\n afterEach(() => {\n if (fse.existsSync(projectDir)) {\n fse.rmSync(projectDir, { recursive: true })\n }\n })\n\n describe('#createProject', () => {\n const args = {\n _: ['project-name'],\n '--db': 'mongodb',\n '--local-template': 'blank',\n '--no-deps': true,\n } as CliArgs\n const packageManager = 'yarn'\n\n it('creates plugin template', async () => {\n const projectName = 'plugin'\n const template: ProjectTemplate = {\n name: 'plugin',\n type: 'plugin',\n description: 'Template for creating a Payload plugin',\n url: 'https://github.com/payloadcms/payload/templates/plugin',\n }\n\n await createProject({\n cliArgs: { ...args, '--local-template': 'plugin' } as CliArgs,\n packageManager,\n projectDir,\n projectName,\n template,\n })\n\n const packageJsonPath = path.resolve(projectDir, 'package.json')\n const packageJson = fse.readJsonSync(packageJsonPath)\n\n // Check package name and description\n expect(packageJson.name).toStrictEqual(projectName)\n })\n\n it('updates project name in plugin template importMap file', async () => {\n const projectName = 'my-custom-plugin'\n const template: ProjectTemplate = {\n name: 'plugin',\n type: 'plugin',\n description: 'Template for creating a Payload plugin',\n url: 'https://github.com/payloadcms/payload/templates/plugin',\n }\n\n await createProject({\n cliArgs: { ...args, '--local-template': 'plugin' } as CliArgs,\n packageManager,\n projectDir,\n projectName,\n template,\n })\n\n const importMapPath = path.resolve(projectDir, './dev/app/(payload)/admin/importMap.js')\n const importMapFile = fse.readFileSync(importMapPath, 'utf-8')\n\n expect(importMapFile).not.toContain('plugin-package-name-placeholder')\n expect(importMapFile).toContain('my-custom-plugin')\n })\n\n it('creates example', async () => {\n const projectName = 'custom-server-example'\n const example: ProjectExample = {\n name: 'custom-server',\n url: 'https://github.com/payloadcms/payload/examples/custom-server#main',\n }\n\n await createProject({\n cliArgs: {\n ...args,\n '--local-template': undefined,\n '--local-example': 'custom-server',\n } as CliArgs,\n packageManager,\n projectDir,\n projectName,\n example,\n })\n\n const packageJsonPath = path.resolve(projectDir, 'package.json')\n const packageJson = fse.readJsonSync(packageJsonPath)\n\n // Check package name and description\n expect(packageJson.name).toStrictEqual(projectName)\n }, 90_000)\n\n describe('creates project from template', () => {\n const templates = getValidTemplates()\n\n it.each([\n ['blank', 'mongodb'],\n ['blank', 'postgres'],\n ['blank-tanstack', 'mongodb'],\n ['blank-tanstack', 'postgres'],\n\n // TODO: Re-enable these once 3.0 is stable and templates updated\n // ['website', 'mongodb'],\n // ['website', 'postgres'],\n // ['ecommerce', 'mongodb'],\n // ['ecommerce', 'postgres'],\n ])('update config and deps: %s, %s', async (templateName, db) => {\n const projectName = 'starter-project'\n\n const template = templates.find((t) => t.name === templateName)\n\n expect(template).toBeDefined()\n\n const cliArgs = {\n ...args,\n '--db': db,\n '--local-template': templateName,\n } as CliArgs\n\n await createProject({\n cliArgs,\n dbDetails: {\n type: db as DbType,\n dbUri: `${db}://localhost:27017/create-project-test`,\n },\n packageManager,\n projectDir,\n projectName,\n template: template as ProjectTemplate,\n })\n\n const packageJsonPath = path.resolve(projectDir, 'package.json')\n const packageJson = fse.readJsonSync(packageJsonPath)\n\n // Verify git was initialized\n expect(fse.existsSync(path.resolve(projectDir, '.git'))).toBe(true)\n\n // Should only have one db adapter\n expect(\n Object.keys(packageJson.dependencies).filter((n) => n.startsWith('@payloadcms/db-')),\n ).toHaveLength(1)\n\n const payloadConfigPath = (\n await globby('**/payload.config.ts', {\n absolute: true,\n cwd: projectDir,\n })\n )?.[0]\n\n const content = fse.readFileSync(payloadConfigPath, 'utf-8')\n\n // Check payload.config.ts doesn't have placeholder comments\n expect(content).not.toContain('// database-adapter-import')\n expect(content).not.toContain('// database-adapter-config-start')\n expect(content).not.toContain('// database-adapter-config-end')\n\n // Verify correct adapter import and usage based on db type\n if (db === 'mongodb') {\n expect(content).toContain(\"import { mongooseAdapter } from '@payloadcms/db-mongodb'\")\n expect(content).toContain('mongooseAdapter')\n } else if (db === 'postgres') {\n expect(content).toContain(\"import { postgresAdapter } from '@payloadcms/db-postgres'\")\n expect(content).toContain('postgresAdapter')\n }\n })\n })\n\n describe('updates package.json', () => {\n it('updates package name and bumps workspace versions', async () => {\n const latestVersion = '3.0.0'\n const initialJSON = {\n name: 'test-project',\n version: '1.0.0',\n dependencies: {\n '@payloadcms/db-mongodb': 'workspace:*',\n payload: 'workspace:*',\n '@payloadcms/ui': 'workspace:*',\n },\n }\n\n const correctlyModifiedJSON = {\n name: 'test-project',\n version: '1.0.0',\n dependencies: {\n '@payloadcms/db-mongodb': `${latestVersion}`,\n payload: `${latestVersion}`,\n '@payloadcms/ui': `${latestVersion}`,\n },\n }\n\n updatePackageJSONDependencies({\n latestVersion,\n packageJson: initialJSON,\n })\n\n expect(initialJSON).toEqual(correctlyModifiedJSON)\n })\n })\n })\n})\n"],"names":["fs","fse","globby","os","path","afterEach","beforeAll","beforeEach","describe","expect","it","vitest","createProject","updatePackageJSONDependencies","getValidTemplates","projectDir","console","log","fn","tempDirectory","realpathSync","tmpdir","Math","random","toString","substring","existsSync","rmSync","recursive","args","_","packageManager","projectName","template","name","type","description","url","cliArgs","packageJsonPath","resolve","packageJson","readJsonSync","toStrictEqual","importMapPath","importMapFile","readFileSync","not","toContain","example","undefined","templates","each","templateName","db","find","t","toBeDefined","dbDetails","dbUri","toBe","Object","keys","dependencies","filter","n","startsWith","toHaveLength","payloadConfigPath","absolute","cwd","content","latestVersion","initialJSON","version","payload","correctlyModifiedJSON","toEqual"],"mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,SAAS,WAAU;AAC1B,OAAOC,YAAY,SAAQ;AAC3B,YAAYC,QAAQ,UAAS;AAC7B,OAAOC,UAAU,OAAM;AACvB,SAASC,SAAS,EAAEC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,MAAM,QAAQ,SAAQ;AAGvF,SAASC,aAAa,EAAEC,6BAA6B,QAAQ,sBAAqB;AAClF,SAASC,iBAAiB,QAAQ,iBAAgB;AAElDN,SAAS,iBAAiB;IACxB,IAAIO;IAEJT,UAAU;QACR,sCAAsC;QACtCU,QAAQC,GAAG,GAAGN,OAAOO,EAAE;IACzB;IAEAX,WAAW;QACT,MAAMY,gBAAgBnB,GAAGoB,YAAY,CAACjB,GAAGkB,MAAM;QAC/CN,aAAa,GAAGI,cAAc,CAAC,EAAEG,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,SAAS,CAAC,IAAI;IAC5E;IAEApB,UAAU;QACR,IAAIJ,IAAIyB,UAAU,CAACX,aAAa;YAC9Bd,IAAI0B,MAAM,CAACZ,YAAY;gBAAEa,WAAW;YAAK;QAC3C;IACF;IAEApB,SAAS,kBAAkB;QACzB,MAAMqB,OAAO;YACXC,GAAG;gBAAC;aAAe;YACnB,QAAQ;YACR,oBAAoB;YACpB,aAAa;QACf;QACA,MAAMC,iBAAiB;QAEvBrB,GAAG,2BAA2B;YAC5B,MAAMsB,cAAc;YACpB,MAAMC,WAA4B;gBAChCC,MAAM;gBACNC,MAAM;gBACNC,aAAa;gBACbC,KAAK;YACP;YAEA,MAAMzB,cAAc;gBAClB0B,SAAS;oBAAE,GAAGT,IAAI;oBAAE,oBAAoB;gBAAS;gBACjDE;gBACAhB;gBACAiB;gBACAC;YACF;YAEA,MAA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C1BvC,OAAO8D,SAASvB,SAAS,CAAC;gBAC5B;YACF;QACF;QAEAxC,SAAS,wBAAwB;YAC/BE,GAAG,qDAAqD;gBACtD,MAAM8D,gBAAgB;gBACtB,MAAMC,cAAc;oBAClBvC,MAAM;oBACNwC,SAAS;oBACTX,cAAc;wBACZ,0BAA0B;wBAC1BY,SAAS;wBACT,kBAAkB;oBACpB;gBACF;gBAEA,MAAMC,wBAAwB;oBAC5B1C,MAAM;oBACNwC,SAAS;oBACTX,cAAc;wBACZ,0BAA0B,GAAGS,eAAe;wBAC5CG,SAAS,GAAGH,eAAe;wBAC3B,kBAAkB,GAAGA,eAAe;oBACtC;gBACF;gBAEA3D,8BAA8B;oBAC5B2D;oBACA/B,aAAagC;gBACf;gBAEAhE,OAAOgE,aAAaI,OAAO,CAACD;YAC9B;QACF;IACF;AACF"}
@@ -1,119 +0,0 @@
1
- import fse from 'fs-extra';
2
- import os from 'node:os';
3
- import path from 'node:path';
4
- import { fileURLToPath } from 'node:url';
5
- import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
6
- import { initTanStack } from './init-tanstack.js';
7
- const dirname = path.dirname(fileURLToPath(import.meta.url));
8
- const mocks = vi.hoisted(()=>({
9
- resolvePackageVersion: vi.fn()
10
- }));
11
- vi.mock('../utils/resolvePackageVersion.js', async (importOriginal)=>({
12
- ...await importOriginal(),
13
- resolvePackageVersion: mocks.resolvePackageVersion
14
- }));
15
- const routerContent = `import { createRouter } from '@tanstack/react-router'
16
-
17
- import { routeTree } from './routeTree.gen'
18
-
19
- export function getRouter() {
20
- return createRouter({ routeTree })
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: () => ({ links: [{ rel: 'stylesheet', href: appCss }] }),
28
- shellComponent: RootDocument,
29
- })
30
-
31
- function RootDocument({ children }: { children: React.ReactNode }) {
32
- return (
33
- <html lang="en">
34
- <head><HeadContent /></head>
35
- <body>{children}<Scripts /></body>
36
- </html>
37
- )
38
- }
39
- `;
40
- const viteConfigContent = `import { tanstackStart } from '@tanstack/react-start/plugin/vite'
41
- import viteReact from '@vitejs/plugin-react'
42
- import { defineConfig } from 'vite'
43
-
44
- export default defineConfig({
45
- plugins: [tanstackStart(), viteReact()],
46
- })
47
- `;
48
- describe('initTanStack default template', ()=>{
49
- let appDetails;
50
- let projectDir;
51
- beforeEach(()=>{
52
- vi.clearAllMocks();
53
- mocks.resolvePackageVersion.mockResolvedValue('4.2.0');
54
- projectDir = fse.mkdtempSync(path.join(os.tmpdir(), 'cpa-init-tanstack-default-'));
55
- writeFiles({
56
- files: {
57
- 'package.json': JSON.stringify({
58
- dependencies: {
59
- '@tanstack/react-router': '^1.200.0',
60
- '@tanstack/react-start': '^1.200.0'
61
- },
62
- name: 'start-app'
63
- }),
64
- 'src/router.tsx': routerContent,
65
- 'src/routes/__root.tsx': rootRouteContent,
66
- 'tsconfig.json': '{"compilerOptions":{"baseUrl":"."}}\n',
67
- 'vite.config.ts': viteConfigContent
68
- },
69
- root: projectDir
70
- });
71
- appDetails = {
72
- isPayloadInstalled: false,
73
- kind: 'start',
74
- projectDir,
75
- rootRoutePath: path.join(projectDir, 'src/routes/__root.tsx'),
76
- routerPath: path.join(projectDir, 'src/router.tsx'),
77
- routesDir: path.join(projectDir, 'src/routes'),
78
- sourceDir: path.join(projectDir, 'src'),
79
- viteConfigPath: path.join(projectDir, 'vite.config.ts')
80
- };
81
- });
82
- afterEach(()=>{
83
- fse.removeSync(projectDir);
84
- });
85
- it('should initialize from the raw source template without a templateRoot override', async ()=>{
86
- const rawPayloadLayoutPath = path.resolve(dirname, '../../../../templates/blank-tanstack/src/app/_payload.tsx');
87
- const result = await initTanStack({
88
- '--no-deps': true,
89
- appDetails,
90
- dbType: 'mongodb',
91
- packageManager: 'pnpm',
92
- projectDir
93
- });
94
- expect(result).toEqual({
95
- payloadConfigPath: path.join(projectDir, 'src/payload.config.ts'),
96
- success: true
97
- });
98
- expect(fse.readFileSync(path.join(projectDir, 'src/routes/_payload.tsx'), 'utf8')).toBe(fse.readFileSync(rawPayloadLayoutPath, 'utf8'));
99
- });
100
- it('should copy a Payload layout whose foundation CSS import does not require a host alias', async ()=>{
101
- const result = await initTanStack({
102
- '--no-deps': true,
103
- '--payload-version': '4.2.0',
104
- appDetails,
105
- dbType: 'mongodb',
106
- packageManager: 'pnpm',
107
- projectDir
108
- });
109
- expect(result.success).toBe(true);
110
- expect(fse.readFileSync(path.join(projectDir, 'src/routes/_payload.tsx'), 'utf8')).toContain("import '../payload-foundation.css'");
111
- });
112
- });
113
- function writeFiles({ files, root }) {
114
- for (const [relativePath, content] of Object.entries(files)){
115
- fse.outputFileSync(path.join(root, relativePath), content);
116
- }
117
- }
118
-
119
- //# sourceMappingURL=init-tanstack-default-template.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/lib/init-tanstack-default-template.spec.ts"],"sourcesContent":["import fse from 'fs-extra'\nimport os from 'node:os'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'\n\nimport type { TanStackAppDetails } from '../types.js'\n\nimport { initTanStack } from './init-tanstack.js'\n\nconst dirname = path.dirname(fileURLToPath(import.meta.url))\n\nconst mocks = vi.hoisted(() => ({ resolvePackageVersion: vi.fn() }))\n\nvi.mock('../utils/resolvePackageVersion.js', async (importOriginal) => ({\n ...(await importOriginal()),\n resolvePackageVersion: mocks.resolvePackageVersion,\n}))\n\nconst routerContent = `import { createRouter } from '@tanstack/react-router'\n\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n return createRouter({ routeTree })\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: () => ({ links: [{ rel: 'stylesheet', href: appCss }] }),\n shellComponent: RootDocument,\n})\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n return (\n <html lang=\"en\">\n <head><HeadContent /></head>\n <body>{children}<Scripts /></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\ndescribe('initTanStack default template', () => {\n let appDetails: TanStackAppDetails\n let projectDir: string\n\n beforeEach(() => {\n vi.clearAllMocks()\n mocks.resolvePackageVersion.mockResolvedValue('4.2.0')\n projectDir = fse.mkdtempSync(path.join(os.tmpdir(), 'cpa-init-tanstack-default-'))\n writeFiles({\n files: {\n 'package.json': JSON.stringify({\n dependencies: {\n '@tanstack/react-router': '^1.200.0',\n '@tanstack/react-start': '^1.200.0',\n },\n name: 'start-app',\n }),\n 'src/router.tsx': routerContent,\n 'src/routes/__root.tsx': rootRouteContent,\n 'tsconfig.json': '{\"compilerOptions\":{\"baseUrl\":\".\"}}\\n',\n 'vite.config.ts': viteConfigContent,\n },\n root: projectDir,\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 })\n\n it('should initialize from the raw source template without a templateRoot override', async () => {\n const rawPayloadLayoutPath = path.resolve(\n dirname,\n '../../../../templates/blank-tanstack/src/app/_payload.tsx',\n )\n\n const result = await initTanStack({\n '--no-deps': true,\n appDetails,\n dbType: 'mongodb',\n packageManager: 'pnpm',\n projectDir,\n })\n\n expect(result).toEqual({\n payloadConfigPath: path.join(projectDir, 'src/payload.config.ts'),\n success: true,\n })\n expect(fse.readFileSync(path.join(projectDir, 'src/routes/_payload.tsx'), 'utf8')).toBe(\n fse.readFileSync(rawPayloadLayoutPath, 'utf8'),\n )\n })\n\n it('should copy a Payload layout whose foundation CSS import does not require a host alias', async () => {\n const result = await initTanStack({\n '--no-deps': true,\n '--payload-version': '4.2.0',\n appDetails,\n dbType: 'mongodb',\n packageManager: 'pnpm',\n projectDir,\n })\n\n expect(result.success).toBe(true)\n expect(fse.readFileSync(path.join(projectDir, 'src/routes/_payload.tsx'), 'utf8')).toContain(\n \"import '../payload-foundation.css'\",\n )\n })\n})\n\nfunction writeFiles({ files, root }: { files: Record<string, string>; root: string }): void {\n for (const [relativePath, content] of Object.entries(files)) {\n fse.outputFileSync(path.join(root, relativePath), content)\n }\n}\n"],"names":["fse","os","path","fileURLToPath","afterEach","beforeEach","describe","expect","it","vi","initTanStack","dirname","url","mocks","hoisted","resolvePackageVersion","fn","mock","importOriginal","routerContent","rootRouteContent","viteConfigContent","appDetails","projectDir","clearAllMocks","mockResolvedValue","mkdtempSync","join","tmpdir","writeFiles","files","JSON","stringify","dependencies","name","root","isPayloadInstalled","kind","rootRoutePath","routerPath","routesDir","sourceDir","viteConfigPath","removeSync","rawPayloadLayoutPath","resolve","result","dbType","packageManager","toEqual","payloadConfigPath","success","readFileSync","toBe","toContain","relativePath","content","Object","entries","outputFileSync"],"mappings":"AAAA,OAAOA,SAAS,WAAU;AAC1B,OAAOC,QAAQ,UAAS;AACxB,OAAOC,UAAU,YAAW;AAC5B,SAASC,aAAa,QAAQ,WAAU;AACxC,SAASC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,SAAQ;AAIxE,SAASC,YAAY,QAAQ,qBAAoB;AAEjD,MAAMC,UAAUT,KAAKS,OAAO,CAACR,cAAc,YAAYS,GAAG;AAE1D,MAAMC,QAAQJ,GAAGK,OAAO,CAAC,IAAO,CAAA;QAAEC,uBAAuBN,GAAGO,EAAE;IAAG,CAAA;AAEjE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