adamantite 0.11.0 → 0.11.1

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.
Files changed (2) hide show
  1. package/dist/index.js +2 -2
  2. package/package.json +6 -5
package/dist/index.js CHANGED
@@ -12,5 +12,5 @@ import{defineCommand as e,runMain as t}from"citty";import{execSync as n}from"chi
12
12
  ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
13
13
  ┃ ADAMANTITE ┃
14
14
  ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
15
- `}var k=e({meta:{name:`check`,description:`Run Biome linter and check files for issues`},args:{files:{description:`Specific files to lint (optional)`,type:`positional`,required:!1},summary:{description:`Show summary of lint results`,type:`boolean`}},run:async({args:e})=>{try{let t=await C(),r=[`check`];e.summary&&r.push(`--reporter`,`summary`);let i=e._;i.length>0&&r.push(...i),n(a(t,`@biomejs/biome`,{args:r}),{stdio:`inherit`})}catch(e){w(e)}}}),A=e({meta:{name:`ci`,description:`Run Adamantite in a CI environment`},args:{monorepo:{description:`Run additional monorepo-specific checks`,type:`boolean`},github:{description:`Use GitHub reporter`,type:`boolean`}},run:async({args:e})=>{try{let t=await C(),r=[{package:`@biomejs/biome`,args:[`ci`,...e.github?[`--reporter`,`github`]:[]]},...e.monorepo?[{package:`sherif`,args:[]}]:[]];for(let e of r)n(a(t,e.package,{args:e.args}),{stdio:`inherit`})}catch(e){w(e)}}}),j=e({meta:{name:`fix`,description:`Run Biome linter and fix issues in files`},args:{files:{description:`Specific files to fix (optional)`,type:`positional`,required:!1},unsafe:{description:`Apply unsafe fixes`,type:`boolean`}},run:async({args:e})=>{try{let t=await C(),r=[`check`,`--write`];e.unsafe&&r.push(`--unsafe`);let i=e._;i.length>0&&r.push(...i),n(a(t,`@biomejs/biome`,{args:r}),{stdio:`inherit`})}catch(e){w(e)}}});const M={config:{extends:`adamantite/tsconfig`},async exists(){return await T(u(process.cwd(),`tsconfig.json`))},async create(){await l(u(process.cwd(),`tsconfig.json`),JSON.stringify(this.config,null,2))},async update(){let e=await c(u(process.cwd(),`tsconfig.json`),`utf-8`),t=x(e),n=b(this.config,t);await l(u(process.cwd(),`tsconfig.json`),JSON.stringify(n,null,2))}},N={version:`2.2.5`,config:{$schema:`./node_modules/@biomejs/biome/configuration_schema.json`},async exists(){return await T(u(process.cwd(),`biome.jsonc`))},async create(){await l(u(process.cwd(),`biome.jsonc`),JSON.stringify({...this.config,extends:[`adamantite`]},null,2))},async update(){let e=await T(u(process.cwd(),`biome.jsonc`))?u(process.cwd(),`biome.jsonc`):u(process.cwd(),`biome.json`),t=await c(e,`utf-8`),n={...x(t)};Array.isArray(n.extends)||(n.extends=n.extends?[n.extends]:[]),n.extends.includes(`adamantite`)||n.extends.push(`adamantite`);let r=b(this.config,n);await l(u(process.cwd(),`biome.jsonc`),JSON.stringify(r,null,2))}},P={config:{"typescript.tsdk":`node_modules/typescript/lib`,"editor.formatOnSave":!0,"editor.formatOnPaste":!0,"editor.codeActionsOnSave":{"source.organizeImports.biome":`explicit`,"source.fixAll.biome":`explicit`},"[javascript][typescript][javascriptreact][typescriptreact][json][jsonc][css][graphql]":{"editor.defaultFormatter":`biomejs.biome`}},async exists(){return await T(u(process.cwd(),`.vscode`,`settings.json`))},async create(){let e=u(process.cwd(),`.vscode`);await s(e,{recursive:!0}),await l(u(e,`settings.json`),JSON.stringify(this.config,null,2))},async update(){let e=u(process.cwd(),`.vscode`,`settings.json`),t=await c(e,`utf-8`),n=x(t),r=b(this.config,n);await l(u(process.cwd(),`.vscode`,`settings.json`),JSON.stringify(r,null,2))}},F={version:`1.6.1`};async function I(){let e=d.cwd();if(await T(u(e,`pnpm-workspace.yaml`)))return!0;try{return(await E()).workspaces!==void 0}catch{return!1}}async function L(){let e=y();await N.exists()?(e.start(`Biome config found, updating...`),await N.update(),e.stop(`Biome config updated with Adamantite preset`)):(e.start(`Biome config not found, creating...`),await N.create(),e.stop(`Biome config created with Adamantite preset`))}async function R({check:e,fix:t,monorepo:n}){let r=y();r.start("Adding scripts to your `package.json`...");try{let i=await E();i.scripts||={},e&&(i.scripts.check=`adamantite check`),t&&(i.scripts.fix=`adamantite fix`),n&&(i.scripts[`lint:monorepo`]=`adamantite monorepo`),await D(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 z(){let e=y();await M.exists()?(e.start("`tsconfig.json` found, updating..."),await M.update(),e.stop("Updated `tsconfig.json` with preset")):(e.start("`tsconfig.json` not found, creating..."),await M.create(),e.stop("Created `tsconfig.json` with preset"))}async function B(){let e=await _({message:`Which editors do you want to configure (recommended)?`,options:[{label:`VSCode / Cursor / Windsurf`,value:`vscode`},{label:`Zed (coming soon)`,value:`zed`}],required:!1});if(h(e))throw Error(`Operation cancelled`);return e}async function V(e){if(!e||e.length===0)return;let t=y();e.includes(`vscode`)&&(await P.exists()?(t.start(`VSCode settings found, updating...`),await P.update(),t.stop(`VSCode settings updated with Adamantite preset`)):(t.start(`VSCode settings not found, creating...`),await P.create(),t.stop(`VSCode settings created with Adamantite preset`))),e.includes(`zed`)&&(t.start(`Zed configuration coming soon...`),t.stop(`Zed configuration coming soon...`))}async function H(e){let t=await p({message:e});if(h(t))throw Error(`Operation cancelled`);return t}async function U(e){let t=y();t.start(`Installing dependencies...`);try{await r(`adamantite`);let n=N.version;await r(`@biomejs/biome@${n}`),e?.monorepo&&await r(`sherif@${F.version}`),t.stop(`Dependencies installed successfully`)}catch(e){throw t.stop(`Failed to install dependencies`),Error(`Failed to install dependencies: ${e instanceof Error?e.message:`Unknown error`}`)}}var W=e({meta:{name:`init`,description:`Initialize Adamantite in the current directory`},run:async()=>{m(O());try{let e=await I(),t=await H("Do you want to add the `check` and `fix` scripts to your `package.json`?"),n=e?await H(`We've detected a monorepo setup in your project. Would you like to install monorepo linting scripts?`):!1,r=await H(`Adamantite provides a TypeScript preset to enforce strict type-safety. Would you like to install it?`),i=await B();await U({monorepo:n}),await L(),(t||n)&&await R({check:t,fix:t,monorepo:n}),r&&await z(),await V(i),v(`💠 Adamantite initialized successfully!`)}catch(e){g.error(`${e instanceof Error?e.message:`Unknown error`}`),f(`Failed to initialize Adamantite`)}}}),G=e({meta:{name:`monorepo`,description:`Lint and automatically fix monorepo-specific issues using Sherif`},run:async()=>{try{let e=await C();n(a(e,`sherif`,{args:[`--fix`]}),{stdio:`inherit`})}catch(e){w(e)}}});async function K(){let e=[];try{let t=await E(),n=t.devDependencies?.[`@biomejs/biome`];n&&n!==N.version&&e.push({name:`@biomejs/biome`,currentVersion:n,targetVersion:N.version,isDevDependency:!0});let r=t.devDependencies?.sherif;return r&&r!==F.version&&e.push({name:`sherif`,currentVersion:r,targetVersion:F.version,isDevDependency:!0}),e}catch(e){throw Error(`Failed to read package.json: ${e instanceof Error?e.message:`Unknown error`}`)}}async function q(e){let t=y();t.start(`Updating dependencies...`);try{let n=e.map(e=>r(`${e.name}@${e.targetVersion}`)),i=await Promise.allSettled(n),a=[],o=[];for(let[t,n]of i.entries()){let r=e[t];if(!r)continue;let i=r.name;n.status===`fulfilled`?o.push(i):a.push(`${i}: ${n.reason?.message||`Unknown error`}`)}if(a.length===0)t.stop(`Dependencies updated successfully`);else if(o.length===0)throw t.stop(`Failed to update dependencies`),Error(`All dependency updates failed:\n${a.join(`
16
- `)}`);else{t.stop(`Partial update completed`),g.warn(`Some dependencies failed to update:`);for(let e of a)g.warn(` ${e}`);g.success(`Successfully updated: ${o.join(`, `)}`)}}catch(e){throw t.stop(`Failed to update dependencies`),e}}async function J(e){g.message(`The following dependencies will be updated:`),g.message(``);for(let t of e)g.message(` ${t.name}: ${t.currentVersion} → ${t.targetVersion}`);g.message(``);let t=await p({message:`Do you want to proceed with these updates?`});if(h(t))throw Error(`Operation cancelled`);return t}var Y=e({meta:{name:`update`,description:`Update adamantite dependencies to latest compatible versions`},run:async()=>{m(O());try{let e=await K();if(e.length===0){g.success(`All adamantite dependencies are already up to date!`),v(`💠 No updates needed`);return}if(!await J(e)){v(`💠 Update cancelled`);return}await q(e),v(`💠 Dependencies updated successfully!`)}catch(e){w(e)}}});function X(){return JSON.parse(S(u(process.cwd(),`package.json`),`utf-8`)).version}var Z=X();const Q=e({meta:{name:`adamantite`,description:`An opinionated set of presets for modern TypeScript applications`,version:Z},subCommands:{check:k,ci:A,fix:j,init:W,monorepo:G,update:Y}});t(Q);
15
+ `}var k=e({meta:{name:`check`,description:`Run Biome linter and check files for issues`},args:{files:{description:`Specific files to lint (optional)`,type:`positional`,required:!1},summary:{description:`Show summary of lint results`,type:`boolean`}},run:async({args:e})=>{try{let t=await C(),r=[`check`];e.summary&&r.push(`--reporter`,`summary`);let i=e._;i.length>0&&r.push(...i),n(a(t,`@biomejs/biome`,{args:r}),{stdio:`inherit`})}catch(e){w(e)}}}),A=e({meta:{name:`ci`,description:`Run Adamantite in a CI environment`},args:{monorepo:{description:`Run additional monorepo-specific checks`,type:`boolean`},github:{description:`Use GitHub reporter`,type:`boolean`}},run:async({args:e})=>{try{let t=await C(),r=[{package:`@biomejs/biome`,args:[`ci`,...e.github?[`--reporter`,`github`]:[]]},...e.monorepo?[{package:`sherif`,args:[]}]:[]];for(let e of r)n(a(t,e.package,{args:e.args}),{stdio:`inherit`})}catch(e){w(e)}}}),j=e({meta:{name:`fix`,description:`Run Biome linter and fix issues in files`},args:{files:{description:`Specific files to fix (optional)`,type:`positional`,required:!1},unsafe:{description:`Apply unsafe fixes`,type:`boolean`}},run:async({args:e})=>{try{let t=await C(),r=[`check`,`--write`];e.unsafe&&r.push(`--unsafe`);let i=e._;i.length>0&&r.push(...i),n(a(t,`@biomejs/biome`,{args:r}),{stdio:`inherit`})}catch(e){w(e)}}});const M={config:{extends:`adamantite/tsconfig`},async exists(){return await T(u(process.cwd(),`tsconfig.json`))},async create(){await l(u(process.cwd(),`tsconfig.json`),JSON.stringify(this.config,null,2))},async update(){let e=x(await c(u(process.cwd(),`tsconfig.json`),`utf-8`)),t=b(this.config,e);await l(u(process.cwd(),`tsconfig.json`),JSON.stringify(t,null,2))}},N={version:`2.2.6`,config:{$schema:`./node_modules/@biomejs/biome/configuration_schema.json`},async exists(){return await T(u(process.cwd(),`biome.jsonc`))},async create(){await l(u(process.cwd(),`biome.jsonc`),JSON.stringify({...this.config,extends:[`adamantite`]},null,2))},async update(){let e={...x(await c(await T(u(process.cwd(),`biome.jsonc`))?u(process.cwd(),`biome.jsonc`):u(process.cwd(),`biome.json`),`utf-8`))};Array.isArray(e.extends)||(e.extends=e.extends?[e.extends]:[]),e.extends.includes(`adamantite`)||e.extends.push(`adamantite`);let t=b(this.config,e);await l(u(process.cwd(),`biome.jsonc`),JSON.stringify(t,null,2))}},P={config:{"typescript.tsdk":`node_modules/typescript/lib`,"editor.formatOnSave":!0,"editor.formatOnPaste":!0,"editor.codeActionsOnSave":{"source.organizeImports.biome":`explicit`,"source.fixAll.biome":`explicit`},"[javascript][typescript][javascriptreact][typescriptreact][json][jsonc][css][graphql]":{"editor.defaultFormatter":`biomejs.biome`}},async exists(){return await T(u(process.cwd(),`.vscode`,`settings.json`))},async create(){let e=u(process.cwd(),`.vscode`);await s(e,{recursive:!0}),await l(u(e,`settings.json`),JSON.stringify(this.config,null,2))},async update(){let e=x(await c(u(process.cwd(),`.vscode`,`settings.json`),`utf-8`)),t=b(this.config,e);await l(u(process.cwd(),`.vscode`,`settings.json`),JSON.stringify(t,null,2))}},F={version:`1.6.1`};async function I(){if(await T(u(d.cwd(),`pnpm-workspace.yaml`)))return!0;try{return(await E()).workspaces!==void 0}catch{return!1}}async function L(){let e=y();await N.exists()?(e.start(`Biome config found, updating...`),await N.update(),e.stop(`Biome config updated with Adamantite preset`)):(e.start(`Biome config not found, creating...`),await N.create(),e.stop(`Biome config created with Adamantite preset`))}async function R({check:e,fix:t,monorepo:n}){let r=y();r.start("Adding scripts to your `package.json`...");try{let i=await E();i.scripts||={},e&&(i.scripts.check=`adamantite check`),t&&(i.scripts.fix=`adamantite fix`),n&&(i.scripts[`lint:monorepo`]=`adamantite monorepo`),await D(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 z(){let e=y();await M.exists()?(e.start("`tsconfig.json` found, updating..."),await M.update(),e.stop("Updated `tsconfig.json` with preset")):(e.start("`tsconfig.json` not found, creating..."),await M.create(),e.stop("Created `tsconfig.json` with preset"))}async function B(){let e=await _({message:`Which editors do you want to configure (recommended)?`,options:[{label:`VSCode / Cursor / Windsurf`,value:`vscode`},{label:`Zed (coming soon)`,value:`zed`}],required:!1});if(h(e))throw Error(`Operation cancelled`);return e}async function V(e){if(!e||e.length===0)return;let t=y();e.includes(`vscode`)&&(await P.exists()?(t.start(`VSCode settings found, updating...`),await P.update(),t.stop(`VSCode settings updated with Adamantite preset`)):(t.start(`VSCode settings not found, creating...`),await P.create(),t.stop(`VSCode settings created with Adamantite preset`))),e.includes(`zed`)&&(t.start(`Zed configuration coming soon...`),t.stop(`Zed configuration coming soon...`))}async function H(e){let t=await p({message:e});if(h(t))throw Error(`Operation cancelled`);return t}async function U(e){let t=y();t.start(`Installing dependencies...`);try{await r(`adamantite`);let n=N.version;await r(`@biomejs/biome@${n}`),e?.monorepo&&await r(`sherif@${F.version}`),t.stop(`Dependencies installed successfully`)}catch(e){throw t.stop(`Failed to install dependencies`),Error(`Failed to install dependencies: ${e instanceof Error?e.message:`Unknown error`}`)}}var W=e({meta:{name:`init`,description:`Initialize Adamantite in the current directory`},run:async()=>{m(O());try{let e=await I(),t=await H("Do you want to add the `check` and `fix` scripts to your `package.json`?"),n=e?await H(`We've detected a monorepo setup in your project. Would you like to install monorepo linting scripts?`):!1,r=await H(`Adamantite provides a TypeScript preset to enforce strict type-safety. Would you like to install it?`),i=await B();await U({monorepo:n}),await L(),(t||n)&&await R({check:t,fix:t,monorepo:n}),r&&await z(),await V(i),v(`💠 Adamantite initialized successfully!`)}catch(e){g.error(`${e instanceof Error?e.message:`Unknown error`}`),f(`Failed to initialize Adamantite`)}}}),G=e({meta:{name:`monorepo`,description:`Lint and automatically fix monorepo-specific issues using Sherif`},run:async()=>{try{n(a(await C(),`sherif`,{args:[`--fix`]}),{stdio:`inherit`})}catch(e){w(e)}}});async function K(){let e=[];try{let t=await E(),n=t.devDependencies?.[`@biomejs/biome`];n&&n!==N.version&&e.push({name:`@biomejs/biome`,currentVersion:n,targetVersion:N.version,isDevDependency:!0});let r=t.devDependencies?.sherif;return r&&r!==F.version&&e.push({name:`sherif`,currentVersion:r,targetVersion:F.version,isDevDependency:!0}),e}catch(e){throw Error(`Failed to read package.json: ${e instanceof Error?e.message:`Unknown error`}`)}}async function q(e){let t=y();t.start(`Updating dependencies...`);try{let n=e.map(e=>r(`${e.name}@${e.targetVersion}`)),i=await Promise.allSettled(n),a=[],o=[];for(let[t,n]of i.entries()){let r=e[t];if(!r)continue;let i=r.name;n.status===`fulfilled`?o.push(i):a.push(`${i}: ${n.reason?.message||`Unknown error`}`)}if(a.length===0)t.stop(`Dependencies updated successfully`);else if(o.length===0)throw t.stop(`Failed to update dependencies`),Error(`All dependency updates failed:\n${a.join(`
16
+ `)}`);else{t.stop(`Partial update completed`),g.warn(`Some dependencies failed to update:`);for(let e of a)g.warn(` ${e}`);g.success(`Successfully updated: ${o.join(`, `)}`)}}catch(e){throw t.stop(`Failed to update dependencies`),e}}async function J(e){g.message(`The following dependencies will be updated:`),g.message(``);for(let t of e)g.message(` ${t.name}: ${t.currentVersion} → ${t.targetVersion}`);g.message(``);let t=await p({message:`Do you want to proceed with these updates?`});if(h(t))throw Error(`Operation cancelled`);return t}var Y=e({meta:{name:`update`,description:`Update adamantite dependencies to latest compatible versions`},run:async()=>{m(O());try{let e=await K();if(e.length===0){g.success(`All adamantite dependencies are already up to date!`),v(`💠 No updates needed`);return}if(!await J(e)){v(`💠 Update cancelled`);return}await q(e),v(`💠 Dependencies updated successfully!`)}catch(e){w(e)}}});function X(){return JSON.parse(S(u(process.cwd(),`package.json`),`utf-8`)).version}t(e({meta:{name:`adamantite`,description:`An opinionated set of presets for modern TypeScript applications`,version:X()},subCommands:{check:k,ci:A,fix:j,init:W,monorepo:G,update:Y}}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adamantite",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "An strict and opinionated set of presets for modern TypeScript applications",
5
5
  "keywords": [
6
6
  "adamantite",
@@ -56,15 +56,16 @@
56
56
  "nypm": "0.6.2"
57
57
  },
58
58
  "devDependencies": {
59
- "@biomejs/biome": "2.2.5",
59
+ "@biomejs/biome": "2.2.6",
60
60
  "@changesets/cli": "2.29.7",
61
- "@types/bun": "1.2.23",
61
+ "@types/bun": "1.3.0",
62
62
  "sherif": "1.6.1",
63
- "tsdown": "0.15.6",
64
- "type-fest": "5.0.1",
63
+ "tsdown": "0.15.7",
64
+ "type-fest": "5.1.0",
65
65
  "typescript": "5.9.3"
66
66
  },
67
67
  "peerDependencies": {
68
+ "@biomejs/biome": "2.2.6",
68
69
  "typescript": ">=5.6.0"
69
70
  },
70
71
  "packageManager": "bun@1.2.20"