@happytiptoe/ape
Advanced tools
Comparing version 0.0.6 to 0.0.7
#!/usr/bin/env node | ||
import s from"fs-extra";import{dim as c,white as a}from"kolorist";import l from"node:path";import{fileURLToPath as d}from"node:url";import{addDevDependency as u}from"nypm";var i="0.0.6";import{red as p}from"kolorist";function o(t){throw new Error(p(`\u2716 ${t}`))}console.log(`Initialising ${c("@happytiptoe/")}${a("ape")} (${i})...`);async function g(){let t=["astro.config.js","astro.config.mjs","astro.config.cjs","astro.config.ts"],e=process.cwd();console.log(e);for(let r of t)if(!await s.exists(`${e}/${r}`))return!1;return!0}async function f(){let t=["@typescript-eslint/parser","eslint","eslint-plugin-astro","eslint-plugin-jsx-a11y","prettier","prettier-plugin-astro"];console.log("\u203A Installing dependencies...");for(let e of t)await u(e);console.log("\u203A Dependencies installed!")}async function m(){if(!await g()){o("ape must be ran inside an Astro project.");return}await f(),console.log("\u203A Copying file stubs...");let e=l.resolve(d(import.meta.url),"../../stubs");await s.copy(`${e}/eslint`,"./.eslintrc.cjs"),await s.copy(`${e}/prettier`,"./.prettierrc"),console.log("\u203A Stubs copied!"),console.clear(),console.log("\u2728 ESLint and Prettier are all good to go - happy coding!")}m().catch(t=>{console.error(t.message)}); | ||
import s from"fs-extra";import{dim as c,white as a}from"kolorist";import l from"node:path";import{fileURLToPath as d}from"node:url";import{addDevDependency as g}from"nypm";var o="0.0.7";import{red as p}from"kolorist";function n(t){throw new Error(p(`\u2716 ${t}`))}console.log(`Initialising ${c("@happytiptoe/")}${a("ape")} (${o})...`);async function u(){let t=["astro.config.js","astro.config.mjs","astro.config.cjs","astro.config.ts"],e=process.cwd();console.log(e);for(let i of t)if(console.log(`Checking if ${e}/${i} exists`),!await s.exists(`${e}/${i}`))return!1;return!0}async function f(){let t=["@typescript-eslint/parser","eslint","eslint-plugin-astro","eslint-plugin-jsx-a11y","prettier","prettier-plugin-astro"];console.log("\u203A Installing dependencies...");for(let e of t)await g(e);console.log("\u203A Dependencies installed!")}async function m(){if(!await u()){n("ape must be ran inside an Astro project.");return}await f(),console.log("\u203A Copying file stubs...");let e=l.resolve(d(import.meta.url),"../../stubs");await s.copy(`${e}/eslint`,"./.eslintrc.cjs"),await s.copy(`${e}/prettier`,"./.prettierrc"),console.log("\u203A Stubs copied!"),console.clear(),console.log("\u2728 ESLint and Prettier are all good to go - happy coding!")}m().catch(t=>{console.error(t.message)}); |
{ | ||
"name": "@happytiptoe/ape", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "Adds Prettier and ESLint to Astro Projects", |
5230