adamantite 0.27.3 → 0.28.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 +4 -4
- package/dist/index.js +269 -188
- package/package.json +10 -12
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
Adamantite is a collection of presets for
|
|
21
21
|
[oxlint](https://oxc.rs/docs/guide/usage/linter.html),
|
|
22
22
|
[oxfmt](https://oxc.rs/docs/guide/usage/formatter.html),
|
|
23
|
-
[
|
|
23
|
+
[TypeScript](https://www.typescriptlang.org/) and
|
|
24
24
|
[sherif](https://github.com/QuiiBz/sherif) that are designed to help humans and agents write
|
|
25
25
|
maintainable and scalable type-safe code, both for individual projects and monorepos.
|
|
26
26
|
|
|
@@ -145,14 +145,14 @@ Automatically detects and fixes:
|
|
|
145
145
|
|
|
146
146
|
### `adamantite typecheck`
|
|
147
147
|
|
|
148
|
-
Run TypeScript type checking using
|
|
148
|
+
Run TypeScript type checking using tsc and the strict preset:
|
|
149
149
|
|
|
150
150
|
```shell
|
|
151
151
|
# Type check all files
|
|
152
152
|
adamantite typecheck
|
|
153
153
|
|
|
154
|
-
# Type check specific
|
|
155
|
-
adamantite typecheck
|
|
154
|
+
# Type check a specific project
|
|
155
|
+
adamantite typecheck --project tsconfig.json
|
|
156
156
|
```
|
|
157
157
|
|
|
158
158
|
### `adamantite update`
|
package/dist/index.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import process5 from "node:process";
|
|
3
3
|
import { Command as Command9 } from "@effect/cli";
|
|
4
4
|
import { NodeContext, NodeRuntime } from "@effect/platform-node";
|
|
5
|
-
import { Effect as Effect19, Layer as
|
|
5
|
+
import { Effect as Effect19, Layer as Layer3 } from "effect";
|
|
6
6
|
|
|
7
7
|
// src/commands/analyze.ts
|
|
8
8
|
import { Command, Options } from "@effect/cli";
|
|
9
9
|
import { Command as ShellCommand2 } from "@effect/platform";
|
|
10
|
-
import { Effect as
|
|
10
|
+
import { Effect as Effect4 } from "effect";
|
|
11
11
|
|
|
12
12
|
// src/helpers/packages/knip.ts
|
|
13
13
|
import { FileSystem as FileSystem2, Path as Path2 } from "@effect/platform";
|
|
@@ -156,9 +156,9 @@ var printTitle = () => Effect2.gen(function* () {
|
|
|
156
156
|
const terminal = yield* Terminal.Terminal;
|
|
157
157
|
const terminalColumns = yield* terminal.columns;
|
|
158
158
|
const title = `
|
|
159
|
-
.o8 . o8o .
|
|
160
|
-
"888 .o8 \`"' .o8
|
|
161
|
-
.oooo. .oooo888 .oooo. ooo. .oo. .oo. .oooo. ooo. .oo. .o888oo oooo .o888oo .ooooo.
|
|
159
|
+
.o8 . o8o .
|
|
160
|
+
"888 .o8 \`"' .o8
|
|
161
|
+
.oooo. .oooo888 .oooo. ooo. .oo. .oo. .oooo. ooo. .oo. .o888oo oooo .o888oo .ooooo.
|
|
162
162
|
\`P )88b d88' \`888 \`P )88b \`888P"Y88bP"Y88b \`P )88b \`888P"Y88b 888 \`888 888 d88' \`88b
|
|
163
163
|
.oP"888 888 888 .oP"888 888 888 888 .oP"888 888 888 888 888 888 888ooo888
|
|
164
164
|
d8( 888 888 888 d8( 888 888 888 888 d8( 888 888 888 888 . 888 888 . 888 .o
|
|
@@ -216,94 +216,13 @@ var knip = {
|
|
|
216
216
|
yield* fs.writeFileString(configPath, `${JSON.stringify(mergedConfig, null, 2)}
|
|
217
217
|
`).pipe(Effect3.mapError((cause) => new FailedToWriteFile({ cause, path: configPath })));
|
|
218
218
|
}),
|
|
219
|
-
version: "5.
|
|
219
|
+
version: "5.82.1"
|
|
220
220
|
};
|
|
221
221
|
|
|
222
|
-
// src/services/package-manager.ts
|
|
223
|
-
import process4 from "node:process";
|
|
224
|
-
import { Context as Context3, Effect as Effect5, Layer as Layer3 } from "effect";
|
|
225
|
-
import { detectPackageManager } from "nypm";
|
|
226
|
-
|
|
227
|
-
// src/services/prompter.ts
|
|
228
|
-
import * as p from "@clack/prompts";
|
|
229
|
-
import { Context as Context2, Effect as Effect4, Layer as Layer2 } from "effect";
|
|
230
|
-
|
|
231
|
-
class Prompter extends Context2.Tag("Prompter")() {
|
|
232
|
-
}
|
|
233
|
-
var PrompterLive = Layer2.succeed(Prompter, {
|
|
234
|
-
cancel: (message) => Effect4.sync(() => {
|
|
235
|
-
p.cancel(message);
|
|
236
|
-
}),
|
|
237
|
-
confirm: (options) => Effect4.tryPromise(() => p.confirm(options)).pipe(Effect4.orDie),
|
|
238
|
-
intro: (message) => Effect4.sync(() => {
|
|
239
|
-
p.intro(message);
|
|
240
|
-
}),
|
|
241
|
-
log: {
|
|
242
|
-
error: (message) => Effect4.sync(() => {
|
|
243
|
-
p.log.error(message);
|
|
244
|
-
}),
|
|
245
|
-
info: (message) => Effect4.sync(() => {
|
|
246
|
-
p.log.info(message);
|
|
247
|
-
}),
|
|
248
|
-
success: (message) => Effect4.sync(() => {
|
|
249
|
-
p.log.success(message);
|
|
250
|
-
}),
|
|
251
|
-
warning: (message) => Effect4.sync(() => {
|
|
252
|
-
p.log.warning(message);
|
|
253
|
-
})
|
|
254
|
-
},
|
|
255
|
-
multiselect: (options) => Effect4.tryPromise(() => p.multiselect(options)).pipe(Effect4.orDie),
|
|
256
|
-
outro: (message) => Effect4.sync(() => {
|
|
257
|
-
p.outro(message);
|
|
258
|
-
}),
|
|
259
|
-
spinner: () => p.spinner()
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
// src/services/package-manager.ts
|
|
263
|
-
class PackageManager extends Context3.Tag("PackageManager")() {
|
|
264
|
-
}
|
|
265
|
-
var PackageManagerLive = Layer3.effect(PackageManager, Effect5.gen(function* () {
|
|
266
|
-
const prompter = yield* Prompter;
|
|
267
|
-
const result = yield* Effect5.tryPromise({
|
|
268
|
-
catch: (cause) => new NoPackageManager({ cause }),
|
|
269
|
-
try: () => detectPackageManager(process4.cwd())
|
|
270
|
-
});
|
|
271
|
-
if (!result?.name) {
|
|
272
|
-
return yield* Effect5.fail(new NoPackageManager({}));
|
|
273
|
-
}
|
|
274
|
-
if (result.warnings?.length) {
|
|
275
|
-
for (const warning of result.warnings) {
|
|
276
|
-
yield* prompter.log.warning(warning);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
const command = (() => {
|
|
280
|
-
switch (result.name) {
|
|
281
|
-
case "bun":
|
|
282
|
-
return ["bunx"];
|
|
283
|
-
case "pnpm":
|
|
284
|
-
return ["pnpm", "dlx"];
|
|
285
|
-
case "yarn":
|
|
286
|
-
return ["yarn", "dlx"];
|
|
287
|
-
case "npm":
|
|
288
|
-
return ["npx"];
|
|
289
|
-
case "deno":
|
|
290
|
-
return ["deno", "run", "-A"];
|
|
291
|
-
default:
|
|
292
|
-
return ["npx"];
|
|
293
|
-
}
|
|
294
|
-
})();
|
|
295
|
-
return {
|
|
296
|
-
command,
|
|
297
|
-
name: result.name
|
|
298
|
-
};
|
|
299
|
-
})).pipe(Layer3.provide(PrompterLive));
|
|
300
|
-
|
|
301
222
|
// src/commands/analyze.ts
|
|
302
223
|
var fix = Options.boolean("fix").pipe(Options.withDescription("Automatically fix issues"));
|
|
303
224
|
var strict = Options.boolean("strict").pipe(Options.withDescription("Enable strict mode"));
|
|
304
|
-
var analyze_default = Command.make("analyze", { fix, strict }).pipe(Command.withDescription("Find unused dependencies, exports, and files using knip"), Command.withHandler(({ fix: fix2, strict: strict2 }) =>
|
|
305
|
-
const pm = yield* PackageManager;
|
|
306
|
-
const [command, ...commandArgs] = pm.command;
|
|
225
|
+
var analyze_default = Command.make("analyze", { fix, strict }).pipe(Command.withDescription("Find unused dependencies, exports, and files using knip"), Command.withHandler(({ fix: fix2, strict: strict2 }) => Effect4.gen(function* () {
|
|
307
226
|
const args = [];
|
|
308
227
|
if (fix2) {
|
|
309
228
|
args.push("--fix", "--allow-remove-files");
|
|
@@ -311,23 +230,23 @@ var analyze_default = Command.make("analyze", { fix, strict }).pipe(Command.with
|
|
|
311
230
|
if (strict2) {
|
|
312
231
|
args.push("--production", "--strict");
|
|
313
232
|
}
|
|
314
|
-
return yield* ShellCommand2.make(
|
|
233
|
+
return yield* ShellCommand2.make(knip.name, ...args).pipe(ShellCommand2.stdout("inherit"), ShellCommand2.stderr("inherit"), ShellCommand2.exitCode);
|
|
315
234
|
})));
|
|
316
235
|
|
|
317
236
|
// src/commands/check.ts
|
|
318
237
|
import { Args, Command as Command2 } from "@effect/cli";
|
|
319
238
|
import { Command as ShellCommand3 } from "@effect/platform";
|
|
320
|
-
import { Effect as
|
|
239
|
+
import { Effect as Effect6, Option } from "effect";
|
|
321
240
|
|
|
322
241
|
// src/helpers/packages/oxlint.ts
|
|
323
242
|
import { FileSystem as FileSystem3, Path as Path3 } from "@effect/platform";
|
|
324
|
-
import { Effect as
|
|
243
|
+
import { Effect as Effect5 } from "effect";
|
|
325
244
|
var CONFIG_FILE = ".oxlintrc.json";
|
|
326
245
|
var oxlint = {
|
|
327
246
|
config: {
|
|
328
247
|
$schema: "./node_modules/oxlint/configuration_schema.json"
|
|
329
248
|
},
|
|
330
|
-
create: (presets = []) =>
|
|
249
|
+
create: (presets = []) => Effect5.gen(function* () {
|
|
331
250
|
const fs = yield* FileSystem3.FileSystem;
|
|
332
251
|
const path = yield* Path3.Path;
|
|
333
252
|
const extendsArray = ["./node_modules/adamantite/presets/lint/core.json"];
|
|
@@ -337,9 +256,9 @@ var oxlint = {
|
|
|
337
256
|
const configPath = path.join(process.cwd(), CONFIG_FILE);
|
|
338
257
|
const payload = JSON.stringify({ ...oxlint.config, extends: extendsArray }, null, 2);
|
|
339
258
|
yield* fs.writeFileString(configPath, `${payload}
|
|
340
|
-
`).pipe(
|
|
259
|
+
`).pipe(Effect5.mapError((cause) => new FailedToWriteFile({ cause, path: configPath })));
|
|
341
260
|
}),
|
|
342
|
-
exists: () =>
|
|
261
|
+
exists: () => Effect5.gen(function* () {
|
|
343
262
|
const fs = yield* FileSystem3.FileSystem;
|
|
344
263
|
const path = yield* Path3.Path;
|
|
345
264
|
const configPath = path.join(process.cwd(), CONFIG_FILE);
|
|
@@ -347,16 +266,16 @@ var oxlint = {
|
|
|
347
266
|
return { path: exists ? configPath : null };
|
|
348
267
|
}),
|
|
349
268
|
name: "oxlint",
|
|
350
|
-
update: (presets = []) =>
|
|
269
|
+
update: (presets = []) => Effect5.gen(function* () {
|
|
351
270
|
const fs = yield* FileSystem3.FileSystem;
|
|
352
271
|
const { path: configPath } = yield* oxlint.exists();
|
|
353
272
|
if (!configPath) {
|
|
354
|
-
return yield*
|
|
273
|
+
return yield* Effect5.fail(new FileNotFound({ path: CONFIG_FILE }));
|
|
355
274
|
}
|
|
356
|
-
const oxlintFile = yield* fs.readFileString(configPath).pipe(
|
|
275
|
+
const oxlintFile = yield* fs.readFileString(configPath).pipe(Effect5.mapError((cause) => new FailedToReadFile({ cause, path: configPath })));
|
|
357
276
|
const existingConfig = yield* parseJson(oxlintFile, configPath);
|
|
358
277
|
if (!isJsonObject(existingConfig)) {
|
|
359
|
-
return yield*
|
|
278
|
+
return yield* Effect5.fail(new InvalidConfigFormat({ path: configPath }));
|
|
360
279
|
}
|
|
361
280
|
const newConfig = { ...existingConfig };
|
|
362
281
|
const extendsArray = Array.isArray(newConfig.extends) ? newConfig.extends : typeof newConfig.extends === "string" ? [newConfig.extends] : [];
|
|
@@ -374,9 +293,9 @@ var oxlint = {
|
|
|
374
293
|
const mergedConfig = yield* mergeConfig(newConfig, oxlint.config);
|
|
375
294
|
mergedConfig.$schema = oxlint.config.$schema;
|
|
376
295
|
yield* fs.writeFileString(configPath, `${JSON.stringify(mergedConfig, null, 2)}
|
|
377
|
-
`).pipe(
|
|
296
|
+
`).pipe(Effect5.mapError((cause) => new FailedToWriteFile({ cause, path: configPath })));
|
|
378
297
|
}),
|
|
379
|
-
version: "1.
|
|
298
|
+
version: "1.41.0"
|
|
380
299
|
};
|
|
381
300
|
var tsgolint = {
|
|
382
301
|
name: "oxlint-tsgolint",
|
|
@@ -385,27 +304,23 @@ var tsgolint = {
|
|
|
385
304
|
|
|
386
305
|
// src/commands/check.ts
|
|
387
306
|
var files = Args.file({ exists: "yes" }).pipe(Args.withDescription("Specific files to lint (optional)"), Args.repeated, Args.optional);
|
|
388
|
-
var check_default = Command2.make("check", { files }).pipe(Command2.withDescription("Find issues in code using oxlint"), Command2.withHandler(({ files: files2 }) =>
|
|
389
|
-
const pm = yield* PackageManager;
|
|
390
|
-
const [command, ...commandArgs] = pm.command;
|
|
307
|
+
var check_default = Command2.make("check", { files }).pipe(Command2.withDescription("Find issues in code using oxlint"), Command2.withHandler(({ files: files2 }) => Effect6.gen(function* () {
|
|
391
308
|
const args = ["--type-aware"];
|
|
392
309
|
if (Option.isSome(files2)) {
|
|
393
310
|
args.push(...files2.value);
|
|
394
311
|
}
|
|
395
|
-
return yield* ShellCommand3.make(
|
|
312
|
+
return yield* ShellCommand3.make(oxlint.name, ...args).pipe(ShellCommand3.stdout("inherit"), ShellCommand3.stderr("inherit"), ShellCommand3.exitCode);
|
|
396
313
|
})));
|
|
397
314
|
|
|
398
315
|
// src/commands/fix.ts
|
|
399
316
|
import { Args as Args2, Command as Command3, Options as Options2 } from "@effect/cli";
|
|
400
317
|
import { Command as ShellCommand4 } from "@effect/platform";
|
|
401
|
-
import { Effect as
|
|
318
|
+
import { Effect as Effect7, Option as Option2 } from "effect";
|
|
402
319
|
var files2 = Args2.file({ exists: "yes" }).pipe(Args2.withDescription("Specific files to fix (optional)"), Args2.repeated, Args2.optional);
|
|
403
320
|
var suggested = Options2.boolean("suggested").pipe(Options2.withDescription("Apply suggested fixes"));
|
|
404
321
|
var dangerous = Options2.boolean("dangerous").pipe(Options2.withDescription("Apply dangerous fixes"));
|
|
405
322
|
var all = Options2.boolean("all").pipe(Options2.withDescription("Apply all fixes, including suggested and dangerous fixes"));
|
|
406
|
-
var fix_default = Command3.make("fix", { all, dangerous, files: files2, suggested }).pipe(Command3.withDescription("Fix issues in code using oxlint"), Command3.withHandler(({ all: all2, dangerous: dangerous2, files: files3, suggested: suggested2 }) =>
|
|
407
|
-
const pm = yield* PackageManager;
|
|
408
|
-
const [command, ...commandArgs] = pm.command;
|
|
323
|
+
var fix_default = Command3.make("fix", { all, dangerous, files: files2, suggested }).pipe(Command3.withDescription("Fix issues in code using oxlint"), Command3.withHandler(({ all: all2, dangerous: dangerous2, files: files3, suggested: suggested2 }) => Effect7.gen(function* () {
|
|
409
324
|
const args = new Set(["--type-aware", "--fix"]);
|
|
410
325
|
if (suggested2 || all2) {
|
|
411
326
|
args.add("--fix-suggestions");
|
|
@@ -418,17 +333,17 @@ var fix_default = Command3.make("fix", { all, dangerous, files: files2, suggeste
|
|
|
418
333
|
args.add(file);
|
|
419
334
|
}
|
|
420
335
|
}
|
|
421
|
-
return yield* ShellCommand4.make(
|
|
336
|
+
return yield* ShellCommand4.make(oxlint.name, ...args).pipe(ShellCommand4.stdout("inherit"), ShellCommand4.stderr("inherit"), ShellCommand4.exitCode);
|
|
422
337
|
})));
|
|
423
338
|
|
|
424
339
|
// src/commands/format.ts
|
|
425
340
|
import { Args as Args3, Command as Command4, Options as Options3 } from "@effect/cli";
|
|
426
341
|
import { Command as ShellCommand5 } from "@effect/platform";
|
|
427
|
-
import { Effect as
|
|
342
|
+
import { Effect as Effect9, Option as Option3 } from "effect";
|
|
428
343
|
|
|
429
344
|
// src/helpers/packages/oxfmt.ts
|
|
430
345
|
import { FileSystem as FileSystem4, Path as Path4 } from "@effect/platform";
|
|
431
|
-
import { Effect as
|
|
346
|
+
import { Effect as Effect8 } from "effect";
|
|
432
347
|
// presets/format.json
|
|
433
348
|
var format_default = {
|
|
434
349
|
$schema: "../node_modules/oxfmt/configuration_schema.json",
|
|
@@ -483,15 +398,15 @@ var oxfmt = {
|
|
|
483
398
|
...format_default,
|
|
484
399
|
$schema: "./node_modules/oxfmt/configuration_schema.json"
|
|
485
400
|
},
|
|
486
|
-
create: () =>
|
|
401
|
+
create: () => Effect8.gen(function* () {
|
|
487
402
|
const fs = yield* FileSystem4.FileSystem;
|
|
488
403
|
const path = yield* Path4.Path;
|
|
489
404
|
const configPath = path.join(process.cwd(), CONFIG_FILE_JSONC2);
|
|
490
405
|
const payload = JSON.stringify(oxfmt.config, null, 2);
|
|
491
406
|
yield* fs.writeFileString(configPath, `${payload}
|
|
492
|
-
`).pipe(
|
|
407
|
+
`).pipe(Effect8.mapError((cause) => new FailedToWriteFile({ cause, path: configPath })));
|
|
493
408
|
}),
|
|
494
|
-
exists: () =>
|
|
409
|
+
exists: () => Effect8.gen(function* () {
|
|
495
410
|
const fs = yield* FileSystem4.FileSystem;
|
|
496
411
|
const path = yield* Path4.Path;
|
|
497
412
|
const jsoncPath = path.join(process.cwd(), CONFIG_FILE_JSONC2);
|
|
@@ -505,31 +420,29 @@ var oxfmt = {
|
|
|
505
420
|
return { path: null };
|
|
506
421
|
}),
|
|
507
422
|
name: "oxfmt",
|
|
508
|
-
update: () =>
|
|
423
|
+
update: () => Effect8.gen(function* () {
|
|
509
424
|
const fs = yield* FileSystem4.FileSystem;
|
|
510
425
|
const { path: configPath } = yield* oxfmt.exists();
|
|
511
426
|
if (!configPath) {
|
|
512
|
-
return yield*
|
|
427
|
+
return yield* Effect8.fail(new FileNotFound({ path: CONFIG_FILE_JSONC2 }));
|
|
513
428
|
}
|
|
514
|
-
const oxfmtFile = yield* fs.readFileString(configPath).pipe(
|
|
429
|
+
const oxfmtFile = yield* fs.readFileString(configPath).pipe(Effect8.mapError((cause) => new FailedToReadFile({ cause, path: configPath })));
|
|
515
430
|
const existingConfig = yield* parseJson(oxfmtFile, configPath);
|
|
516
431
|
if (!isJsonObject(existingConfig)) {
|
|
517
|
-
return yield*
|
|
432
|
+
return yield* Effect8.fail(new InvalidConfigFormat({ path: configPath }));
|
|
518
433
|
}
|
|
519
434
|
const mergedConfig = yield* mergeConfig(existingConfig, oxfmt.config);
|
|
520
435
|
mergedConfig.$schema = oxfmt.config.$schema;
|
|
521
436
|
yield* fs.writeFileString(configPath, `${JSON.stringify(mergedConfig, null, 2)}
|
|
522
|
-
`).pipe(
|
|
437
|
+
`).pipe(Effect8.mapError((cause) => new FailedToWriteFile({ cause, path: configPath })));
|
|
523
438
|
}),
|
|
524
|
-
version: "0.
|
|
439
|
+
version: "0.26.0"
|
|
525
440
|
};
|
|
526
441
|
|
|
527
442
|
// src/commands/format.ts
|
|
528
443
|
var files3 = Args3.file({ exists: "yes" }).pipe(Args3.withDescription("Specific files to format (optional)"), Args3.repeated, Args3.optional);
|
|
529
444
|
var check = Options3.boolean("check").pipe(Options3.withDescription("Check if files are formatted without writing"));
|
|
530
|
-
var format_default2 = Command4.make("format", { check, files: files3 }).pipe(Command4.withDescription("Format files using oxfmt"), Command4.withHandler(({ check: check2, files: files4 }) =>
|
|
531
|
-
const pm = yield* PackageManager;
|
|
532
|
-
const [command, ...commandArgs] = pm.command;
|
|
445
|
+
var format_default2 = Command4.make("format", { check, files: files3 }).pipe(Command4.withDescription("Format files using oxfmt"), Command4.withHandler(({ check: check2, files: files4 }) => Effect9.gen(function* () {
|
|
533
446
|
const args = [];
|
|
534
447
|
if (check2) {
|
|
535
448
|
args.push("--check");
|
|
@@ -537,19 +450,21 @@ var format_default2 = Command4.make("format", { check, files: files3 }).pipe(Com
|
|
|
537
450
|
if (Option3.isSome(files4)) {
|
|
538
451
|
args.push(...files4.value);
|
|
539
452
|
}
|
|
540
|
-
return yield* ShellCommand5.make(
|
|
453
|
+
return yield* ShellCommand5.make(oxfmt.name, ...args).pipe(ShellCommand5.stdout("inherit"), ShellCommand5.stderr("inherit"), ShellCommand5.exitCode);
|
|
541
454
|
})));
|
|
542
455
|
|
|
543
456
|
// src/commands/init.ts
|
|
457
|
+
import process4 from "node:process";
|
|
544
458
|
import { isCancel } from "@clack/prompts";
|
|
545
|
-
import
|
|
546
|
-
import
|
|
547
|
-
import
|
|
548
|
-
import
|
|
459
|
+
import * as Command5 from "@effect/cli/Command";
|
|
460
|
+
import * as FileSystem9 from "@effect/platform/FileSystem";
|
|
461
|
+
import * as Path9 from "@effect/platform/Path";
|
|
462
|
+
import * as Effect15 from "effect/Effect";
|
|
463
|
+
import { addDevDependency, detectPackageManager } from "nypm";
|
|
549
464
|
|
|
550
465
|
// src/helpers/ci/github.ts
|
|
551
466
|
import { FileSystem as FileSystem5, Path as Path5 } from "@effect/platform";
|
|
552
|
-
import { Effect as
|
|
467
|
+
import { Effect as Effect10 } from "effect";
|
|
553
468
|
import { runScriptCommand } from "nypm";
|
|
554
469
|
var setupSteps = {
|
|
555
470
|
bun: ` - name: Setup Bun
|
|
@@ -686,7 +601,7 @@ var CI_COMPATIBLE_SCRIPTS = new Set([
|
|
|
686
601
|
]);
|
|
687
602
|
var hasCICompatibleScripts = (scripts) => scripts.some((script) => CI_COMPATIBLE_SCRIPTS.has(script));
|
|
688
603
|
var github = {
|
|
689
|
-
create: (options) =>
|
|
604
|
+
create: (options) => Effect10.gen(function* () {
|
|
690
605
|
const fs = yield* FileSystem5.FileSystem;
|
|
691
606
|
const path = yield* Path5.Path;
|
|
692
607
|
const workflowDir = path.join(process.cwd(), ".github", "workflows");
|
|
@@ -696,14 +611,14 @@ var github = {
|
|
|
696
611
|
return;
|
|
697
612
|
}
|
|
698
613
|
const workflowPath = path.join(workflowDir, "adamantite.yml");
|
|
699
|
-
yield* fs.writeFileString(workflowPath, workflowContent).pipe(
|
|
614
|
+
yield* fs.writeFileString(workflowPath, workflowContent).pipe(Effect10.mapError((cause) => new FailedToWriteFile({ cause, path: workflowPath })));
|
|
700
615
|
}),
|
|
701
|
-
exists: () =>
|
|
616
|
+
exists: () => Effect10.gen(function* () {
|
|
702
617
|
const fs = yield* FileSystem5.FileSystem;
|
|
703
618
|
const path = yield* Path5.Path;
|
|
704
619
|
return yield* fs.exists(path.join(process.cwd(), ".github", "workflows", "adamantite.yml"));
|
|
705
620
|
}),
|
|
706
|
-
update: (options) =>
|
|
621
|
+
update: (options) => Effect10.gen(function* () {
|
|
707
622
|
const fs = yield* FileSystem5.FileSystem;
|
|
708
623
|
const path = yield* Path5.Path;
|
|
709
624
|
const workflowPath = path.join(process.cwd(), ".github", "workflows", "adamantite.yml");
|
|
@@ -711,17 +626,17 @@ var github = {
|
|
|
711
626
|
if (!workflowContent) {
|
|
712
627
|
return;
|
|
713
628
|
}
|
|
714
|
-
yield* fs.writeFileString(workflowPath, workflowContent).pipe(
|
|
629
|
+
yield* fs.writeFileString(workflowPath, workflowContent).pipe(Effect10.mapError((cause) => new FailedToWriteFile({ cause, path: workflowPath })));
|
|
715
630
|
}),
|
|
716
631
|
workflowPath: ".github/workflows/adamantite.yml"
|
|
717
632
|
};
|
|
718
633
|
|
|
719
634
|
// src/helpers/editors/vscode.ts
|
|
720
635
|
import { FileSystem as FileSystem6, Path as Path6, Command as ShellCommand6 } from "@effect/platform";
|
|
721
|
-
import { Effect as
|
|
636
|
+
import { Effect as Effect11 } from "effect";
|
|
722
637
|
var SETTINGS_FILE = "settings.json";
|
|
723
638
|
var vscode = {
|
|
724
|
-
cliExists: () => checkCliExists("code").pipe(
|
|
639
|
+
cliExists: () => checkCliExists("code").pipe(Effect11.mapError((cause) => new VscodeCliNotFound({ cause }))),
|
|
725
640
|
config: {
|
|
726
641
|
"[css]": {
|
|
727
642
|
"editor.defaultFormatter": "oxc.oxc-vscode"
|
|
@@ -756,92 +671,228 @@ var vscode = {
|
|
|
756
671
|
"oxc.typeAware": true,
|
|
757
672
|
"typescript.tsdk": "node_modules/typescript/lib"
|
|
758
673
|
},
|
|
759
|
-
create: () =>
|
|
674
|
+
create: () => Effect11.gen(function* () {
|
|
760
675
|
const fs = yield* FileSystem6.FileSystem;
|
|
761
676
|
const path = yield* Path6.Path;
|
|
762
677
|
const vscodePath = path.join(process.cwd(), ".vscode");
|
|
763
678
|
const settingsPath = path.join(vscodePath, SETTINGS_FILE);
|
|
764
|
-
yield* fs.makeDirectory(vscodePath, { recursive: true }).pipe(
|
|
679
|
+
yield* fs.makeDirectory(vscodePath, { recursive: true }).pipe(Effect11.mapError((cause) => new FailedToCreateDirectory({ cause, path: vscodePath })));
|
|
765
680
|
yield* fs.writeFileString(settingsPath, `${JSON.stringify(vscode.config, null, 2)}
|
|
766
|
-
`).pipe(
|
|
681
|
+
`).pipe(Effect11.mapError((cause) => new FailedToWriteFile({ cause, path: settingsPath })));
|
|
767
682
|
}),
|
|
768
|
-
exists: () =>
|
|
683
|
+
exists: () => Effect11.gen(function* () {
|
|
769
684
|
const fs = yield* FileSystem6.FileSystem;
|
|
770
685
|
const path = yield* Path6.Path;
|
|
771
686
|
return yield* fs.exists(path.join(process.cwd(), ".vscode", SETTINGS_FILE));
|
|
772
687
|
}),
|
|
773
|
-
extension: (scripts = []) =>
|
|
688
|
+
extension: (scripts = []) => Effect11.gen(function* () {
|
|
774
689
|
yield* vscode.cliExists();
|
|
775
|
-
const installExtension = (extension) => ShellCommand6.make("code", "--install-extension", extension).pipe(ShellCommand6.stdout("inherit"), ShellCommand6.stderr("inherit"), ShellCommand6.exitCode,
|
|
690
|
+
const installExtension = (extension) => ShellCommand6.make("code", "--install-extension", extension).pipe(ShellCommand6.stdout("inherit"), ShellCommand6.stderr("inherit"), ShellCommand6.exitCode, Effect11.mapError((cause) => new FailedToInstallExtension({ cause, extension })));
|
|
776
691
|
const extensions = [
|
|
777
|
-
scripts.includes("check") || scripts.includes("fix") || scripts.includes("format") ? installExtension("oxc.oxc-vscode") :
|
|
778
|
-
scripts.includes("analyze") ? installExtension("webpro.vscode-knip") :
|
|
779
|
-
scripts.includes("typecheck") ? installExtension("TypeScriptTeam.native-preview") : Effect13.void
|
|
692
|
+
scripts.includes("check") || scripts.includes("fix") || scripts.includes("format") ? installExtension("oxc.oxc-vscode") : Effect11.void,
|
|
693
|
+
scripts.includes("analyze") ? installExtension("webpro.vscode-knip") : Effect11.void
|
|
780
694
|
];
|
|
781
|
-
const results = yield*
|
|
695
|
+
const results = yield* Effect11.all(extensions, { mode: "either" });
|
|
782
696
|
const firstFailure = results.find((r) => r._tag === "Left");
|
|
783
697
|
if (firstFailure) {
|
|
784
|
-
yield*
|
|
698
|
+
yield* Effect11.fail(firstFailure.left);
|
|
785
699
|
}
|
|
786
700
|
}),
|
|
787
|
-
update: () =>
|
|
701
|
+
update: () => Effect11.gen(function* () {
|
|
788
702
|
const fs = yield* FileSystem6.FileSystem;
|
|
789
703
|
const path = yield* Path6.Path;
|
|
790
704
|
const vscodePath = path.join(process.cwd(), ".vscode", SETTINGS_FILE);
|
|
791
|
-
const vscodeFile = yield* fs.readFileString(vscodePath).pipe(
|
|
705
|
+
const vscodeFile = yield* fs.readFileString(vscodePath).pipe(Effect11.mapError((cause) => new FailedToReadFile({ cause, path: vscodePath })));
|
|
792
706
|
const existingConfig = yield* parseJson(vscodeFile, vscodePath);
|
|
793
707
|
if (!isJsonObject(existingConfig)) {
|
|
794
|
-
return yield*
|
|
708
|
+
return yield* Effect11.fail(new InvalidConfigFormat({ path: vscodePath }));
|
|
795
709
|
}
|
|
796
710
|
const newConfig = yield* mergeConfig(vscode.config, existingConfig);
|
|
797
711
|
yield* fs.writeFileString(vscodePath, `${JSON.stringify(newConfig, null, 2)}
|
|
798
|
-
`).pipe(
|
|
712
|
+
`).pipe(Effect11.mapError((cause) => new FailedToWriteFile({ cause, path: vscodePath })));
|
|
713
|
+
})
|
|
714
|
+
};
|
|
715
|
+
|
|
716
|
+
// src/helpers/editors/zed.ts
|
|
717
|
+
import { FileSystem as FileSystem7, Path as Path7 } from "@effect/platform";
|
|
718
|
+
import { Effect as Effect12 } from "effect";
|
|
719
|
+
var SETTINGS_FILE2 = "settings.json";
|
|
720
|
+
var zed = {
|
|
721
|
+
config: {
|
|
722
|
+
languages: {
|
|
723
|
+
CSS: {
|
|
724
|
+
format_on_save: "on",
|
|
725
|
+
formatter: [{ language_server: { name: "oxfmt" } }]
|
|
726
|
+
},
|
|
727
|
+
HTML: {
|
|
728
|
+
format_on_save: "on",
|
|
729
|
+
formatter: [{ language_server: { name: "oxfmt" } }]
|
|
730
|
+
},
|
|
731
|
+
JSON: {
|
|
732
|
+
format_on_save: "on",
|
|
733
|
+
formatter: [{ language_server: { name: "oxfmt" } }]
|
|
734
|
+
},
|
|
735
|
+
JSONC: {
|
|
736
|
+
format_on_save: "on",
|
|
737
|
+
formatter: [{ language_server: { name: "oxfmt" } }]
|
|
738
|
+
},
|
|
739
|
+
JavaScript: {
|
|
740
|
+
format_on_save: "on",
|
|
741
|
+
formatter: [{ language_server: { name: "oxfmt" } }, { code_action: "source.fixAll.oxc" }]
|
|
742
|
+
},
|
|
743
|
+
MDX: {
|
|
744
|
+
format_on_save: "on",
|
|
745
|
+
formatter: [{ language_server: { name: "oxfmt" } }]
|
|
746
|
+
},
|
|
747
|
+
Markdown: {
|
|
748
|
+
format_on_save: "on",
|
|
749
|
+
formatter: [{ language_server: { name: "oxfmt" } }]
|
|
750
|
+
},
|
|
751
|
+
TSX: {
|
|
752
|
+
format_on_save: "on",
|
|
753
|
+
formatter: [{ language_server: { name: "oxfmt" } }]
|
|
754
|
+
},
|
|
755
|
+
TypeScript: {
|
|
756
|
+
format_on_save: "on",
|
|
757
|
+
formatter: [{ language_server: { name: "oxfmt" } }]
|
|
758
|
+
},
|
|
759
|
+
YAML: {
|
|
760
|
+
format_on_save: "on",
|
|
761
|
+
formatter: [{ language_server: { name: "oxfmt" } }]
|
|
762
|
+
}
|
|
763
|
+
},
|
|
764
|
+
lsp: {
|
|
765
|
+
oxfmt: {
|
|
766
|
+
initialization_options: {
|
|
767
|
+
settings: {
|
|
768
|
+
configPath: null,
|
|
769
|
+
"fmt.experimental": true,
|
|
770
|
+
run: "onSave",
|
|
771
|
+
typeAware: false,
|
|
772
|
+
unusedDisableDirectives: false
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
},
|
|
776
|
+
oxlint: {
|
|
777
|
+
initialization_options: {
|
|
778
|
+
settings: {
|
|
779
|
+
configPath: null,
|
|
780
|
+
fixKind: "safe_fix",
|
|
781
|
+
run: "onType",
|
|
782
|
+
typeAware: true,
|
|
783
|
+
unusedDisableDirectives: "deny"
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
},
|
|
789
|
+
create: () => Effect12.gen(function* () {
|
|
790
|
+
const fs = yield* FileSystem7.FileSystem;
|
|
791
|
+
const path = yield* Path7.Path;
|
|
792
|
+
const zedPath = path.join(process.cwd(), ".zed");
|
|
793
|
+
const settingsPath = path.join(zedPath, SETTINGS_FILE2);
|
|
794
|
+
yield* fs.makeDirectory(zedPath, { recursive: true }).pipe(Effect12.mapError((cause) => new FailedToCreateDirectory({ cause, path: zedPath })));
|
|
795
|
+
yield* fs.writeFileString(settingsPath, `${JSON.stringify(zed.config, null, 2)}
|
|
796
|
+
`).pipe(Effect12.mapError((cause) => new FailedToWriteFile({ cause, path: settingsPath })));
|
|
797
|
+
}),
|
|
798
|
+
exists: () => Effect12.gen(function* () {
|
|
799
|
+
const fs = yield* FileSystem7.FileSystem;
|
|
800
|
+
const path = yield* Path7.Path;
|
|
801
|
+
return yield* fs.exists(path.join(process.cwd(), ".zed", SETTINGS_FILE2));
|
|
802
|
+
}),
|
|
803
|
+
update: () => Effect12.gen(function* () {
|
|
804
|
+
const fs = yield* FileSystem7.FileSystem;
|
|
805
|
+
const path = yield* Path7.Path;
|
|
806
|
+
const zedPath = path.join(process.cwd(), ".zed", SETTINGS_FILE2);
|
|
807
|
+
const zedFile = yield* fs.readFileString(zedPath).pipe(Effect12.mapError((cause) => new FailedToReadFile({ cause, path: zedPath })));
|
|
808
|
+
const existingConfig = yield* parseJson(zedFile, zedPath);
|
|
809
|
+
if (!isJsonObject(existingConfig)) {
|
|
810
|
+
return yield* Effect12.fail(new InvalidConfigFormat({ path: zedPath }));
|
|
811
|
+
}
|
|
812
|
+
const newConfig = yield* mergeConfig(zed.config, existingConfig);
|
|
813
|
+
yield* fs.writeFileString(zedPath, `${JSON.stringify(newConfig, null, 2)}
|
|
814
|
+
`).pipe(Effect12.mapError((cause) => new FailedToWriteFile({ cause, path: zedPath })));
|
|
799
815
|
})
|
|
800
816
|
};
|
|
801
817
|
|
|
802
818
|
// src/helpers/packages/sherif.ts
|
|
803
819
|
var sherif = {
|
|
804
820
|
name: "sherif",
|
|
805
|
-
version: "1.
|
|
821
|
+
version: "1.10.0"
|
|
806
822
|
};
|
|
807
823
|
|
|
808
824
|
// src/helpers/packages/typescript.ts
|
|
809
|
-
import { FileSystem as
|
|
810
|
-
import { Effect as
|
|
825
|
+
import { FileSystem as FileSystem8, Path as Path8 } from "@effect/platform";
|
|
826
|
+
import { Effect as Effect13 } from "effect";
|
|
811
827
|
var CONFIG_FILE2 = "tsconfig.json";
|
|
812
828
|
var typescript = {
|
|
813
|
-
command: "
|
|
829
|
+
command: "tsc",
|
|
814
830
|
config: { extends: "adamantite/typescript" },
|
|
815
|
-
create: () =>
|
|
816
|
-
const fs = yield*
|
|
817
|
-
const path = yield*
|
|
831
|
+
create: () => Effect13.gen(function* () {
|
|
832
|
+
const fs = yield* FileSystem8.FileSystem;
|
|
833
|
+
const path = yield* Path8.Path;
|
|
818
834
|
const configPath = path.join(process.cwd(), CONFIG_FILE2);
|
|
819
835
|
const payload = JSON.stringify(typescript.config, null, 2);
|
|
820
836
|
yield* fs.writeFileString(configPath, `${payload}
|
|
821
|
-
`).pipe(
|
|
837
|
+
`).pipe(Effect13.mapError((cause) => new FailedToWriteFile({ cause, path: configPath })));
|
|
822
838
|
}),
|
|
823
|
-
exists: () =>
|
|
824
|
-
const fs = yield*
|
|
825
|
-
const path = yield*
|
|
839
|
+
exists: () => Effect13.gen(function* () {
|
|
840
|
+
const fs = yield* FileSystem8.FileSystem;
|
|
841
|
+
const path = yield* Path8.Path;
|
|
826
842
|
return yield* fs.exists(path.join(process.cwd(), CONFIG_FILE2));
|
|
827
843
|
}),
|
|
828
|
-
name: "
|
|
829
|
-
update: () =>
|
|
830
|
-
const fs = yield*
|
|
831
|
-
const path = yield*
|
|
844
|
+
name: "typescript",
|
|
845
|
+
update: () => Effect13.gen(function* () {
|
|
846
|
+
const fs = yield* FileSystem8.FileSystem;
|
|
847
|
+
const path = yield* Path8.Path;
|
|
832
848
|
const configPath = path.join(process.cwd(), CONFIG_FILE2);
|
|
833
|
-
const tsconfigFile = yield* fs.readFileString(configPath).pipe(
|
|
849
|
+
const tsconfigFile = yield* fs.readFileString(configPath).pipe(Effect13.mapError((cause) => new FailedToReadFile({ cause, path: configPath })));
|
|
834
850
|
const existingConfig = yield* parseJson(tsconfigFile, configPath);
|
|
835
851
|
if (!isJsonObject(existingConfig)) {
|
|
836
|
-
return yield*
|
|
852
|
+
return yield* Effect13.fail(new InvalidConfigFormat({ path: configPath }));
|
|
837
853
|
}
|
|
838
854
|
const newConfig = yield* mergeConfig(typescript.config, existingConfig);
|
|
839
855
|
yield* fs.writeFileString(configPath, `${JSON.stringify(newConfig, null, 2)}
|
|
840
|
-
`).pipe(
|
|
856
|
+
`).pipe(Effect13.mapError((cause) => new FailedToWriteFile({ cause, path: configPath })));
|
|
841
857
|
}),
|
|
842
|
-
version: "
|
|
858
|
+
version: "5.9.3"
|
|
843
859
|
};
|
|
844
860
|
|
|
861
|
+
// src/services/prompter.ts
|
|
862
|
+
import * as p from "@clack/prompts";
|
|
863
|
+
import { Context as Context2, Effect as Effect14, Layer as Layer2 } from "effect";
|
|
864
|
+
|
|
865
|
+
class Prompter extends Context2.Tag("Prompter")() {
|
|
866
|
+
}
|
|
867
|
+
var PrompterLive = Layer2.succeed(Prompter, {
|
|
868
|
+
cancel: (message) => Effect14.sync(() => {
|
|
869
|
+
p.cancel(message);
|
|
870
|
+
}),
|
|
871
|
+
confirm: (options) => Effect14.tryPromise(() => p.confirm(options)).pipe(Effect14.orDie),
|
|
872
|
+
intro: (message) => Effect14.sync(() => {
|
|
873
|
+
p.intro(message);
|
|
874
|
+
}),
|
|
875
|
+
log: {
|
|
876
|
+
error: (message) => Effect14.sync(() => {
|
|
877
|
+
p.log.error(message);
|
|
878
|
+
}),
|
|
879
|
+
info: (message) => Effect14.sync(() => {
|
|
880
|
+
p.log.info(message);
|
|
881
|
+
}),
|
|
882
|
+
success: (message) => Effect14.sync(() => {
|
|
883
|
+
p.log.success(message);
|
|
884
|
+
}),
|
|
885
|
+
warning: (message) => Effect14.sync(() => {
|
|
886
|
+
p.log.warning(message);
|
|
887
|
+
})
|
|
888
|
+
},
|
|
889
|
+
multiselect: (options) => Effect14.tryPromise(() => p.multiselect(options)).pipe(Effect14.orDie),
|
|
890
|
+
outro: (message) => Effect14.sync(() => {
|
|
891
|
+
p.outro(message);
|
|
892
|
+
}),
|
|
893
|
+
spinner: () => p.spinner()
|
|
894
|
+
});
|
|
895
|
+
|
|
845
896
|
// src/commands/init.ts
|
|
846
897
|
var installDependencies = (packages) => Effect15.gen(function* () {
|
|
847
898
|
const prompter = yield* Prompter;
|
|
@@ -887,8 +938,8 @@ var setupOxfmtConfig = () => Effect15.gen(function* () {
|
|
|
887
938
|
}
|
|
888
939
|
});
|
|
889
940
|
var addScripts = (scripts) => Effect15.gen(function* () {
|
|
890
|
-
const fs = yield*
|
|
891
|
-
const path = yield*
|
|
941
|
+
const fs = yield* FileSystem9.FileSystem;
|
|
942
|
+
const path = yield* Path9.Path;
|
|
892
943
|
const cwd = yield* Cwd;
|
|
893
944
|
const prompter = yield* Prompter;
|
|
894
945
|
const packageJson = yield* readPackageJson();
|
|
@@ -974,18 +1025,32 @@ var setupEditors = (editors) => Effect15.gen(function* () {
|
|
|
974
1025
|
spinner2.stop("`.vscode/settings.json` created with Adamantite preset.");
|
|
975
1026
|
}
|
|
976
1027
|
}
|
|
977
|
-
if (editors.includes("zed")) {
|
|
1028
|
+
if (editors.includes("zed")) {
|
|
1029
|
+
const spinner2 = prompter.spinner();
|
|
1030
|
+
spinner2.start("Checking for `.zed/settings.json`...");
|
|
1031
|
+
const hasZedSettings = yield* zed.exists();
|
|
1032
|
+
if (hasZedSettings) {
|
|
1033
|
+
spinner2.message("`.zed/settings.json` found, updating...");
|
|
1034
|
+
yield* zed.update();
|
|
1035
|
+
spinner2.stop("`.zed/settings.json` updated with Adamantite preset.");
|
|
1036
|
+
} else {
|
|
1037
|
+
spinner2.message("`.zed/settings.json` not found, creating...");
|
|
1038
|
+
yield* zed.create();
|
|
1039
|
+
spinner2.stop("`.zed/settings.json` created with Adamantite preset.");
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
978
1042
|
});
|
|
979
1043
|
var installEditorExtensions = (editors, scripts) => Effect15.gen(function* () {
|
|
980
1044
|
const prompter = yield* Prompter;
|
|
981
1045
|
const spinner2 = prompter.spinner();
|
|
982
1046
|
spinner2.start("Installing editor extensions...");
|
|
1047
|
+
const hasZed = editors.includes("zed");
|
|
1048
|
+
const hasVscode = editors.includes("vscode");
|
|
983
1049
|
const result = yield* Effect15.gen(function* () {
|
|
984
1050
|
if (editors.includes("vscode")) {
|
|
985
1051
|
spinner2.message("Installing VS Code extension...");
|
|
986
1052
|
yield* vscode.extension(scripts);
|
|
987
1053
|
}
|
|
988
|
-
if (editors.includes("zed")) {}
|
|
989
1054
|
return true;
|
|
990
1055
|
}).pipe(Effect15.tapError(() => Effect15.sync(() => {
|
|
991
1056
|
spinner2.stop();
|
|
@@ -1005,7 +1070,14 @@ var installEditorExtensions = (editors, scripts) => Effect15.gen(function* () {
|
|
|
1005
1070
|
})
|
|
1006
1071
|
}));
|
|
1007
1072
|
if (result) {
|
|
1008
|
-
|
|
1073
|
+
if (hasZed && !hasVscode) {
|
|
1074
|
+
spinner2.stop("Zed extensions require manual install.");
|
|
1075
|
+
} else {
|
|
1076
|
+
spinner2.stop("Editor extensions installed successfully.");
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
if (hasZed) {
|
|
1080
|
+
yield* prompter.log.info("Install the Zed `oxc` extension: zed://extension/oxc");
|
|
1009
1081
|
}
|
|
1010
1082
|
});
|
|
1011
1083
|
var setupGitHubActions = (packageManager, scripts) => Effect15.gen(function* () {
|
|
@@ -1024,11 +1096,22 @@ var setupGitHubActions = (packageManager, scripts) => Effect15.gen(function* ()
|
|
|
1024
1096
|
}
|
|
1025
1097
|
}).pipe(Effect15.option);
|
|
1026
1098
|
var init_default = Command5.make("init").pipe(Command5.withDescription("Initialize Adamantite in the current directory"), Command5.withHandler(() => Effect15.gen(function* () {
|
|
1027
|
-
const pm = yield* PackageManager;
|
|
1028
1099
|
const prompter = yield* Prompter;
|
|
1029
1100
|
yield* printTitle();
|
|
1030
1101
|
yield* prompter.intro("\uD83D\uDCA0 adamantite init");
|
|
1031
|
-
yield*
|
|
1102
|
+
const packageManager = yield* Effect15.tryPromise({
|
|
1103
|
+
catch: (cause) => new NoPackageManager({ cause }),
|
|
1104
|
+
try: () => detectPackageManager(process4.cwd())
|
|
1105
|
+
});
|
|
1106
|
+
if (!packageManager) {
|
|
1107
|
+
return yield* Effect15.fail(new NoPackageManager({}));
|
|
1108
|
+
}
|
|
1109
|
+
if (packageManager.warnings?.length) {
|
|
1110
|
+
for (const warning of packageManager.warnings) {
|
|
1111
|
+
yield* prompter.log.warning(warning);
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
yield* prompter.log.info(`Detected package manager: ${packageManager.name}`);
|
|
1032
1115
|
const isMonorepo = yield* checkIsMonorepo();
|
|
1033
1116
|
if (isMonorepo) {
|
|
1034
1117
|
yield* prompter.log.info("We've detected a monorepo setup in your project.");
|
|
@@ -1053,7 +1136,7 @@ var init_default = Command5.make("init").pipe(Command5.withDescription("Initiali
|
|
|
1053
1136
|
},
|
|
1054
1137
|
{
|
|
1055
1138
|
hint: "extends the `adamantite/typescript` preset in your `tsconfig.json`",
|
|
1056
|
-
label: "typecheck - type-check your code using
|
|
1139
|
+
label: "typecheck - type-check your code using tsc",
|
|
1057
1140
|
value: "typecheck"
|
|
1058
1141
|
},
|
|
1059
1142
|
{
|
|
@@ -1101,7 +1184,7 @@ var init_default = Command5.make("init").pipe(Command5.withDescription("Initiali
|
|
|
1101
1184
|
message: "Which editors do you want to configure? (optional)",
|
|
1102
1185
|
options: [
|
|
1103
1186
|
{ label: "VSCode / Cursor / Windsurf", value: "vscode" },
|
|
1104
|
-
{
|
|
1187
|
+
{ label: "Zed", value: "zed" }
|
|
1105
1188
|
],
|
|
1106
1189
|
required: false
|
|
1107
1190
|
});
|
|
@@ -1170,7 +1253,7 @@ var init_default = Command5.make("init").pipe(Command5.withDescription("Initiali
|
|
|
1170
1253
|
yield* installEditorExtensions(selectedEditors, selectedScripts);
|
|
1171
1254
|
}
|
|
1172
1255
|
if (enableGitHubActions) {
|
|
1173
|
-
yield* setupGitHubActions(
|
|
1256
|
+
yield* setupGitHubActions(packageManager.name, selectedScripts);
|
|
1174
1257
|
}
|
|
1175
1258
|
yield* prompter.log.success("Your project is now configured");
|
|
1176
1259
|
yield* prompter.outro("\uD83D\uDCA0 Adamantite initialized successfully!");
|
|
@@ -1187,13 +1270,11 @@ import { Command as ShellCommand7 } from "@effect/platform";
|
|
|
1187
1270
|
import { Effect as Effect16 } from "effect";
|
|
1188
1271
|
var fix2 = Options4.boolean("fix").pipe(Options4.withDescription("Automatically fix issues"));
|
|
1189
1272
|
var monorepo_default = Command6.make("monorepo", { fix: fix2 }).pipe(Command6.withDescription("Find and fix monorepo-specific issues using Sherif"), Command6.withHandler(({ fix: fix3 }) => Effect16.gen(function* () {
|
|
1190
|
-
const pm = yield* PackageManager;
|
|
1191
|
-
const [command, ...commandArgs] = pm.command;
|
|
1192
1273
|
const args = [];
|
|
1193
1274
|
if (fix3) {
|
|
1194
1275
|
args.push("--fix");
|
|
1195
1276
|
}
|
|
1196
|
-
return yield* ShellCommand7.make(
|
|
1277
|
+
return yield* ShellCommand7.make(sherif.name, ...args).pipe(ShellCommand7.stdin("inherit"), ShellCommand7.stdout("inherit"), ShellCommand7.stderr("inherit"), ShellCommand7.exitCode);
|
|
1197
1278
|
})));
|
|
1198
1279
|
|
|
1199
1280
|
// src/commands/typecheck.ts
|
|
@@ -1203,8 +1284,8 @@ import { Effect as Effect17, Option as Option4 } from "effect";
|
|
|
1203
1284
|
var project = Options5.file("project").pipe(Options5.withAlias("p"), Options5.optional, Options5.withDescription("Path to tsconfig.json file"));
|
|
1204
1285
|
var watch = Options5.boolean("watch").pipe(Options5.withAlias("w"), Options5.withDescription("Run in watch mode"));
|
|
1205
1286
|
var typecheck_default = Command7.make("typecheck", { project, watch }).pipe(Command7.withDescription("Run TypeScript type checking"), Command7.withHandler(({ project: project2, watch: watch2 }) => Effect17.gen(function* () {
|
|
1206
|
-
const
|
|
1207
|
-
const
|
|
1287
|
+
const cwd = yield* Cwd;
|
|
1288
|
+
const currentDir = yield* cwd.get;
|
|
1208
1289
|
const args = ["--noEmit"];
|
|
1209
1290
|
if (Option4.isSome(project2)) {
|
|
1210
1291
|
args.push("--project", project2.value);
|
|
@@ -1212,7 +1293,7 @@ var typecheck_default = Command7.make("typecheck", { project, watch }).pipe(Comm
|
|
|
1212
1293
|
if (watch2) {
|
|
1213
1294
|
args.push("--watch");
|
|
1214
1295
|
}
|
|
1215
|
-
return yield* ShellCommand8.make(
|
|
1296
|
+
return yield* ShellCommand8.make(typescript.command, ...args).pipe(ShellCommand8.workingDirectory(currentDir), ShellCommand8.stdout("inherit"), ShellCommand8.stderr("inherit"), ShellCommand8.exitCode);
|
|
1216
1297
|
})));
|
|
1217
1298
|
|
|
1218
1299
|
// src/commands/update.ts
|
|
@@ -1291,6 +1372,6 @@ var update_default = Command8.make("update").pipe(Command8.withDescription("Upda
|
|
|
1291
1372
|
|
|
1292
1373
|
// src/index.ts
|
|
1293
1374
|
var main = Command9.make("adamantite").pipe(Command9.withDescription("Opinionated preset package for modern TypeScript applications"), Command9.withSubcommands([analyze_default, check_default, fix_default, format_default2, init_default, monorepo_default, typecheck_default, update_default]));
|
|
1294
|
-
var version = await "0.
|
|
1375
|
+
var version = await "0.28.0";
|
|
1295
1376
|
var program = Command9.run(main, { name: "adamantite", version });
|
|
1296
|
-
program(process5.argv).pipe(Effect19.provide(
|
|
1377
|
+
program(process5.argv).pipe(Effect19.provide(Layer3.mergeAll(NodeContext.layer, PrompterLive, CwdLive)), NodeRuntime.runMain);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adamantite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "An strict and opinionated set of presets for modern TypeScript applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adamantite",
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
"oxfmt",
|
|
10
10
|
"oxlint",
|
|
11
11
|
"preset",
|
|
12
|
-
"tsgo",
|
|
13
12
|
"typescript"
|
|
14
13
|
],
|
|
15
14
|
"homepage": "https://github.com/adelrodriguez/adamantite",
|
|
@@ -61,24 +60,23 @@
|
|
|
61
60
|
},
|
|
62
61
|
"dependencies": {
|
|
63
62
|
"@clack/prompts": "1.0.0-alpha.9",
|
|
64
|
-
"@effect/cli": "0.73.
|
|
65
|
-
"@effect/platform": "0.94.
|
|
66
|
-
"@effect/platform-node": "0.104.
|
|
63
|
+
"@effect/cli": "0.73.1",
|
|
64
|
+
"@effect/platform": "0.94.2",
|
|
65
|
+
"@effect/platform-node": "0.104.1",
|
|
67
66
|
"defu": "6.1.4",
|
|
68
|
-
"effect": "3.19.
|
|
67
|
+
"effect": "3.19.15",
|
|
69
68
|
"jsonc-parser": "3.3.1",
|
|
70
|
-
"nypm": "0.6.
|
|
69
|
+
"nypm": "0.6.4"
|
|
71
70
|
},
|
|
72
71
|
"devDependencies": {
|
|
73
72
|
"@changesets/cli": "2.29.8",
|
|
74
73
|
"@types/bun": "1.3.6",
|
|
75
|
-
"@typescript/native-preview": "7.0.0-dev.20260115.1",
|
|
76
74
|
"bunup": "0.16.20",
|
|
77
|
-
"knip": "5.
|
|
78
|
-
"oxfmt": "0.
|
|
79
|
-
"oxlint": "1.
|
|
75
|
+
"knip": "5.82.1",
|
|
76
|
+
"oxfmt": "0.26.0",
|
|
77
|
+
"oxlint": "1.41.0",
|
|
80
78
|
"oxlint-tsgolint": "0.11.1",
|
|
81
|
-
"sherif": "1.
|
|
79
|
+
"sherif": "1.10.0",
|
|
82
80
|
"type-fest": "5.4.1",
|
|
83
81
|
"typescript": "5.9.3"
|
|
84
82
|
},
|