create-payload-app 3.0.0-alpha.55 → 3.0.0-alpha.60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. package/bin/cli.js +3 -1
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +10 -9
  5. package/dist/index.js.map +1 -1
  6. package/dist/lib/configure-payload-config.js +12 -27
  7. package/dist/lib/configure-payload-config.js.map +1 -1
  8. package/dist/lib/create-project.js +32 -96
  9. package/dist/lib/create-project.js.map +1 -1
  10. package/dist/lib/create-project.spec.js +24 -33
  11. package/dist/lib/create-project.spec.js.map +1 -1
  12. package/dist/lib/generate-secret.js +3 -13
  13. package/dist/lib/generate-secret.js.map +1 -1
  14. package/dist/lib/init-next.js +40 -104
  15. package/dist/lib/init-next.js.map +1 -1
  16. package/dist/lib/packages.js +1 -11
  17. package/dist/lib/packages.js.map +1 -1
  18. package/dist/lib/parse-project-name.js +8 -64
  19. package/dist/lib/parse-project-name.js.map +1 -1
  20. package/dist/lib/parse-template.js +4 -55
  21. package/dist/lib/parse-template.js.map +1 -1
  22. package/dist/lib/select-db.js +8 -64
  23. package/dist/lib/select-db.js.map +1 -1
  24. package/dist/lib/templates.js +5 -23
  25. package/dist/lib/templates.js.map +1 -1
  26. package/dist/lib/wrap-next-config.js +18 -41
  27. package/dist/lib/wrap-next-config.js.map +1 -1
  28. package/dist/lib/wrap-next-config.spec.js +10 -55
  29. package/dist/lib/wrap-next-config.spec.js.map +1 -1
  30. package/dist/lib/write-env-file.js +11 -26
  31. package/dist/lib/write-env-file.js.map +1 -1
  32. package/dist/main.js +60 -115
  33. package/dist/main.js.map +1 -1
  34. package/dist/scripts/pack-template-files.js +15 -24
  35. package/dist/scripts/pack-template-files.js.map +1 -1
  36. package/dist/types.js +1 -4
  37. package/dist/types.js.map +1 -1
  38. package/dist/utils/copy-recursive-sync.js +11 -24
  39. package/dist/utils/copy-recursive-sync.js.map +1 -1
  40. package/dist/utils/log.js +12 -85
  41. package/dist/utils/log.js.map +1 -1
  42. package/dist/utils/messages.js +20 -55
  43. package/dist/utils/messages.js.map +1 -1
  44. package/package.json +2 -2
@@ -1,50 +1,15 @@
1
- /* eslint-disable no-console */ "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- feedbackOutro: function() {
13
- return feedbackOutro;
14
- },
15
- helpMessage: function() {
16
- return helpMessage;
17
- },
18
- moveMessage: function() {
19
- return moveMessage;
20
- },
21
- successMessage: function() {
22
- return successMessage;
23
- },
24
- successfulNextInit: function() {
25
- return successfulNextInit;
26
- },
27
- welcomeMessage: function() {
28
- return welcomeMessage;
29
- }
30
- });
31
- const _chalk = /*#__PURE__*/ _interop_require_default(require("chalk"));
32
- const _path = /*#__PURE__*/ _interop_require_default(require("path"));
33
- const _terminallink = /*#__PURE__*/ _interop_require_default(require("terminal-link"));
34
- const _templates = require("../lib/templates.js");
35
- function _interop_require_default(obj) {
36
- return obj && obj.__esModule ? obj : {
37
- default: obj
38
- };
39
- }
40
- const header = (message)=>_chalk.default.bold(message);
41
- const welcomeMessage = (0, _chalk.default)`
1
+ /* eslint-disable no-console */ import chalk from 'chalk';
2
+ import path from 'path';
3
+ import terminalLink from 'terminal-link';
4
+ import { getValidTemplates } from '../lib/templates.js';
5
+ const header = (message)=>chalk.bold(message);
6
+ export const welcomeMessage = chalk`
42
7
  {green Welcome to Payload. Let's create a project! }
43
8
  `;
44
9
  const spacer = ' '.repeat(8);
45
- function helpMessage() {
46
- const validTemplates = (0, _templates.getValidTemplates)();
47
- console.log((0, _chalk.default)`
10
+ export function helpMessage() {
11
+ const validTemplates = getValidTemplates();
12
+ console.log(chalk`
48
13
  {bold USAGE}
49
14
 
50
15
  {dim $} {bold npx create-payload-app}
@@ -68,13 +33,13 @@ function helpMessage() {
68
33
  function formatTemplates(templates) {
69
34
  return `\n\n${spacer}${templates.map((t)=>`${t.name}${' '.repeat(28 - t.name.length)}${t.description}`).join(`\n${spacer}`)}`;
70
35
  }
71
- function successMessage(projectDir, packageManager) {
72
- const relativePath = _path.default.relative(process.cwd(), projectDir);
36
+ export function successMessage(projectDir, packageManager) {
37
+ const relativePath = path.relative(process.cwd(), projectDir);
73
38
  return `
74
39
  ${header('Launch Application:')}
75
40
 
76
41
  - cd ./${relativePath}
77
- - ${packageManager === 'npm' ? 'npm run' : packageManager} dev or follow directions in ${createTerminalLink('README.md', `file://${_path.default.resolve(projectDir, 'README.md')}`)}
42
+ - ${packageManager === 'npm' ? 'npm run' : packageManager} dev or follow directions in ${createTerminalLink('README.md', `file://${path.resolve(projectDir, 'README.md')}`)}
78
43
 
79
44
  ${header('Documentation:')}
80
45
 
@@ -83,31 +48,31 @@ ${header('Documentation:')}
83
48
 
84
49
  `;
85
50
  }
86
- function successfulNextInit() {
51
+ export function successfulNextInit() {
87
52
  return `- ${createTerminalLink('Getting Started', 'https://payloadcms.com/docs/getting-started/what-is-payload')}
88
53
  - ${createTerminalLink('Configuration', 'https://payloadcms.com/docs/configuration/overview')}
89
54
  `;
90
55
  }
91
- function moveMessage(args) {
92
- const relativePath = _path.default.relative(process.cwd(), args.nextAppDir);
56
+ export function moveMessage(args) {
57
+ const relativePath = path.relative(process.cwd(), args.nextAppDir);
93
58
  return `
94
59
  ${header('Next Steps:')}
95
60
 
96
61
  Payload does not support a top-level layout.tsx file in the app directory.
97
62
 
98
- ${_chalk.default.bold('To continue:')}
63
+ ${chalk.bold('To continue:')}
99
64
 
100
- Move all files from ./${relativePath} to a named directory such as ./${relativePath}/${_chalk.default.bold('(app)')}
65
+ Move all files from ./${relativePath} to a named directory such as ./${relativePath}/${chalk.bold('(app)')}
101
66
 
102
67
  Once moved, rerun the create-payload-app command again.
103
68
  `;
104
69
  }
105
- function feedbackOutro() {
106
- return `${_chalk.default.bgCyan(_chalk.default.black(' Have feedback? '))} Visit us on ${createTerminalLink('GitHub', 'https://github.com/payloadcms/payload')}.`;
70
+ export function feedbackOutro() {
71
+ return `${chalk.bgCyan(chalk.black(' Have feedback? '))} Visit us on ${createTerminalLink('GitHub', 'https://github.com/payloadcms/payload')}.`;
107
72
  }
108
73
  // Create terminalLink with fallback for unsupported terminals
109
74
  function createTerminalLink(text, url) {
110
- return (0, _terminallink.default)(text, url, {
75
+ return terminalLink(text, url, {
111
76
  fallback: (text, url)=>`${text}: ${url}`
112
77
  });
113
78
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/messages.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport chalk from 'chalk'\nimport path from 'path'\nimport terminalLink from 'terminal-link'\n\nimport type { ProjectTemplate } from '../types.js'\nimport type { PackageManager } from '../types.js'\n\nimport { getValidTemplates } from '../lib/templates.js'\n\nconst header = (message: string): string => chalk.bold(message)\n\nexport const welcomeMessage = chalk`\n {green Welcome to Payload. Let's create a project! }\n`\n\nconst spacer = ' '.repeat(8)\n\nexport function helpMessage(): void {\n const validTemplates = getValidTemplates()\n console.log(chalk`\n {bold USAGE}\n\n {dim $} {bold npx create-payload-app}\n {dim $} {bold npx create-payload-app} my-project\n {dim $} {bold npx create-payload-app} -n my-project -t template-name\n\n {bold OPTIONS}\n\n -n {underline my-payload-app} Set project name\n -t {underline template_name} Choose specific template\n\n {dim Available templates: ${formatTemplates(validTemplates)}}\n\n --use-npm Use npm to install dependencies\n --use-yarn Use yarn to install dependencies\n --use-pnpm Use pnpm to install dependencies\n --no-deps Do not install any dependencies\n -h Show help\n`)\n}\n\nfunction formatTemplates(templates: ProjectTemplate[]) {\n return `\\n\\n${spacer}${templates\n .map((t) => `${t.name}${' '.repeat(28 - t.name.length)}${t.description}`)\n .join(`\\n${spacer}`)}`\n}\n\nexport function successMessage(projectDir: string, packageManager: PackageManager): string {\n const relativePath = path.relative(process.cwd(), projectDir)\n return `\n${header('Launch Application:')}\n\n - cd ./${relativePath}\n - ${\n packageManager === 'npm' ? 'npm run' : packageManager\n } dev or follow directions in ${createTerminalLink(\n 'README.md',\n `file://${path.resolve(projectDir, 'README.md')}`,\n )}\n\n${header('Documentation:')}\n\n - ${createTerminalLink(\n 'Getting Started',\n 'https://payloadcms.com/docs/getting-started/what-is-payload',\n )}\n - ${createTerminalLink('Configuration', 'https://payloadcms.com/docs/configuration/overview')}\n\n`\n}\n\nexport function successfulNextInit(): string {\n return `- ${createTerminalLink(\n 'Getting Started',\n 'https://payloadcms.com/docs/getting-started/what-is-payload',\n )}\n- ${createTerminalLink('Configuration', 'https://payloadcms.com/docs/configuration/overview')}\n`\n}\n\nexport function moveMessage(args: { nextAppDir: string; projectDir: string }): string {\n const relativePath = path.relative(process.cwd(), args.nextAppDir)\n return `\n${header('Next Steps:')}\n\nPayload does not support a top-level layout.tsx file in the app directory.\n\n${chalk.bold('To continue:')}\n\nMove all files from ./${relativePath} to a named directory such as ./${relativePath}/${chalk.bold('(app)')}\n\nOnce moved, rerun the create-payload-app command again.\n`\n}\n\nexport function feedbackOutro(): string {\n return `${chalk.bgCyan(chalk.black(' Have feedback? '))} Visit us on ${createTerminalLink('GitHub', 'https://github.com/payloadcms/payload')}.`\n}\n\n// Create terminalLink with fallback for unsupported terminals\nfunction createTerminalLink(text: string, url: string) {\n return terminalLink(text, url, {\n fallback: (text, url) => `${text}: ${url}`,\n })\n}\n"],"names":["feedbackOutro","helpMessage","moveMessage","successMessage","successfulNextInit","welcomeMessage","header","message","chalk","bold","spacer","repeat","validTemplates","getValidTemplates","console","log","formatTemplates","templates","map","t","name","length","description","join","projectDir","packageManager","relativePath","path","relative","process","cwd","createTerminalLink","resolve","args","nextAppDir","bgCyan","black","text","url","terminalLink","fallback"],"mappings":"AAAA,6BAA6B;;;;;;;;;;;IAgGbA,aAAa;eAAbA;;IA9EAC,WAAW;eAAXA;;IA+DAC,WAAW;eAAXA;;IAjCAC,cAAc;eAAdA;;IAwBAC,kBAAkB;eAAlBA;;IA5DHC,cAAc;eAAdA;;;8DAXK;6DACD;q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+B,IAAgD;IAC1E,MAAMP,eAAeC,aAAI,CAACC,QAAQ,CAACC,QAAQC,GAAG,IAAIG,KAAKC,UAAU;IACjE,OAAO,CAAC;AACV,EAAE5B,OAAO,eAAe;;;;AAIxB,EAAEE,cAAK,CAACC,IAAI,CAAC,gBAAgB;;sBAEP,EAAEiB,aAAa,gCAAgC,EAAEA,aAAa,CAAC,EAAElB,cAAK,CAACC,IAAI,CAAC,SAAS;;;AAG3G,CAAC;AACD;AAEO,SAAST;IACd,OAAO,CAAC,EAAEQ,cAAK,CAAC2B,MAAM,CAAC3B,cAAK,CAAC4B,KAAK,CAAC,qBAAqB,aAAa,EAAEL,mBAAmB,UAAU,yCAAyC,CAAC,CAAC;AACjJ;AAEA,8DAA8D;AAC9D,SAASA,mBAAmBM,IAAY,EAAEC,GAAW;IACnD,OAAOC,IAAAA,qBAAY,EAACF,MAAMC,KAAK;QAC7BE,UAAU,CAACH,MAAMC,MAAQ,CAAC,EAAED,KAAK,EAAE,EAAEC,IAAI,CAAC;IAC5C;AACF"}
1
+ {"version":3,"sources":["../../src/utils/messages.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport chalk from 'chalk'\nimport path from 'path'\nimport terminalLink from 'terminal-link'\n\nimport type { ProjectTemplate } from '../types.js'\nimport type { PackageManager } from '../types.js'\n\nimport { getValidTemplates } from '../lib/templates.js'\n\nconst header = (message: string): string => chalk.bold(message)\n\nexport const welcomeMessage = chalk`\n {green Welcome to Payload. Let's create a project! }\n`\n\nconst spacer = ' '.repeat(8)\n\nexport function helpMessage(): void {\n const validTemplates = getValidTemplates()\n console.log(chalk`\n {bold USAGE}\n\n {dim $} {bold npx create-payload-app}\n {dim $} {bold npx create-payload-app} my-project\n {dim $} {bold npx create-payload-app} -n my-project -t template-name\n\n {bold OPTIONS}\n\n -n {underline my-payload-app} Set project name\n -t {underline template_name} Choose specific template\n\n {dim Available templates: ${formatTemplates(validTemplates)}}\n\n --use-npm Use npm to install dependencies\n --use-yarn Use yarn to install dependencies\n --use-pnpm Use pnpm to install dependencies\n --no-deps Do not install any dependencies\n -h Show help\n`)\n}\n\nfunction formatTemplates(templates: ProjectTemplate[]) {\n return `\\n\\n${spacer}${templates\n .map((t) => `${t.name}${' '.repeat(28 - t.name.length)}${t.description}`)\n .join(`\\n${spacer}`)}`\n}\n\nexport function successMessage(projectDir: string, packageManager: PackageManager): string {\n const relativePath = path.relative(process.cwd(), projectDir)\n return `\n${header('Launch Application:')}\n\n - cd ./${relativePath}\n - ${\n packageManager === 'npm' ? 'npm run' : packageManager\n } dev or follow directions in ${createTerminalLink(\n 'README.md',\n `file://${path.resolve(projectDir, 'README.md')}`,\n )}\n\n${header('Documentation:')}\n\n - ${createTerminalLink(\n 'Getting Started',\n 'https://payloadcms.com/docs/getting-started/what-is-payload',\n )}\n - ${createTerminalLink('Configuration', 'https://payloadcms.com/docs/configuration/overview')}\n\n`\n}\n\nexport function successfulNextInit(): string {\n return `- ${createTerminalLink(\n 'Getting Started',\n 'https://payloadcms.com/docs/getting-started/what-is-payload',\n )}\n- ${createTerminalLink('Configuration', 'https://payloadcms.com/docs/configuration/overview')}\n`\n}\n\nexport function moveMessage(args: { nextAppDir: string; projectDir: string }): string {\n const relativePath = path.relative(process.cwd(), args.nextAppDir)\n return `\n${header('Next Steps:')}\n\nPayload does not support a top-level layout.tsx file in the app directory.\n\n${chalk.bold('To continue:')}\n\nMove all files from ./${relativePath} to a named directory such as ./${relativePath}/${chalk.bold('(app)')}\n\nOnce moved, rerun the create-payload-app command again.\n`\n}\n\nexport function feedbackOutro(): string {\n return `${chalk.bgCyan(chalk.black(' Have feedback? '))} Visit us on ${createTerminalLink('GitHub', 'https://github.com/payloadcms/payload')}.`\n}\n\n// Create terminalLink with fallback for unsupported terminals\nfunction createTerminalLink(text: string, url: string) {\n return terminalLink(text, url, {\n fallback: (text, url) => `${text}: ${url}`,\n })\n}\n"],"names":["chalk","path","terminalLink","getValidTemplates","header","message","bold","welcomeMessage","spacer","repeat","helpMessage","validTemplates","console","log","formatTemplates","templates","map","t","name","length","description","join","successMessage","projectDir","packageManager","relativePath","relative","process","cwd","createTerminalLink","resolve","successfulNextInit","moveMessage","args","nextAppDir","feedbackOutro","bgCyan","black","text","url","fallback"],"mappings":"AAAA,6BAA6B,GAC7B,OAAOA,WAAW,QAAO;AACzB,OAAOC,UAAU,OAAM;AACvB,OAAOC,kBAAkB,gBAAe;AAKxC,SAASC,iBAAiB,QAAQ,sBAAqB;AAEvD,MAAMC,SAAS,CAACC,UAA4BL,MAAMM,IAAI,CAACD;AAEvD,OAAO,MAAME,iBAAiBP,KAAK,CAAC;;AAEpC,CAAC,CAAA;AAED,MAAMQ,SAAS,IAAIC,MAAM,CAAC;AAE1B,OAAO,SAASC;IACd,MAAMC,iBAAiBR;IACvBS,QAAQC,GAAG,CAACb,KAAK,CAAC;;;;;;;;;;;;kCAYc,EAAEc,gBAAgBH,gBAAgB;;;;;;;AAOpE,CAAC;AACD;AAEA,SAASG,gBAAgBC,SAA4B;IACnD,OAAO,CAAC,IAAI,EAAEP,OAAO,EAAEO,UACpBC,GAAG,CAAC,CAACC,IAAM,CAAC,EAAEA,EAAEC,IAAI,CAAC,EAAE,IAAIT,MAAM,CAAC,KAAKQ,EAAEC,IAAI,CAACC,MAAM,EAAE,EAAEF,EAAEG,WAAW,CAAC,CAAC,EACvEC,IAAI,CAAC,CAAC,EAAE,EAAEb,OAAO,CAAC,EAAE,CAAC;AAC1B;AAEA,OAAO,SAASc,eAAeC,UAAkB,EAAEC,cAA8B;IAC/E,MAAMC,eAAexB,KAAKyB,QAAQ,CAACC,QAAQC,GAAG,IAAIL;IAClD,OAAO,CAAC;AACV,EAAEnB,OAAO,uBAAuB;;SAEvB,EAAEqB,aAAa;IACpB,EACAD,mBAAmB,QAAQ,YAAYA,eACxC,6BAA6B,EAAEK,mBAC9B,aACA,CAAC,OAAO,EAAE5B,KAAK6B,OAAO,CAACP,YAAY,aAAa,CAAC,EACjD;;AAEJ,EAAEnB,OAAO,kBAAkB;;IAEvB,EAAEyB,mBACF,mBACA,+DACA;IACA,EAAEA,mBAAmB,iBAAiB,sDAAsD;;AAEhG,CAAC;AACD;AAEA,OAAO,SAASE;IACd,OAAO,CAAC,EAAE,EAAEF,mBACV,mBACA,+DACA;EACF,EAAEA,mBAAmB,iBAAiB,sDAAsD;AAC9F,CAAC;AACD;AAEA,OAAO,SAASG,YAAYC,IAAgD;IAC1E,MAAMR,eAAexB,KAAKyB,QAAQ,CAACC,QAAQC,GAAG,IAAIK,KAAKC,UAAU;IACjE,OAAO,CAAC;AACV,EAAE9B,OAAO,eAAe;;;;AAIxB,EAAEJ,MAAMM,IAAI,CAAC,gBAAgB;;sBAEP,EAAEmB,aAAa,gCAAgC,EAAEA,aAAa,CAAC,EAAEzB,MAAMM,IAAI,CAAC,SAAS;;;AAG3G,CAAC;AACD;AAEA,OAAO,SAAS6B;IACd,OAAO,CAAC,EAAEnC,MAAMoC,MAAM,CAACpC,MAAMqC,KAAK,CAAC,qBAAqB,aAAa,EAAER,mBAAmB,UAAU,yCAAyC,CAAC,CAAC;AACjJ;AAEA,8DAA8D;AAC9D,SAASA,mBAAmBS,IAAY,EAAEC,GAAW;IACnD,OAAOrC,aAAaoC,MAAMC,KAAK;QAC7BC,UAAU,CAACF,MAAMC,MAAQ,CAAC,EAAED,KAAK,EAAE,EAAEC,IAAI,CAAC;IAC5C;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-payload-app",
3
- "version": "3.0.0-alpha.55",
3
+ "version": "3.0.0-alpha.60",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "homepage": "https://payloadcms.com",
@@ -39,7 +39,7 @@
39
39
  "@types/esprima": "^4.0.6",
40
40
  "@types/fs-extra": "^9.0.12",
41
41
  "@types/jest": "^27.0.3",
42
- "@types/node": "^16.6.2"
42
+ "@types/node": "20.12.5"
43
43
  },
44
44
  "exports": {
45
45
  "./commands": {