This commit is contained in:
Adam Matthiesen 2024-01-27 19:48:47 -08:00
parent 3339065f27
commit aaf860cc73
2 changed files with 15 additions and 21 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@matthiesenxyz/create-astro-ghostcms", "name": "@matthiesenxyz/create-astro-ghostcms",
"version": "0.0.1-dev15", "version": "0.0.1-dev16",
"description": "Utility to quickly get started with our Integration and astro", "description": "Utility to quickly get started with our Integration and astro",
"type": "module", "type": "module",
"main": "./create-astro-ghostcms.mjs", "main": "./create-astro-ghostcms.mjs",

View File

@ -41,29 +41,23 @@ 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({
opts: ({results}) => { installDeps: () => p.confirm({
p.multiselect({ message: `${c.cyan('Install dependencies? (Recommended)')}`,
message: `${c.cyan('Select Additional Options')}`, initialValue: false,
options: [ }),
{ initGitRepo: () => p.confirm({
value: 'installDeps', message: `${c.cyan('Initialize a Git repository?')} ${c.italic(c.gray(`( Tip: If this option gets 'stuck' press the enter button a second time! )`))}`,
label: `${c.cyan('Install Dependencies?')}`, initialValue: false,
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. ')))}`,
value: 'initGitRepo', initialValue: true,
label: `${c.cyan('Initialize a Git repository?')}` }),
}
]
})
}
}, },
{ onCancel: () => { exitPrompt(); } }); { onCancel: () => { exitPrompt(); } });
const opts = await fCheck.results
if(fCheck.readyCheck){ if(fCheck.readyCheck){
initGitRepo = initGitRepo ?? opts.installGitRepo initGitRepo = initGitRepo ?? fCheck.initGitRepo;
// 3. Initialize git repo // 3. Initialize git repo
if (initGitRepo) { if (initGitRepo) {
if (dryRun) { if (dryRun) {
@ -79,7 +73,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 ?? opts.installDeps; installDeps = installDeps ?? fCheck.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}`)} `);