create-payload-app 3.0.0-alpha.59 → 3.0.0-alpha.61
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/cli.js +3 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -9
- package/dist/index.js.map +1 -1
- package/dist/lib/configure-payload-config.js +12 -27
- package/dist/lib/configure-payload-config.js.map +1 -1
- package/dist/lib/create-project.js +32 -96
- package/dist/lib/create-project.js.map +1 -1
- package/dist/lib/create-project.spec.js +24 -33
- package/dist/lib/create-project.spec.js.map +1 -1
- package/dist/lib/generate-secret.js +3 -13
- package/dist/lib/generate-secret.js.map +1 -1
- package/dist/lib/init-next.js +40 -104
- package/dist/lib/init-next.js.map +1 -1
- package/dist/lib/packages.js +1 -11
- package/dist/lib/packages.js.map +1 -1
- package/dist/lib/parse-project-name.js +8 -64
- package/dist/lib/parse-project-name.js.map +1 -1
- package/dist/lib/parse-template.js +4 -55
- package/dist/lib/parse-template.js.map +1 -1
- package/dist/lib/select-db.js +8 -64
- package/dist/lib/select-db.js.map +1 -1
- package/dist/lib/templates.js +5 -23
- package/dist/lib/templates.js.map +1 -1
- package/dist/lib/wrap-next-config.js +18 -41
- package/dist/lib/wrap-next-config.js.map +1 -1
- package/dist/lib/wrap-next-config.spec.js +10 -55
- package/dist/lib/wrap-next-config.spec.js.map +1 -1
- package/dist/lib/write-env-file.js +11 -26
- package/dist/lib/write-env-file.js.map +1 -1
- package/dist/main.js +60 -115
- package/dist/main.js.map +1 -1
- package/dist/scripts/pack-template-files.js +15 -24
- package/dist/scripts/pack-template-files.js.map +1 -1
- package/dist/types.js +1 -4
- package/dist/types.js.map +1 -1
- package/dist/utils/copy-recursive-sync.js +11 -24
- package/dist/utils/copy-recursive-sync.js.map +1 -1
- package/dist/utils/log.js +12 -85
- package/dist/utils/log.js.map +1 -1
- package/dist/utils/messages.js +20 -55
- package/dist/utils/messages.js.map +1 -1
- package/package.json +1 -1
package/dist/utils/messages.js
CHANGED
@@ -1,50 +1,15 @@
|
|
1
|
-
/* eslint-disable no-console */
|
2
|
-
|
3
|
-
|
4
|
-
}
|
5
|
-
|
6
|
-
|
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 =
|
47
|
-
console.log(
|
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 =
|
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://${
|
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 =
|
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
|
-
${
|
63
|
+
${chalk.bold('To continue:')}
|
99
64
|
|
100
|
-
Move all files from ./${relativePath} to a named directory such as ./${relativePath}/${
|
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 `${
|
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 (
|
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":["
|
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"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","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,EA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