This commit is contained in:
Adam Matthiesen 2024-01-27 15:38:16 -08:00
parent ba763a4756
commit a2b10b3f5a
3 changed files with 35 additions and 18 deletions

View File

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

View File

@ -79,7 +79,7 @@ export async function main() {
// 3. Call template functions
switch (template) {
case "basic":
await createBasic(ctx).catch(console.error).then(success);
await createBasic(ctx).catch(console.error);
break;
default:
throw new Error(`Unknown template: ${template}`);
@ -89,13 +89,6 @@ export async function main() {
prompts.outro(color.reset(`Problems? ${color.underline(color.cyan('https://github.com/MatthiesenXYZ/astro-ghostcms/issues'))}`));
}
const nextSteps = `If you didnt opt to install Dependencies dont forget to run \n ${color.yellow('npm install')} / ${color.yellow('pnpm install')} / ${color.yellow('yarn install')} inside your project directory \n Dont forget to modify your .env file for YOUR ghost install!`
function success() {
prompts.note(nextSteps);
prompts.outro(color.green("Deployment Complete!"));
}
function getHelp() {
return `Need Help? Check the Docs! ${color.underline(color.cyan('https://astro-ghostcms.xyz/docs'))}`;
}

View File

@ -1,5 +1,6 @@
import path from "node:path";
import fse from "fs-extra";
import c from 'picocolors';
import { execa } from "execa";
import * as prompts from "@clack/prompts";
import { exitPrompt, getModulePaths, isPathname,
@ -37,16 +38,24 @@ export async function createBasic(ctx) {
});
}
spinner.stop(`New Astro-GhostCMS project '${project.name}' created 🚀`);
const fCheck = await prompts.group({
initGitRepo: () => prompts.confirm({
message: "Initialize a Git repository?",
initialValue: false,
const fCheck = await prompts.group(
{ initGitRepo: () =>
prompts.confirm({
message: "Initialize a Git repository?",
initialValue: false,
}),
installDeps: () => prompts.confirm({
message: "Install dependencies? (Recommended)",
initialValue: false,
})
});
installDeps: () =>
prompts.confirm({
message: "Install dependencies? (Recommended)",
initialValue: false,
}),
},
{ onCancel: () => {
prompts.cancel(c.red('Operation Cancelled!'));
process.exit(0);
}
}
);
initGitRepo = initGitRepo ?? fCheck.initGitRepo;
// 3. Initialize git repo
@ -72,8 +81,23 @@ export async function createBasic(ctx) {
await installDependencies(pm, { cwd });
}
spinner.stop(`Dependencies installed with ${pm}`);
success()
} else {
prompts.log.info("Skipped dependency installation");
success()
}
const { black, bgYellow, yellow, green } = c.createColors(true)
const i = yellow;
const nextSteps = `
If you didnt opt to install Dependencies dont forget to run: \n
${i('npm install')} / ${i('pnpm install')} / ${i('yarn install')} inside your project directory! \n
\n
${bgYellow+black("Dont forget to modify your .env file for YOUR ghost install!")} `
function success() {
prompts.note(nextSteps);
prompts.outro(green("Deployment Complete!"));
}
}