create-payload-app 3.62.0-internal.ec3a6fa → 3.62.0
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/create-project.spec.js +2 -2
 - package/dist/lib/create-project.spec.js.map +1 -1
 - package/dist/lib/manage-env-files.spec.js +2 -2
 - package/dist/lib/manage-env-files.spec.js.map +1 -1
 - package/dist/lib/wrap-next-config.spec.js +2 -2
 - package/dist/lib/wrap-next-config.spec.js.map +1 -1
 - package/package.json +2 -1
 
| 
         @@ -1,9 +1,9 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { jest } from '@jest/globals';
         
     | 
| 
       1 
2 
     | 
    
         
             
            import fs from 'fs';
         
     | 
| 
       2 
3 
     | 
    
         
             
            import fse from 'fs-extra';
         
     | 
| 
       3 
4 
     | 
    
         
             
            import globby from 'globby';
         
     | 
| 
       4 
5 
     | 
    
         
             
            import * as os from 'node:os';
         
     | 
| 
       5 
6 
     | 
    
         
             
            import path from 'path';
         
     | 
| 
       6 
     | 
    
         
            -
            import { afterEach, beforeAll, beforeEach, describe, expect, it, vitest } from 'vitest';
         
     | 
| 
       7 
7 
     | 
    
         
             
            import { createProject, updatePackageJSONDependencies } from './create-project.js';
         
     | 
| 
       8 
8 
     | 
    
         
             
            import { dbReplacements } from './replacements.js';
         
     | 
| 
       9 
9 
     | 
    
         
             
            import { getValidTemplates } from './templates.js';
         
     | 
| 
         @@ -11,7 +11,7 @@ describe('createProject', ()=>{ 
     | 
|
| 
       11 
11 
     | 
    
         
             
                let projectDir;
         
     | 
| 
       12 
12 
     | 
    
         
             
                beforeAll(()=>{
         
     | 
| 
       13 
13 
     | 
    
         
             
                    // eslint-disable-next-line no-console
         
     | 
| 
       14 
     | 
    
         
            -
                    console.log =  
     | 
| 
      
 14 
     | 
    
         
            +
                    console.log = jest.fn();
         
     | 
| 
       15 
15 
     | 
    
         
             
                });
         
     | 
| 
       16 
16 
     | 
    
         
             
                beforeEach(()=>{
         
     | 
| 
       17 
17 
     | 
    
         
             
                    const tempDirectory = fs.realpathSync(os.tmpdir());
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       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 { dbReplacements } from './replacements.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    })\n\n    describe('creates project from template', () => {\n      const templates = getValidTemplates()\n\n      it.each([\n        ['blank', 'mongodb'],\n        ['blank', '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        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 dbReplacement = dbReplacements[db as DbType]\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\n        expect(content).not.toContain('// database-adapter-import')\n        expect(content).toContain(dbReplacement.importReplacement)\n\n        expect(content).not.toContain('// database-adapter-config-start')\n        expect(content).not.toContain('// database-adapter-config-end')\n        expect(content).toContain(dbReplacement.configReplacement().join('\\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","dbReplacements","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","dbDetails","dbUri","dbReplacement","toBe","Object","keys","dependencies","filter","n","startsWith","toHaveLength","payloadConfigPath","absolute","cwd","content","importReplacement","configReplacement","join","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,cAAc,QAAQ,oBAAmB;AAClD,SAASC,iBAAiB,QAAQ,iBAAgB;AAElDP,SAAS,iBAAiB;IACxB,IAAIQ;IAEJV,UAAU;QACR,sCAAsC;QACtCW,QAAQC,GAAG,GAAGP,OAAOQ,EAAE;IACzB;IAEAZ,WAAW;QACT,MAAMa,gBAAgBpB,GAAGqB,YAAY,CAAClB,GAAGmB,MAAM;QAC/CN,aAAa,GAAGI,cAAc,CAAC,EAAEG,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,SAAS,CAAC,IAAI;IAC5E;IAEArB,UAAU;QACR,IAAIJ,IAAI0B,UAAU,CAACX,aAAa;YAC9Bf,IAAI2B,MAAM,CAACZ,YAAY;gBAAEa,WAAW;YAAK;QAC3C;IACF;IAEArB,SAAS,kBAAkB;QACzB,MAAMsB,OAAO;YACXC,GAAG;gBAAC;aAAe;YACnB,QAAQ;YACR,oBAAoB;YACpB,aAAa;QACf;QACA,MAAMC,iBAAiB;QAEvBtB,GAAG,2BAA2B;YAC5B,MAAMuB,cAAc;YACpB,MAAMC,WAA4B;gBAChCC,MAAM;gBACNC,MAAM;gBACNC,aAAa;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C,IAAI,CAAC;YACnE;QACF;QAEAnE,SAAS,wBAAwB;YAC/BE,GAAG,qDAAqD;gBACtD,MAAMkE,gBAAgB;gBACtB,MAAMC,cAAc;oBAClB1C,MAAM;oBACN2C,SAAS;oBACTd,cAAc;wBACZ,0BAA0B;wBAC1Be,SAAS;wBACT,kBAAkB;oBACpB;gBACF;gBAEA,MAAMC,wBAAwB;oBAC5B7C,MAAM;oBACN2C,SAAS;oBACTd,cAAc;wBACZ,0BAA0B,GAAGY,eAAe;wBAC5CG,SAAS,GAAGH,eAAe;wBAC3B,kBAAkB,GAAGA,eAAe;oBACtC;gBACF;gBAEA/D,8BAA8B;oBAC5B+D;oBACAlC,aAAamC;gBACf;gBAEApE,OAAOoE,aAAaI,OAAO,CAACD;YAC9B;QACF;IACF;AACF"}
         
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"sources":["../../src/lib/create-project.spec.ts"],"sourcesContent":["import { jest } from '@jest/globals'\nimport fs from 'fs'\nimport fse from 'fs-extra'\nimport globby from 'globby'\nimport * as os from 'node:os'\nimport path from 'path'\n\nimport type { CliArgs, DbType, ProjectExample, ProjectTemplate } from '../types.js'\n\nimport { createProject, updatePackageJSONDependencies } from './create-project.js'\nimport { dbReplacements } from './replacements.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 = jest.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    })\n\n    describe('creates project from template', () => {\n      const templates = getValidTemplates()\n\n      it.each([\n        ['blank', 'mongodb'],\n        ['blank', '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        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 dbReplacement = dbReplacements[db as DbType]\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\n        expect(content).not.toContain('// database-adapter-import')\n        expect(content).toContain(dbReplacement.importReplacement)\n\n        expect(content).not.toContain('// database-adapter-config-start')\n        expect(content).not.toContain('// database-adapter-config-end')\n        expect(content).toContain(dbReplacement.configReplacement().join('\\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":["jest","fs","fse","globby","os","path","createProject","updatePackageJSONDependencies","dbReplacements","getValidTemplates","describe","projectDir","beforeAll","console","log","fn","beforeEach","tempDirectory","realpathSync","tmpdir","Math","random","toString","substring","afterEach","existsSync","rmSync","recursive","args","_","packageManager","it","projectName","template","name","type","description","url","cliArgs","packageJsonPath","resolve","packageJson","readJsonSync","expect","toStrictEqual","importMapPath","importMapFile","readFileSync","not","toContain","example","undefined","templates","each","templateName","db","find","t","dbDetails","dbUri","dbReplacement","toBe","Object","keys","dependencies","filter","n","startsWith","toHaveLength","payloadConfigPath","absolute","cwd","content","importReplacement","configReplacement","join","latestVersion","initialJSON","version","payload","correctlyModifiedJSON","toEqual"],"mappings":"AAAA,SAASA,IAAI,QAAQ,gBAAe;AACpC,OAAOC,QAAQ,KAAI;AACnB,OAAOC,SAAS,WAAU;AAC1B,OAAOC,YAAY,SAAQ;AAC3B,YAAYC,QAAQ,UAAS;AAC7B,OAAOC,UAAU,OAAM;AAIvB,SAASC,aAAa,EAAEC,6BAA6B,QAAQ,sBAAqB;AAClF,SAASC,cAAc,QAAQ,oBAAmB;AAClD,SAASC,iBAAiB,QAAQ,iBAAgB;AAElDC,SAAS,iBAAiB;IACxB,IAAIC;IAEJC,UAAU;QACR,sCAAsC;QACtCC,QAAQC,GAAG,GAAGd,KAAKe,EAAE;IACvB;IAEAC,WAAW;QACT,MAAMC,gBAAgBhB,GAAGiB,YAAY,CAACd,GAAGe,MAAM;QAC/CR,aAAa,GAAGM,cAAc,CAAC,EAAEG,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,SAAS,CAAC,IAAI;IAC5E;IAEAC,UAAU;QACR,IAAItB,IAAIuB,UAAU,CAACd,aAAa;YAC9BT,IAAIwB,MAAM,CAACf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B;gBAEpD,0BAA0B;gBAC1B1B,OAAO6B,SAASxB,GAAG,CAACC,SAAS,CAAC;gBAC9BN,OAAO6B,SAASvB,SAAS,CAACW,cAAca,iBAAiB;gBAEzD9B,OAAO6B,SAASxB,GAAG,CAACC,SAAS,CAAC;gBAC9BN,OAAO6B,SAASxB,GAAG,CAACC,SAAS,CAAC;gBAC9BN,OAAO6B,SAASvB,SAAS,CAACW,cAAcc,iBAAiB,GAAGC,IAAI,CAAC;YACnE;QACF;QAEAjE,SAAS,wBAAwB;YAC/BqB,GAAG,qDAAqD;gBACtD,MAAM6C,gBAAgB;gBACtB,MAAMC,cAAc;oBAClB3C,MAAM;oBACN4C,SAAS;oBACTd,cAAc;wBACZ,0BAA0B;wBAC1Be,SAAS;wBACT,kBAAkB;oBACpB;gBACF;gBAEA,MAAMC,wBAAwB;oBAC5B9C,MAAM;oBACN4C,SAAS;oBACTd,cAAc;wBACZ,0BAA0B,GAAGY,eAAe;wBAC5CG,SAAS,GAAGH,eAAe;wBAC3B,kBAAkB,GAAGA,eAAe;oBACtC;gBACF;gBAEArE,8BAA8B;oBAC5BqE;oBACAnC,aAAaoC;gBACf;gBAEAlC,OAAOkC,aAAaI,OAAO,CAACD;YAC9B;QACF;IACF;AACF"}
         
     | 
| 
         @@ -1,8 +1,8 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { jest } from '@jest/globals';
         
     | 
| 
       1 
2 
     | 
    
         
             
            import fs from 'fs';
         
     | 
| 
       2 
3 
     | 
    
         
             
            import fse from 'fs-extra';
         
     | 
| 
       3 
4 
     | 
    
         
             
            import * as os from 'node:os';
         
     | 
| 
       4 
5 
     | 
    
         
             
            import path from 'path';
         
     | 
| 
       5 
     | 
    
         
            -
            import { afterEach, beforeAll, beforeEach, describe, expect, it, vitest } from 'vitest';
         
     | 
| 
       6 
6 
     | 
    
         
             
            import { manageEnvFiles } from './manage-env-files.js';
         
     | 
| 
       7 
7 
     | 
    
         
             
            describe('createProject', ()=>{
         
     | 
| 
       8 
8 
     | 
    
         
             
                let projectDir;
         
     | 
| 
         @@ -10,7 +10,7 @@ describe('createProject', ()=>{ 
     | 
|
| 
       10 
10 
     | 
    
         
             
                let envExampleFilePath = '';
         
     | 
| 
       11 
11 
     | 
    
         
             
                beforeAll(()=>{
         
     | 
| 
       12 
12 
     | 
    
         
             
                    // eslint-disable-next-line no-console
         
     | 
| 
       13 
     | 
    
         
            -
                    console.log =  
     | 
| 
      
 13 
     | 
    
         
            +
                    console.log = jest.fn();
         
     | 
| 
       14 
14 
     | 
    
         
             
                });
         
     | 
| 
       15 
15 
     | 
    
         
             
                beforeEach(()=>{
         
     | 
| 
       16 
16 
     | 
    
         
             
                    const tempDirectory = fs.realpathSync(os.tmpdir());
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"sources":["../../src/lib/manage-env-files.spec.ts"],"sourcesContent":["import fs from 'fs'\nimport fse from 'fs-extra'\nimport * as os from 'node:os'\nimport path from 'path'\ 
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"sources":["../../src/lib/manage-env-files.spec.ts"],"sourcesContent":["import { jest } from '@jest/globals'\nimport fs from 'fs'\nimport fse from 'fs-extra'\nimport * as os from 'node:os'\nimport path from 'path'\n\nimport type { CliArgs } from '../types.js'\n\nimport { manageEnvFiles } from './manage-env-files.js'\n\ndescribe('createProject', () => {\n  let projectDir: string\n  let envFilePath = ''\n  let envExampleFilePath = ''\n\n  beforeAll(() => {\n    // eslint-disable-next-line no-console\n    console.log = jest.fn()\n  })\n\n  beforeEach(() => {\n    const tempDirectory = fs.realpathSync(os.tmpdir())\n    projectDir = `${tempDirectory}/${Math.random().toString(36).substring(7)}`\n\n    envFilePath = path.join(projectDir, '.env')\n    envExampleFilePath = path.join(projectDir, '.env.example')\n\n    if (fse.existsSync(envFilePath)) {\n      fse.removeSync(envFilePath)\n    }\n\n    fse.ensureDirSync(projectDir)\n  })\n\n  afterEach(() => {\n    if (fse.existsSync(projectDir)) {\n      fse.rmSync(projectDir, { recursive: true })\n    }\n  })\n\n  it('generates .env using defaults (not from .env.example)', async () => {\n    // ensure no .env.example exists so that the default values are used\n    // the `manageEnvFiles` function will look for .env.example in the file system\n    if (fse.existsSync(envExampleFilePath)) {\n      fse.removeSync(envExampleFilePath)\n    }\n\n    await manageEnvFiles({\n      cliArgs: {\n        '--debug': true,\n      } as CliArgs,\n      databaseUri: '', // omitting this will ensure the default vars are used\n      payloadSecret: '', // omitting this will ensure the default vars are used\n      projectDir,\n      template: undefined,\n    })\n\n    expect(fse.existsSync(envFilePath)).toBe(true)\n\n    const updatedEnvContent = fse.readFileSync(envFilePath, 'utf-8')\n\n    expect(updatedEnvContent).toBe(\n      `# Added by Payload\\nPAYLOAD_SECRET=YOUR_SECRET_HERE\\nDATABASE_URI=your-connection-string-here`,\n    )\n  })\n\n  it('generates .env from .env.example', async () => {\n    // create or override the .env.example file with a connection string that will NOT be overridden\n    fse.ensureFileSync(envExampleFilePath)\n    fse.writeFileSync(\n      envExampleFilePath,\n      `DATABASE_URI=example-connection-string\\nCUSTOM_VAR=custom-value\\n`,\n    )\n\n    await manageEnvFiles({\n      cliArgs: {\n        '--debug': true,\n      } as CliArgs,\n      databaseUri: '', // omitting this will ensure the `.env.example` vars are used\n      payloadSecret: '', // omitting this will ensure the `.env.example` vars are used\n      projectDir,\n      template: undefined,\n    })\n\n    expect(fse.existsSync(envFilePath)).toBe(true)\n\n    const updatedEnvContent = fse.readFileSync(envFilePath, 'utf-8')\n\n    expect(updatedEnvContent).toBe(\n      `DATABASE_URI=example-connection-string\\nCUSTOM_VAR=custom-value\\nPAYLOAD_SECRET=YOUR_SECRET_HERE\\n# Added by Payload`,\n    )\n  })\n\n  it('updates existing .env without overriding vars', async () => {\n    // create an existing .env file with some custom variables that should NOT be overridden\n    fse.ensureFileSync(envFilePath)\n    fse.writeFileSync(\n      envFilePath,\n      `CUSTOM_VAR=custom-value\\nDATABASE_URI=example-connection-string\\n`,\n    )\n\n    // create an .env.example file to ensure that its contents DO NOT override existing .env vars\n    fse.ensureFileSync(envExampleFilePath)\n    fse.writeFileSync(\n      envExampleFilePath,\n      `CUSTOM_VAR=custom-value-2\\nDATABASE_URI=example-connection-string-2\\n`,\n    )\n\n    await manageEnvFiles({\n      cliArgs: {\n        '--debug': true,\n      } as CliArgs,\n      databaseUri: '', // omitting this will ensure the `.env` vars are kept\n      payloadSecret: '', // omitting this will ensure the `.env` vars are kept\n      projectDir,\n      template: undefined,\n    })\n\n    expect(fse.existsSync(envFilePath)).toBe(true)\n\n    const updatedEnvContent = fse.readFileSync(envFilePath, 'utf-8')\n\n    expect(updatedEnvContent).toBe(\n      `# Added by Payload\\nPAYLOAD_SECRET=YOUR_SECRET_HERE\\nDATABASE_URI=example-connection-string\\nCUSTOM_VAR=custom-value`,\n    )\n  })\n\n  it('sanitizes .env based on selected database type', async () => {\n    await manageEnvFiles({\n      cliArgs: {\n        '--debug': true,\n      } as CliArgs,\n      databaseType: 'mongodb', // this mimics the CLI selection and will be used as the DATABASE_URI\n      databaseUri: 'mongodb://localhost:27017/test', // this mimics the CLI selection and will be used as the DATABASE_URI\n      payloadSecret: 'test-secret', // this mimics the CLI selection and will be used as the PAYLOAD_SECRET\n      projectDir,\n      template: undefined,\n    })\n\n    const updatedEnvContent = fse.readFileSync(envFilePath, 'utf-8')\n\n    expect(updatedEnvContent).toBe(\n      `# Added by Payload\\nPAYLOAD_SECRET=test-secret\\nDATABASE_URI=mongodb://localhost:27017/test`,\n    )\n\n    // delete the generated .env file and do it again, but this time, omit the databaseUri to ensure the default is generated\n    fse.removeSync(envFilePath)\n\n    await manageEnvFiles({\n      cliArgs: {\n        '--debug': true,\n      } as CliArgs,\n      databaseType: 'mongodb', // this mimics the CLI selection and will be used as the DATABASE_URI\n      databaseUri: '', // omit this to ensure the default is generated based on the selected database type\n      payloadSecret: 'test-secret',\n      projectDir,\n      template: undefined,\n    })\n\n    const updatedEnvContentWithDefault = fse.readFileSync(envFilePath, 'utf-8')\n    expect(updatedEnvContentWithDefault).toBe(\n      `# Added by Payload\\nPAYLOAD_SECRET=test-secret\\nDATABASE_URI=mongodb://127.0.0.1/your-database-name`,\n    )\n  })\n})\n"],"names":["jest","fs","fse","os","path","manageEnvFiles","describe","projectDir","envFilePath","envExampleFilePath","beforeAll","console","log","fn","beforeEach","tempDirectory","realpathSync","tmpdir","Math","random","toString","substring","join","existsSync","removeSync","ensureDirSync","afterEach","rmSync","recursive","it","cliArgs","databaseUri","payloadSecret","template","undefined","expect","toBe","updatedEnvContent","readFileSync","ensureFileSync","writeFileSync","databaseType","updatedEnvContentWithDefault"],"mappings":"AAAA,SAASA,IAAI,QAAQ,gBAAe;AACpC,OAAOC,QAAQ,KAAI;AACnB,OAAOC,SAAS,WAAU;AAC1B,YAAYC,QAAQ,UAAS;AAC7B,OAAOC,UAAU,OAAM;AAIvB,SAASC,cAAc,QAAQ,wBAAuB;AAEtDC,SAAS,iBAAiB;IACxB,IAAIC;IACJ,IAAIC,cAAc;IAClB,IAAIC,qBAAqB;IAEzBC,UAAU;QACR,sCAAsC;QACtCC,QAAQC,GAAG,GAAGZ,KAAKa,EAAE;IACvB;IAEAC,WAAW;QACT,MAAMC,gBAAgBd,GAAGe,YAAY,CAACb,GAAGc,MAAM;QAC/CV,aAAa,GAAGQ,cAAc,CAAC,EAAEG,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,SAAS,CAAC,IAAI;QAE1Eb,cAAcJ,KAAKkB,IAAI,CAACf,YAAY;QACpCE,qBAAqBL,KAAKkB,IAAI,CAACf,YAAY;QAE3C,IAAIL,IAAIqB,UAAU,CAACf,cAAc;YAC/BN,IAAIsB,UAAU,CAAChB;QACjB;QAEAN,IAAIuB,aAAa,CAAClB;IACpB;IAEAmB,UAAU;QACR,IAAIxB,IAAIqB,UAAU,CAAChB,aAAa;YAC9BL,IAAIyB,MAAM,CAACpB,YAAY;gBAAEqB,WAAW;YAAK;QAC3C;IACF;IAEAC,G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9B,aAAa;QAExD2B,OAAOE,mBAAmBD,IAAI,CAC5B,CAAC,oHAAoH,CAAC;IAE1H;IAEAP,GAAG,kDAAkD;QACnD,MAAMxB,eAAe;YACnByB,SAAS;gBACP,WAAW;YACb;YACAW,cAAc;YACdV,aAAa;YACbC,eAAe;YACfzB;YACA0B,UAAUC;QACZ;QAEA,MAAMG,oBAAoBnC,IAAIoC,YAAY,CAAC9B,aAAa;QAExD2B,OAAOE,mBAAmBD,IAAI,CAC5B,CAAC,2FAA2F,CAAC;QAG/F,yHAAyH;QACzHlC,IAAIsB,UAAU,CAAChB;QAEf,MAAMH,eAAe;YACnByB,SAAS;gBACP,WAAW;YACb;YACAW,cAAc;YACdV,aAAa;YACbC,eAAe;YACfzB;YACA0B,UAAUC;QACZ;QAEA,MAAMQ,+BAA+BxC,IAAIoC,YAAY,CAAC9B,aAAa;QACnE2B,OAAOO,8BAA8BN,IAAI,CACvC,CAAC,mGAAmG,CAAC;IAEzG;AACF"}
         
     | 
| 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            import * as p from '@clack/prompts';
         
     | 
| 
       2 
     | 
    
         
            -
            import {  
     | 
| 
      
 2 
     | 
    
         
            +
            import { jest } from '@jest/globals';
         
     | 
| 
       3 
3 
     | 
    
         
             
            import { parseAndModifyConfigContent, withPayloadStatement } from './wrap-next-config.js';
         
     | 
| 
       4 
4 
     | 
    
         
             
            const tsConfigs = {
         
     | 
| 
       5 
5 
     | 
    
         
             
                defaultNextConfig: `import type { NextConfig } from "next";
         
     | 
| 
         @@ -122,7 +122,7 @@ describe('parseAndInsertWithPayload', ()=>{ 
     | 
|
| 
       122 
122 
     | 
    
         
             
                    });
         
     | 
| 
       123 
123 
     | 
    
         
             
                    // Unsupported: export { wrapped as default }
         
     | 
| 
       124 
124 
     | 
    
         
             
                    it('should give warning with a named export as default', async ()=>{
         
     | 
| 
       125 
     | 
    
         
            -
                        const warnLogSpy =  
     | 
| 
      
 125 
     | 
    
         
            +
                        const warnLogSpy = jest.spyOn(p.log, 'warn').mockImplementation(()=>{});
         
     | 
| 
       126 
126 
     | 
    
         
             
                        const { modifiedConfigContent, success } = await parseAndModifyConfigContent(esmConfigs.nextConfigExportNamedDefault, configType);
         
     | 
| 
       127 
127 
     | 
    
         
             
                        expect(modifiedConfigContent).toContain(importStatement);
         
     | 
| 
       128 
128 
     | 
    
         
             
                        expect(success).toBe(false);
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"sources":["../../src/lib/wrap-next-config.spec.ts"],"sourcesContent":["import * as p from '@clack/prompts'\nimport { describe, it, expect, vitest } from 'vitest'\n\nimport { parseAndModifyConfigContent, withPayloadStatement } from './wrap-next-config.js'\n\nconst tsConfigs = {\n  defaultNextConfig: `import type { NextConfig } from \"next\";\n\nconst nextConfig: NextConfig = {};\nexport default nextConfig;`,\n\n  nextConfigExportNamedDefault: `import type { NextConfig } from \"next\";\nconst nextConfig: NextConfig = {};\nconst wrapped = someFunc(asdf);\nexport { wrapped as default };\n`,\n  nextConfigWithFunc: `import type { NextConfig } from \"next\";\nconst nextConfig: NextConfig = {};\nexport default someFunc(nextConfig);\n`,\n  nextConfigWithFuncMultiline: `import type { NextConfig } from \"next\";\nconst nextConfig: NextConfig = {};\nexport default someFunc(\n  nextConfig\n);\n`,\n  nextConfigWithSpread: `import type { NextConfig } from \"next\";\nconst nextConfig: NextConfig = {\n  ...someConfig,\n};\nexport default nextConfig;\n`,\n}\n\nconst esmConfigs = {\n  defaultNextConfig: `/** @type {import('next').NextConfig} */\nconst nextConfig = {};\nexport default nextConfig;\n`,\n  nextConfigExportNamedDefault: `const nextConfig = {};\nconst wrapped = someFunc(asdf);\nexport { wrapped as default };\n`,\n  nextConfigWithFunc: `const nextConfig = {};\nexport default someFunc(nextConfig);\n`,\n  nextConfigWithFuncMultiline: `const nextConfig = {};;\nexport default someFunc(\n  nextConfig\n);\n`,\n  nextConfigWithSpread: `const nextConfig = {\n  ...someConfig,\n};\nexport default nextConfig;\n`,\n}\n\nconst cjsConfigs = {\n  anonConfig: `module.exports = {};`,\n  defaultNextConfig: `\n  /** @type {import('next').NextConfig} */\nconst nextConfig = {};\nmodule.exports = nextConfig;\n`,\n  nextConfigExportNamedDefault: `const nextConfig = {};\nconst wrapped = someFunc(asdf);\nmodule.exports = wrapped;\n`,\n  nextConfigWithFunc: `const nextConfig = {};\nmodule.exports = someFunc(nextConfig);\n`,\n  nextConfigWithFuncMultiline: `const nextConfig = {};\nmodule.exports = someFunc(\n  nextConfig\n);\n`,\n  nextConfigWithSpread: `const nextConfig = { ...someConfig };\nmodule.exports = nextConfig;\n`,\n}\n\ndescribe('parseAndInsertWithPayload', () => {\n  describe('ts', () => {\n    const configType = 'ts'\n    const importStatement = withPayloadStatement[configType]\n\n    it('should parse the default next config', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        tsConfigs.defaultNextConfig,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(importStatement)\n      expect(modifiedConfigContent).toContain('withPayload(nextConfig)')\n    })\n\n    it('should parse the config with a function', async () => {\n      const { modifiedConfigContent: modifiedConfigContent2 } = await parseAndModifyConfigContent(\n        tsConfigs.nextConfigWithFunc,\n        configType,\n      )\n      expect(modifiedConfigContent2).toContain('withPayload(someFunc(nextConfig))')\n    })\n\n    it('should parse the config with a multi-lined function', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        tsConfigs.nextConfigWithFuncMultiline,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(importStatement)\n      expect(modifiedConfigContent).toMatch(/withPayload\\(someFunc\\(\\n {2}nextConfig\\n\\)\\)/)\n    })\n\n    it('should parse the config with a spread', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        tsConfigs.nextConfigWithSpread,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(importStatement)\n      expect(modifiedConfigContent).toContain('withPayload(nextConfig)')\n    })\n  })\n  describe('esm', () => {\n    const configType = 'esm'\n    const importStatement = withPayloadStatement[configType]\n    it('should parse the default next config', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        esmConfigs.defaultNextConfig,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(importStatement)\n      expect(modifiedConfigContent).toContain('withPayload(nextConfig)')\n    })\n    it('should parse the config with a function', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        esmConfigs.nextConfigWithFunc,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain('withPayload(someFunc(nextConfig))')\n    })\n\n    it('should parse the config with a multi-lined function', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        esmConfigs.nextConfigWithFuncMultiline,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(importStatement)\n      expect(modifiedConfigContent).toMatch(/withPayload\\(someFunc\\(\\n {2}nextConfig\\n\\)\\)/)\n    })\n\n    it('should parse the config with a spread', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        esmConfigs.nextConfigWithSpread,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(importStatement)\n      expect(modifiedConfigContent).toContain('withPayload(nextConfig)')\n    })\n\n    // Unsupported: export { wrapped as default }\n    it('should give warning with a named export as default', async () => {\n      const warnLogSpy = vitest.spyOn(p.log, 'warn').mockImplementation(() => {})\n\n      const { modifiedConfigContent, success } = await parseAndModifyConfigContent(\n        esmConfigs.nextConfigExportNamedDefault,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(importStatement)\n      expect(success).toBe(false)\n\n      expect(warnLogSpy).toHaveBeenCalledWith(\n        expect.stringContaining('Could not automatically wrap'),\n      )\n    })\n  })\n\n  describe('cjs', () => {\n    const configType = 'cjs'\n    const requireStatement = withPayloadStatement[configType]\n    it('should parse the default next config', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        cjsConfigs.defaultNextConfig,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(requireStatement)\n      expect(modifiedConfigContent).toContain('withPayload(nextConfig)')\n    })\n    it('should parse anonymous default config', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        cjsConfigs.anonConfig,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(requireStatement)\n      expect(modifiedConfigContent).toContain('withPayload({})')\n    })\n    it('should parse the config with a function', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        cjsConfigs.nextConfigWithFunc,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain('withPayload(someFunc(nextConfig))')\n    })\n    it('should parse the config with a multi-lined function', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        cjsConfigs.nextConfigWithFuncMultiline,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(requireStatement)\n      expect(modifiedConfigContent).toMatch(/withPayload\\(someFunc\\(\\n {2}nextConfig\\n\\)\\)/)\n    })\n    it('should parse the config with a named export as default', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        cjsConfigs.nextConfigExportNamedDefault,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(requireStatement)\n      expect(modifiedConfigContent).toContain('withPayload(wrapped)')\n    })\n\n    it('should parse the config with a spread', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        cjsConfigs.nextConfigWithSpread,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(requireStatement)\n      expect(modifiedConfigContent).toContain('withPayload(nextConfig)')\n    })\n  })\n})\n"],"names":["p","describe","it","expect","vitest","parseAndModifyConfigContent","withPayloadStatement","tsConfigs","defaultNextConfig","nextConfigExportNamedDefault","nextConfigWithFunc","nextConfigWithFuncMultiline","nextConfigWithSpread","esmConfigs","cjsConfigs","anonConfig","configType","importStatement","modifiedConfigContent","toContain","modifiedConfigContent2","toMatch","warnLogSpy","spyOn","log","mockImplementation","success","toBe","toHaveBeenCalledWith","stringContaining","requireStatement"],"mappings":"AAAA,YAAYA,OAAO,iBAAgB;AACnC,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C;QAC1C;QAEAjB,GAAG,yCAAyC;YAC1C,MAAM,EAAEgB,qBAAqB,EAAE,GAAG,MAAMb,4BACtCS,WAAWF,oBAAoB,EAC/BI;YAEFb,OAAOe,uBAAuBC,SAAS,CAACW;YACxC3B,OAAOe,uBAAuBC,SAAS,CAAC;QAC1C;IACF;AACF"}
         
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"sources":["../../src/lib/wrap-next-config.spec.ts"],"sourcesContent":["import * as p from '@clack/prompts'\nimport { jest } from '@jest/globals'\n\nimport { parseAndModifyConfigContent, withPayloadStatement } from './wrap-next-config.js'\n\nconst tsConfigs = {\n  defaultNextConfig: `import type { NextConfig } from \"next\";\n\nconst nextConfig: NextConfig = {};\nexport default nextConfig;`,\n\n  nextConfigExportNamedDefault: `import type { NextConfig } from \"next\";\nconst nextConfig: NextConfig = {};\nconst wrapped = someFunc(asdf);\nexport { wrapped as default };\n`,\n  nextConfigWithFunc: `import type { NextConfig } from \"next\";\nconst nextConfig: NextConfig = {};\nexport default someFunc(nextConfig);\n`,\n  nextConfigWithFuncMultiline: `import type { NextConfig } from \"next\";\nconst nextConfig: NextConfig = {};\nexport default someFunc(\n  nextConfig\n);\n`,\n  nextConfigWithSpread: `import type { NextConfig } from \"next\";\nconst nextConfig: NextConfig = {\n  ...someConfig,\n};\nexport default nextConfig;\n`,\n}\n\nconst esmConfigs = {\n  defaultNextConfig: `/** @type {import('next').NextConfig} */\nconst nextConfig = {};\nexport default nextConfig;\n`,\n  nextConfigExportNamedDefault: `const nextConfig = {};\nconst wrapped = someFunc(asdf);\nexport { wrapped as default };\n`,\n  nextConfigWithFunc: `const nextConfig = {};\nexport default someFunc(nextConfig);\n`,\n  nextConfigWithFuncMultiline: `const nextConfig = {};;\nexport default someFunc(\n  nextConfig\n);\n`,\n  nextConfigWithSpread: `const nextConfig = {\n  ...someConfig,\n};\nexport default nextConfig;\n`,\n}\n\nconst cjsConfigs = {\n  anonConfig: `module.exports = {};`,\n  defaultNextConfig: `\n  /** @type {import('next').NextConfig} */\nconst nextConfig = {};\nmodule.exports = nextConfig;\n`,\n  nextConfigExportNamedDefault: `const nextConfig = {};\nconst wrapped = someFunc(asdf);\nmodule.exports = wrapped;\n`,\n  nextConfigWithFunc: `const nextConfig = {};\nmodule.exports = someFunc(nextConfig);\n`,\n  nextConfigWithFuncMultiline: `const nextConfig = {};\nmodule.exports = someFunc(\n  nextConfig\n);\n`,\n  nextConfigWithSpread: `const nextConfig = { ...someConfig };\nmodule.exports = nextConfig;\n`,\n}\n\ndescribe('parseAndInsertWithPayload', () => {\n  describe('ts', () => {\n    const configType = 'ts'\n    const importStatement = withPayloadStatement[configType]\n\n    it('should parse the default next config', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        tsConfigs.defaultNextConfig,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(importStatement)\n      expect(modifiedConfigContent).toContain('withPayload(nextConfig)')\n    })\n\n    it('should parse the config with a function', async () => {\n      const { modifiedConfigContent: modifiedConfigContent2 } = await parseAndModifyConfigContent(\n        tsConfigs.nextConfigWithFunc,\n        configType,\n      )\n      expect(modifiedConfigContent2).toContain('withPayload(someFunc(nextConfig))')\n    })\n\n    it('should parse the config with a multi-lined function', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        tsConfigs.nextConfigWithFuncMultiline,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(importStatement)\n      expect(modifiedConfigContent).toMatch(/withPayload\\(someFunc\\(\\n {2}nextConfig\\n\\)\\)/)\n    })\n\n    it('should parse the config with a spread', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        tsConfigs.nextConfigWithSpread,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(importStatement)\n      expect(modifiedConfigContent).toContain('withPayload(nextConfig)')\n    })\n  })\n  describe('esm', () => {\n    const configType = 'esm'\n    const importStatement = withPayloadStatement[configType]\n    it('should parse the default next config', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        esmConfigs.defaultNextConfig,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(importStatement)\n      expect(modifiedConfigContent).toContain('withPayload(nextConfig)')\n    })\n    it('should parse the config with a function', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        esmConfigs.nextConfigWithFunc,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain('withPayload(someFunc(nextConfig))')\n    })\n\n    it('should parse the config with a multi-lined function', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        esmConfigs.nextConfigWithFuncMultiline,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(importStatement)\n      expect(modifiedConfigContent).toMatch(/withPayload\\(someFunc\\(\\n {2}nextConfig\\n\\)\\)/)\n    })\n\n    it('should parse the config with a spread', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        esmConfigs.nextConfigWithSpread,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(importStatement)\n      expect(modifiedConfigContent).toContain('withPayload(nextConfig)')\n    })\n\n    // Unsupported: export { wrapped as default }\n    it('should give warning with a named export as default', async () => {\n      const warnLogSpy = jest.spyOn(p.log, 'warn').mockImplementation(() => {})\n\n      const { modifiedConfigContent, success } = await parseAndModifyConfigContent(\n        esmConfigs.nextConfigExportNamedDefault,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(importStatement)\n      expect(success).toBe(false)\n\n      expect(warnLogSpy).toHaveBeenCalledWith(\n        expect.stringContaining('Could not automatically wrap'),\n      )\n    })\n  })\n\n  describe('cjs', () => {\n    const configType = 'cjs'\n    const requireStatement = withPayloadStatement[configType]\n    it('should parse the default next config', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        cjsConfigs.defaultNextConfig,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(requireStatement)\n      expect(modifiedConfigContent).toContain('withPayload(nextConfig)')\n    })\n    it('should parse anonymous default config', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        cjsConfigs.anonConfig,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(requireStatement)\n      expect(modifiedConfigContent).toContain('withPayload({})')\n    })\n    it('should parse the config with a function', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        cjsConfigs.nextConfigWithFunc,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain('withPayload(someFunc(nextConfig))')\n    })\n    it('should parse the config with a multi-lined function', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        cjsConfigs.nextConfigWithFuncMultiline,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(requireStatement)\n      expect(modifiedConfigContent).toMatch(/withPayload\\(someFunc\\(\\n {2}nextConfig\\n\\)\\)/)\n    })\n    it('should parse the config with a named export as default', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        cjsConfigs.nextConfigExportNamedDefault,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(requireStatement)\n      expect(modifiedConfigContent).toContain('withPayload(wrapped)')\n    })\n\n    it('should parse the config with a spread', async () => {\n      const { modifiedConfigContent } = await parseAndModifyConfigContent(\n        cjsConfigs.nextConfigWithSpread,\n        configType,\n      )\n      expect(modifiedConfigContent).toContain(requireStatement)\n      expect(modifiedConfigContent).toContain('withPayload(nextConfig)')\n    })\n  })\n})\n"],"names":["p","jest","parseAndModifyConfigContent","withPayloadStatement","tsConfigs","defaultNextConfig","nextConfigExportNamedDefault","nextConfigWithFunc","nextConfigWithFuncMultiline","nextConfigWithSpread","esmConfigs","cjsConfigs","anonConfig","describe","configType","importStatement","it","modifiedConfigContent","expect","toContain","modifiedConfigContent2","toMatch","warnLogSpy","spyOn","log","mockImplementation","success","toBe","toHaveBeenCalledWith","stringContaining","requireStatement"],"mappings":"AAAA,YAAYA,OAAO,iBAAgB;AACnC,SAASC,IAAI,QAAQ,gBAAe;AAEpC,SAASC,2BAA2B,EAAEC,oBAAoB,QAAQ,wBAAuB;AAEzF,MAAMC,YA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BAAuBE,SAAS,CAAC;QAC1C;IACF;AACF"}
         
     | 
    
        package/package.json
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            {
         
     | 
| 
       2 
2 
     | 
    
         
             
              "name": "create-payload-app",
         
     | 
| 
       3 
     | 
    
         
            -
              "version": "3.62.0 
     | 
| 
      
 3 
     | 
    
         
            +
              "version": "3.62.0",
         
     | 
| 
       4 
4 
     | 
    
         
             
              "homepage": "https://payloadcms.com",
         
     | 
| 
       5 
5 
     | 
    
         
             
              "repository": {
         
     | 
| 
       6 
6 
     | 
    
         
             
                "type": "git",
         
     | 
| 
         @@ -65,6 +65,7 @@ 
     | 
|
| 
       65 
65 
     | 
    
         
             
              "devDependencies": {
         
     | 
| 
       66 
66 
     | 
    
         
             
                "@types/esprima": "^4.0.6",
         
     | 
| 
       67 
67 
     | 
    
         
             
                "@types/fs-extra": "^9.0.12",
         
     | 
| 
      
 68 
     | 
    
         
            +
                "@types/jest": "29.5.12",
         
     | 
| 
       68 
69 
     | 
    
         
             
                "@types/node": "22.15.30"
         
     | 
| 
       69 
70 
     | 
    
         
             
              },
         
     | 
| 
       70 
71 
     | 
    
         
             
              "engines": {
         
     |