adamantite 0.11.1 → 0.12.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/dist/index.js +1 -1
- package/package.json +6 -6
- package/src/presets/biome.jsonc +34 -10
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=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.
|
|
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.3.0`,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.7.0`};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
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.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "An strict and opinionated set of presets for modern TypeScript applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adamantite",
|
|
@@ -56,16 +56,16 @@
|
|
|
56
56
|
"nypm": "0.6.2"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@biomejs/biome": "2.
|
|
59
|
+
"@biomejs/biome": "2.3.0",
|
|
60
60
|
"@changesets/cli": "2.29.7",
|
|
61
|
-
"@types/bun": "1.3.
|
|
62
|
-
"sherif": "1.
|
|
63
|
-
"tsdown": "0.15.
|
|
61
|
+
"@types/bun": "1.3.1",
|
|
62
|
+
"sherif": "1.7.0",
|
|
63
|
+
"tsdown": "0.15.9",
|
|
64
64
|
"type-fest": "5.1.0",
|
|
65
65
|
"typescript": "5.9.3"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@biomejs/biome": "2.
|
|
68
|
+
"@biomejs/biome": "2.3.0",
|
|
69
69
|
"typescript": ">=5.6.0"
|
|
70
70
|
},
|
|
71
71
|
"packageManager": "bun@1.2.20"
|
package/src/presets/biome.jsonc
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"indentStyle": "space",
|
|
13
13
|
// Use 2 spaces for indentation.
|
|
14
14
|
"indentWidth": 2,
|
|
15
|
-
// Use
|
|
16
|
-
"lineEnding": "
|
|
15
|
+
// Use the system line ending.
|
|
16
|
+
"lineEnding": "auto",
|
|
17
17
|
// The expected line width for most editors.
|
|
18
18
|
"lineWidth": 80,
|
|
19
19
|
// Don't force attributes to be on the same line as the element.
|
|
@@ -180,6 +180,7 @@
|
|
|
180
180
|
"noVoidTypeReturn": "error",
|
|
181
181
|
"useExhaustiveDependencies": "error",
|
|
182
182
|
"useHookAtTopLevel": "error",
|
|
183
|
+
"useImageSize": "error",
|
|
183
184
|
"useIsNan": "error",
|
|
184
185
|
"useJsonImportAttributes": "error",
|
|
185
186
|
"useJsxKeyInIterable": "error",
|
|
@@ -210,14 +211,11 @@
|
|
|
210
211
|
// ----------------------- JavaScript ------------------------
|
|
211
212
|
"noFloatingPromises": "error",
|
|
212
213
|
"noMisusedPromises": "error",
|
|
213
|
-
"noNonNullAssertedOptionalChain": "error",
|
|
214
214
|
"noReactForwardRef": "error",
|
|
215
215
|
"noShadow": "error",
|
|
216
216
|
"noUnnecessaryConditions": "error",
|
|
217
217
|
"noUselessUndefined": "error",
|
|
218
218
|
"useExhaustiveSwitchCases": "error",
|
|
219
|
-
"useReactFunctionComponents": "error",
|
|
220
|
-
"useAnchorHref": "error",
|
|
221
219
|
"useConsistentArrowReturn": "error",
|
|
222
220
|
"useSortedClasses": {
|
|
223
221
|
"fix": "safe",
|
|
@@ -301,6 +299,7 @@
|
|
|
301
299
|
"useNumberNamespace": "error",
|
|
302
300
|
"useNumericSeparators": "error",
|
|
303
301
|
"useObjectSpread": "error",
|
|
302
|
+
"useReactFunctionComponents": "error",
|
|
304
303
|
"useSelfClosingElements": "error",
|
|
305
304
|
"useShorthandAssign": "error",
|
|
306
305
|
"useShorthandFunctionType": "error",
|
|
@@ -365,6 +364,7 @@
|
|
|
365
364
|
"noMisrefactoredShorthandAssign": "error",
|
|
366
365
|
"noOctalEscape": "error",
|
|
367
366
|
"noPrototypeBuiltins": "error",
|
|
367
|
+
"noNonNullAssertedOptionalChain": "error",
|
|
368
368
|
// Disabling to allow passing specific props (like `className`) from
|
|
369
369
|
// parent to child components
|
|
370
370
|
"noReactSpecificProps": "off",
|
|
@@ -407,8 +407,7 @@
|
|
|
407
407
|
"noEmptyBlock": "error",
|
|
408
408
|
"noImportantInKeyframe": "error",
|
|
409
409
|
"noShorthandPropertyOverrides": "error",
|
|
410
|
-
|
|
411
|
-
"noUnknownAtRules": "off",
|
|
410
|
+
"noUnknownAtRules": "error",
|
|
412
411
|
|
|
413
412
|
// --------------------------- JSON ---------------------------
|
|
414
413
|
"noBiomeFirstException": "error",
|
|
@@ -444,7 +443,8 @@
|
|
|
444
443
|
},
|
|
445
444
|
"parser": {
|
|
446
445
|
"allowWrongLineComments": false,
|
|
447
|
-
"cssModules": false
|
|
446
|
+
"cssModules": false,
|
|
447
|
+
"tailwindDirectives": true
|
|
448
448
|
}
|
|
449
449
|
},
|
|
450
450
|
// ------------------------------ JSON -------------------------------
|
|
@@ -456,7 +456,7 @@
|
|
|
456
456
|
"enabled": true,
|
|
457
457
|
"indentStyle": "space",
|
|
458
458
|
"indentWidth": 2,
|
|
459
|
-
"lineEnding": "
|
|
459
|
+
"lineEnding": "auto",
|
|
460
460
|
"lineWidth": 80,
|
|
461
461
|
"trailingCommas": "none"
|
|
462
462
|
},
|
|
@@ -464,10 +464,34 @@
|
|
|
464
464
|
"enabled": true
|
|
465
465
|
}
|
|
466
466
|
},
|
|
467
|
+
"html": {
|
|
468
|
+
"assist": {
|
|
469
|
+
"enabled": true
|
|
470
|
+
},
|
|
471
|
+
"experimentalFullSupportEnabled": true,
|
|
472
|
+
"formatter": {
|
|
473
|
+
"enabled": true,
|
|
474
|
+
|
|
475
|
+
"attributePosition": "auto",
|
|
476
|
+
"bracketSameLine": false,
|
|
477
|
+
"indentStyle": "space",
|
|
478
|
+
"indentScriptAndStyle": false,
|
|
479
|
+
"lineEnding": "auto",
|
|
480
|
+
"selfCloseVoidElements": "always",
|
|
481
|
+
"whitespaceSensitivity": "strict"
|
|
482
|
+
},
|
|
483
|
+
"linter": {
|
|
484
|
+
"enabled": true
|
|
485
|
+
},
|
|
486
|
+
"parser": {
|
|
487
|
+
"interpolation": true
|
|
488
|
+
}
|
|
489
|
+
},
|
|
467
490
|
"vcs": {
|
|
491
|
+
"enabled": true,
|
|
492
|
+
|
|
468
493
|
"clientKind": "git",
|
|
469
494
|
"defaultBranch": "main",
|
|
470
|
-
"enabled": true,
|
|
471
495
|
"useIgnoreFile": true
|
|
472
496
|
}
|
|
473
497
|
}
|