Merge Branch create-util #19

Merged
Adammatthiesen merged 62 commits from create-util into main 2024-01-28 09:42:14 +00:00
3 changed files with 35 additions and 18 deletions
Showing only changes of commit a2b10b3f5a - Show all commits

View File

@ -1,6 +1,6 @@
{ {
"name": "@matthiesenxyz/create-astro-ghostcms", "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", "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

@ -79,7 +79,7 @@ export async function main() {
// 3. Call template functions // 3. Call template functions
switch (template) { switch (template) {
case "basic": case "basic":
await createBasic(ctx).catch(console.error).then(success); await createBasic(ctx).catch(console.error);
break; break;
default: default:
throw new Error(`Unknown template: ${template}`); 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'))}`)); 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() { function getHelp() {
return `Need Help? Check the Docs! ${color.underline(color.cyan('https://astro-ghostcms.xyz/docs'))}`; 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 path from "node:path";
import fse from "fs-extra"; import fse from "fs-extra";
import c from 'picocolors';
import { execa } from "execa"; import { execa } from "execa";
import * as prompts from "@clack/prompts"; import * as prompts from "@clack/prompts";
import { exitPrompt, getModulePaths, isPathname, import { exitPrompt, getModulePaths, isPathname,
@ -37,16 +38,24 @@ export async function createBasic(ctx) {
}); });
} }
spinner.stop(`New Astro-GhostCMS project '${project.name}' created 🚀`); spinner.stop(`New Astro-GhostCMS project '${project.name}' created 🚀`);
const fCheck = await prompts.group({ const fCheck = await prompts.group(
initGitRepo: () => prompts.confirm({ { initGitRepo: () =>
message: "Initialize a Git repository?", prompts.confirm({
initialValue: false, message: "Initialize a Git repository?",
initialValue: false,
}), }),
installDeps: () => prompts.confirm({ installDeps: () =>
message: "Install dependencies? (Recommended)", prompts.confirm({
initialValue: false, message: "Install dependencies? (Recommended)",
}) initialValue: false,
}); }),
},
{ onCancel: () => {
prompts.cancel(c.red('Operation Cancelled!'));
process.exit(0);
}
}
);
initGitRepo = initGitRepo ?? fCheck.initGitRepo; initGitRepo = initGitRepo ?? fCheck.initGitRepo;
// 3. Initialize git repo // 3. Initialize git repo
@ -72,8 +81,23 @@ export async function createBasic(ctx) {
await installDependencies(pm, { cwd }); await installDependencies(pm, { cwd });
} }
spinner.stop(`Dependencies installed with ${pm}`); spinner.stop(`Dependencies installed with ${pm}`);
success()
} else { } else {
prompts.log.info("Skipped dependency installation"); 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!"));
} }
} }