adamantite 0.5.0 → 0.6.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/biome.jsonc CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
- "$schema": "https://biomejs.dev/schemas/2.1.4/schema.json",
2
+ "$schema": "https://biomejs.dev/schemas/2.2.0/schema.json",
3
3
 
4
4
  // ---------------------------- FORMATTER -----------------------------
5
5
  // These are the generic settings that apply to all files in the project.
6
6
  "formatter": {
7
7
  "enabled": true,
8
+
8
9
  // Format the code even if there are errors.
9
10
  "formatWithErrors": true,
10
11
  // Use spaces for indentation.
@@ -23,6 +24,8 @@
23
24
  // ------------------------------ ASSIST ------------------------------
24
25
  // Help with code organization.
25
26
  "assist": {
27
+ "enabled": true,
28
+
26
29
  "actions": {
27
30
  "source": {
28
31
  // Sort imports in a certain order. We prioritize runtime imports
@@ -34,7 +37,9 @@
34
37
  "groups": [":BUN:", ":NODE:", ":PACKAGE:", ":ALIAS:"]
35
38
  }
36
39
  },
40
+ // Enforce that the attributes of a JSX element are sorted.
37
41
  "useSortedAttributes": "on",
42
+ // Enforce that CSS properties are sorted.
38
43
  "useSortedProperties": "on",
39
44
  // Don't sort the keys of an object.
40
45
  "useSortedKeys": "off"
@@ -48,13 +53,16 @@
48
53
  "enabled": true,
49
54
  "rules": {
50
55
  "a11y": {
56
+ // ----------------------- JavaScript ------------------------
51
57
  "noAccessKey": "error",
52
58
  "noAriaHiddenOnFocusable": "error",
53
59
  "noAriaUnsupportedElements": "error",
60
+ "noAutofocus": "error",
54
61
  "noDistractingElements": "error",
55
62
  "noHeaderScope": "error",
56
63
  "noInteractiveElementToNoninteractiveRole": "error",
57
64
  "noLabelWithoutControl": "error",
65
+ "noNoninteractiveElementInteractions": "error",
58
66
  "noNoninteractiveElementToInteractiveRole": "error",
59
67
  "noNoninteractiveTabindex": "error",
60
68
  "noPositiveTabindex": "error",
@@ -82,24 +90,55 @@
82
90
  "useValidAriaValues": "error",
83
91
  "useValidAutocomplete": "error",
84
92
  "useValidLang": "error",
85
- "noAutofocus": "off",
93
+
94
+ // --------------------------- CSS ---------------------------
86
95
  "useGenericFontNames": "error"
87
96
  },
88
97
  "complexity": {
98
+ // ----------------------- JavaScript ------------------------
89
99
  "noAdjacentSpacesInRegex": "error",
90
100
  "noArguments": "error",
91
101
  "noBannedTypes": "error",
92
102
  "noCommaOperator": "error",
93
103
  "noEmptyTypeParameters": "error",
104
+ "noExtraBooleanCast": "error",
94
105
  "noExcessiveCognitiveComplexity": {
95
106
  "level": "error",
96
107
  "options": {
97
- "maxAllowedComplexity": 18
108
+ "maxAllowedComplexity": 20
98
109
  }
99
110
  },
100
111
  "noExcessiveNestedTestSuites": "error",
112
+ "noStaticOnlyClass": "error",
113
+ "noThisInStatic": "error",
114
+ "noUselessContinue": "error",
115
+ "noUselessEmptyExport": "error",
116
+ "noUselessEscapeInRegex": "error",
117
+ "noUselessFragments": "error",
118
+ "noUselessLabel": "error",
119
+ "noUselessLoneBlockStatements": "error",
120
+ "noUselessRename": "error",
121
+ "noUselessStringConcat": "error",
122
+ "noUselessStringRaw": "error",
123
+ "noUselessSwitchCase": "error",
124
+ "noUselessTernary": "error",
125
+ "noUselessThisAlias": "error",
126
+ "noUselessTypeConstraint": "error",
127
+ "noUselessUndefinedInitialization": "error",
128
+ "useArrowFunction": "error",
129
+ "useDateNow": "error",
130
+ "useFlatMap": "error",
131
+ "useIndexOf": "error",
132
+ "useLiteralKeys": "error",
133
+ "useNumericLiterals": "error",
134
+ "useOptionalChain": "error",
135
+ "useRegexLiterals": "error",
136
+ "useSimpleNumberKeys": "error",
101
137
  "useSimplifiedLogicExpression": "error",
102
- "useWhile": "error"
138
+ "useWhile": "error",
139
+
140
+ // --------------------------- CSS ---------------------------
141
+ "noImportantStyles": "error"
103
142
  },
104
143
  "correctness": {
105
144
  // ----------------------- JavaScript ------------------------
@@ -110,21 +149,23 @@
110
149
  "noConstructorReturn": "error",
111
150
  "noEmptyCharacterClassInRegex": "error",
112
151
  "noEmptyPattern": "error",
152
+ "noGlobalDirnameFilename": "error",
113
153
  "noGlobalObjectCalls": "error",
114
154
  "noInnerDeclarations": "error",
115
155
  "noInvalidBuiltinInstantiation": "error",
116
156
  "noInvalidConstructorSuper": "error",
117
157
  "noInvalidUseBeforeDeclaration": "error",
158
+ "noNestedComponentDefinitions": "error",
118
159
  "noNodejsModules": "off",
119
160
  "noNonoctalDecimalEscape": "error",
120
161
  "noPrecisionLoss": "error",
121
162
  "noPrivateImports": "error",
163
+ "noProcessGlobal": "off",
122
164
  "noRenderReturnValue": "error",
123
165
  "noSelfAssign": "error",
124
166
  "noSetterReturn": "error",
125
167
  "noStringCaseMismatch": "error",
126
168
  "noSwitchDeclarations": "error",
127
- "noUndeclaredDependencies": "off",
128
169
  "noUndeclaredVariables": "error",
129
170
  "noUnreachable": "error",
130
171
  "noUnreachableSuper": "error",
@@ -139,9 +180,12 @@
139
180
  "noVoidTypeReturn": "error",
140
181
  "useExhaustiveDependencies": "error",
141
182
  "useHookAtTopLevel": "error",
142
- "useImportExtensions": "off",
143
183
  "useIsNan": "error",
184
+ "useJsonImportAttributes": "error",
144
185
  "useJsxKeyInIterable": "error",
186
+ "useParseIntRadix": "error",
187
+ "useSingleJsDocAsterisk": "error",
188
+ "useUniqueElementIds": "error",
145
189
  "useValidForDirection": "error",
146
190
  "useValidTypeof": "error",
147
191
  "useYield": "error",
@@ -151,6 +195,8 @@
151
195
  "noInvalidGridAreas": "error",
152
196
  "noInvalidPositionAtImportRule": "error",
153
197
  "noMissingVarFunction": "error",
198
+ "noReactPropAssignments": "error",
199
+ "noRestrictedElements": "error",
154
200
  "noUnknownFunction": "error",
155
201
  "noUnknownMediaFeatureName": "error",
156
202
  "noUnknownProperty": "error",
@@ -162,39 +208,15 @@
162
208
  },
163
209
  "nursery": {
164
210
  // ----------------------- JavaScript ------------------------
165
- "noAwaitInLoop": "error",
166
- "noBitwiseOperators": "error",
167
- "noConstantBinaryExpression": "error",
168
- "noGlobalDirnameFilename": "error",
169
- "noNestedComponentDefinitions": "error",
170
- "noNoninteractiveElementInteractions": "error",
171
- "noReactPropAssign": "error",
172
- "noRestrictedElements": "error",
211
+ "noFloatingPromises": "error",
212
+ "noMisusedPromises": "error",
213
+ "noNonNullAssertedOptionalChain": "error",
173
214
  "noShadow": "error",
174
- "noTsIgnore": "error",
175
- "noUnwantedPolyfillio": "error",
176
- "noUselessBackrefInRegex": "error",
177
- "noUselessEscapeInString": "error",
215
+ "noUnnecessaryConditions": "error",
178
216
  "noUselessUndefined": "error",
179
- "useAdjacentGetterSetter": "error",
180
- "useConsistentObjectDefinition": "error",
181
- "useConsistentResponse": "error",
182
217
  "useExhaustiveSwitchCases": "error",
183
- "useGoogleFontPreconnect": "error",
184
- "useIndexOf": "error",
185
- "useIterableCallbackReturn": "error",
186
- "useJsonImportAttribute": "error",
187
- "useNumericSeparators": "error",
188
- "useObjectSpread": "error",
189
- "useParseIntRadix": "error",
190
- "useSingleJsDocAsterisk": "error",
191
- "useSymbolDescription": "error",
192
-
193
- "useExplicitType": "off",
194
-
195
- "noProcessGlobal": "off",
196
- "noSecrets": "off",
197
- "useExportsLast": "off",
218
+ "useReactFunctionComponents": "error",
219
+ "useAnchorHref": "error",
198
220
  "useSortedClasses": {
199
221
  "fix": "safe",
200
222
  "level": "error",
@@ -202,30 +224,17 @@
202
224
  "attributes": ["className"],
203
225
  "functions": ["clsx", "cva", "tw", "twMerge", "cn", "twJoin", "tv"]
204
226
  }
205
- },
206
- "useUniqueElementIds": "off",
207
-
208
- // These rules should be enabled eventually
209
- "noFloatingPromises": "off",
210
- "noImportCycles": "off",
211
- "noUnresolvedImports": "off",
212
-
213
- // --------------------------- CSS ---------------------------
214
- "noImportantStyles": "error",
215
- // Disabling this rule since we need custom at-rules for Tailwind
216
- "noUnknownAtRule": "off"
227
+ }
217
228
  },
218
229
  "performance": {
219
230
  // ----------------------- JavaScript ------------------------
220
-
221
231
  "noAccumulatingSpread": "error",
222
- "noBarrelFile": "off",
232
+ "noAwaitInLoops": "error",
223
233
  "noDelete": "error",
224
234
  "noDynamicNamespaceImportAccess": "error",
225
- "noImgElement": "error",
226
- "noNamespaceImport": "off",
227
- "noReExportAll": "off",
228
- "useTopLevelRegex": "error"
235
+ "useTopLevelRegex": "error",
236
+ "noUnwantedPolyfillio": "error",
237
+ "useGoogleFontPreconnect": "error"
229
238
  },
230
239
  "security": {
231
240
  // ----------------------- JavaScript ------------------------
@@ -236,8 +245,6 @@
236
245
  },
237
246
  "style": {
238
247
  // ----------------------- JavaScript ------------------------
239
- "noCommonJs": "off",
240
- "noDefaultExport": "off",
241
248
  "noDoneCallback": "error",
242
249
  "noEnum": "error",
243
250
  "noExportedImports": "error",
@@ -246,11 +253,9 @@
246
253
  "noInferrableTypes": "error",
247
254
  "noNamespace": "error",
248
255
  "noNegationElse": "error",
249
- "noNestedTernary": "off",
250
256
  "noNonNullAssertion": "error",
251
257
  "noParameterAssign": "error",
252
258
  "noParameterProperties": "error",
253
- "noProcessEnv": "off",
254
259
  "noRestrictedGlobals": "error",
255
260
  "noRestrictedImports": "error",
256
261
  "noRestrictedTypes": "error",
@@ -265,7 +270,6 @@
265
270
  "useBlockStatements": "error",
266
271
  "useCollapsedElseIf": "error",
267
272
  "useCollapsedIf": "error",
268
- "useComponentExportOnlyModules": "off",
269
273
  "useConsistentArrayType": "error",
270
274
  "useConsistentBuiltinInstantiation": "error",
271
275
  "useConsistentCurlyBraces": "off",
@@ -274,7 +278,7 @@
274
278
  "useDefaultParameterLast": "error",
275
279
  "useDefaultSwitchClause": "error",
276
280
  "useEnumInitializers": "error",
277
- "useExplicitLengthCheck": "off",
281
+ "useExplicitLengthCheck": "error",
278
282
  "useExponentiationOperator": "error",
279
283
  "useExportType": "error",
280
284
  "useFilenamingConvention": {
@@ -285,18 +289,22 @@
285
289
  "match": "[-?%+]?(.+?)[.](.+)"
286
290
  }
287
291
  },
292
+ "useConsistentObjectDefinitions": "error",
288
293
  "useForOf": "error",
289
294
  "useFragmentSyntax": "error",
295
+ "useGroupedAccessorPairs": "error",
290
296
  "useImportType": "error",
291
297
  "useLiteralEnumMembers": "error",
292
- "useNamingConvention": "off",
293
298
  "useNodeAssertStrict": "error",
294
299
  "useNodejsImportProtocol": "error",
295
300
  "useNumberNamespace": "error",
301
+ "useNumericSeparators": "error",
302
+ "useObjectSpread": "error",
296
303
  "useSelfClosingElements": "error",
297
304
  "useShorthandAssign": "error",
298
305
  "useShorthandFunctionType": "error",
299
- "useSingleVarDeclarator": "off",
306
+ "useSingleVarDeclarator": "error",
307
+ "useSymbolDescription": "error",
300
308
  "useTemplate": "error",
301
309
  "useThrowNewError": "error",
302
310
  "useThrowOnlyError": "error",
@@ -311,6 +319,7 @@
311
319
  "noArrayIndexKey": "error",
312
320
  "noAssignInExpressions": "error",
313
321
  "noAsyncPromiseExecutor": "error",
322
+ "noBitwiseOperators": "error",
314
323
  "noCatchAssign": "error",
315
324
  "noClassAssign": "error",
316
325
  "noCommentText": "error",
@@ -319,6 +328,7 @@
319
328
  "noConfusingVoidType": "error",
320
329
  // Warn for the use of console to avoid accidental logging. Prefer a dedicated logger.
321
330
  "noConsole": "warn",
331
+ "noConstantBinaryExpressions": "error",
322
332
  "noConstEnum": "error",
323
333
  "noControlCharactersInRegex": "error",
324
334
  "noDebugger": "error",
@@ -355,6 +365,8 @@
355
365
  "noMisrefactoredShorthandAssign": "error",
356
366
  "noOctalEscape": "error",
357
367
  "noPrototypeBuiltins": "error",
368
+ // Disabling to allow passing specific props (like `className`) from
369
+ // parent to child components
358
370
  "noReactSpecificProps": "off",
359
371
  "noRedeclare": "error",
360
372
  "noRedundantUseStrict": "error",
@@ -365,8 +377,11 @@
365
377
  "noSuspiciousSemicolonInJsx": "error",
366
378
  "noTemplateCurlyInString": "error",
367
379
  "noThenProperty": "error",
380
+ "noTsIgnore": "error",
368
381
  "noUnsafeDeclarationMerging": "error",
369
382
  "noUnsafeNegation": "error",
383
+ "noUselessEscapeInString": "error",
384
+ "noUselessRegexBackrefs": "error",
370
385
  "noVar": "error",
371
386
  "noWith": "error",
372
387
  "useAdjacentOverloadSignatures": "error",
@@ -377,8 +392,10 @@
377
392
  "useGoogleFontDisplay": "error",
378
393
  "useGuardForIn": "error",
379
394
  "useIsArray": "error",
395
+ "useIterableCallbackReturn": "error",
380
396
  "useNamespaceKeyword": "error",
381
397
  "useNumberToFixedDigitsArgument": "error",
398
+ "useStaticResponseMethods": "error",
382
399
  "useStrictMode": "error",
383
400
 
384
401
  // --------------------------- CSS ---------------------------
@@ -389,7 +406,14 @@
389
406
  "noDuplicateSelectorsKeyframeBlock": "error",
390
407
  "noEmptyBlock": "error",
391
408
  "noImportantInKeyframe": "error",
392
- "noShorthandPropertyOverrides": "error"
409
+ "noShorthandPropertyOverrides": "error",
410
+ // Disabling this rule since we need custom at-rules for Tailwind
411
+ "noUnknownAtRules": "off",
412
+
413
+ // --------------------------- JSON ---------------------------
414
+ "noBiomeFirstException": "error",
415
+ "noQuickfixBiome": "error",
416
+ "useBiomeIgnoreFolder": "error"
393
417
  }
394
418
  }
395
419
  },
@@ -397,12 +421,13 @@
397
421
  // Options for JavaScript and TypeScript files.
398
422
  "javascript": {
399
423
  "formatter": {
424
+ "enabled": true,
425
+
400
426
  "arrowParentheses": "always",
401
427
  "attributePosition": "auto",
402
428
  "bracketSameLine": false,
403
429
  "bracketSpacing": true,
404
- "enabled": true,
405
- "indentStyle": "space",
430
+ "expand": "auto",
406
431
  "jsxQuoteStyle": "double",
407
432
  "quoteProperties": "asNeeded",
408
433
  "quoteStyle": "double",
package/dist/index.js CHANGED
@@ -11,4 +11,4 @@ import{Command as e}from"commander";import t from"process";import{spawnSync as n
11
11
  ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
12
12
  ┃ ADAMANTITE ┃
13
13
  ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
14
- `}async function O(e,n){try{let t=await T(),r=E(t),i=[`@biomejs/biome`,`check`,`--write`];n.unsafe&&i.push(`--unsafe`),e.length>0&&i.push(...e),b(r,i)}catch(e){let n=e instanceof Error?e.message:`An unknown error occurred`;console.error(`Failed to run Adamantite:`,n),t.exit(1)}}const k={config:{extends:`adamantite/presets/tsconfig.json`},async exists(){return await x(s(process.cwd(),`tsconfig.json`))},async create(){await o(s(process.cwd(),`tsconfig.json`),JSON.stringify(this.config,null,2))},async update(){let e=await a(s(process.cwd(),`tsconfig.json`),`utf-8`),t=v(e),n=_(this.config,t);await o(s(process.cwd(),`tsconfig.json`),JSON.stringify(n,null,2))}},A={version:`2.1.4`,config:{$schema:`./node_modules/@biomejs/biome/configuration_schema.json`},async exists(){return await x(s(process.cwd(),`biome.jsonc`))},async create(){await o(s(process.cwd(),`biome.jsonc`),JSON.stringify({...this.config,extends:[`adamantite`]},null,2))},async update(){let e=await x(s(process.cwd(),`biome.jsonc`))?s(process.cwd(),`biome.jsonc`):s(process.cwd(),`biome.json`),t=await a(e,`utf-8`),n=v(t),r={...n};Array.isArray(r.extends)||(r.extends=r.extends?[r.extends]:[]),r.extends.includes(`adamantite`)||r.extends.push(`adamantite`);let i=_(this.config,r);await o(s(process.cwd(),`biome.jsonc`),JSON.stringify(i,null,2))}},j={config:{"typescript.tsdk":`node_modules/typescript/lib`,"editor.defaultFormatter":`esbenp.prettier-vscode`,"editor.formatOnSave":!0,"editor.formatOnPaste":!0,"editor.codeActionsOnSave":{"quickfix.biome":`explicit`,"source.organizeImports.biome":`explicit`,"source.fixAll.biome":`explicit`},"[javascript][typescript][javascriptreact][typescriptreact][json][jsonc][css][graphql]":{"editor.defaultFormatter":`biomejs.biome`}},async exists(){return await x(s(process.cwd(),`.vscode`,`settings.json`))},async create(){let e=s(process.cwd(),`.vscode`);await i(e,{recursive:!0}),await o(s(e,`settings.json`),JSON.stringify(this.config,null,2))},async update(){let e=(await x(s(process.cwd(),`.vscode`,`settings.json`)),s(process.cwd(),`.vscode`,`settings.json`)),t=await a(e,`utf-8`),n=v(t),r=_(this.config,n);await o(s(process.cwd(),`.vscode`,`settings.json`),JSON.stringify(r,null,2))}},M={version:`1.6.1`};async function N(){let e=await h({message:`Select your package manager`,options:w.map(e=>({label:e,value:e})),initialValue:await T()});if(d(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 x(s(e,`pnpm-workspace.yaml`)))return!0;try{let e=await S();return e.workspaces!==void 0}catch{return!1}}async function F(){let e=g();await A.exists()?(e.start(`Biome config found, updating...`),await A.update(),e.stop(`Biome config updated with Adamantite preset`)):(e.start(`Biome config not found, creating...`),await A.create(),e.stop(`Biome config created with Adamantite preset`))}async function I({lint:e,format:t,monorepo:n}){let r=g();r.start("Adding scripts to your `package.json`...");try{let i=await S();i.scripts||={},e&&(i.scripts.lint=`adamantite lint`),t&&(i.scripts.format=`adamantite format`),n&&(i.scripts[`lint:monorepo`]=`adamantite monorepo`),await C(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=g();await k.exists()?(e.start("`tsconfig.json` found, updating..."),await k.update(),e.stop("Updated `tsconfig.json` with preset")):(e.start("`tsconfig.json` not found, creating..."),await k.create(),e.stop("Created `tsconfig.json` with preset"))}async function R(){let e=await p({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(d(e))throw Error(`Operation cancelled`);return e}async function z(e){if(!e||e.length===0)return;let t=g();e.includes(`vscode`)&&(await j.exists()?(t.start(`VSCode settings found, updating...`),await j.update(),t.stop(`VSCode settings updated with Adamantite preset`)):(t.start(`VSCode settings not found, creating...`),await j.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 B(e){let t=await l({message:e});if(d(t))throw Error(`Operation cancelled`);return t}function V(e,t){let n=g();n.start(`Installing dependencies...`);try{let r=A.version,i=[`adamantite`,`@biomejs/biome@^${r}`];switch(t?.monorepo&&i.push(`sherif@${M.version}`),e){case`npm`:b(`npm`,[`install`,`--save-dev`,`--exact`,...i]);break;case`yarn`:b(`yarn`,[`add`,`--dev`,`--exact`,...i]);break;case`pnpm`:b(`pnpm`,[`add`,`--save-dev`,`--save-exact`,...i]);break;case`bun`:b(`bun`,[`add`,`--dev`,`--exact`,...i]);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 H(){u(D());try{let e=await N(),t=await P(),n=await B("Do you want to add the `format` and `lint` scripts to your `package.json`?"),r=t?await B(`We've detected a monorepo setup in your project. Would you like to install monorepo linting scripts?`):!1,i=await B(`Adamantite provides a TypeScript preset to enforce strict type-safety. Would you like to install it?`),a=await R();V(e,{monorepo:r}),await F(),(n||r)&&await I({lint:n,format:n,monorepo:r}),i&&await L(),await z(a),m(`💠 Adamantite initialized successfully!`)}catch(e){f.error(`${e instanceof Error?e.message:`Unknown error`}`),c(`Failed to initialize Adamantite`)}}async function U(e){try{let t=await T(),n=E(t),r=[`@biomejs/biome`,`lint`,`--fix`];e.length>0&&r.push(...e),b(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 W(){try{let e=await T(),t=E(e);b(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)}}async function G(){let e=[];try{let t=await S(),n=t.devDependencies?.[`@biomejs/biome`];n&&n!==A.version&&e.push({name:`@biomejs/biome`,currentVersion:n,targetVersion:A.version,isDevDependency:!0});let r=t.devDependencies?.sherif;return r&&r!==M.version&&e.push({name:`sherif`,currentVersion:r,targetVersion:M.version,isDevDependency:!0}),e}catch(e){throw Error(`Failed to read package.json: ${e instanceof Error?e.message:`Unknown error`}`)}}function K(e,t){let n=g();n.start(`Updating dependencies...`);try{let r=t.map(e=>`${e.name}@${e.targetVersion}`);switch(e){case`npm`:b(`npm`,[`install`,`--save-dev`,`--save-exact`,...r]);break;case`yarn`:b(`yarn`,[`add`,`--dev`,`--exact`,...r]);break;case`pnpm`:b(`pnpm`,[`add`,`--save-dev`,`--save-exact`,...r]);break;case`bun`:b(`bun`,[`add`,`--dev`,`--exact`,...r]);break;default:throw Error(`Invalid package manager: ${e}`)}n.stop(`Dependencies updated successfully`)}catch(e){throw n.stop(`Failed to update dependencies`),Error(`Failed to update dependencies: ${e instanceof Error?e.message:`Unknown error`}`)}}async function q(e){f.message(`The following dependencies will be updated:`),f.message(``);for(let t of e)f.message(` ${t.name}: ${t.currentVersion} → ${t.targetVersion}`);f.message(``);let t=await l({message:`Do you want to proceed with these updates?`});if(d(t))throw Error(`Operation cancelled`);return t}async function J(){u(D());try{let e=await T();if(!e)throw Error(`Unable to detect package manager. Please ensure you have a lock file (package-lock.json, yarn.lock, pnpm-lock.yaml, or bun.lock/bun.lockb) in your project.`);let t=await G();if(t.length===0){f.success(`All adamantite dependencies are already up to date!`),m(`💠 No updates needed`);return}let n=await q(t);if(!n){m(`💠 Update cancelled`);return}K(e,t),m(`💠 Dependencies updated successfully!`)}catch(e){f.error(`${e instanceof Error?e.message:`Unknown error`}`),c(`Failed to update dependencies`)}}function Y(){let e=JSON.parse(y(s(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(H),Q.command(`lint`).description(`Run Biome linter and fix files`).argument(`[files...]`,`specific files to lint (optional)`).action(U),Q.command(`format`).description(`Run Biome formatter and fix files`).argument(`[files...]`,`specific files to format (optional)`).option(`--unsafe`,`apply unsafe fixes`).action(O),Q.command(`monorepo`).description(`Lint and automatically fix monorepo-specific issues using Sherif`).action(W),Q.command(`update`).description(`Update adamantite dependencies to latest compatible versions`).action(J),Q.parse();
14
+ `}async function O(e,n){try{let t=await T(),r=E(t),i=[`@biomejs/biome`,`check`,`--write`];n.unsafe&&i.push(`--unsafe`),e.length>0&&i.push(...e),b(r,i)}catch(e){let n=e instanceof Error?e.message:`An unknown error occurred`;console.error(`Failed to run Adamantite:`,n),t.exit(1)}}const k={config:{extends:`adamantite/presets/tsconfig.json`},async exists(){return await x(s(process.cwd(),`tsconfig.json`))},async create(){await o(s(process.cwd(),`tsconfig.json`),JSON.stringify(this.config,null,2))},async update(){let e=await a(s(process.cwd(),`tsconfig.json`),`utf-8`),t=v(e),n=_(this.config,t);await o(s(process.cwd(),`tsconfig.json`),JSON.stringify(n,null,2))}},A={version:`2.2.0`,config:{$schema:`./node_modules/@biomejs/biome/configuration_schema.json`},async exists(){return await x(s(process.cwd(),`biome.jsonc`))},async create(){await o(s(process.cwd(),`biome.jsonc`),JSON.stringify({...this.config,extends:[`adamantite`]},null,2))},async update(){let e=await x(s(process.cwd(),`biome.jsonc`))?s(process.cwd(),`biome.jsonc`):s(process.cwd(),`biome.json`),t=await a(e,`utf-8`),n=v(t),r={...n};Array.isArray(r.extends)||(r.extends=r.extends?[r.extends]:[]),r.extends.includes(`adamantite`)||r.extends.push(`adamantite`);let i=_(this.config,r);await o(s(process.cwd(),`biome.jsonc`),JSON.stringify(i,null,2))}},j={config:{"typescript.tsdk":`node_modules/typescript/lib`,"editor.defaultFormatter":`esbenp.prettier-vscode`,"editor.formatOnSave":!0,"editor.formatOnPaste":!0,"editor.codeActionsOnSave":{"quickfix.biome":`explicit`,"source.organizeImports.biome":`explicit`,"source.fixAll.biome":`explicit`},"[javascript][typescript][javascriptreact][typescriptreact][json][jsonc][css][graphql]":{"editor.defaultFormatter":`biomejs.biome`}},async exists(){return await x(s(process.cwd(),`.vscode`,`settings.json`))},async create(){let e=s(process.cwd(),`.vscode`);await i(e,{recursive:!0}),await o(s(e,`settings.json`),JSON.stringify(this.config,null,2))},async update(){let e=(await x(s(process.cwd(),`.vscode`,`settings.json`)),s(process.cwd(),`.vscode`,`settings.json`)),t=await a(e,`utf-8`),n=v(t),r=_(this.config,n);await o(s(process.cwd(),`.vscode`,`settings.json`),JSON.stringify(r,null,2))}},M={version:`1.6.1`};async function N(){let e=await h({message:`Select your package manager`,options:w.map(e=>({label:e,value:e})),initialValue:await T()});if(d(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 x(s(e,`pnpm-workspace.yaml`)))return!0;try{let e=await S();return e.workspaces!==void 0}catch{return!1}}async function F(){let e=g();await A.exists()?(e.start(`Biome config found, updating...`),await A.update(),e.stop(`Biome config updated with Adamantite preset`)):(e.start(`Biome config not found, creating...`),await A.create(),e.stop(`Biome config created with Adamantite preset`))}async function I({lint:e,format:t,monorepo:n}){let r=g();r.start("Adding scripts to your `package.json`...");try{let i=await S();i.scripts||={},e&&(i.scripts.lint=`adamantite lint`),t&&(i.scripts.format=`adamantite format`),n&&(i.scripts[`lint:monorepo`]=`adamantite monorepo`),await C(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=g();await k.exists()?(e.start("`tsconfig.json` found, updating..."),await k.update(),e.stop("Updated `tsconfig.json` with preset")):(e.start("`tsconfig.json` not found, creating..."),await k.create(),e.stop("Created `tsconfig.json` with preset"))}async function R(){let e=await p({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(d(e))throw Error(`Operation cancelled`);return e}async function z(e){if(!e||e.length===0)return;let t=g();e.includes(`vscode`)&&(await j.exists()?(t.start(`VSCode settings found, updating...`),await j.update(),t.stop(`VSCode settings updated with Adamantite preset`)):(t.start(`VSCode settings not found, creating...`),await j.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 B(e){let t=await l({message:e});if(d(t))throw Error(`Operation cancelled`);return t}function V(e,t){let n=g();n.start(`Installing dependencies...`);try{let r=A.version,i=[`adamantite`,`@biomejs/biome@^${r}`];switch(t?.monorepo&&i.push(`sherif@${M.version}`),e){case`npm`:b(`npm`,[`install`,`--save-dev`,`--exact`,...i]);break;case`yarn`:b(`yarn`,[`add`,`--dev`,`--exact`,...i]);break;case`pnpm`:b(`pnpm`,[`add`,`--save-dev`,`--save-exact`,...i]);break;case`bun`:b(`bun`,[`add`,`--dev`,`--exact`,...i]);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 H(){u(D());try{let e=await N(),t=await P(),n=await B("Do you want to add the `format` and `lint` scripts to your `package.json`?"),r=t?await B(`We've detected a monorepo setup in your project. Would you like to install monorepo linting scripts?`):!1,i=await B(`Adamantite provides a TypeScript preset to enforce strict type-safety. Would you like to install it?`),a=await R();V(e,{monorepo:r}),await F(),(n||r)&&await I({lint:n,format:n,monorepo:r}),i&&await L(),await z(a),m(`💠 Adamantite initialized successfully!`)}catch(e){f.error(`${e instanceof Error?e.message:`Unknown error`}`),c(`Failed to initialize Adamantite`)}}async function U(e,{summary:n}){try{let t=await T(),r=E(t),i=[`@biomejs/biome`,`lint`,`--fix`];e.length>0&&i.push(...e),n&&i.push(`--reporter`,`summary`),b(r,i)}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 W(){try{let e=await T(),t=E(e);b(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)}}async function G(){let e=[];try{let t=await S(),n=t.devDependencies?.[`@biomejs/biome`];n&&n!==A.version&&e.push({name:`@biomejs/biome`,currentVersion:n,targetVersion:A.version,isDevDependency:!0});let r=t.devDependencies?.sherif;return r&&r!==M.version&&e.push({name:`sherif`,currentVersion:r,targetVersion:M.version,isDevDependency:!0}),e}catch(e){throw Error(`Failed to read package.json: ${e instanceof Error?e.message:`Unknown error`}`)}}function K(e,t){let n=g();n.start(`Updating dependencies...`);try{let r=t.map(e=>`${e.name}@${e.targetVersion}`);switch(e){case`npm`:b(`npm`,[`install`,`--save-dev`,`--save-exact`,...r]);break;case`yarn`:b(`yarn`,[`add`,`--dev`,`--exact`,...r]);break;case`pnpm`:b(`pnpm`,[`add`,`--save-dev`,`--save-exact`,...r]);break;case`bun`:b(`bun`,[`add`,`--dev`,`--exact`,...r]);break;default:throw Error(`Invalid package manager: ${e}`)}n.stop(`Dependencies updated successfully`)}catch(e){throw n.stop(`Failed to update dependencies`),Error(`Failed to update dependencies: ${e instanceof Error?e.message:`Unknown error`}`)}}async function q(e){f.message(`The following dependencies will be updated:`),f.message(``);for(let t of e)f.message(` ${t.name}: ${t.currentVersion} → ${t.targetVersion}`);f.message(``);let t=await l({message:`Do you want to proceed with these updates?`});if(d(t))throw Error(`Operation cancelled`);return t}async function J(){u(D());try{let e=await T();if(!e)throw Error(`Unable to detect package manager. Please ensure you have a lock file (package-lock.json, yarn.lock, pnpm-lock.yaml, or bun.lock/bun.lockb) in your project.`);let t=await G();if(t.length===0){f.success(`All adamantite dependencies are already up to date!`),m(`💠 No updates needed`);return}let n=await q(t);if(!n){m(`💠 Update cancelled`);return}K(e,t),m(`💠 Dependencies updated successfully!`)}catch(e){f.error(`${e instanceof Error?e.message:`Unknown error`}`),c(`Failed to update dependencies`)}}function Y(){let e=JSON.parse(y(s(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(H),Q.command(`lint`).description(`Run Biome linter and fix files`).argument(`[files...]`,`specific files to lint (optional)`).option(`-s, --summary`,`show summary of lint results`).action(async(e,{summary:t})=>{await U(e,{summary:t})}),Q.command(`format`).description(`Run Biome formatter and fix files`).argument(`[files...]`,`specific files to format (optional)`).option(`-u, --unsafe`,`apply unsafe fixes`).action(async(e,{unsafe:t})=>{await O(e,{unsafe:t})}),Q.command(`monorepo`).description(`Lint and automatically fix monorepo-specific issues using Sherif`).action(W),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.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "An strict and opinionated set of presets for modern TypeScript applications",
5
5
  "keywords": [
6
6
  "adamantite",
@@ -43,13 +43,14 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@clack/prompts": "0.11.0",
46
+ "@commander-js/extra-typings": "^14.0.0",
46
47
  "commander": "14.0.0",
47
48
  "defu": "6.1.4",
48
49
  "jsonc-parser": "3.3.1"
49
50
  },
50
51
  "devDependencies": {
51
- "@biomejs/biome": "2.1.4",
52
- "@changesets/cli": "2.29.5",
52
+ "@biomejs/biome": "2.2.0",
53
+ "@changesets/cli": "2.29.6",
53
54
  "@types/bun": "1.2.20",
54
55
  "sherif": "1.6.1",
55
56
  "tsdown": "0.14.1",