feat(create-mcfly): catch error

This commit is contained in:
Ayo 2023-10-21 21:13:35 +02:00
parent bea5cc039d
commit de89c9df5a

View file

@ -3,12 +3,16 @@
const { downloadTemplate } = require("giget");
create();
async function create() {
const { source, dir } = await downloadTemplate(
"github:ayoayco/mcfly/templates/basic",
{
dir: "mcfly-app",
}
);
console.log(`✨ New McFly app created: ${dir}`);
try {
const { source, dir } = await downloadTemplate(
"github:ayoayco/mcfly/templates/basic",
{
dir: "mcfly-app",
}
);
console.log(`✨ New McFly app created: ${dir}`);
} catch (e) {
console.error('😱 "mcfly-app" directory already exists');
}
return 1;
}