adamantite 0.7.2 → 0.8.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 +15 -15
- package/dist/index.js +2 -2
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -80,34 +80,34 @@ echo '{ "extends": "adamantite/presets/tsconfig.json" }' > tsconfig.json
|
|
|
80
80
|
|
|
81
81
|
Adamantite provides a comprehensive CLI for all your code quality needs:
|
|
82
82
|
|
|
83
|
-
### `adamantite
|
|
83
|
+
### `adamantite check`
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
Check your code for issues without automatically fixing them:
|
|
86
86
|
|
|
87
87
|
```shell
|
|
88
|
-
#
|
|
89
|
-
adamantite
|
|
88
|
+
# Check all files
|
|
89
|
+
adamantite check
|
|
90
90
|
|
|
91
|
-
#
|
|
92
|
-
adamantite
|
|
91
|
+
# Check specific files
|
|
92
|
+
adamantite check src/components/**/*.ts
|
|
93
93
|
|
|
94
94
|
# Show summary of results
|
|
95
|
-
adamantite
|
|
95
|
+
adamantite check --summary
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
### `adamantite
|
|
98
|
+
### `adamantite fix`
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
Fix issues in your code with automatic formatting and safe fixes:
|
|
101
101
|
|
|
102
102
|
```shell
|
|
103
|
-
#
|
|
104
|
-
adamantite
|
|
103
|
+
# Fix all files
|
|
104
|
+
adamantite fix
|
|
105
105
|
|
|
106
|
-
#
|
|
107
|
-
adamantite
|
|
106
|
+
# Fix specific files
|
|
107
|
+
adamantite fix src/utils.ts
|
|
108
108
|
|
|
109
|
-
# Apply unsafe
|
|
110
|
-
adamantite
|
|
109
|
+
# Apply unsafe fixes
|
|
110
|
+
adamantite fix --unsafe
|
|
111
111
|
```
|
|
112
112
|
|
|
113
113
|
### `adamantite ci`
|
package/dist/index.js
CHANGED
|
@@ -12,5 +12,5 @@ import{Command as e}from"commander";import{execSync as t}from"child_process";imp
|
|
|
12
12
|
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
13
13
|
┃ ADAMANTITE ┃
|
|
14
14
|
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
15
|
-
`}async function O({github:e,monorepo:n}){try{let r=await S(),a=[{package:`@biomejs/biome`,args:[`ci`,...e?[`--reporter`,`github`]:[]]},...n?[{package:`sherif`,args:[]}]:[]];for(let e of a)t(i(r,e.package,{args:e.args}),{stdio:`inherit`})}catch(e){C(e)}}async function
|
|
16
|
-
`)}`);else{t.stop(`Partial update completed`),h.warn(`Some dependencies failed to update:`);for(let e of a)h.warn(` ${e}`);h.success(`Successfully updated: ${o.join(`, `)}`)}}catch(e){throw t.stop(`Failed to update dependencies`),e}}async function q(e){h.message(`The following dependencies will be updated:`),h.message(``);for(let t of e)h.message(` ${t.name}: ${t.currentVersion} → ${t.targetVersion}`);h.message(``);let t=await f({message:`Do you want to proceed with these updates?`});if(m(t))throw Error(`Operation cancelled`);return t}async function J(){p(D());try{let e=await G();if(e.length===0){h.success(`All adamantite dependencies are already up to date!`),_(`💠 No updates needed`);return}let t=await q(e);if(!t){_(`💠 Update cancelled`);return}await K(e),_(`💠 Dependencies updated successfully!`)}catch(e){h.error(`${e instanceof Error?e.message:`Unknown error`}`),d(`Failed to update dependencies`)}}function Y(){let e=JSON.parse(x(l(process.cwd(),`package.json`),`utf-8`));return e.version}const X=Y();var Z=X;const Q=new e;Q.version(Z),Q.name(`adamantite`).description(`An opinionated set of presets for modern TypeScript applications`),Q.command(`init`).description(`Initialize Adamantite in the current directory`).action(
|
|
15
|
+
`}async function O(e,{summary:n}){try{let r=await S(),a=[`check`];n&&a.push(`--reporter`,`summary`),e.length>0&&a.push(...e),t(i(r,`@biomejs/biome`,{args:a}),{stdio:`inherit`})}catch(e){C(e)}}async function k({github:e,monorepo:n}){try{let r=await S(),a=[{package:`@biomejs/biome`,args:[`ci`,...e?[`--reporter`,`github`]:[]]},...n?[{package:`sherif`,args:[]}]:[]];for(let e of a)t(i(r,e.package,{args:e.args}),{stdio:`inherit`})}catch(e){C(e)}}async function A(e,n){try{let r=await S(),a=[`check`,`--write`];n.unsafe&&a.push(`--unsafe`),e.length>0&&a.push(...e),t(i(r,`@biomejs/biome`,{args:a}),{stdio:`inherit`})}catch(e){C(e)}}const j={config:{extends:`adamantite/presets/tsconfig.json`},async exists(){return await w(l(process.cwd(),`tsconfig.json`))},async create(){await c(l(process.cwd(),`tsconfig.json`),JSON.stringify(this.config,null,2))},async update(){let e=await s(l(process.cwd(),`tsconfig.json`),`utf-8`),t=b(e),n=y(this.config,t);await c(l(process.cwd(),`tsconfig.json`),JSON.stringify(n,null,2))}},M={version:`2.2.2`,config:{$schema:`./node_modules/@biomejs/biome/configuration_schema.json`},async exists(){return await w(l(process.cwd(),`biome.jsonc`))},async create(){await c(l(process.cwd(),`biome.jsonc`),JSON.stringify({...this.config,extends:[`adamantite`]},null,2))},async update(){let e=await w(l(process.cwd(),`biome.jsonc`))?l(process.cwd(),`biome.jsonc`):l(process.cwd(),`biome.json`),t=await s(e,`utf-8`),n=b(t),r={...n};Array.isArray(r.extends)||(r.extends=r.extends?[r.extends]:[]),r.extends.includes(`adamantite`)||r.extends.push(`adamantite`);let i=y(this.config,r);await c(l(process.cwd(),`biome.jsonc`),JSON.stringify(i,null,2))}},N={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 w(l(process.cwd(),`.vscode`,`settings.json`))},async create(){let e=l(process.cwd(),`.vscode`);await o(e,{recursive:!0}),await c(l(e,`settings.json`),JSON.stringify(this.config,null,2))},async update(){let e=l(process.cwd(),`.vscode`,`settings.json`),t=await s(e,`utf-8`),n=b(t),r=y(this.config,n);await c(l(process.cwd(),`.vscode`,`settings.json`),JSON.stringify(r,null,2))}},P={version:`1.6.1`};async function F(){let e=u.cwd();if(await w(l(e,`pnpm-workspace.yaml`)))return!0;try{let e=await T();return e.workspaces!==void 0}catch{return!1}}async function I(){let e=v();await M.exists()?(e.start(`Biome config found, updating...`),await M.update(),e.stop(`Biome config updated with Adamantite preset`)):(e.start(`Biome config not found, creating...`),await M.create(),e.stop(`Biome config created with Adamantite preset`))}async function L({check:e,fix:t,monorepo:n}){let r=v();r.start("Adding scripts to your `package.json`...");try{let i=await T();i.scripts||={},e&&(i.scripts.check=`adamantite check`),t&&(i.scripts.fix=`adamantite fix`),n&&(i.scripts[`lint:monorepo`]=`adamantite monorepo`),await E(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 R(){let e=v();await j.exists()?(e.start("`tsconfig.json` found, updating..."),await j.update(),e.stop("Updated `tsconfig.json` with preset")):(e.start("`tsconfig.json` not found, creating..."),await j.create(),e.stop("Created `tsconfig.json` with preset"))}async function z(){let e=await g({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(m(e))throw Error(`Operation cancelled`);return e}async function B(e){if(!e||e.length===0)return;let t=v();e.includes(`vscode`)&&(await N.exists()?(t.start(`VSCode settings found, updating...`),await N.update(),t.stop(`VSCode settings updated with Adamantite preset`)):(t.start(`VSCode settings not found, creating...`),await N.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 V(e){let t=await f({message:e});if(m(t))throw Error(`Operation cancelled`);return t}async function H(e){let t=v();t.start(`Installing dependencies...`);try{await n(`adamantite`);let r=M.version;await n(`@biomejs/biome@${r}`),e?.monorepo&&await n(`sherif@${P.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`}`)}}async function U(){p(D());try{let e=await F(),t=await V("Do you want to add the `check` and `fix` scripts to your `package.json`?"),n=e?await V(`We've detected a monorepo setup in your project. Would you like to install monorepo linting scripts?`):!1,r=await V(`Adamantite provides a TypeScript preset to enforce strict type-safety. Would you like to install it?`),i=await z();await H({monorepo:n}),await I(),(t||n)&&await L({check:t,fix:t,monorepo:n}),r&&await R(),await B(i),_(`💠 Adamantite initialized successfully!`)}catch(e){h.error(`${e instanceof Error?e.message:`Unknown error`}`),d(`Failed to initialize Adamantite`)}}async function W(){try{let e=await S();t(i(e,`sherif`,{args:[`--fix`]}),{stdio:`inherit`})}catch(e){C(e)}}async function G(){let e=[];try{let t=await T(),n=t.devDependencies?.[`@biomejs/biome`];n&&n!==M.version&&e.push({name:`@biomejs/biome`,currentVersion:n,targetVersion:M.version,isDevDependency:!0});let r=t.devDependencies?.sherif;return r&&r!==P.version&&e.push({name:`sherif`,currentVersion:r,targetVersion:P.version,isDevDependency:!0}),e}catch(e){throw Error(`Failed to read package.json: ${e instanceof Error?e.message:`Unknown error`}`)}}async function K(e){let t=v();t.start(`Updating dependencies...`);try{let r=e.map(e=>n(`${e.name}@${e.targetVersion}`)),i=await Promise.allSettled(r),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`),h.warn(`Some dependencies failed to update:`);for(let e of a)h.warn(` ${e}`);h.success(`Successfully updated: ${o.join(`, `)}`)}}catch(e){throw t.stop(`Failed to update dependencies`),e}}async function q(e){h.message(`The following dependencies will be updated:`),h.message(``);for(let t of e)h.message(` ${t.name}: ${t.currentVersion} → ${t.targetVersion}`);h.message(``);let t=await f({message:`Do you want to proceed with these updates?`});if(m(t))throw Error(`Operation cancelled`);return t}async function J(){p(D());try{let e=await G();if(e.length===0){h.success(`All adamantite dependencies are already up to date!`),_(`💠 No updates needed`);return}let t=await q(e);if(!t){_(`💠 Update cancelled`);return}await K(e),_(`💠 Dependencies updated successfully!`)}catch(e){h.error(`${e instanceof Error?e.message:`Unknown error`}`),d(`Failed to update dependencies`)}}function Y(){let e=JSON.parse(x(l(process.cwd(),`package.json`),`utf-8`));return e.version}const X=Y();var Z=X;const Q=new e;Q.version(Z),Q.name(`adamantite`).description(`An opinionated set of presets for modern TypeScript applications`),Q.command(`init`).description(`Initialize Adamantite in the current directory`).action(U),Q.command(`check`).description(`Run Biome linter and check files for issues`).argument(`[files...]`,`specific files to lint (optional)`).option(`--summary`,`show summary of lint results`).action(async(e,t)=>{await O(e,t)}),Q.command(`fix`).description(`Run Biome linter and fix issues in files`).argument(`[files...]`,`specific files to fix (optional)`).option(`--unsafe`,`apply unsafe fixes`).action(async(e,t)=>{await A(e,t)}),Q.command(`monorepo`).description(`Lint and automatically fix monorepo-specific issues using Sherif`).action(W),Q.command(`ci`).description(`Run Adamantitte in a CI environment`).option(`--monorepo`,`run additional monorepo-specific checks`).option(`--github`,`use GitHub reporter`).action(async e=>{await k(e)}),Q.command(`update`).description(`Update adamantite dependencies to latest compatible versions`).action(J),Q.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adamantite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "An strict and opinionated set of presets for modern TypeScript applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adamantite",
|
|
@@ -26,15 +26,16 @@
|
|
|
26
26
|
"adamantite": "bin/adamantite"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
|
+
"bin",
|
|
29
30
|
"biome.jsonc",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
31
|
+
"dist",
|
|
32
|
+
"presets/tsconfig.json"
|
|
32
33
|
],
|
|
33
34
|
"scripts": {
|
|
34
35
|
"build": "tsdown",
|
|
35
36
|
"dev": "tsdown --watch",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
37
|
+
"check": "biome check",
|
|
38
|
+
"fix": "biome check --write",
|
|
38
39
|
"release": "changeset publish",
|
|
39
40
|
"test": "bun test",
|
|
40
41
|
"test:watch": "bun --watch test",
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
"@changesets/cli": "2.29.6",
|
|
55
56
|
"@types/bun": "1.2.20",
|
|
56
57
|
"sherif": "1.6.1",
|
|
57
|
-
"tsdown": "0.14.
|
|
58
|
+
"tsdown": "0.14.2",
|
|
58
59
|
"type-fest": "4.41.0",
|
|
59
60
|
"typescript": "5.9.2"
|
|
60
61
|
},
|