feat(create-mcfly): add more helpful info

This commit is contained in:
Ayo 2023-10-22 18:52:51 +02:00
parent 32db426c06
commit 5a4722c80e
3 changed files with 22 additions and 5 deletions

2
package-lock.json generated
View file

@ -3975,7 +3975,7 @@
} }
}, },
"packages/create-mcfly": { "packages/create-mcfly": {
"version": "0.2.2", "version": "0.2.3",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"consola": "^3.2.3", "consola": "^3.2.3",

View file

@ -7,8 +7,9 @@ create();
async function create() { async function create() {
console.clear(); console.clear();
let hasErrors = false; let hasErrors = false;
consola.box("👋 Hello! Welcome to McFly.");
const directory = const directory =
(await consola.prompt("Name your new vanilla web app:", { (await consola.prompt("Give your new project a name:", {
placeholder: "./mcfly-app", placeholder: "./mcfly-app",
})) ?? "mcfly-app"; })) ?? "mcfly-app";
try { try {
@ -29,9 +30,17 @@ async function create() {
} }
); );
if (installDeps) { if (installDeps) {
consola.start("Installing dependencies..."); consola.start("Installing dependencies using npm...");
let done = false;
setTimeout(() => {
if (!done)
consola.info(
"This may take some time depending on your connectivity..."
);
}, 3000);
try { try {
await exec(`npm --prefix ${directory} install`); await exec(`npm --prefix ${directory} install`);
done = true;
consola.success("Done!"); consola.success("Done!");
} catch (e) { } catch (e) {
consola.error(e); consola.error(e);
@ -54,7 +63,15 @@ async function create() {
} }
} }
consola.box(`McFly app created: ${directory}`); let counter = 2;
consola.box(`🎉 Your new McFly app is now ready: ./${directory}
Next actions:
1. Go to your project by running 'cd ./${directory}'
2. Run 'npm start' to start the dev server`);
} }
consola.info(
"Need more info? Join the McFly community at https://ayco.io/gh/McFly \n"
);
return 1; return 1;
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "create-mcfly", "name": "create-mcfly",
"version": "0.2.2", "version": "0.2.3",
"bin": { "bin": {
"create-mcfly": "./index.js" "create-mcfly": "./index.js"
}, },