create-payload-app 3.0.0-canary.a78fca3 → 3.0.0-canary.ab70b75

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. package/dist/index.js.map +1 -1
  2. package/dist/lib/configure-payload-config.js +1 -1
  3. package/dist/lib/configure-payload-config.js.map +1 -1
  4. package/dist/lib/create-project.d.ts.map +1 -1
  5. package/dist/lib/create-project.js +8 -3
  6. package/dist/lib/create-project.js.map +1 -1
  7. package/dist/lib/create-project.spec.js +22 -23
  8. package/dist/lib/create-project.spec.js.map +1 -1
  9. package/dist/lib/download-template.d.ts +10 -0
  10. package/dist/lib/download-template.d.ts.map +1 -0
  11. package/dist/lib/download-template.js +21 -0
  12. package/dist/lib/download-template.js.map +1 -0
  13. package/dist/lib/generate-secret.js.map +1 -1
  14. package/dist/lib/get-package-manager.js +26 -5
  15. package/dist/lib/get-package-manager.js.map +1 -1
  16. package/dist/lib/init-next.d.ts +2 -2
  17. package/dist/lib/init-next.d.ts.map +1 -1
  18. package/dist/lib/init-next.js +54 -12
  19. package/dist/lib/init-next.js.map +1 -1
  20. package/dist/lib/install-packages.js.map +1 -1
  21. package/dist/lib/parse-project-name.d.ts.map +1 -1
  22. package/dist/lib/parse-project-name.js +9 -3
  23. package/dist/lib/parse-project-name.js.map +1 -1
  24. package/dist/lib/parse-template.d.ts.map +1 -1
  25. package/dist/lib/parse-template.js +3 -1
  26. package/dist/lib/parse-template.js.map +1 -1
  27. package/dist/lib/replacements.d.ts.map +1 -1
  28. package/dist/lib/replacements.js +29 -4
  29. package/dist/lib/replacements.js.map +1 -1
  30. package/dist/lib/select-db.d.ts.map +1 -1
  31. package/dist/lib/select-db.js +23 -14
  32. package/dist/lib/select-db.js.map +1 -1
  33. package/dist/lib/templates.js +7 -1
  34. package/dist/lib/templates.js.map +1 -1
  35. package/dist/lib/update-payload-in-project.d.ts.map +1 -1
  36. package/dist/lib/update-payload-in-project.js +7 -5
  37. package/dist/lib/update-payload-in-project.js.map +1 -1
  38. package/dist/lib/wrap-next-config.d.ts +5 -5
  39. package/dist/lib/wrap-next-config.d.ts.map +1 -1
  40. package/dist/lib/wrap-next-config.js +119 -59
  41. package/dist/lib/wrap-next-config.js.map +1 -1
  42. package/dist/lib/wrap-next-config.spec.js +84 -34
  43. package/dist/lib/wrap-next-config.spec.js.map +1 -1
  44. package/dist/lib/write-env-file.d.ts.map +1 -1
  45. package/dist/lib/write-env-file.js +27 -25
  46. package/dist/lib/write-env-file.js.map +1 -1
  47. package/dist/main.d.ts.map +1 -1
  48. package/dist/main.js +8 -2
  49. package/dist/main.js.map +1 -1
  50. package/dist/scripts/pack-template-files.js +3 -3
  51. package/dist/scripts/pack-template-files.js.map +1 -1
  52. package/dist/template/src/app/(payload)/admin/[[...segments]]/not-found.tsx +8 -6
  53. package/dist/template/src/app/(payload)/admin/[[...segments]]/page.tsx +8 -6
  54. package/dist/template/src/app/(payload)/admin/importMap.js +1 -0
  55. package/dist/template/src/app/(payload)/api/[...slug]/route.ts +1 -1
  56. package/dist/template/src/app/(payload)/api/graphql/route.ts +1 -1
  57. package/dist/template/src/app/(payload)/api/graphql-playground/route.ts +1 -1
  58. package/dist/template/src/app/(payload)/layout.tsx +7 -2
  59. package/dist/template/src/collections/Media.ts +1 -1
  60. package/dist/template/src/collections/Users.ts +1 -1
  61. package/dist/template/src/payload-types.ts +127 -0
  62. package/dist/template/src/payload.config.ts +4 -1
  63. package/dist/types.d.ts +5 -2
  64. package/dist/types.d.ts.map +1 -1
  65. package/dist/types.js.map +1 -1
  66. package/dist/utils/copy-recursive-sync.d.ts +1 -1
  67. package/dist/utils/copy-recursive-sync.d.ts.map +1 -1
  68. package/dist/utils/copy-recursive-sync.js +1 -1
  69. package/dist/utils/copy-recursive-sync.js.map +1 -1
  70. package/dist/utils/git.js.map +1 -1
  71. package/dist/utils/log.d.ts.map +1 -1
  72. package/dist/utils/log.js +1 -1
  73. package/dist/utils/log.js.map +1 -1
  74. package/dist/utils/messages.d.ts.map +1 -1
  75. package/dist/utils/messages.js +1 -0
  76. package/dist/utils/messages.js.map +1 -1
  77. package/package.json +10 -6
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/write-env-file.ts"],"sourcesContent":["import fs from 'fs-extra'\nimport path from 'path'\n\nimport type { CliArgs, ProjectTemplate } from '../types.js'\n\nimport { debug, error } from '../utils/log.js'\n\n/** Parse and swap .env.example values and write .env */\nexport async function writeEnvFile(args: {\n cliArgs: CliArgs\n databaseUri: string\n payloadSecret: string\n projectDir: string\n template?: ProjectTemplate\n}): Promise<void> {\n const { cliArgs, databaseUri, payloadSecret, projectDir, template } = args\n\n if (cliArgs['--dry-run']) {\n debug(`DRY RUN: .env file created`)\n return\n }\n\n const envOutputPath = path.join(projectDir, '.env')\n\n try {\n if (fs.existsSync(envOutputPath)) {\n if (template?.type === 'starter') {\n // Parse .env file into key/value pairs\n const envFile = await fs.readFile(path.join(projectDir, '.env.example'), 'utf8')\n const envWithValues: string[] = envFile\n .split('\\n')\n .filter((e) => e)\n .map((line) => {\n if (line.startsWith('#') || !line.includes('=')) return line\n\n const split = line.split('=')\n const key = split[0]\n let value = split[1]\n\n if (key === 'MONGODB_URI' || key === 'MONGO_URL' || key === 'DATABASE_URI') {\n value = databaseUri\n }\n if (key === 'PAYLOAD_SECRET' || key === 'PAYLOAD_SECRET_KEY') {\n value = payloadSecret\n }\n\n return `${key}=${value}`\n })\n\n // Write new .env file\n await fs.writeFile(envOutputPath, envWithValues.join('\\n'))\n } else {\n const existingEnv = await fs.readFile(envOutputPath, 'utf8')\n const newEnv =\n existingEnv + `\\nDATABASE_URI=${databaseUri}\\nPAYLOAD_SECRET=${payloadSecret}\\n`\n await fs.writeFile(envOutputPath, newEnv)\n }\n } else {\n const content = `DATABASE_URI=${databaseUri}\\nPAYLOAD_SECRET=${payloadSecret}`\n await fs.outputFile(`${projectDir}/.env`, content)\n }\n } catch (err: unknown) {\n error('Unable to write .env file')\n if (err instanceof Error) {\n error(err.message)\n }\n process.exit(1)\n }\n}\n"],"names":["fs","path","debug","error","writeEnvFile","args","cliArgs","databaseUri","payloadSecret","projectDir","template","envOutputPath","join","existsSync","type","envFile","readFile","envWithValues","split","filter","e","map","line","startsWith","includes","key","value","writeFile","existingEnv","newEnv","content","outputFile","err","Error","message","process","exit"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,QAAQ,WAAU;AACzB,OAAOC,UAAU,OAAM;AAIvB,SAASC,KAAK,EAAEC,KAAK,QAAQ,kBAAiB;AAE9C,sDAAsD,GACtD,OAAO,eAAeC,aAAaC,IAMlC;IACC,MAAM,EAAEC,OAAO,EAAEC,WAAW,EAAEC,aAAa,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGL;IAEtE,IAAIC,OAAO,CAAC,YAAY,EAAE;QACxBJ,MAAM,CAAC,0BAA0B,CAAC;QAClC;IACF;IAEA,MAAMS,gBAAgBV,KAAKW,IAAI,CAACH,YAAY;IAE5C,IAAI;QACF,IAAIT,GAAGa,UAAU,CAACF,gBAAgB;YAChC,IAAID,UAAUI,SAAS,WAAW;gBAChC,uCAAuC;gBACvC,MAAMC,UAAU,MAAMf,GAAGgB,QAAQ,CAACf,KAAKW,IAAI,CAACH,YAAY,iBAAiB;gBACzE,MAAMQ,gBAA0BF,QAC7BG,KAAK,CAAC,MACNC,MAAM,CAAC,CAACC,IAAMA,GACdC,GAAG,CAAC,CAACC;oBACJ,IAAIA,KAAKC,UAAU,CAAC,QAAQ,CAACD,KAAKE,QAAQ,CAAC,MAAM,OAAOF;oBAExD,MAAMJ,QAAQI,KAAKJ,KAAK,CAAC;oBACzB,MAAMO,MAAMP,KAAK,CAAC,EAAE;oBACpB,IAAIQ,QAAQR,KAAK,CAAC,EAAE;oBAEpB,IAAIO,QAAQ,iBAAiBA,QAAQ,eAAeA,QAAQ,gBAAgB;wBAC1EC,QAAQnB;oBACV;oBACA,IAAIkB,QAAQ,oBAAoBA,QAAQ,sBAAsB;wBAC5DC,QAAQlB;oBACV;oBAEA,OAAO,CAAC,EAAEiB,IAAI,CAAC,EAAEC,MAAM,CAAC;gBAC1B;gBAEF,sBAAsB;gBACtB,MAAM1B,GAAG2B,SAAS,CAAChB,eAAeM,cAAcL,IAAI,CAAC;YACvD,OAAO;gBACL,MAAMgB,cAAc,MAAM5B,GAAGgB,QAAQ,CAACL,eAAe;gBACrD,MAAMkB,SACJD,cAAc,CAAC,eAAe,EAAErB,YAAY,iBAAiB,EAAEC,cAAc,EAAE,CAAC;gBAClF,MAAMR,GAAG2B,SAAS,CAAChB,eAAekB;YACpC;QACF,OAAO;YACL,MAAMC,UAAU,CAAC,aAAa,EAAEvB,YAAY,iBAAiB,EAAEC,cAAc,CAAC;YAC9E,MAAMR,GAAG+B,UAAU,CAAC,CAAC,EAAEtB,WAAW,KAAK,CAAC,EAAEqB;QAC5C;IACF,EAAE,OAAOE,KAAc;QACrB7B,MAAM;QACN,IAAI6B,eAAeC,OAAO;YACxB9B,MAAM6B,IAAIE,OAAO;QACnB;QACAC,QAAQC,IAAI,CAAC;IACf;AACF"}
1
+ {"version":3,"sources":["../../src/lib/write-env-file.ts"],"sourcesContent":["import fs from 'fs-extra'\nimport path from 'path'\n\nimport type { CliArgs, ProjectTemplate } from '../types.js'\n\nimport { debug, error } from '../utils/log.js'\n\n/** Parse and swap .env.example values and write .env */\nexport async function writeEnvFile(args: {\n cliArgs: CliArgs\n databaseUri: string\n payloadSecret: string\n projectDir: string\n template?: ProjectTemplate\n}): Promise<void> {\n const { cliArgs, databaseUri, payloadSecret, projectDir, template } = args\n\n if (cliArgs['--dry-run']) {\n debug(`DRY RUN: .env file created`)\n return\n }\n\n const envOutputPath = path.join(projectDir, '.env')\n\n try {\n let fileContents: string\n\n if (template?.type === 'starter') {\n // Parse .env file into key/value pairs\n const envExample = path.join(projectDir, '.env.example')\n const envFile = await fs.readFile(envExample, 'utf8')\n\n fileContents =\n `# Added by Payload\\n` +\n envFile\n .split('\\n')\n .filter((e) => e)\n .map((line) => {\n if (line.startsWith('#') || !line.includes('=')) {\n return line\n }\n\n const split = line.split('=')\n const key = split[0]\n let value = split[1]\n\n if (\n key === 'MONGODB_URI' ||\n key === 'MONGO_URL' ||\n key === 'DATABASE_URI' ||\n key === 'POSTGRES_URL'\n ) {\n value = databaseUri\n }\n if (key === 'PAYLOAD_SECRET' || key === 'PAYLOAD_SECRET_KEY') {\n value = payloadSecret\n }\n\n return `${key}=${value}`\n })\n .join('\\n')\n } else {\n fileContents = `# Added by Payload\\nDATABASE_URI=${databaseUri}\\nPAYLOAD_SECRET=${payloadSecret}\\n`\n }\n\n if (fs.existsSync(envOutputPath)) {\n const existingEnv = await fs.readFile(envOutputPath, 'utf8')\n const newEnv = existingEnv + '\\n# Added by Payload' + fileContents\n await fs.writeFile(envOutputPath, newEnv)\n } else {\n await fs.writeFile(envOutputPath, fileContents)\n }\n } catch (err: unknown) {\n error('Unable to write .env file')\n if (err instanceof Error) {\n error(err.message)\n }\n process.exit(1)\n }\n}\n"],"names":["fs","path","debug","error","writeEnvFile","args","cliArgs","databaseUri","payloadSecret","projectDir","template","envOutputPath","join","fileContents","type","envExample","envFile","readFile","split","filter","e","map","line","startsWith","includes","key","value","existsSync","existingEnv","newEnv","writeFile","err","Error","message","process","exit"],"mappings":"AAAA,OAAOA,QAAQ,WAAU;AACzB,OAAOC,UAAU,OAAM;AAIvB,SAASC,KAAK,EAAEC,KAAK,QAAQ,kBAAiB;AAE9C,sDAAsD,GACtD,OAAO,eAAeC,aAAaC,IAMlC;IACC,MAAM,EAAEC,OAAO,EAAEC,WAAW,EAAEC,aAAa,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGL;IAEtE,IAAIC,OAAO,CAAC,YAAY,EAAE;QACxBJ,MAAM,CAAC,0BAA0B,CAAC;QAClC;IACF;IAEA,MAAMS,gBAAgBV,KAAKW,IAAI,CAACH,YAAY;IAE5C,IAAI;QACF,IAAII;QAEJ,IAAIH,UAAUI,SAAS,WAAW;YAChC,uC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"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAsBzC,qBAAa,IAAI;IACf,IAAI,EAAE,OAAO,CAAA;;IA2CP,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAiK5B"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAsBzC,qBAAa,IAAI;IACf,IAAI,EAAE,OAAO,CAAA;;IA4CP,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAgL5B"}
package/dist/main.js CHANGED
@@ -16,7 +16,7 @@ import { getValidTemplates, validateTemplate } from './lib/templates.js';
16
16
  import { updatePayloadInProject } from './lib/update-payload-in-project.js';
17
17
  import { writeEnvFile } from './lib/write-env-file.js';
18
18
  import { error, info } from './utils/log.js';
19
- import { feedbackOutro, helpMessage, moveMessage, successMessage, successfulNextInit } from './utils/messages.js';
19
+ import { feedbackOutro, helpMessage, moveMessage, successfulNextInit, successMessage } from './utils/messages.js';
20
20
  export class Main {
21
21
  args;
22
22
  constructor(){
@@ -35,6 +35,7 @@ export class Main {
35
35
  '--init-next': Boolean,
36
36
  // Package manager
37
37
  '--no-deps': Boolean,
38
+ '--use-bun': Boolean,
38
39
  '--use-npm': Boolean,
39
40
  '--use-pnpm': Boolean,
40
41
  '--use-yarn': Boolean,
@@ -65,7 +66,12 @@ export class Main {
65
66
  p.note("Welcome to Payload. Let's create a project!");
66
67
  // Detect if inside Next.js project
67
68
  const nextAppDetails = await getNextAppDetails(process.cwd());
68
- const { hasTopLevelLayout, isPayloadInstalled, nextAppDir, nextConfigPath } = nextAppDetails;
69
+ const { hasTopLevelLayout, isPayloadInstalled, isSupportedNextVersion, nextAppDir, nextConfigPath, nextVersion } = nextAppDetails;
70
+ if (nextConfigPath && !isSupportedNextVersion) {
71
+ p.log.warn(`Next.js v${nextVersion} is unsupported. Next.js >= 15 is required to use Payload.`);
72
+ p.outro(feedbackOutro());
73
+ process.exit(0);
74
+ }
69
75
  // Upgrade Payload in existing project
70
76
  if (isPayloadInstalled && nextConfigPath) {
71
77
  p.log.warn(`Payload installation detected in current project.`);
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/main.ts"],"sourcesContent":["import * as p from '@clack/prompts'\nimport slugify from '@sindresorhus/slugify'\nimport arg from 'arg'\nimport chalk from 'chalk'\nimport figures from 'figures'\nimport path from 'path'\n\nimport type { CliArgs } from './types.js'\n\nimport { configurePayloadConfig } from './lib/configure-payload-config.js'\nimport { createProject } from './lib/create-project.js'\nimport { generateSecret } from './lib/generate-secret.js'\nimport { getPackageManager } from './lib/get-package-manager.js'\nimport { getNextAppDetails, initNext } from './lib/init-next.js'\nimport { parseProjectName } from './lib/parse-project-name.js'\nimport { parseTemplate } from './lib/parse-template.js'\nimport { selectDb } from './lib/select-db.js'\nimport { getValidTemplates, validateTemplate } from './lib/templates.js'\nimport { updatePayloadInProject } from './lib/update-payload-in-project.js'\nimport { writeEnvFile } from './lib/write-env-file.js'\nimport { error, info } from './utils/log.js'\nimport {\n feedbackOutro,\n helpMessage,\n moveMessage,\n successMessage,\n successfulNextInit,\n} from './utils/messages.js'\n\nexport class Main {\n args: CliArgs\n\n constructor() {\n // @ts-expect-error bad typings\n this.args = arg(\n {\n '--db': String,\n '--db-accept-recommended': Boolean,\n '--db-connection-string': String,\n '--help': Boolean,\n '--local-template': String,\n '--name': String,\n '--secret': String,\n '--template': String,\n '--template-branch': String,\n\n // Next.js\n '--init-next': Boolean, // TODO: Is this needed if we detect if inside Next.js project?\n\n // Package manager\n '--no-deps': Boolean,\n '--use-npm': Boolean,\n '--use-pnpm': Boolean,\n '--use-yarn': Boolean,\n\n // Other\n '--no-git': Boolean,\n\n // Flags\n '--beta': Boolean,\n '--debug': Boolean,\n '--dry-run': Boolean,\n\n // Aliases\n '-d': '--db',\n '-h': '--help',\n '-n': '--name',\n '-t': '--template',\n },\n { permissive: true },\n )\n }\n\n async init(): Promise<void> {\n try {\n if (this.args['--help']) {\n helpMessage()\n process.exit(0)\n }\n\n // eslint-disable-next-line no-console\n console.log('\\n')\n p.intro(chalk.bgCyan(chalk.black(' create-payload-app ')))\n p.note(\"Welcome to Payload. Let's create a project!\")\n\n // Detect if inside Next.js project\n const nextAppDetails = await getNextAppDetails(process.cwd())\n const { hasTopLevelLayout, isPayloadInstalled, nextAppDir, nextConfigPath } = nextAppDetails\n\n // Upgrade Payload in existing project\n if (isPayloadInstalled && nextConfigPath) {\n p.log.warn(`Payload installation detected in current project.`)\n const shouldUpdate = await p.confirm({\n initialValue: false,\n message: chalk.bold(`Upgrade Payload in this project?`),\n })\n\n if (!p.isCancel(shouldUpdate) && shouldUpdate) {\n const { message, success: updateSuccess } = await updatePayloadInProject(nextAppDetails)\n if (updateSuccess) {\n info(message)\n } else {\n error(message)\n }\n }\n\n p.outro(feedbackOutro())\n process.exit(0)\n }\n\n if (nextConfigPath) {\n this.args['--name'] = slugify(path.basename(path.dirname(nextConfigPath)))\n }\n\n const projectName = await parseProjectName(this.args)\n const projectDir = nextConfigPath\n ? path.dirname(nextConfigPath)\n : path.resolve(process.cwd(), slugify(projectName))\n\n const packageManager = await getPackageManager({ cliArgs: this.args, projectDir })\n\n if (nextConfigPath) {\n p.log.step(\n chalk.bold(`${chalk.bgBlack(` ${figures.triangleUp} Next.js `)} project detected!`),\n )\n\n const proceed = await p.confirm({\n initialValue: true,\n message: chalk.bold(`Install ${chalk.green('Payload')} in this project?`),\n })\n if (p.isCancel(proceed) || !proceed) {\n p.outro(feedbackOutro())\n process.exit(0)\n }\n\n // Check for top-level layout.tsx\n if (nextAppDir && hasTopLevelLayout) {\n p.log.warn(moveMessage({ nextAppDir, projectDir }))\n p.outro(feedbackOutro())\n process.exit(0)\n }\n\n const dbDetails = await selectDb(this.args, projectName)\n\n const result = await initNext({\n ...this.args,\n dbType: dbDetails.type,\n nextAppDetails,\n packageManager,\n projectDir,\n })\n\n if (result.success === false) {\n p.outro(feedbackOutro())\n process.exit(1)\n }\n\n await configurePayloadConfig({\n dbType: dbDetails?.type,\n projectDirOrConfigPath: {\n payloadConfigPath: result.payloadConfigPath,\n },\n })\n\n await writeEnvFile({\n cliArgs: this.args,\n databaseUri: dbDetails.dbUri,\n payloadSecret: generateSecret(),\n projectDir,\n })\n\n info('Payload project successfully initialized!')\n p.note(successfulNextInit(), chalk.bgGreen(chalk.black(' Documentation ')))\n p.outro(feedbackOutro())\n return\n }\n\n const templateArg = this.args['--template']\n if (templateArg) {\n const valid = validateTemplate(templateArg)\n if (!valid) {\n helpMessage()\n process.exit(1)\n }\n }\n\n const validTemplates = getValidTemplates()\n const template = await parseTemplate(this.args, validTemplates)\n if (!template) {\n p.log.error('Invalid template given')\n p.outro(feedbackOutro())\n process.exit(1)\n }\n\n switch (template.type) {\n case 'starter': {\n const dbDetails = await selectDb(this.args, projectName)\n const payloadSecret = generateSecret()\n await createProject({\n cliArgs: this.args,\n dbDetails,\n packageManager,\n projectDir,\n projectName,\n template,\n })\n await writeEnvFile({\n cliArgs: this.args,\n databaseUri: dbDetails.dbUri,\n payloadSecret,\n projectDir,\n template,\n })\n break\n }\n case 'plugin': {\n await createProject({\n cliArgs: this.args,\n packageManager,\n projectDir,\n projectName,\n template,\n })\n break\n }\n }\n\n info('Payload project successfully created!')\n p.note(successMessage(projectDir, packageManager), chalk.bgGreen(chalk.black(' Next Steps ')))\n p.outro(feedbackOutro())\n } catch (err: unknown) {\n error(err instanceof Error ? err.message : 'An error occurred')\n }\n }\n}\n"],"names":["p","slugify","arg","chalk","figures","path","configurePayloadConfig","createProject","generateSecret","getPackageManager","getNextAppDetails","initNext","parseProjectName","parseTemplate","selectDb","getValidTemplates","validateTemplate","updatePayloadInProject","writeEnvFile","error","info","feedbackOutro","helpMessage","moveMessage","successMessage","successfulNextInit","Main","args","constructor","String","Boolean","permissive","init","process","exit","console","log","intro","bgCyan","black","note","nextAppDetails","cwd","hasTopLevelLayout","isPayloadInstalled","nextAppDir","nextConfigPath","warn","shouldUpdate","confirm","initialValue","message","bold","isCancel","success","updateSuccess","outro","basename","dirname","projectName","projectDir","resolve","packageManager","cliArgs","step","bgBlack","triangleUp","proceed","green","dbDetails","result","dbType","type","projectDirOrConfigPath","payloadConfigPath","databaseUri","dbUri","payloadSecret","bgGreen","templateArg","valid","validTemplates","template","err","Error"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,OAAO,iBAAgB;AACnC,OAAOC,aAAa,wBAAuB;AAC3C,OAAOC,SAAS,MAAK;AACrB,OAAOC,WAAW,QAAO;AACzB,OAAOC,aAAa,UAAS;AAC7B,OAAOC,UAAU,OAAM;AAIvB,SAASC,sBAAsB,QAAQ,oCAAmC;AAC1E,SAASC,aAAa,QAAQ,0BAAyB;AACvD,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SAASC,iBAAiB,QAAQ,+BAA8B;AAChE,SAASC,iBAAiB,EAAEC,QAAQ,QAAQ,qBAAoB;AAChE,SAASC,gBAAgB,QAAQ,8BAA6B;AAC9D,SAASC,aAAa,QAAQ,0BAAyB;AACvD,SAASC,QAAQ,QAAQ,qBAAoB;AAC7C,SAASC,iBAAiB,EAAEC,gBAAgB,QAAQ,qBAAoB;AACxE,SAASC,sBAAsB,QAAQ,qCAAoC;AAC3E,SAASC,YAAY,QAAQ,0BAAyB;AACtD,SAASC,KAAK,EAAEC,IAAI,QAAQ,iBAAgB;AAC5C,SACEC,aAAa,EACbC,WAAW,EACXC,WAAW,EACXC,cAAc,EACdC,kBAAkB,QACb,sBAAqB;AAE5B,OAAO,MAAM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IAAI;4BAClB0C;4BACAP;4BACAF;4BACAD;4BACAuB;wBACF;wBACA,MAAMhE,aAAa;4BACjB6C,SAAS,IAAI,CAACpC,IAAI;4BAClBgD,aAAaN,UAAUO,KAAK;4BAC5BC;4BACAjB;4BACAsB;wBACF;wBACA;oBACF;gBACA,KAAK;oBAAU;wBACb,MAAM3E,cAAc;4BAClBwD,SAAS,IAAI,CAACpC,IAAI;4BAClBmC;4BACAF;4BACAD;4BACAuB;wBACF;wBACA;oBACF;YACF;YAEA9D,KAAK;YACLpB,EAAEwC,IAAI,CAAChB,eAAeoC,YAAYE,iBAAiB3D,MAAM2E,OAAO,CAAC3E,MAAMoC,KAAK,CAAC;YAC7EvC,EAAEwD,KAAK,CAACnC;QACV,EAAE,OAAO8D,KAAc;YACrBhE,MAAMgE,eAAeC,QAAQD,IAAIhC,OAAO,GAAG;QAC7C;IACF;AACF"}
1
+ {"version":3,"sources":["../src/main.ts"],"sourcesContent":["import * as p from '@clack/prompts'\nimport slugify from '@sindresorhus/slugify'\nimport arg from 'arg'\nimport chalk from 'chalk'\nimport figures from 'figures'\nimport path from 'path'\n\nimport type { CliArgs } from './types.js'\n\nimport { configurePayloadConfig } from './lib/configure-payload-config.js'\nimport { createProject } from './lib/create-project.js'\nimport { generateSecret } from './lib/generate-secret.js'\nimport { getPackageManager } from './lib/get-package-manager.js'\nimport { getNextAppDetails, initNext } from './lib/init-next.js'\nimport { parseProjectName } from './lib/parse-project-name.js'\nimport { parseTemplate } from './lib/parse-template.js'\nimport { selectDb } from './lib/select-db.js'\nimport { getValidTemplates, validateTemplate } from './lib/templates.js'\nimport { updatePayloadInProject } from './lib/update-payload-in-project.js'\nimport { writeEnvFile } from './lib/write-env-file.js'\nimport { error, info } from './utils/log.js'\nimport {\n feedbackOutro,\n helpMessage,\n moveMessage,\n successfulNextInit,\n successMessage,\n} from './utils/messages.js'\n\nexport class Main {\n args: CliArgs\n\n constructor() {\n // @ts-expect-error bad typings\n this.args = arg(\n {\n '--db': String,\n '--db-accept-recommended': Boolean,\n '--db-connection-string': String,\n '--help': Boolean,\n '--local-template': String,\n '--name': String,\n '--secret': String,\n '--template': String,\n '--template-branch': String,\n\n // Next.js\n '--init-next': Boolean, // TODO: Is this needed if we detect if inside Next.js project?\n\n // Package manager\n '--no-deps': Boolean,\n '--use-bun': Boolean,\n '--use-npm': Boolean,\n '--use-pnpm': Boolean,\n '--use-yarn': Boolean,\n\n // Other\n '--no-git': Boolean,\n\n // Flags\n '--beta': Boolean,\n '--debug': Boolean,\n '--dry-run': Boolean,\n\n // Aliases\n '-d': '--db',\n '-h': '--help',\n '-n': '--name',\n '-t': '--template',\n },\n { permissive: true },\n )\n }\n\n async init(): Promise<void> {\n try {\n if (this.args['--help']) {\n helpMessage()\n process.exit(0)\n }\n\n // eslint-disable-next-line no-console\n console.log('\\n')\n p.intro(chalk.bgCyan(chalk.black(' create-payload-app ')))\n p.note(\"Welcome to Payload. Let's create a project!\")\n\n // Detect if inside Next.js project\n const nextAppDetails = await getNextAppDetails(process.cwd())\n const {\n hasTopLevelLayout,\n isPayloadInstalled,\n isSupportedNextVersion,\n nextAppDir,\n nextConfigPath,\n nextVersion,\n } = nextAppDetails\n\n if (nextConfigPath && !isSupportedNextVersion) {\n p.log.warn(\n `Next.js v${nextVersion} is unsupported. Next.js >= 15 is required to use Payload.`,\n )\n p.outro(feedbackOutro())\n process.exit(0)\n }\n\n // Upgrade Payload in existing project\n if (isPayloadInstalled && nextConfigPath) {\n p.log.warn(`Payload installation detected in current project.`)\n const shouldUpdate = await p.confirm({\n initialValue: false,\n message: chalk.bold(`Upgrade Payload in this project?`),\n })\n\n if (!p.isCancel(shouldUpdate) && shouldUpdate) {\n const { message, success: updateSuccess } = await updatePayloadInProject(nextAppDetails)\n if (updateSuccess) {\n info(message)\n } else {\n error(message)\n }\n }\n\n p.outro(feedbackOutro())\n process.exit(0)\n }\n\n if (nextConfigPath) {\n this.args['--name'] = slugify(path.basename(path.dirname(nextConfigPath)))\n }\n\n const projectName = await parseProjectName(this.args)\n const projectDir = nextConfigPath\n ? path.dirname(nextConfigPath)\n : path.resolve(process.cwd(), slugify(projectName))\n\n const packageManager = await getPackageManager({ cliArgs: this.args, projectDir })\n\n if (nextConfigPath) {\n p.log.step(\n chalk.bold(`${chalk.bgBlack(` ${figures.triangleUp} Next.js `)} project detected!`),\n )\n\n const proceed = await p.confirm({\n initialValue: true,\n message: chalk.bold(`Install ${chalk.green('Payload')} in this project?`),\n })\n if (p.isCancel(proceed) || !proceed) {\n p.outro(feedbackOutro())\n process.exit(0)\n }\n\n // Check for top-level layout.tsx\n if (nextAppDir && hasTopLevelLayout) {\n p.log.warn(moveMessage({ nextAppDir, projectDir }))\n p.outro(feedbackOutro())\n process.exit(0)\n }\n\n const dbDetails = await selectDb(this.args, projectName)\n\n const result = await initNext({\n ...this.args,\n dbType: dbDetails.type,\n nextAppDetails,\n packageManager,\n projectDir,\n })\n\n if (result.success === false) {\n p.outro(feedbackOutro())\n process.exit(1)\n }\n\n await configurePayloadConfig({\n dbType: dbDetails?.type,\n projectDirOrConfigPath: {\n payloadConfigPath: result.payloadConfigPath,\n },\n })\n\n await writeEnvFile({\n cliArgs: this.args,\n databaseUri: dbDetails.dbUri,\n payloadSecret: generateSecret(),\n projectDir,\n })\n\n info('Payload project successfully initialized!')\n p.note(successfulNextInit(), chalk.bgGreen(chalk.black(' Documentation ')))\n p.outro(feedbackOutro())\n return\n }\n\n const templateArg = this.args['--template']\n if (templateArg) {\n const valid = validateTemplate(templateArg)\n if (!valid) {\n helpMessage()\n process.exit(1)\n }\n }\n\n const validTemplates = getValidTemplates()\n const template = await parseTemplate(this.args, validTemplates)\n if (!template) {\n p.log.error('Invalid template given')\n p.outro(feedbackOutro())\n process.exit(1)\n }\n\n switch (template.type) {\n case 'starter': {\n const dbDetails = await selectDb(this.args, projectName)\n const payloadSecret = generateSecret()\n await createProject({\n cliArgs: this.args,\n dbDetails,\n packageManager,\n projectDir,\n projectName,\n template,\n })\n await writeEnvFile({\n cliArgs: this.args,\n databaseUri: dbDetails.dbUri,\n payloadSecret,\n projectDir,\n template,\n })\n break\n }\n case 'plugin': {\n await createProject({\n cliArgs: this.args,\n packageManager,\n projectDir,\n projectName,\n template,\n })\n break\n }\n }\n\n info('Payload project successfully created!')\n p.note(successMessage(projectDir, packageManager), chalk.bgGreen(chalk.black(' Next Steps ')))\n p.outro(feedbackOutro())\n } catch (err: unknown) {\n error(err instanceof Error ? err.message : 'An error occurred')\n }\n }\n}\n"],"names":["p","slugify","arg","chalk","figures","path","configurePayloadConfig","createProject","generateSecret","getPackageManager","getNextAppDetails","initNext","parseProjectName","parseTemplate","selectDb","getValidTemplates","validateTemplate","updatePayloadInProject","writeEnvFile","error","info","feedbackOutro","helpMessage","moveMessage","successfulNextInit","successMessage","Main","args","constructor","String","Boolean","permissive","init","process","exit","console","log","intro","bgCyan","black","note","nextAppDetails","cwd","hasTopLevelLayout","isPayloadInstalled","isSupportedNextVersion","nextAppDir","nextConfigPath","nextVersion","warn","outro","shouldUpdate","confirm","initialValue","message","bold","isCancel","success","updateSuccess","basename","dirname","projectName","projectDir","resolve","packageManager","cliArgs","step","bgBlack","triangleUp","proceed","green","dbDetails","result","dbType","type","projectDirOrConfigPath","payloadConfigPath","databaseUri","dbUri","payloadSecret","bgGreen","templateArg","valid","validTemplates","template","err","Error"],"mappings":"AAAA,YAAYA,OAAO,iBAAgB;AACnC,OAAOC,aAAa,wBAAuB;AAC3C,OAAOC,SAAS,MAAK;AACrB,OAAOC,WAAW,QAAO;AACzB,OAAOC,aAAa,UAAS;AAC7B,OAAOC,UAAU,OAAM;AAIvB,SAASC,sBAAsB,QAAQ,oCAAmC;AAC1E,SAASC,aAAa,QAAQ,0BAAyB;AACvD,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SAASC,iBAAiB,QAAQ,+BAA8B;AAChE,SAASC,iBAAiB,EAAEC,QAAQ,QAAQ,qBAAoB;AAChE,SAASC,gBAAgB,QAAQ,8BAA6B;AAC9D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cAAc,IAAI,CAACtD,IAAI,CAAC,aAAa;YAC3C,IAAIsD,aAAa;gBACf,MAAMC,QAAQlE,iBAAiBiE;gBAC/B,IAAI,CAACC,OAAO;oBACV5D;oBACAW,QAAQC,IAAI,CAAC;gBACf;YACF;YAEA,MAAMiD,iBAAiBpE;YACvB,MAAMqE,WAAW,MAAMvE,cAAc,IAAI,CAACc,IAAI,EAAEwD;YAChD,IAAI,CAACC,UAAU;gBACbpF,EAAEoC,GAAG,CAACjB,KAAK,CAAC;gBACZnB,EAAEkD,KAAK,CAAC7B;gBACRY,QAAQC,IAAI,CAAC;YACf;YAEA,OAAQkD,SAASV,IAAI;gBACnB,KAAK;oBAAW;wBACd,MAAMH,YAAY,MAAMzD,SAAS,IAAI,CAACa,IAAI,EAAEkC;wBAC5C,MAAMkB,gBAAgBvE;wBACtB,MAAMD,cAAc;4BAClB0D,SAAS,IAAI,CAACtC,IAAI;4BAClB4C;4BACAP;4BACAF;4BACAD;4BACAuB;wBACF;wBACA,MAAMlE,aAAa;4BACjB+C,SAAS,IAAI,CAACtC,IAAI;4BAClBkD,aAAaN,UAAUO,KAAK;4BAC5BC;4BACAjB;4BACAsB;wBACF;wBACA;oBACF;gBACA,KAAK;oBAAU;wBACb,MAAM7E,cAAc;4BAClB0D,SAAS,IAAI,CAACtC,IAAI;4BAClBqC;4BACAF;4BACAD;4BACAuB;wBACF;wBACA;oBACF;YACF;YAEAhE,KAAK;YACLpB,EAAEwC,IAAI,CAACf,eAAeqC,YAAYE,iBAAiB7D,MAAM6E,OAAO,CAAC7E,MAAMoC,KAAK,CAAC;YAC7EvC,EAAEkD,KAAK,CAAC7B;QACV,EAAE,OAAOgE,KAAc;YACrBlE,MAAMkE,eAAeC,QAAQD,IAAI/B,OAAO,GAAG;QAC7C;IACF;AACF"}
@@ -7,13 +7,13 @@ const dirname = path.dirname(filename);
7
7
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
8
8
  main();
9
9
  /**
10
- * Copy the necessary template files from `templates/blank-3.0` to `dist/template`
10
+ * Copy the necessary template files from `templates/blank` to `dist/template`
11
11
  *
12
12
  * Eventually, this should be replaced with using tar.x to stream from the git repo
13
13
  */ async function main() {
14
14
  const root = path.resolve(dirname, '../../../../');
15
15
  const outputPath = path.resolve(dirname, '../../dist/template');
16
- const sourceTemplatePath = path.resolve(root, 'templates/blank-3.0');
16
+ const sourceTemplatePath = path.resolve(root, 'templates/blank');
17
17
  if (!fs.existsSync(sourceTemplatePath)) {
18
18
  throw new Error(`Source path does not exist: ${sourceTemplatePath}`);
19
19
  }
@@ -22,7 +22,7 @@ main();
22
22
  recursive: true
23
23
  });
24
24
  }
25
- // Copy the src directory from `templates/blank-3.0` to `dist`
25
+ // Copy the src directory from `templates/blank` to `dist`
26
26
  const srcPath = path.resolve(sourceTemplatePath, 'src');
27
27
  const distSrcPath = path.resolve(outputPath, 'src');
28
28
  // Copy entire file structure from src to dist
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/scripts/pack-template-files.ts"],"sourcesContent":["import fs from 'fs'\nimport fsp from 'fs/promises'\nimport { fileURLToPath } from 'node:url'\nimport path from 'path'\nconst filename = fileURLToPath(import.meta.url)\nconst dirname = path.dirname(filename)\n\n// eslint-disable-next-line @typescript-eslint/no-floating-promises\nmain()\n\n/**\n * Copy the necessary template files from `templates/blank-3.0` to `dist/template`\n *\n * Eventually, this should be replaced with using tar.x to stream from the git repo\n */\n\nasync function main() {\n const root = path.resolve(dirname, '../../../../')\n const outputPath = path.resolve(dirname, '../../dist/template')\n const sourceTemplatePath = path.resolve(root, 'templates/blank-3.0')\n\n if (!fs.existsSync(sourceTemplatePath)) {\n throw new Error(`Source path does not exist: ${sourceTemplatePath}`)\n }\n\n if (!fs.existsSync(outputPath)) {\n fs.mkdirSync(outputPath, { recursive: true })\n }\n\n // Copy the src directory from `templates/blank-3.0` to `dist`\n const srcPath = path.resolve(sourceTemplatePath, 'src')\n const distSrcPath = path.resolve(outputPath, 'src')\n // Copy entire file structure from src to dist\n await fsp.cp(srcPath, distSrcPath, { recursive: true })\n}\n"],"names":["fs","fsp","fileURLToPath","path","filename","url","dirname","main","root","resolve","outputPath","sourceTemplatePath","existsSync","Error","mkdirSync","recursive","srcPath","distSrcPath","cp"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,SAAS,cAAa;AAC7B,SAASC,aAAa,QAAQ,WAAU;AACxC,OAAOC,UAAU,OAAM;AACvB,MAAMC,WAAWF,cAAc,YAAYG,GAAG;AAC9C,MAAMC,UAAUH,KAAKG,OAAO,CAACF;AAE7B,mEAAmE;AACnEG;AAEA;;;;CAIC,GAED,eAAeA;IACb,MAAMC,OAAOL,KAAKM,OAAO,CAACH,SAAS;IACnC,MAAMI,aAAaP,KAAKM,OAAO,CAACH,SAAS;IACzC,MAAMK,qBAAqBR,KAAKM,OAAO,CAACD,MAAM;IAE9C,IAAI,CAACR,GAAGY,UAAU,CAACD,qBAAqB;QACtC,MAAM,IAAIE,MAAM,CAAC,4BAA4B,EAAEF,mBAAmB,CAAC;IACrE;IAEA,IAAI,CAACX,GAAGY,UAAU,CAACF,aAAa;QAC9BV,GAAGc,SAAS,CAACJ,YAAY;YAAEK,WAAW;QAAK;IAC7C;IAEA,8DAA8D;IAC9D,MAAMC,UAAUb,KAAKM,OAAO,CAACE,oBAAoB;IACjD,MAAMM,cAAcd,KAAKM,OAAO,CAACC,YAAY;IAC7C,8CAA8C;IAC9C,MAAMT,IAAIiB,EAAE,CAACF,SAASC,aAAa;QAAEF,WAAW;IAAK;AACvD"}
1
+ {"version":3,"sources":["../../src/scripts/pack-template-files.ts"],"sourcesContent":["import fs from 'fs'\nimport fsp from 'fs/promises'\nimport { fileURLToPath } from 'node:url'\nimport path from 'path'\nconst filename = fileURLToPath(import.meta.url)\nconst dirname = path.dirname(filename)\n\n// eslint-disable-next-line @typescript-eslint/no-floating-promises\nmain()\n\n/**\n * Copy the necessary template files from `templates/blank` to `dist/template`\n *\n * Eventually, this should be replaced with using tar.x to stream from the git repo\n */\n\nasync function main() {\n const root = path.resolve(dirname, '../../../../')\n const outputPath = path.resolve(dirname, '../../dist/template')\n const sourceTemplatePath = path.resolve(root, 'templates/blank')\n\n if (!fs.existsSync(sourceTemplatePath)) {\n throw new Error(`Source path does not exist: ${sourceTemplatePath}`)\n }\n\n if (!fs.existsSync(outputPath)) {\n fs.mkdirSync(outputPath, { recursive: true })\n }\n\n // Copy the src directory from `templates/blank` to `dist`\n const srcPath = path.resolve(sourceTemplatePath, 'src')\n const distSrcPath = path.resolve(outputPath, 'src')\n // Copy entire file structure from src to dist\n await fsp.cp(srcPath, distSrcPath, { recursive: true })\n}\n"],"names":["fs","fsp","fileURLToPath","path","filename","url","dirname","main","root","resolve","outputPath","sourceTemplatePath","existsSync","Error","mkdirSync","recursive","srcPath","distSrcPath","cp"],"mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,SAAS,cAAa;AAC7B,SAASC,aAAa,QAAQ,WAAU;AACxC,OAAOC,UAAU,OAAM;AACvB,MAAMC,WAAWF,cAAc,YAAYG,GAAG;AAC9C,MAAMC,UAAUH,KAAKG,OAAO,CAACF;AAE7B,mEAAmE;AACnEG;AAEA;;;;CAIC,GAED,eAAeA;IACb,MAAMC,OAAOL,KAAKM,OAAO,CAACH,SAAS;IACnC,MAAMI,aAAaP,KAAKM,OAAO,CAACH,SAAS;IACzC,MAAMK,qBAAqBR,KAAKM,OAAO,CAACD,MAAM;IAE9C,IAAI,CAACR,GAAGY,UAAU,CAACD,qBAAqB;QACtC,MAAM,IAAIE,MAAM,CAAC,4BAA4B,EAAEF,mBAAmB,CAAC;IACrE;IAEA,IAAI,CAACX,GAAGY,UAAU,CAACF,aAAa;QAC9BV,GAAGc,SAAS,CAACJ,YAAY;YAAEK,WAAW;QAAK;IAC7C;IAEA,0DAA0D;IAC1D,MAAMC,UAAUb,KAAKM,OAAO,CAACE,oBAAoB;IACjD,MAAMM,cAAcd,KAAKM,OAAO,CAACC,YAAY;IAC7C,8CAA8C;IAC9C,MAAMT,IAAIiB,EAAE,CAACF,SAASC,aAAa;QAAEF,WAAW;IAAK;AACvD"}
@@ -1,22 +1,24 @@
1
1
  /* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
2
+ /* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
2
3
  import type { Metadata } from 'next'
3
4
 
4
5
  import config from '@payload-config'
5
- /* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
6
6
  import { NotFoundPage, generatePageMetadata } from '@payloadcms/next/views'
7
+ import { importMap } from '../importMap'
7
8
 
8
9
  type Args = {
9
- params: {
10
+ params: Promise<{
10
11
  segments: string[]
11
- }
12
- searchParams: {
12
+ }>
13
+ searchParams: Promise<{
13
14
  [key: string]: string | string[]
14
- }
15
+ }>
15
16
  }
16
17
 
17
18
  export const generateMetadata = ({ params, searchParams }: Args): Promise<Metadata> =>
18
19
  generatePageMetadata({ config, params, searchParams })
19
20
 
20
- const NotFound = ({ params, searchParams }: Args) => NotFoundPage({ config, params, searchParams })
21
+ const NotFound = ({ params, searchParams }: Args) =>
22
+ NotFoundPage({ config, params, searchParams, importMap })
21
23
 
22
24
  export default NotFound
@@ -1,22 +1,24 @@
1
1
  /* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
2
+ /* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
2
3
  import type { Metadata } from 'next'
3
4
 
4
5
  import config from '@payload-config'
5
- /* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
6
6
  import { RootPage, generatePageMetadata } from '@payloadcms/next/views'
7
+ import { importMap } from '../importMap'
7
8
 
8
9
  type Args = {
9
- params: {
10
+ params: Promise<{
10
11
  segments: string[]
11
- }
12
- searchParams: {
12
+ }>
13
+ searchParams: Promise<{
13
14
  [key: string]: string | string[]
14
- }
15
+ }>
15
16
  }
16
17
 
17
18
  export const generateMetadata = ({ params, searchParams }: Args): Promise<Metadata> =>
18
19
  generatePageMetadata({ config, params, searchParams })
19
20
 
20
- const Page = ({ params, searchParams }: Args) => RootPage({ config, params, searchParams })
21
+ const Page = ({ params, searchParams }: Args) =>
22
+ RootPage({ config, params, searchParams, importMap })
21
23
 
22
24
  export default Page
@@ -0,0 +1 @@
1
+ export const importMap = {}
@@ -1,5 +1,5 @@
1
1
  /* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
2
- /* DO NOT MODIFY it because it could be re-written at any time. */
2
+ /* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
3
3
  import config from '@payload-config'
4
4
  import { REST_DELETE, REST_GET, REST_OPTIONS, REST_PATCH, REST_POST } from '@payloadcms/next/routes'
5
5
 
@@ -1,5 +1,5 @@
1
1
  /* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
2
- /* DO NOT MODIFY it because it could be re-written at any time. */
2
+ /* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
3
3
  import config from '@payload-config'
4
4
  import { GRAPHQL_POST } from '@payloadcms/next/routes'
5
5
 
@@ -1,5 +1,5 @@
1
1
  /* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
2
- /* DO NOT MODIFY it because it could be re-written at any time. */
2
+ /* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
3
3
  import config from '@payload-config'
4
4
  import { GRAPHQL_PLAYGROUND_GET } from '@payloadcms/next/routes'
5
5
 
@@ -1,16 +1,21 @@
1
1
  /* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
2
+ /* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
2
3
  import configPromise from '@payload-config'
3
4
  import '@payloadcms/next/css'
4
5
  import { RootLayout } from '@payloadcms/next/layouts'
5
- /* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
6
6
  import React from 'react'
7
7
 
8
8
  import './custom.scss'
9
+ import { importMap } from './admin/importMap'
9
10
 
10
11
  type Args = {
11
12
  children: React.ReactNode
12
13
  }
13
14
 
14
- const Layout = ({ children }: Args) => <RootLayout config={configPromise}>{children}</RootLayout>
15
+ const Layout = ({ children }: Args) => (
16
+ <RootLayout importMap={importMap} config={configPromise}>
17
+ {children}
18
+ </RootLayout>
19
+ )
15
20
 
16
21
  export default Layout
@@ -1,4 +1,4 @@
1
- import type { CollectionConfig } from 'payload/types'
1
+ import type { CollectionConfig } from 'payload'
2
2
 
3
3
  export const Media: CollectionConfig = {
4
4
  slug: 'media',
@@ -1,4 +1,4 @@
1
- import type { CollectionConfig } from 'payload/types'
1
+ import type { CollectionConfig } from 'payload'
2
2
 
3
3
  export const Users: CollectionConfig = {
4
4
  slug: 'users',
@@ -0,0 +1,127 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * This file was automatically generated by Payload.
5
+ * DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config,
6
+ * and re-run `payload generate:types` to regenerate this file.
7
+ */
8
+
9
+ export interface Config {
10
+ auth: {
11
+ users: UserAuthOperations;
12
+ };
13
+ collections: {
14
+ users: User;
15
+ media: Media;
16
+ 'payload-preferences': PayloadPreference;
17
+ 'payload-migrations': PayloadMigration;
18
+ };
19
+ db: {
20
+ defaultIDType: string;
21
+ };
22
+ globals: {};
23
+ locale: null;
24
+ user: User & {
25
+ collection: 'users';
26
+ };
27
+ }
28
+ export interface UserAuthOperations {
29
+ forgotPassword: {
30
+ email: string;
31
+ password: string;
32
+ };
33
+ login: {
34
+ email: string;
35
+ password: string;
36
+ };
37
+ registerFirstUser: {
38
+ email: string;
39
+ password: string;
40
+ };
41
+ unlock: {
42
+ email: string;
43
+ password: string;
44
+ };
45
+ }
46
+ /**
47
+ * This interface was referenced by `Config`'s JSON-Schema
48
+ * via the `definition` "users".
49
+ */
50
+ export interface User {
51
+ id: string;
52
+ updatedAt: string;
53
+ createdAt: string;
54
+ email: string;
55
+ resetPasswordToken?: string | null;
56
+ resetPasswordExpiration?: string | null;
57
+ salt?: string | null;
58
+ hash?: string | null;
59
+ loginAttempts?: number | null;
60
+ lockUntil?: string | null;
61
+ password?: string | null;
62
+ }
63
+ /**
64
+ * This interface was referenced by `Config`'s JSON-Schema
65
+ * via the `definition` "media".
66
+ */
67
+ export interface Media {
68
+ id: string;
69
+ alt: string;
70
+ updatedAt: string;
71
+ createdAt: string;
72
+ url?: string | null;
73
+ thumbnailURL?: string | null;
74
+ filename?: string | null;
75
+ mimeType?: string | null;
76
+ filesize?: number | null;
77
+ width?: number | null;
78
+ height?: number | null;
79
+ focalX?: number | null;
80
+ focalY?: number | null;
81
+ }
82
+ /**
83
+ * This interface was referenced by `Config`'s JSON-Schema
84
+ * via the `definition` "payload-preferences".
85
+ */
86
+ export interface PayloadPreference {
87
+ id: string;
88
+ user: {
89
+ relationTo: 'users';
90
+ value: string | User;
91
+ };
92
+ key?: string | null;
93
+ value?:
94
+ | {
95
+ [k: string]: unknown;
96
+ }
97
+ | unknown[]
98
+ | string
99
+ | number
100
+ | boolean
101
+ | null;
102
+ updatedAt: string;
103
+ createdAt: string;
104
+ }
105
+ /**
106
+ * This interface was referenced by `Config`'s JSON-Schema
107
+ * via the `definition` "payload-migrations".
108
+ */
109
+ export interface PayloadMigration {
110
+ id: string;
111
+ name?: string | null;
112
+ batch?: number | null;
113
+ updatedAt: string;
114
+ createdAt: string;
115
+ }
116
+ /**
117
+ * This interface was referenced by `Config`'s JSON-Schema
118
+ * via the `definition` "auth".
119
+ */
120
+ export interface Auth {
121
+ [k: string]: unknown;
122
+ }
123
+
124
+
125
+ declare module 'payload' {
126
+ export interface GeneratedTypes extends Config {}
127
+ }
@@ -2,7 +2,7 @@
2
2
  import { mongooseAdapter } from '@payloadcms/db-mongodb' // database-adapter-import
3
3
  import { lexicalEditor } from '@payloadcms/richtext-lexical'
4
4
  import path from 'path'
5
- import { buildConfig } from 'payload/config'
5
+ import { buildConfig } from 'payload'
6
6
  import { fileURLToPath } from 'url'
7
7
  import sharp from 'sharp'
8
8
 
@@ -15,6 +15,9 @@ const dirname = path.dirname(filename)
15
15
  export default buildConfig({
16
16
  admin: {
17
17
  user: Users.slug,
18
+ importMap: {
19
+ baseDir: path.resolve(dirname),
20
+ },
18
21
  },
19
22
  collections: [Users, Media],
20
23
  editor: lexicalEditor(),
package/dist/types.d.ts CHANGED
@@ -15,6 +15,7 @@ export interface Args extends arg.Spec {
15
15
  '--secret': StringConstructor;
16
16
  '--template': StringConstructor;
17
17
  '--template-branch': StringConstructor;
18
+ '--use-bun': BooleanConstructor;
18
19
  '--use-npm': BooleanConstructor;
19
20
  '--use-pnpm': BooleanConstructor;
20
21
  '--use-yarn': BooleanConstructor;
@@ -46,7 +47,7 @@ interface Template {
46
47
  type: ProjectTemplate['type'];
47
48
  }
48
49
  export type PackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn';
49
- export type DbType = 'mongodb' | 'postgres';
50
+ export type DbType = 'mongodb' | 'postgres' | 'sqlite' | 'vercel-postgres';
50
51
  export type DbDetails = {
51
52
  dbUri: string;
52
53
  type: DbType;
@@ -56,11 +57,13 @@ export type NextAppDetails = {
56
57
  hasTopLevelLayout: boolean;
57
58
  isPayloadInstalled?: boolean;
58
59
  isSrcDir: boolean;
60
+ isSupportedNextVersion: boolean;
59
61
  nextAppDir?: string;
60
62
  nextConfigPath?: string;
61
63
  nextConfigType?: NextConfigType;
64
+ nextVersion: null | string;
62
65
  };
63
- export type NextConfigType = 'cjs' | 'esm';
66
+ export type NextConfigType = 'cjs' | 'esm' | 'ts';
64
67
  export type StorageAdapterType = 'localDisk' | 'payloadCloud' | 'vercelBlobStorage';
65
68
  export {};
66
69
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"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A;AAE5C,MAAM,MAAM,cAAc,GAAG;IAC3B,iBAAiB,EAAE,OAAO,CAAA;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,QAAQ,EAAE,OAAO,CAAA;IACjB,sBAAsB,EAAE,OAAO,CAAA;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,WAAW,EAAE,IAAI,GAAG,MAAM,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,CAAA;AAEjD,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,cAAc,GAAG,mBAAmB,CAAA"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type arg from 'arg'\n\nexport interface Args extends arg.Spec {\n '--beta': BooleanConstructor\n '--db': StringConstructor\n '--db-accept-recommended': BooleanConstructor\n '--db-connection-string': StringConstructor\n '--debug': BooleanConstructor\n '--dry-run': BooleanConstructor\n '--help': BooleanConstructor\n '--init-next': BooleanConstructor\n '--local-template': StringConstructor\n '--name': StringConstructor\n '--no-deps': BooleanConstructor\n '--no-git': BooleanConstructor\n '--secret': StringConstructor\n '--template': StringConstructor\n '--template-branch': StringConstructor\n '--use-npm': BooleanConstructor\n '--use-pnpm': BooleanConstructor\n '--use-yarn': BooleanConstructor\n\n // Aliases\n\n '-h': string\n '-n': string\n '-t': string\n}\n\nexport type CliArgs = arg.Result<Args>\n\nexport type ProjectTemplate = GitTemplate | PluginTemplate\n\n/**\n * Template that is cloned verbatim from a git repo\n * Performs .env manipulation based upon input\n */\nexport interface GitTemplate extends Template {\n type: 'starter'\n url: string\n}\n\n/**\n * Type specifically for the plugin template\n * No .env manipulation is done\n */\nexport interface PluginTemplate extends Template {\n type: 'plugin'\n url: string\n}\n\ninterface Template {\n description?: string\n name: string\n type: ProjectTemplate['type']\n}\n\nexport type PackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn'\n\nexport type DbType = 'mongodb' | 'postgres'\n\nexport type DbDetails = {\n dbUri: string\n type: DbType\n}\n\nexport type EditorType = 'lexical' | 'slate'\n\nexport type NextAppDetails = {\n hasTopLevelLayout: boolean\n isPayloadInstalled?: boolean\n isSrcDir: boolean\n nextAppDir?: string\n nextConfigPath?: string\n nextConfigType?: NextConfigType\n}\n\nexport type NextConfigType = 'cjs' | 'esm'\n\nexport type StorageAdapterType = 'localDisk' | 'payloadCloud' | 'vercelBlobStorage'\n"],"names":[],"rangeMappings":"","mappings":"AA+EA,WAAmF"}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type arg from 'arg'\n\nexport interface Args extends arg.Spec {\n '--beta': BooleanConstructor\n '--db': StringConstructor\n '--db-accept-recommended': BooleanConstructor\n '--db-connection-string': StringConstructor\n '--debug': BooleanConstructor\n '--dry-run': BooleanConstructor\n '--help': BooleanConstructor\n '--init-next': BooleanConstructor\n '--local-template': StringConstructor\n '--name': StringConstructor\n '--no-deps': BooleanConstructor\n '--no-git': BooleanConstructor\n '--secret': StringConstructor\n '--template': StringConstructor\n '--template-branch': StringConstructor\n '--use-bun': BooleanConstructor\n '--use-npm': BooleanConstructor\n '--use-pnpm': BooleanConstructor\n '--use-yarn': BooleanConstructor\n\n // Aliases\n\n '-h': string\n '-n': string\n '-t': string\n}\n\nexport type CliArgs = arg.Result<Args>\n\nexport type ProjectTemplate = GitTemplate | PluginTemplate\n\n/**\n * Template that is cloned verbatim from a git repo\n * Performs .env manipulation based upon input\n */\nexport interface GitTemplate extends Template {\n type: 'starter'\n url: string\n}\n\n/**\n * Type specifically for the plugin template\n * No .env manipulation is done\n */\nexport interface PluginTemplate extends Template {\n type: 'plugin'\n url: string\n}\n\ninterface Template {\n description?: string\n name: string\n type: ProjectTemplate['type']\n}\n\nexport type PackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn'\n\nexport type DbType = 'mongodb' | 'postgres' | 'sqlite' | 'vercel-postgres'\n\nexport type DbDetails = {\n dbUri: string\n type: DbType\n}\n\nexport type EditorType = 'lexical' | 'slate'\n\nexport type NextAppDetails = {\n hasTopLevelLayout: boolean\n isPayloadInstalled?: boolean\n isSrcDir: boolean\n isSupportedNextVersion: boolean\n nextAppDir?: string\n nextConfigPath?: string\n nextConfigType?: NextConfigType\n nextVersion: null | string\n}\n\nexport type NextConfigType = 'cjs' | 'esm' | 'ts'\n\nexport type StorageAdapterType = 'localDisk' | 'payloadCloud' | 'vercelBlobStorage'\n"],"names":[],"mappings":"AAkFA,WAAmF"}
@@ -3,5 +3,5 @@
3
3
  *
4
4
  * @internal
5
5
  */
6
- export declare function copyRecursiveSync(src: string, dest: string, debug?: boolean): void;
6
+ export declare function copyRecursiveSync(src: string, dest: string): void;
7
7
  //# sourceMappingURL=copy-recursive-sync.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"copy-recursive-sync.d.ts","sourceRoot":"","sources":["../../src/utils/copy-recursive-sync.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,QAY3E"}
1
+ {"version":3,"file":"copy-recursive-sync.d.ts","sourceRoot":"","sources":["../../src/utils/copy-recursive-sync.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAY1D"}
@@ -4,7 +4,7 @@ import path from 'path';
4
4
  * Recursively copy files from src to dest
5
5
  *
6
6
  * @internal
7
- */ export function copyRecursiveSync(src, dest, debug) {
7
+ */ export function copyRecursiveSync(src, dest) {
8
8
  const exists = fs.existsSync(src);
9
9
  const stats = exists && fs.statSync(src);
10
10
  const isDirectory = exists && stats !== false && stats.isDirectory();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/copy-recursive-sync.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\n\n/**\n * Recursively copy files from src to dest\n *\n * @internal\n */\nexport function copyRecursiveSync(src: string, dest: string, debug?: boolean) {\n const exists = fs.existsSync(src)\n const stats = exists && fs.statSync(src)\n const isDirectory = exists && stats !== false && stats.isDirectory()\n if (isDirectory) {\n fs.mkdirSync(dest, { recursive: true })\n fs.readdirSync(src).forEach((childItemName) => {\n copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName))\n })\n } else {\n fs.copyFileSync(src, dest)\n }\n}\n"],"names":["fs","path","copyRecursiveSync","src","dest","debug","exists","existsSync","stats","statSync","isDirectory","mkdirSync","recursive","readdirSync","forEach","childItemName","join","copyFileSync"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AAEvB;;;;CAIC,GACD,OAAO,SAASC,kBAAkBC,GAAW,EAAEC,IAAY,EAAEC,KAAe;IAC1E,MAAMC,SAASN,GAAGO,UAAU,CAACJ;IAC7B,MAAMK,QAAQF,UAAUN,GAAGS,QAAQ,CAACN;IACpC,MAAMO,cAAcJ,UAAUE,UAAU,SAASA,MAAME,WAAW;IAClE,IAAIA,aAAa;QACfV,GAAGW,SAAS,CAACP,MAAM;YAAEQ,WAAW;QAAK;QACrCZ,GAAGa,WAAW,CAACV,KAAKW,OAAO,CAAC,CAACC;YAC3Bb,kBAAkBD,KAAKe,IAAI,CAACb,KAAKY,gBAAgBd,KAAKe,IAAI,CAACZ,MAAMW;QACnE;IACF,OAAO;QACLf,GAAGiB,YAAY,CAACd,KAAKC;IACvB;AACF"}
1
+ {"version":3,"sources":["../../src/utils/copy-recursive-sync.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\n\n/**\n * Recursively copy files from src to dest\n *\n * @internal\n */\nexport function copyRecursiveSync(src: string, dest: string) {\n const exists = fs.existsSync(src)\n const stats = exists && fs.statSync(src)\n const isDirectory = exists && stats !== false && stats.isDirectory()\n if (isDirectory) {\n fs.mkdirSync(dest, { recursive: true })\n fs.readdirSync(src).forEach((childItemName) => {\n copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName))\n })\n } else {\n fs.copyFileSync(src, dest)\n }\n}\n"],"names":["fs","path","copyRecursiveSync","src","dest","exists","existsSync","stats","statSync","isDirectory","mkdirSync","recursive","readdirSync","forEach","childItemName","join","copyFileSync"],"mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AAEvB;;;;CAIC,GACD,OAAO,SAASC,kBAAkBC,GAAW,EAAEC,IAAY;IACzD,MAAMC,SAASL,GAAGM,UAAU,CAACH;IAC7B,MAAMI,QAAQF,UAAUL,GAAGQ,QAAQ,CAACL;IACpC,MAAMM,cAAcJ,UAAUE,UAAU,SAASA,MAAME,WAAW;IAClE,IAAIA,aAAa;QACfT,GAAGU,SAAS,CAACN,MAAM;YAAEO,WAAW;QAAK;QACrCX,GAAGY,WAAW,CAACT,KAAKU,OAAO,CAAC,CAACC;YAC3BZ,kBAAkBD,KAAKc,IAAI,CAACZ,KAAKW,gBAAgBb,KAAKc,IAAI,CAACX,MAAMU;QACnE;IACF,OAAO;QACLd,GAAGgB,YAAY,CAACb,KAAKC;IACvB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/git.ts"],"sourcesContent":["import type { ExecSyncOptions } from 'child_process'\n\nimport { execSync } from 'child_process'\n\nimport { warning } from './log.js'\n\nexport function tryInitRepoAndCommit(args: { cwd: string }): void {\n const execOpts: ExecSyncOptions = { cwd: args.cwd, stdio: 'ignore' }\n try {\n // Check if git is available\n execSync('git -v', execOpts)\n\n // Do nothing if already in a git repo\n if (isGitRepo(execOpts)) {\n return\n }\n\n // Initialize\n execSync('git init', execOpts)\n if (!ensureHasDefaultBranch(execOpts)) {\n execSync('git checkout -b main', execOpts)\n }\n\n // Add and commit files\n execSync('git add -A', execOpts)\n execSync('git commit -m \"feat: initial commit\"', execOpts)\n } catch (_) {\n warning('Failed to initialize git repository.')\n }\n}\n\nfunction isGitRepo(opts: ExecSyncOptions): boolean {\n try {\n execSync('git rev-parse --is-inside-work-tree', opts)\n return true\n } catch (_) {\n // Ignore errors\n }\n return false\n}\n\nfunction ensureHasDefaultBranch(opts: ExecSyncOptions): boolean {\n try {\n execSync(`git config init.defaultBranch`, opts)\n return true\n } catch (_) {\n // Ignore errros\n }\n return false\n}\n"],"names":["execSync","warning","tryInitRepoAndCommit","args","execOpts","cwd","stdio","isGitRepo","ensureHasDefaultBranch","_","opts"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,QAAQ,QAAQ,gBAAe;AAExC,SAASC,OAAO,QAAQ,WAAU;AAElC,OAAO,SAASC,qBAAqBC,IAAqB;IACxD,MAAMC,WAA4B;QAAEC,KAAKF,KAAKE,GAAG;QAAEC,OAAO;IAAS;IACnE,IAAI;QACF,4BAA4B;QAC5BN,SAAS,UAAUI;QAEnB,sCAAsC;QACtC,IAAIG,UAAUH,WAAW;YACvB;QACF;QAEA,aAAa;QACbJ,SAAS,YAAYI;QACrB,IAAI,CAACI,uBAAuBJ,WAAW;YACrCJ,SAAS,wBAAwBI;QACnC;QAEA,uBAAuB;QACvBJ,SAAS,cAAcI;QACvBJ,SAAS,wCAAwCI;IACnD,EAAE,OAAOK,GAAG;QACVR,QAAQ;IACV;AACF;AAEA,SAASM,UAAUG,IAAqB;IACtC,IAAI;QACFV,SAAS,uCAAuCU;QAChD,OAAO;IACT,EAAE,OAAOD,GAAG;IACV,gBAAgB;IAClB;IACA,OAAO;AACT;AAEA,SAASD,uBAAuBE,IAAqB;IACnD,IAAI;QACFV,SAAS,CAAC,6BAA6B,CAAC,EAAEU;QAC1C,OAAO;IACT,EAAE,OAAOD,GAAG;IACV,gBAAgB;IAClB;IACA,OAAO;AACT"}
1
+ {"version":3,"sources":["../../src/utils/git.ts"],"sourcesContent":["import type { ExecSyncOptions } from 'child_process'\n\nimport { execSync } from 'child_process'\n\nimport { warning } from './log.js'\n\nexport function tryInitRepoAndCommit(args: { cwd: string }): void {\n const execOpts: ExecSyncOptions = { cwd: args.cwd, stdio: 'ignore' }\n try {\n // Check if git is available\n execSync('git -v', execOpts)\n\n // Do nothing if already in a git repo\n if (isGitRepo(execOpts)) {\n return\n }\n\n // Initialize\n execSync('git init', execOpts)\n if (!ensureHasDefaultBranch(execOpts)) {\n execSync('git checkout -b main', execOpts)\n }\n\n // Add and commit files\n execSync('git add -A', execOpts)\n execSync('git commit -m \"feat: initial commit\"', execOpts)\n } catch (_) {\n warning('Failed to initialize git repository.')\n }\n}\n\nfunction isGitRepo(opts: ExecSyncOptions): boolean {\n try {\n execSync('git rev-parse --is-inside-work-tree', opts)\n return true\n } catch (_) {\n // Ignore errors\n }\n return false\n}\n\nfunction ensureHasDefaultBranch(opts: ExecSyncOptions): boolean {\n try {\n execSync(`git config init.defaultBranch`, opts)\n return true\n } catch (_) {\n // Ignore errros\n }\n return false\n}\n"],"names":["execSync","warning","tryInitRepoAndCommit","args","execOpts","cwd","stdio","isGitRepo","ensureHasDefaultBranch","_","opts"],"mappings":"AAEA,SAASA,QAAQ,QAAQ,gBAAe;AAExC,SAASC,OAAO,QAAQ,WAAU;AAElC,OAAO,SAASC,qBAAqBC,IAAqB;IACxD,MAAMC,WAA4B;QAAEC,KAAKF,KAAKE,GAAG;QAAEC,OAAO;IAAS;IACnE,IAAI;QACF,4BAA4B;QAC5BN,SAAS,UAAUI;QAEnB,sCAAsC;QACtC,IAAIG,UAAUH,WAAW;YACvB;QACF;QAEA,aAAa;QACbJ,SAAS,YAAYI;QACrB,IAAI,CAACI,uBAAuBJ,WAAW;YACrCJ,SAAS,wBAAwBI;QACnC;QAEA,uBAAuB;QACvBJ,SAAS,cAAcI;QACvBJ,SAAS,wCAAwCI;IACnD,EAAE,OAAOK,GAAG;QACVR,QAAQ;IACV;AACF;AAEA,SAASM,UAAUG,IAAqB;IACtC,IAAI;QACFV,SAAS,uCAAuCU;QAChD,OAAO;IACT,EAAE,OAAOD,GAAG;IACV,gBAAgB;IAClB;IACA,OAAO;AACT;AAEA,SAASD,uBAAuBE,IAAqB;IACnD,IAAI;QACFV,SAAS,CAAC,6BAA6B,CAAC,EAAEU;QAC1C,OAAO;IACT,EAAE,OAAOD,GAAG;IACV,gBAAgB;IAClB;IACA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/utils/log.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO,YAAa,MAAM,KAAG,IAEzC,CAAA;AAED,eAAO,MAAM,IAAI,YAAa,MAAM,KAAG,IAEtC,CAAA;AAED,eAAO,MAAM,KAAK,YAAa,MAAM,KAAG,IAEvC,CAAA;AAED,eAAO,MAAM,KAAK,YAAa,MAAM,KAAG,IAEvC,CAAA;AAED,eAAO,MAAM,GAAG,YAAa,MAAM,KAAG,IAErC,CAAA"}
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/utils/log.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,YAAa,MAAM,KAAG,IAEzC,CAAA;AAED,eAAO,MAAM,IAAI,YAAa,MAAM,KAAG,IAEtC,CAAA;AAED,eAAO,MAAM,KAAK,YAAa,MAAM,KAAG,IAEvC,CAAA;AAED,eAAO,MAAM,KAAK,YAAa,MAAM,KAAG,IAEvC,CAAA;AAED,eAAO,MAAM,GAAG,YAAa,MAAM,KAAG,IAErC,CAAA"}
package/dist/utils/log.js CHANGED
@@ -1,4 +1,4 @@
1
- /* eslint-disable no-console */ import * as p from '@clack/prompts';
1
+ import * as p from '@clack/prompts';
2
2
  import chalk from 'chalk';
3
3
  export const warning = (message)=>{
4
4
  p.log.warn(chalk.yellow('? ') + chalk.bold(message));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/log.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport * as p from '@clack/prompts'\nimport chalk from 'chalk'\n\nexport const warning = (message: string): void => {\n p.log.warn(chalk.yellow('? ') + chalk.bold(message))\n}\n\nexport const info = (message: string): void => {\n p.log.step(chalk.bold(message))\n}\n\nexport const error = (message: string): void => {\n p.log.error(chalk.bold(message))\n}\n\nexport const debug = (message: string): void => {\n p.log.step(`${chalk.bgGray('[DEBUG]')} ${chalk.gray(message)}`)\n}\n\nexport const log = (message: string): void => {\n p.log.message(message)\n}\n"],"names":["p","chalk","warning","message","log","warn","yellow","bold","info","step","error","debug","bgGray","gray"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":"AAAA,6BAA6B,GAC7B,YAAYA,OAAO,iBAAgB;AACnC,OAAOC,WAAW,QAAO;AAEzB,OAAO,MAAMC,UAAU,CAACC;IACtBH,EAAEI,GAAG,CAACC,IAAI,CAACJ,MAAMK,MAAM,CAAC,QAAQL,MAAMM,IAAI,CAACJ;AAC7C,EAAC;AAED,OAAO,MAAMK,OAAO,CAACL;IACnBH,EAAEI,GAAG,CAACK,IAAI,CAACR,MAAMM,IAAI,CAACJ;AACxB,EAAC;AAED,OAAO,MAAMO,QAAQ,CAACP;IACpBH,EAAEI,GAAG,CAACM,KAAK,CAACT,MAAMM,IAAI,CAACJ;AACzB,EAAC;AAED,OAAO,MAAMQ,QAAQ,CAACR;IACpBH,EAAEI,GAAG,CAACK,IAAI,CAAC,CAAC,EAAER,MAAMW,MAAM,CAAC,WAAW,CAAC,EAAEX,MAAMY,IAAI,CAACV,SAAS,CAAC;AAChE,EAAC;AAED,OAAO,MAAMC,MAAM,CAACD;IAClBH,EAAEI,GAAG,CAACD,OAAO,CAACA;AAChB,EAAC"}
1
+ {"version":3,"sources":["../../src/utils/log.ts"],"sourcesContent":["import * as p from '@clack/prompts'\nimport chalk from 'chalk'\n\nexport const warning = (message: string): void => {\n p.log.warn(chalk.yellow('? ') + chalk.bold(message))\n}\n\nexport const info = (message: string): void => {\n p.log.step(chalk.bold(message))\n}\n\nexport const error = (message: string): void => {\n p.log.error(chalk.bold(message))\n}\n\nexport const debug = (message: string): void => {\n p.log.step(`${chalk.bgGray('[DEBUG]')} ${chalk.gray(message)}`)\n}\n\nexport const log = (message: string): void => {\n p.log.message(message)\n}\n"],"names":["p","chalk","warning","message","log","warn","yellow","bold","info","step","error","debug","bgGray","gray"],"mappings":"AAAA,YAAYA,OAAO,iBAAgB;AACnC,OAAOC,WAAW,QAAO;AAEzB,OAAO,MAAMC,UAAU,CAACC;IACtBH,EAAEI,GAAG,CAACC,IAAI,CAACJ,MAAMK,MAAM,CAAC,QAAQL,MAAMM,IAAI,CAACJ;AAC7C,EAAC;AAED,OAAO,MAAMK,OAAO,CAACL;IACnBH,EAAEI,GAAG,CAACK,IAAI,CAACR,MAAMM,IAAI,CAACJ;AACxB,EAAC;AAED,OAAO,MAAMO,QAAQ,CAACP;IACpBH,EAAEI,GAAG,CAACM,KAAK,CAACT,MAAMM,IAAI,CAACJ;AACzB,EAAC;AAED,OAAO,MAAMQ,QAAQ,CAACR;IACpBH,EAAEI,GAAG,CAACK,IAAI,CAAC,CAAC,EAAER,MAAMW,MAAM,CAAC,WAAW,CAAC,EAAEX,MAAMY,IAAI,CAACV,SAAS,CAAC;AAChE,EAAC;AAED,OAAO,MAAMC,MAAM,CAACD;IAClBH,EAAEI,GAAG,CAACD,OAAO,CAACA;AAChB,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/utils/messages.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAmB,MAAM,aAAa,CAAA;AAMlE,eAAO,MAAM,cAAc,QAE1B,CAAA;AAID,wBAAgB,WAAW,IAAI,IAAI,CA4BlC;AAQD,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,GAAG,MAAM,CAsBzF;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAO3C;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAgBpF;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/utils/messages.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAmB,MAAM,aAAa,CAAA;AAMlE,eAAO,MAAM,cAAc,QAE1B,CAAA;AAID,wBAAgB,WAAW,IAAI,IAAI,CA6BlC;AAQD,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,GAAG,MAAM,CAsBzF;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAO3C;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAgBpF;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
@@ -32,6 +32,7 @@ export function helpMessage() {
32
32
  --use-npm Use npm to install dependencies
33
33
  --use-yarn Use yarn to install dependencies
34
34
  --use-pnpm Use pnpm to install dependencies
35
+ --use-bun Use bun to install dependencies (experimental)
35
36
  --no-deps Do not install any dependencies
36
37
  -h Show help
37
38
  `);