adamantite 0.21.0 → 0.22.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.
- package/dist/index.js +63 -26
- package/package.json +9 -8
- package/presets/knip.json +29 -0
- package/presets/oxlint/core.json +4 -1
package/dist/index.js
CHANGED
|
@@ -14,6 +14,36 @@ import { readFile as readFile2, writeFile } from "node:fs/promises";
|
|
|
14
14
|
import { join as join2 } from "node:path";
|
|
15
15
|
import { Fault as Fault2 } from "faultier";
|
|
16
16
|
import { err as err2, fromPromise as fromPromise2, ok as ok2, safeTry as safeTry2 } from "neverthrow";
|
|
17
|
+
// presets/knip.json
|
|
18
|
+
var knip_default = {
|
|
19
|
+
$schema: "https://unpkg.com/knip@5/schema.json",
|
|
20
|
+
rules: {
|
|
21
|
+
files: "error",
|
|
22
|
+
dependencies: "error",
|
|
23
|
+
devDependencies: "error",
|
|
24
|
+
optionalPeerDependencies: "warn",
|
|
25
|
+
unlisted: "error",
|
|
26
|
+
binaries: "error",
|
|
27
|
+
unresolved: "error",
|
|
28
|
+
exports: "warn",
|
|
29
|
+
nsExports: "warn",
|
|
30
|
+
types: "warn",
|
|
31
|
+
nsTypes: "warn",
|
|
32
|
+
enumMembers: "off",
|
|
33
|
+
classMembers: "off",
|
|
34
|
+
duplicates: "warn"
|
|
35
|
+
},
|
|
36
|
+
ignoreExportsUsedInFile: true,
|
|
37
|
+
ignoreFiles: [
|
|
38
|
+
"**/dist/**",
|
|
39
|
+
"**/build/**",
|
|
40
|
+
"**/coverage/**",
|
|
41
|
+
"**/.next/**",
|
|
42
|
+
"**/.vercel/**",
|
|
43
|
+
"**/.turbo/**"
|
|
44
|
+
],
|
|
45
|
+
ignore: ["**/*.d.ts"]
|
|
46
|
+
};
|
|
17
47
|
|
|
18
48
|
// src/utils.ts
|
|
19
49
|
import { spawnSync } from "node:child_process";
|
|
@@ -93,10 +123,8 @@ d8( 888 888 888 d8( 888 888 888 888 d8( 888 888 888 888 .
|
|
|
93
123
|
// src/helpers/packages/knip.ts
|
|
94
124
|
var knip = {
|
|
95
125
|
name: "knip",
|
|
96
|
-
version: "5.
|
|
97
|
-
config:
|
|
98
|
-
$schema: "https://unpkg.com/knip@5/schema-jsonc.json"
|
|
99
|
-
},
|
|
126
|
+
version: "5.79.0",
|
|
127
|
+
config: knip_default,
|
|
100
128
|
exists: async () => {
|
|
101
129
|
if (await checkIfExists(join2(process.cwd(), "knip.json"))) {
|
|
102
130
|
return { path: join2(process.cwd(), "knip.json") };
|
|
@@ -106,7 +134,7 @@ var knip = {
|
|
|
106
134
|
}
|
|
107
135
|
return { path: null };
|
|
108
136
|
},
|
|
109
|
-
create: () => fromPromise2(writeFile(join2(process.cwd(), "knip.
|
|
137
|
+
create: () => fromPromise2(writeFile(join2(process.cwd(), "knip.json"), JSON.stringify(knip.config, null, 2)), (error) => Fault2.wrap(error).withTag("FAILED_TO_WRITE_FILE").withDescription("Failed to write knip configuration", "We're unable to write the knip configuration to the current directory.")),
|
|
110
138
|
update: () => safeTry2(async function* () {
|
|
111
139
|
const exists = await knip.exists();
|
|
112
140
|
if (!exists.path) {
|
|
@@ -118,7 +146,8 @@ var knip = {
|
|
|
118
146
|
return err2(Fault2.create("INVALID_CONFIG_FORMAT").withDescription("Invalid knip configuration format", "The knip configuration must be a JSON object."));
|
|
119
147
|
}
|
|
120
148
|
const mergedConfig = yield* mergeConfig(existingConfig, knip.config);
|
|
121
|
-
|
|
149
|
+
const isJsonc = exists.path.endsWith(".jsonc");
|
|
150
|
+
mergedConfig.$schema = isJsonc ? "https://unpkg.com/knip@5/schema-jsonc.json" : "https://unpkg.com/knip@5/schema.json";
|
|
122
151
|
yield* fromPromise2(writeFile(exists.path, JSON.stringify(mergedConfig, null, 2)), (error) => Fault2.wrap(error).withTag("FAILED_TO_WRITE_FILE").withDescription("Failed to write knip configuration", "We're unable to write the knip configuration to the current directory.").withContext({ path: exists.path }));
|
|
123
152
|
return ok2();
|
|
124
153
|
})
|
|
@@ -178,7 +207,7 @@ import { Fault as Fault4 } from "faultier";
|
|
|
178
207
|
import { err as err3, fromPromise as fromPromise3, ok as ok4, safeTry as safeTry4 } from "neverthrow";
|
|
179
208
|
var oxlint = {
|
|
180
209
|
name: "oxlint",
|
|
181
|
-
version: "1.
|
|
210
|
+
version: "1.36.0",
|
|
182
211
|
config: {
|
|
183
212
|
$schema: "./node_modules/oxlint/configuration_schema.json"
|
|
184
213
|
},
|
|
@@ -226,7 +255,7 @@ var oxlint = {
|
|
|
226
255
|
};
|
|
227
256
|
var tsgolint = {
|
|
228
257
|
name: "oxlint-tsgolint",
|
|
229
|
-
version: "0.10.
|
|
258
|
+
version: "0.10.1"
|
|
230
259
|
};
|
|
231
260
|
|
|
232
261
|
// src/commands/check.ts
|
|
@@ -368,7 +397,7 @@ var oxfmt_default = {
|
|
|
368
397
|
// src/helpers/packages/oxfmt.ts
|
|
369
398
|
var oxfmt = {
|
|
370
399
|
name: "oxfmt",
|
|
371
|
-
version: "0.
|
|
400
|
+
version: "0.21.0",
|
|
372
401
|
config: {
|
|
373
402
|
$schema: "./node_modules/oxfmt/configuration_schema.json",
|
|
374
403
|
...oxfmt_default
|
|
@@ -576,7 +605,14 @@ ${setupSteps[packageManager]}
|
|
|
576
605
|
return `${workflow}
|
|
577
606
|
`;
|
|
578
607
|
};
|
|
579
|
-
var
|
|
608
|
+
var CI_COMPATIBLE_SCRIPTS = new Set([
|
|
609
|
+
"check",
|
|
610
|
+
"format",
|
|
611
|
+
"typecheck",
|
|
612
|
+
"check:monorepo",
|
|
613
|
+
"analyze"
|
|
614
|
+
]);
|
|
615
|
+
var hasCICompatibleScripts = (scripts) => scripts.some((script) => CI_COMPATIBLE_SCRIPTS.has(script));
|
|
580
616
|
var github = {
|
|
581
617
|
workflowPath: ".github/workflows/adamantite.yml",
|
|
582
618
|
exists: () => checkIfExists(join5(process7.cwd(), ".github", "workflows", "adamantite.yml")),
|
|
@@ -659,9 +695,17 @@ var vscode = {
|
|
|
659
695
|
yield* fromPromise6(writeFile5(join6(process.cwd(), ".vscode", "settings.json"), JSON.stringify(newConfig, null, 2)), (error) => Fault10.wrap(error).withTag("FAILED_TO_WRITE_FILE").withDescription("Failed to write .vscode/settings.json", "We're unable to write the .vscode/settings.json file in the current directory.").withContext({ path: vscodePath }));
|
|
660
696
|
return ok10();
|
|
661
697
|
}),
|
|
662
|
-
extension: () => safeTry10(function* () {
|
|
698
|
+
extension: (scripts = []) => safeTry10(function* () {
|
|
663
699
|
yield* vscode.cliExists();
|
|
664
|
-
|
|
700
|
+
if (scripts.includes("check") || scripts.includes("fix") || scripts.includes("format")) {
|
|
701
|
+
yield* runCommand("code --install-extension oxc.oxc-vscode").mapErr((error) => Fault10.wrap(error).withTag("FAILED_TO_INSTALL_EXTENSION").withDescription("Failed to install VS Code extension", "An error occurred while installing the VS Code extension."));
|
|
702
|
+
}
|
|
703
|
+
if (scripts.includes("analyze")) {
|
|
704
|
+
yield* runCommand("code --install-extension webpro.vscode-knip").mapErr((error) => Fault10.wrap(error).withTag("FAILED_TO_INSTALL_EXTENSION").withDescription("Failed to install VS Code extension", "An error occurred while installing the VS Code extension."));
|
|
705
|
+
}
|
|
706
|
+
if (scripts.includes("typecheck")) {
|
|
707
|
+
yield* runCommand("code --install-extension TypeScriptTeam.native-preview").mapErr((error) => Fault10.wrap(error).withTag("FAILED_TO_INSTALL_EXTENSION").withDescription("Failed to install VS Code extension", "An error occurred while installing the VS Code extension."));
|
|
708
|
+
}
|
|
665
709
|
return ok10();
|
|
666
710
|
})
|
|
667
711
|
};
|
|
@@ -679,7 +723,7 @@ import { Fault as Fault11 } from "faultier";
|
|
|
679
723
|
import { err as err6, fromPromise as fromPromise7, ok as ok11, safeTry as safeTry11 } from "neverthrow";
|
|
680
724
|
var typescript = {
|
|
681
725
|
name: "@typescript/native-preview",
|
|
682
|
-
version: "7.0.0-dev.
|
|
726
|
+
version: "7.0.0-dev.20260103.1",
|
|
683
727
|
command: "tsgo",
|
|
684
728
|
config: { extends: "adamantite/typescript" },
|
|
685
729
|
exists: () => checkIfExists(join7(process.cwd(), "tsconfig.json")),
|
|
@@ -701,10 +745,7 @@ var installDependencies = (packages) => safeTry12(async function* () {
|
|
|
701
745
|
const s = p.spinner();
|
|
702
746
|
s.start("Installing dependencies...");
|
|
703
747
|
const isMonorepo = yield* checkIsMonorepo();
|
|
704
|
-
|
|
705
|
-
s.message(`Installing dependency: ${pkg}...`);
|
|
706
|
-
yield* fromPromise8(addDevDependency(pkg, { silent: true, workspace: isMonorepo }), (error) => Fault12.wrap(error).withTag("FAILED_TO_INSTALL_DEPENDENCY").withMessage(`Failed to install ${pkg}`));
|
|
707
|
-
}
|
|
748
|
+
yield* fromPromise8(addDevDependency(packages, { silent: true, workspace: isMonorepo }), (error) => Fault12.wrap(error).withTag("FAILED_TO_INSTALL_DEPENDENCY").withMessage(`Failed to install dependencies: ${packages.join(", ")}`));
|
|
708
749
|
s.stop("Dependencies installed.");
|
|
709
750
|
return ok12();
|
|
710
751
|
});
|
|
@@ -821,12 +862,12 @@ var setupEditors = (editors) => safeTry12(async function* () {
|
|
|
821
862
|
if (editors.includes("zed")) {}
|
|
822
863
|
return ok12();
|
|
823
864
|
});
|
|
824
|
-
var installEditorExtensions = (editors) => safeTry12(function* () {
|
|
865
|
+
var installEditorExtensions = (editors, scripts) => safeTry12(function* () {
|
|
825
866
|
const spinner2 = p.spinner();
|
|
826
867
|
spinner2.start("Installing editor extensions...");
|
|
827
868
|
if (editors.includes("vscode")) {
|
|
828
869
|
spinner2.message("Installing VS Code extension...");
|
|
829
|
-
yield* vscode.extension();
|
|
870
|
+
yield* vscode.extension(scripts);
|
|
830
871
|
}
|
|
831
872
|
if (editors.includes("zed")) {}
|
|
832
873
|
spinner2.stop("Editor extensions installed successfully.");
|
|
@@ -991,7 +1032,7 @@ var init_default = defineCommand({
|
|
|
991
1032
|
}
|
|
992
1033
|
yield* setupEditors(editors);
|
|
993
1034
|
if (installExtensions) {
|
|
994
|
-
yield* installEditorExtensions(editors);
|
|
1035
|
+
yield* installEditorExtensions(editors, scripts);
|
|
995
1036
|
}
|
|
996
1037
|
if (enableGitHubActions) {
|
|
997
1038
|
yield* setupGitHubActions(packageManager, scripts);
|
|
@@ -1119,11 +1160,9 @@ var update_default = defineCommand({
|
|
|
1119
1160
|
return ok15("no-updates");
|
|
1120
1161
|
}
|
|
1121
1162
|
log8.message("The following dependencies will be updated:");
|
|
1122
|
-
log8.message("");
|
|
1123
1163
|
for (const dep of updates) {
|
|
1124
1164
|
log8.message(` ${dep.name}: ${dep.currentVersion} → ${dep.targetVersion}`);
|
|
1125
1165
|
}
|
|
1126
|
-
log8.message("");
|
|
1127
1166
|
const shouldUpdate = yield* fromSafePromise2(confirm2({
|
|
1128
1167
|
message: "Do you want to proceed with these updates?"
|
|
1129
1168
|
}));
|
|
@@ -1135,9 +1174,7 @@ var update_default = defineCommand({
|
|
|
1135
1174
|
}
|
|
1136
1175
|
const s = spinner2();
|
|
1137
1176
|
s.start("Updating dependencies...");
|
|
1138
|
-
|
|
1139
|
-
yield* fromPromise9(addDevDependency2(`${dep.name}@${dep.targetVersion}`), (error) => Fault15.wrap(error).withTag("FAILED_TO_INSTALL_DEPENDENCY").withMessage(`Failed to update ${dep.name}`));
|
|
1140
|
-
}
|
|
1177
|
+
yield* fromPromise9(addDevDependency2(updates.map((dep) => `${dep.name}@${dep.targetVersion}`), { silent: true }), (error) => Fault15.wrap(error).withTag("FAILED_TO_INSTALL_DEPENDENCY").withMessage(`Failed to update dependencies: ${updates.map((dep) => dep.name).join(", ")}`));
|
|
1141
1178
|
s.stop("Dependencies updated successfully");
|
|
1142
1179
|
return ok15("updated");
|
|
1143
1180
|
}).match((value) => {
|
|
@@ -1165,5 +1202,5 @@ var update_default = defineCommand({
|
|
|
1165
1202
|
});
|
|
1166
1203
|
|
|
1167
1204
|
// src/index.ts
|
|
1168
|
-
var version = await "0.
|
|
1205
|
+
var version = await "0.22.1";
|
|
1169
1206
|
yargs(hideBin(process.argv)).scriptName("adamantite").version(version).command(analyze_default).command(check_default).command(fix_default).command(format_default).command(init_default).command(monorepo_default).command(typecheck_default).command(update_default).demandCommand(1).strict().help().parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adamantite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.1",
|
|
4
4
|
"description": "An strict and opinionated set of presets for modern TypeScript applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adamantite",
|
|
@@ -37,9 +37,10 @@
|
|
|
37
37
|
"#presets/*": "./presets/*"
|
|
38
38
|
},
|
|
39
39
|
"exports": {
|
|
40
|
+
"./analyze": "./presets/knip.json",
|
|
41
|
+
"./format": "./presets/oxfmt.json",
|
|
40
42
|
"./lint": "./presets/oxlint/core.json",
|
|
41
43
|
"./lint/*": "./presets/oxlint/*.json",
|
|
42
|
-
"./format": "./presets/oxfmt.json",
|
|
43
44
|
"./typescript": "./presets/tsconfig.json",
|
|
44
45
|
"./presets/*": "./presets/*"
|
|
45
46
|
},
|
|
@@ -71,12 +72,12 @@
|
|
|
71
72
|
"@changesets/cli": "2.29.8",
|
|
72
73
|
"@types/bun": "1.3.5",
|
|
73
74
|
"@types/yargs": "17.0.35",
|
|
74
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
75
|
-
"bunup": "0.16.
|
|
76
|
-
"knip": "5.
|
|
77
|
-
"oxfmt": "0.
|
|
78
|
-
"oxlint": "1.
|
|
79
|
-
"oxlint-tsgolint": "0.10.
|
|
75
|
+
"@typescript/native-preview": "7.0.0-dev.20260103.1",
|
|
76
|
+
"bunup": "0.16.17",
|
|
77
|
+
"knip": "5.79.0",
|
|
78
|
+
"oxfmt": "0.21.0",
|
|
79
|
+
"oxlint": "1.36.0",
|
|
80
|
+
"oxlint-tsgolint": "0.10.1",
|
|
80
81
|
"sherif": "1.9.0",
|
|
81
82
|
"type-fest": "5.3.1",
|
|
82
83
|
"typescript": "5.9.3"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/knip@5/schema.json",
|
|
3
|
+
"rules": {
|
|
4
|
+
"files": "error",
|
|
5
|
+
"dependencies": "error",
|
|
6
|
+
"devDependencies": "error",
|
|
7
|
+
"optionalPeerDependencies": "warn",
|
|
8
|
+
"unlisted": "error",
|
|
9
|
+
"binaries": "error",
|
|
10
|
+
"unresolved": "error",
|
|
11
|
+
"exports": "warn",
|
|
12
|
+
"nsExports": "warn",
|
|
13
|
+
"types": "warn",
|
|
14
|
+
"nsTypes": "warn",
|
|
15
|
+
"enumMembers": "off",
|
|
16
|
+
"classMembers": "off",
|
|
17
|
+
"duplicates": "warn"
|
|
18
|
+
},
|
|
19
|
+
"ignoreExportsUsedInFile": true,
|
|
20
|
+
"ignoreFiles": [
|
|
21
|
+
"**/dist/**",
|
|
22
|
+
"**/build/**",
|
|
23
|
+
"**/coverage/**",
|
|
24
|
+
"**/.next/**",
|
|
25
|
+
"**/.vercel/**",
|
|
26
|
+
"**/.turbo/**"
|
|
27
|
+
],
|
|
28
|
+
"ignore": ["**/*.d.ts"]
|
|
29
|
+
}
|
package/presets/oxlint/core.json
CHANGED
|
@@ -44,7 +44,10 @@
|
|
|
44
44
|
"no-unsafe-finally": "error",
|
|
45
45
|
"no-unsafe-negation": "error",
|
|
46
46
|
"no-unsafe-optional-chaining": "error",
|
|
47
|
-
"no-unused-expressions":
|
|
47
|
+
"no-unused-expressions": [
|
|
48
|
+
"error",
|
|
49
|
+
{ "allowTaggedTemplates": true, "allowTernary": true, "enforceForJSX": true }
|
|
50
|
+
],
|
|
48
51
|
"no-unused-labels": "error",
|
|
49
52
|
"no-unused-private-class-members": "error",
|
|
50
53
|
"no-unused-vars": "error",
|