adamantite 0.10.0 → 0.11.0

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/README.md CHANGED
@@ -72,7 +72,7 @@ npm install --save-dev adamantite @biomejs/biome
72
72
  echo '{ "extends": ["adamantite"] }' > biome.jsonc
73
73
 
74
74
  # Extend TypeScript configuration
75
- echo '{ "extends": "adamantite/presets/tsconfig.json" }' > tsconfig.json
75
+ echo '{ "extends": "adamantite/tsconfig" }' > tsconfig.json
76
76
  ```
77
77
 
78
78
  ## 📋 Commands
@@ -165,7 +165,7 @@ Adamantite's Biome preset includes:
165
165
  - React/JSX patterns
166
166
  - **File Patterns**: Pre-configured for TypeScript, JavaScript, JSON, and more
167
167
 
168
- ### TypeScript Configuration ([presets/tsconfig.json](./presets/tsconfig.json))
168
+ ### TypeScript Configuration ([presets/tsconfig.json](./src/presets/tsconfig.json))
169
169
 
170
170
  The TypeScript preset includes strict settings for maximum type safety:
171
171
 
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/presets/tsconfig.json`},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(`
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
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adamantite",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "An strict and opinionated set of presets for modern TypeScript applications",
5
5
  "keywords": [
6
6
  "adamantite",
@@ -21,22 +21,27 @@
21
21
  "license": "MIT",
22
22
  "author": "Adel Rodriguez <hello@adelrodriguez.com>",
23
23
  "type": "module",
24
- "main": "biome.jsonc",
24
+ "main": "src/presets/biome.jsonc",
25
25
  "bin": {
26
26
  "adamantite": "bin/adamantite"
27
27
  },
28
+ "exports": {
29
+ ".": "./src/presets/biome.jsonc",
30
+ "./biome": "./src/presets/biome.jsonc",
31
+ "./tsconfig": "./src/presets/tsconfig.json",
32
+ "./presets/*": "./src/presets/*"
33
+ },
28
34
  "files": [
29
35
  "bin",
30
- "biome.jsonc",
31
36
  "dist",
32
- "presets/tsconfig.json"
37
+ "src/presets"
33
38
  ],
34
39
  "scripts": {
35
40
  "build": "tsdown",
36
41
  "bump:deps": "bun update --interactive",
37
- "check": "biome check",
42
+ "check": "bun --bun run src/index.ts check",
38
43
  "dev": "tsdown --watch",
39
- "fix": "biome check --write",
44
+ "fix": "bun --bun run src/index.ts fix",
40
45
  "release": "changeset publish",
41
46
  "test": "bun test",
42
47
  "test:watch": "bun --watch test",
@@ -1,6 +1,6 @@
1
1
  {
2
- "$schema": "https://biomejs.dev/schemas/2.2.5/schema.json",
3
-
2
+ "$schema": "../../node_modules/@biomejs/biome/configuration_schema.json",
3
+ "root": false,
4
4
  // ---------------------------- FORMATTER -----------------------------
5
5
  // These are the generic settings that apply to all files in the project.
6
6
  "formatter": {
@@ -4,7 +4,6 @@
4
4
  // Base options
5
5
  "esModuleInterop": true,
6
6
  "skipLibCheck": true,
7
- "verbatimModuleSyntax": true,
8
7
  "allowJs": true,
9
8
  "resolveJsonModule": true,
10
9
  "moduleDetection": "force",