This commit is contained in:
Adam Matthiesen 2024-01-27 19:43:41 -08:00
parent ae12b7e1c6
commit 7be955ec6b
1 changed files with 20 additions and 14 deletions

View File

@ -41,23 +41,29 @@ export async function createBasic(ctx) {
} }
s.stop(`${c.green('New Astro-GhostCMS project')} '${project.name}' ${c.green('created')} 🚀`); s.stop(`${c.green('New Astro-GhostCMS project')} '${project.name}' ${c.green('created')} 🚀`);
const fCheck = await p.group({ const fCheck = await p.group({
installDeps: () => p.confirm({ opts: ({results}) => {
message: `${c.cyan('Install dependencies? (Recommended)')}`, p.multiselect({
initialValue: false, message: `${c.cyan('Select Additional Options')}`,
}), options: [
initGitRepo: () => p.confirm({ {
message: `${c.cyan('Initialize a Git repository?')} ${c.italic(c.gray(`( Tip: If this option gets 'stuck' press the enter button a second time! )`))}`, value: 'installDeps',
initialValue: false, label: `${c.cyan('Install Dependencies?')}`,
}), hint: `${c.cyan('recommended')}`
readyCheck: () => p.confirm({ },
message: `${c.bgYellow(c.black(c.bold(' CONFIRM: Press Enter Twice to continue or `Ctrl+C` to Cancel. ')))}`, {
initialValue: true, value: 'initGitRepo',
}), label: `${c.cyan('Initialize a Git repository?')}`
}
]
})
}
}, },
{ onCancel: () => { exitPrompt(); } }); { onCancel: () => { exitPrompt(); } });
const opts = await fCheck.results
if(fCheck.readyCheck){ if(fCheck.readyCheck){
initGitRepo = initGitRepo ?? fCheck.initGitRepo; initGitRepo = initGitRepo ?? opts.installGitRepo
// 3. Initialize git repo // 3. Initialize git repo
if (initGitRepo) { if (initGitRepo) {
if (dryRun) { if (dryRun) {
@ -73,7 +79,7 @@ export async function createBasic(ctx) {
const nextSteps = `If you didnt opt to install Dependencies dont forget to run: \n ${c.yellow('npm install')} / ${c.yellow('pnpm install')} / ${c.yellow('yarn install')} inside your project directory! \n \n ${c.bgYellow(c.black(c.bold(" Dont forget to modify your .env file for YOUR ghost install! ")))} ` const nextSteps = `If you didnt opt to install Dependencies dont forget to run: \n ${c.yellow('npm install')} / ${c.yellow('pnpm install')} / ${c.yellow('yarn install')} inside your project directory! \n \n ${c.bgYellow(c.black(c.bold(" Dont forget to modify your .env file for YOUR ghost install! ")))} `
// 4. Install dependencies // 4. Install dependencies
installDeps = installDeps ?? fCheck.installDeps; installDeps = installDeps ?? opts.installDeps;
const pm = ctx.pkgManager ?? "pnpm"; const pm = ctx.pkgManager ?? "pnpm";
if (installDeps) { if (installDeps) {
s.start(`${c.cyan(`Installing dependencies with ${pm}`)} `); s.start(`${c.cyan(`Installing dependencies with ${pm}`)} `);