adamantite 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,4 +7,4 @@ import{Command as e}from"commander";import t from"process";import{execSync as n}
|
|
|
7
7
|
███░░███ ░███ ░███ ███░░███ ░███ ░███ ░███ ███░░███ ░███ ░███ ░███ ███ ░███ ░███ ███░███░░░
|
|
8
8
|
░░████████░░████████░░████████ █████░███ █████░░████████ ████ █████ ░░█████ █████ ░░█████ ░░██████
|
|
9
9
|
░░░░░░░░ ░░░░░░░░ ░░░░░░░░ ░░░░░ ░░░ ░░░░░ ░░░░░░░░ ░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░░
|
|
10
|
-
`;async function N(){let e=await p({message:`Select your package manager`,options:E.map(e=>({label:e,value:e})),initialValue:await D()});if(u(e)||e===null)throw Error(`No package manager selected`);if(e===void 0)throw Error(`Invalid package manager selected`);return e}async function P(){let e=t.cwd();if(await C(o(e,`pnpm-workspace.yaml`)))return!0;try{let e=await w();return e.workspaces!==void 0}catch{return!1}}async function F(){let e=m();await j.exists()?(e.start(`Biome config found, updating...`),await j.update(),e.stop(`Biome config updated with Adamantite preset`)):(e.start(`Biome config not found, creating...`),await j.create(),e.stop(`Biome config created with Adamantite preset`))}async function I({lint:e,format:t,
|
|
10
|
+
`;async function N(){let e=await p({message:`Select your package manager`,options:E.map(e=>({label:e,value:e})),initialValue:await D()});if(u(e)||e===null)throw Error(`No package manager selected`);if(e===void 0)throw Error(`Invalid package manager selected`);return e}async function P(){let e=t.cwd();if(await C(o(e,`pnpm-workspace.yaml`)))return!0;try{let e=await w();return e.workspaces!==void 0}catch{return!1}}async function F(){let e=m();await j.exists()?(e.start(`Biome config found, updating...`),await j.update(),e.stop(`Biome config updated with Adamantite preset`)):(e.start(`Biome config not found, creating...`),await j.create(),e.stop(`Biome config created with Adamantite preset`))}async function I({lint:e,format:t,monorepo:n}){let r=m();r.start("Adding scripts to your `package.json`...");try{let i=await w();i.scripts||={},e&&(i.scripts.lint=`adamantite lint`),t&&(i.scripts.format=`adamantite format`),n&&(i.scripts[`lint:monorepo`]=`adamantite monorepo`),await T(i),r.stop("Scripts added to your `package.json`")}catch(e){throw r.stop(`Failed to add scripts`),Error(`Failed to modify package.json: ${e instanceof Error?e.message:`Unknown error`}`)}}async function L(){let e=m();await A.exists()?(e.start("`tsconfig.json` found, updating..."),await A.update(),e.stop("Updated `tsconfig.json` with preset")):(e.start("`tsconfig.json` not found, creating..."),await A.create(),e.stop("Created `tsconfig.json` with preset"))}async function R(e){let t=await c({message:e});if(u(t))throw Error(`Operation cancelled`);return t}function z(e,t){let n=m();n.start(`Installing dependencies...`);try{switch(e){case`npm`:S(`npm`,[`install`,`--save-dev`,`--exact`,`adamantite`,`@biomejs/biome@${v}`,t?.monorepo?`sherif@${y}`:``]);break;case`yarn`:S(`yarn`,[`add`,`--dev`,`--exact`,`adamantite`,`@biomejs/biome@${v}`,t?.monorepo?`sherif@${y}`:``]);break;case`pnpm`:S(`pnpm`,[`add`,`--save-dev`,`--save-exact`,`adamantite`,`@biomejs/biome@${v}`,t?.monorepo?`sherif@${y}`:``]);break;case`bun`:S(`bun`,[`add`,`--dev`,`--exact`,`adamantite`,`@biomejs/biome@${v}`,t?.monorepo?`sherif@${y}`:``]);break;default:throw Error(`Invalid package manager: ${e}`)}n.stop(`Dependencies installed successfully`)}catch(e){throw n.stop(`Failed to install dependencies`),Error(`Failed to install dependencies: ${e instanceof Error?e.message:`Unknown error`}`)}}async function B(){l(M);try{let e=await N(),t=await P(),n=await R("Do you want to add the `format` and `lint` scripts to your `package.json`?"),r=t?await R(`We've detected a monorepo setup in your project. Would you like to install monorepo linting scripts?`):!1,i=await R(`Adamantite provides a TypeScript preset to enforce strict type-safety. Would you like to install it?`);z(e,{monorepo:r}),await F(),(n||r)&&await I({lint:n,format:n,monorepo:r}),i&&await L(),f(`💠 Adamantite initialized successfully!`)}catch(e){d.error(`${e instanceof Error?e.message:`Unknown error`}`),s(`Failed to initialize Adamantite`)}}async function V(e){try{let t=await D(),n=O(t),r=[`@biomejs/biome`,`lint`,`--fix`];e.length>0&&r.push(...e),S(n,r)}catch(e){let n=e instanceof Error?e.message:`An unknown error occurred`;console.error(`Failed to run Adamantite:`,n),t.exit(1)}}async function H(){try{let e=await D(),t=O(e);S(t,[`sherif`,`--fix`])}catch(e){let n=e instanceof Error?e.message:`An unknown error occurred`;console.error(`Failed to run Adamantite:`,n),t.exit(1)}}function U(){let e=JSON.parse(_(o(process.cwd(),`package.json`),`utf-8`));return e.version}const W=U();var G=W;const K=new e;K.version(G),K.name(`adamantite`).description(`An opinionated set of presets for modern TypeScript applications`),K.command(`init`).description(`Initialize Adamantite in the current directory`).action(B),K.command(`lint`).description(`Run Biome linter and fix files`).argument(`[files...]`,`specific files to lint (optional)`).action(V),K.command(`format`).description(`Run Biome formatter and fix files`).argument(`[files...]`,`specific files to format (optional)`).option(`--unsafe`,`apply unsafe fixes`).action(k),K.command(`monorepo`).description(`Lint and automatically fix monorepo-specific issues using Sherif`).action(H),K.parse();
|