Merge Branch create-util #19
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@matthiesenxyz/create-astro-ghostcms",
|
"name": "@matthiesenxyz/create-astro-ghostcms",
|
||||||
"version": "0.0.1-dev13",
|
"version": "0.0.1-dev14",
|
||||||
"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",
|
||||||
|
|
|
@ -41,54 +41,61 @@ 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: () =>
|
installDeps: () => p.confirm({
|
||||||
p.confirm({
|
message: `${c.cyan('Install dependencies? (Recommended)')}`,
|
||||||
message: `${c.cyan('Install dependencies? (Recommended)')}`,
|
initialValue: false,
|
||||||
initialValue: false,
|
|
||||||
}),
|
}),
|
||||||
initGitRepo: () =>
|
initGitRepo: () => p.confirm({
|
||||||
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! )`))}`,
|
||||||
message: `${c.cyan('Initialize a Git repository?')} ${c.italic(c.gray(`( Tip: If this option gets 'stuck' press the enter button a second time! )`))}`,
|
initialValue: false,
|
||||||
initialValue: false,
|
}),
|
||||||
})},
|
readyCheck: () => p.confirm({
|
||||||
{ onCancel: () => { exitPrompt(); } }
|
message: `${c.bgYellow(c.black(c.bold(' CONFIRM: Press Enter Twice to continue or `Ctrl+C` to Cancel. ')))}`,
|
||||||
);
|
initialValue: true,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
{ onCancel: () => { exitPrompt(); } });
|
||||||
|
|
||||||
initGitRepo = initGitRepo ?? fCheck.initGitRepo;
|
if(fCheck.readyCheck){
|
||||||
// 3. Initialize git repo
|
initGitRepo = initGitRepo ?? fCheck.initGitRepo;
|
||||||
if (initGitRepo) {
|
// 3. Initialize git repo
|
||||||
if (dryRun) {
|
if (initGitRepo) {
|
||||||
await wait(1);
|
if (dryRun) {
|
||||||
|
await wait(1);
|
||||||
|
} else {
|
||||||
|
await exec("git", ["init"], { cwd });
|
||||||
|
}
|
||||||
|
p.log.success(c.green("Initialized Git repository"));
|
||||||
} else {
|
} else {
|
||||||
await exec("git", ["init"], { cwd });
|
p.log.info(`${c.gray("Skipped Git initialization")}`);
|
||||||
}
|
}
|
||||||
p.log.success(c.green("Initialized Git repository"));
|
|
||||||
} else {
|
|
||||||
p.log.info(`${c.gray("Skipped Git initialization")}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
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! ")))} `
|
||||||
installDeps = installDeps ?? fCheck.installDeps;
|
|
||||||
const pm = ctx.pkgManager ?? "pnpm";
|
// 4. Install dependencies
|
||||||
if (installDeps) {
|
installDeps = installDeps ?? fCheck.installDeps;
|
||||||
s.start(`${c.cyan(`Installing dependencies with ${pm}`)} `);
|
const pm = ctx.pkgManager ?? "pnpm";
|
||||||
if (dryRun) {
|
if (installDeps) {
|
||||||
await wait(1);
|
s.start(`${c.cyan(`Installing dependencies with ${pm}`)} `);
|
||||||
|
if (dryRun) {
|
||||||
|
await wait(1);
|
||||||
|
} else {
|
||||||
|
await installDependencies(pm, { cwd });
|
||||||
|
}
|
||||||
|
s.stop(`${c.green(`Dependencies installed with ${pm}`)}`);
|
||||||
|
success()
|
||||||
} else {
|
} else {
|
||||||
await installDependencies(pm, { cwd });
|
p.log.info(`${c.gray('Skipped dependency installation')}`);
|
||||||
|
success()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function success() {
|
||||||
|
p.note(nextSteps);
|
||||||
|
p.outro(c.green("Deployment Complete!"));
|
||||||
}
|
}
|
||||||
s.stop(`${c.green(`Dependencies installed with ${pm}`)}`);
|
|
||||||
success()
|
|
||||||
} else {
|
|
||||||
p.log.info(`${c.gray('Skipped dependency installation')}`);
|
|
||||||
success()
|
|
||||||
}
|
|
||||||
|
|
||||||
async function success() {
|
} else {
|
||||||
p.note(nextSteps);
|
exitPrompt();
|
||||||
p.outro(c.green("Deployment Complete!"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue