diff --git a/src/utilities/install.js b/src/utilities/install.js index f43c775..f94c673 100644 --- a/src/utilities/install.js +++ b/src/utilities/install.js @@ -16,15 +16,12 @@ export async function installDeps(choice, name) { const pkg = await findUp('package.json', { cwd: process.cwd() + '/' + name, }); - if (!pkg) throw new Error('No package.json found!'); const output = JSON.parse(await readFile(pkg, 'utf8')); - if (!output) throw new Error("Can't read file."); const deps = output.dependencies; - if (!deps) throw new Error("Can't find dependencies."); const spin = ora({ @@ -35,7 +32,6 @@ export async function installDeps(choice, name) { const result = await execa(choice, ['install'], { cwd: process.cwd() + '/' + name, }).catch(() => null); - if (!result || result?.failed) { spin.fail(`${redBright('Failed')} to install dependencies!`); return process.exit(1); @@ -66,12 +62,11 @@ export async function cloneRepo(lang, name) { * @param {string} dest - The destination folder where the files will be copied to. */ function copyRecursiveSync(src, dest) { - var exists = fs.existsSync(src); + const exists = fs.existsSync(src); - var stats = exists && fs.statSync(src); - - var isDirectory = exists && stats.isDirectory(); + const stats = exists && fs.statSync(src); + const isDirectory = exists && stats.isDirectory(); if (isDirectory) { fs.mkdirSync(dest);