@vlandoss/run-run 0.5.3-git-f368be9.0 → 0.5.3-git-137024d.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 CHANGED
@@ -4,7 +4,7 @@ CLI toolbox to fullstack common scripts in [Variable Land](https://variable.land
4
4
 
5
5
  ## Prerequisites
6
6
 
7
- - Node.js >= 24.0.0
7
+ - Node.js >= 20.0.0
8
8
 
9
9
  ## Toolbox
10
10
 
@@ -1,7 +1,7 @@
1
1
  // @generated by @usage-spec/commander from Commander.js metadata
2
2
  name rr
3
3
  bin rr
4
- version "0.5.3-git-f368be9.0"
4
+ version "0.5.3-git-137024d.0"
5
5
  usage "[options] <command...>"
6
6
  flag --usage help="print KDL spec for this CLI (https://kdl.dev)"
7
7
  cmd completion help="print shell completion script 🐚 (usage)" {
package/dist/run.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import path from "node:path";
2
- import { colorize, createPkg, createShellService, cwd, dirnameOf, isCI, palette, resolveBinPath, run, text } from "@vlandoss/clibuddy";
2
+ import { colorize, createPkg, createShellService, cwd, dirnameOf, isCI, palette, resolvePackageBin, run, text } from "@vlandoss/clibuddy";
3
3
  import { Argument, Option, createCommand } from "commander";
4
4
  import fs from "node:fs";
5
5
  import os from "node:os";
@@ -116,18 +116,35 @@ ${runRunColor(`
116
116
  //#region src/services/tool.ts
117
117
  var ToolService = class {
118
118
  #shellService;
119
+ #pkg;
119
120
  #bin;
120
121
  #ui;
121
- constructor({ bin, ui, shellService }) {
122
- this.#bin = bin;
123
- this.#ui = ui ?? bin;
122
+ get bin() {
123
+ return this.#bin;
124
+ }
125
+ get ui() {
126
+ return this.#ui;
127
+ }
128
+ get pkg() {
129
+ return this.#pkg;
130
+ }
131
+ constructor({ pkg, bin, ui, shellService }) {
132
+ this.#pkg = pkg;
133
+ this.#bin = bin ?? pkg;
134
+ this.#ui = ui;
124
135
  this.#shellService = shellService;
125
136
  }
137
+ async getBinDir() {
138
+ return resolvePackageBin(this.#pkg, {
139
+ from: import.meta.url,
140
+ binName: this.#bin
141
+ });
142
+ }
126
143
  async exec(args = []) {
127
- return this.#shellService.run(this.getBinDir(), args, { display: this.#bin });
144
+ return this.#shellService.run(await this.getBinDir(), args, { display: this.#bin });
128
145
  }
129
146
  async doctor() {
130
- const output = await this.#shellService.runCaptured(this.getBinDir(), ["--help"], { throwOnError: false });
147
+ const output = await this.#shellService.runCaptured(await this.getBinDir(), ["--help"], { throwOnError: false });
131
148
  return {
132
149
  ok: output.exitCode === 0,
133
150
  output: {
@@ -137,26 +154,17 @@ var ToolService = class {
137
154
  }
138
155
  };
139
156
  }
140
- get bin() {
141
- return this.#bin;
142
- }
143
- get ui() {
144
- return this.#ui;
145
- }
146
157
  };
147
158
  //#endregion
148
159
  //#region src/services/tsdown.ts
149
160
  var TsdownService = class extends ToolService {
150
161
  constructor(shellService) {
151
162
  super({
152
- bin: "tsdown",
163
+ pkg: "tsdown",
153
164
  ui: TOOL_LABELS.TSDOWN,
154
165
  shellService
155
166
  });
156
167
  }
157
- getBinDir() {
158
- return resolveBinPath("tsdown", { from: import.meta.url });
159
- }
160
168
  async buildLib() {
161
169
  await this.exec();
162
170
  }
@@ -245,17 +253,12 @@ const COMMON_FLAGS = ["--colors=force", "--no-errors-on-unmatched"];
245
253
  var BiomeService = class extends ToolService {
246
254
  constructor(shellService) {
247
255
  super({
256
+ pkg: "@biomejs/biome",
248
257
  bin: "biome",
249
258
  ui: TOOL_LABELS.BIOME,
250
259
  shellService
251
260
  });
252
261
  }
253
- getBinDir() {
254
- return resolveBinPath("@biomejs/biome", {
255
- from: import.meta.url,
256
- binName: "biome"
257
- });
258
- }
259
262
  async format(options) {
260
263
  const args = ["format", ...COMMON_FLAGS];
261
264
  if (options.fix) args.push("--fix");
@@ -290,14 +293,11 @@ var BiomeService = class extends ToolService {
290
293
  var OxfmtService = class extends ToolService {
291
294
  constructor(shellService) {
292
295
  super({
293
- bin: "oxfmt",
296
+ pkg: "oxfmt",
294
297
  ui: TOOL_LABELS.OXFMT,
295
298
  shellService
296
299
  });
297
300
  }
298
- getBinDir() {
299
- return resolveBinPath("oxfmt", { from: import.meta.url });
300
- }
301
301
  async format(options) {
302
302
  await this.exec(["--no-error-on-unmatched-pattern", options.fix ? "--fix" : "--check"]);
303
303
  }
@@ -328,14 +328,11 @@ function createJsCheckCommand(ctx) {
328
328
  var OxlintService = class extends ToolService {
329
329
  constructor(shellService) {
330
330
  super({
331
- bin: "oxlint",
331
+ pkg: "oxlint",
332
332
  ui: TOOL_LABELS.OXLINT,
333
333
  shellService
334
334
  });
335
335
  }
336
- getBinDir() {
337
- return resolveBinPath("oxlint", { from: import.meta.url });
338
- }
339
336
  async lint(options) {
340
337
  await this.exec(["--report-unused-disable-directives", options.fix ? "--fix" : "--check"]);
341
338
  }
@@ -424,17 +421,12 @@ function createToolsCommand(ctx) {
424
421
  var TscService = class extends ToolService {
425
422
  constructor(shellService) {
426
423
  super({
424
+ pkg: "typescript",
427
425
  bin: "tsc",
428
426
  ui: TOOL_LABELS.TSC,
429
427
  shellService
430
428
  });
431
429
  }
432
- getBinDir() {
433
- return resolveBinPath("typescript", {
434
- from: import.meta.url,
435
- binName: "tsc"
436
- });
437
- }
438
430
  };
439
431
  //#endregion
440
432
  //#region src/program/commands/tscheck.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vlandoss/run-run",
3
- "version": "0.5.3-git-f368be9.0",
3
+ "version": "0.5.3-git-137024d.0",
4
4
  "description": "The CLI toolbox to fullstack common scripts in Variable Land",
5
5
  "homepage": "https://github.com/variableland/dx/tree/main/packages/run-run#readme",
6
6
  "bugs": {
@@ -61,10 +61,10 @@
61
61
  "oxlint": "1.50.0",
62
62
  "oxlint-tsgolint": "0.15.0",
63
63
  "rimraf": "6.1.3",
64
- "tsdown": "0.21.10",
64
+ "tsdown": "0.22.0",
65
65
  "typescript": "6.0.3",
66
- "@vlandoss/clibuddy": "0.5.1-git-f368be9.0",
67
- "@vlandoss/loggy": "0.2.0"
66
+ "@vlandoss/loggy": "0.2.0",
67
+ "@vlandoss/clibuddy": "0.5.1-git-137024d.0"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@vlandoss/tsdown-config": "^0.0.1"
@@ -1,4 +1,4 @@
1
- import { isCI, resolveBinPath, type ShellService } from "@vlandoss/clibuddy";
1
+ import { isCI, type ShellService } from "@vlandoss/clibuddy";
2
2
  import { TOOL_LABELS } from "#src/program/ui.ts";
3
3
  import type { FormatOptions, Formatter, Linter, LintOptions, StaticChecker, StaticCheckerOptions } from "#src/types/tool.ts";
4
4
  import { ToolService } from "./tool.ts";
@@ -7,11 +7,7 @@ const COMMON_FLAGS = ["--colors=force", "--no-errors-on-unmatched"];
7
7
 
8
8
  export class BiomeService extends ToolService implements Formatter, Linter, StaticChecker {
9
9
  constructor(shellService: ShellService) {
10
- super({ bin: "biome", ui: TOOL_LABELS.BIOME, shellService });
11
- }
12
-
13
- override getBinDir() {
14
- return resolveBinPath("@biomejs/biome", { from: import.meta.url, binName: "biome" });
10
+ super({ pkg: "@biomejs/biome", bin: "biome", ui: TOOL_LABELS.BIOME, shellService });
15
11
  }
16
12
 
17
13
  async format(options: FormatOptions) {
@@ -1,15 +1,11 @@
1
- import { resolveBinPath, type ShellService } from "@vlandoss/clibuddy";
1
+ import type { ShellService } from "@vlandoss/clibuddy";
2
2
  import { TOOL_LABELS } from "#src/program/ui.ts";
3
3
  import type { FormatOptions, Formatter } from "#src/types/tool.ts";
4
4
  import { ToolService } from "./tool.ts";
5
5
 
6
6
  export class OxfmtService extends ToolService implements Formatter {
7
7
  constructor(shellService: ShellService) {
8
- super({ bin: "oxfmt", ui: TOOL_LABELS.OXFMT, shellService });
9
- }
10
-
11
- override getBinDir() {
12
- return resolveBinPath("oxfmt", { from: import.meta.url });
8
+ super({ pkg: "oxfmt", ui: TOOL_LABELS.OXFMT, shellService });
13
9
  }
14
10
 
15
11
  async format(options: FormatOptions) {
@@ -1,15 +1,11 @@
1
- import { resolveBinPath, type ShellService } from "@vlandoss/clibuddy";
1
+ import type { ShellService } from "@vlandoss/clibuddy";
2
2
  import { TOOL_LABELS } from "#src/program/ui.ts";
3
3
  import type { Linter, LintOptions } from "#src/types/tool.ts";
4
4
  import { ToolService } from "./tool.ts";
5
5
 
6
6
  export class OxlintService extends ToolService implements Linter {
7
7
  constructor(shellService: ShellService) {
8
- super({ bin: "oxlint", ui: TOOL_LABELS.OXLINT, shellService });
9
- }
10
-
11
- override getBinDir() {
12
- return resolveBinPath("oxlint", { from: import.meta.url });
8
+ super({ pkg: "oxlint", ui: TOOL_LABELS.OXLINT, shellService });
13
9
  }
14
10
 
15
11
  async lint(options: LintOptions) {
@@ -1,46 +1,60 @@
1
- import type { ShellService } from "@vlandoss/clibuddy";
1
+ import { resolvePackageBin, type ShellService } from "@vlandoss/clibuddy";
2
2
  import type { DoctorResult } from "#src/types/tool.ts";
3
3
 
4
4
  type CreateOptions = {
5
- bin: string;
6
- ui?: string;
5
+ pkg: string;
6
+ bin?: string;
7
+ ui: string;
7
8
  shellService: ShellService;
8
9
  };
9
10
 
10
- export abstract class ToolService {
11
+ export class ToolService {
11
12
  #shellService: ShellService;
13
+ #pkg: string;
12
14
  #bin: string;
13
15
  #ui: string;
14
16
 
15
- constructor({ bin, ui, shellService }: CreateOptions) {
16
- this.#bin = bin;
17
- this.#ui = ui ?? bin;
17
+ get bin() {
18
+ return this.#bin;
19
+ }
20
+
21
+ get ui() {
22
+ return this.#ui;
23
+ }
24
+
25
+ get pkg() {
26
+ return this.#pkg;
27
+ }
28
+
29
+ constructor({ pkg, bin, ui, shellService }: CreateOptions) {
30
+ this.#pkg = pkg;
31
+ this.#bin = bin ?? pkg;
32
+ this.#ui = ui;
18
33
  this.#shellService = shellService;
19
34
  }
20
35
 
21
- // Must return an absolute path so we bypass the `node_modules/.bin/<bin>`
22
- // shims that run-run itself publishes (`tools/biome`, etc) — otherwise
23
- // calling the friendly name loops back through `rr tools <bin>`.
24
- abstract getBinDir(): string;
36
+ async getBinDir() {
37
+ return resolvePackageBin(this.#pkg, {
38
+ from: import.meta.url,
39
+ binName: this.#bin,
40
+ });
41
+ }
25
42
 
26
43
  async exec(args: string[] = []) {
27
- return this.#shellService.run(this.getBinDir(), args, { display: this.#bin });
44
+ return this.#shellService.run(await this.getBinDir(), args, { display: this.#bin });
28
45
  }
29
46
 
30
47
  async doctor(): Promise<DoctorResult> {
31
- const output = await this.#shellService.runCaptured(this.getBinDir(), ["--help"], { throwOnError: false });
48
+ const output = await this.#shellService.runCaptured(await this.getBinDir(), ["--help"], { throwOnError: false });
32
49
  const ok = output.exitCode === 0;
50
+
33
51
  return {
34
52
  ok,
35
- output: { stdout: output.stdout, stderr: output.stderr, exitCode: output.exitCode },
53
+ output: {
54
+ stdout: output.stdout,
55
+ stderr: output.stderr,
56
+ exitCode: output.exitCode,
57
+ },
36
58
  };
37
59
  }
38
-
39
- get bin() {
40
- return this.#bin;
41
- }
42
-
43
- get ui() {
44
- return this.#ui;
45
- }
46
60
  }
@@ -1,13 +1,9 @@
1
- import { resolveBinPath, type ShellService } from "@vlandoss/clibuddy";
1
+ import type { ShellService } from "@vlandoss/clibuddy";
2
2
  import { TOOL_LABELS } from "#src/program/ui.ts";
3
3
  import { ToolService } from "./tool.ts";
4
4
 
5
5
  export class TscService extends ToolService {
6
6
  constructor(shellService: ShellService) {
7
- super({ bin: "tsc", ui: TOOL_LABELS.TSC, shellService });
8
- }
9
-
10
- override getBinDir() {
11
- return resolveBinPath("typescript", { from: import.meta.url, binName: "tsc" });
7
+ super({ pkg: "typescript", bin: "tsc", ui: TOOL_LABELS.TSC, shellService });
12
8
  }
13
9
  }
@@ -1,14 +1,10 @@
1
- import { resolveBinPath, type ShellService } from "@vlandoss/clibuddy";
1
+ import type { ShellService } from "@vlandoss/clibuddy";
2
2
  import { TOOL_LABELS } from "#src/program/ui.ts";
3
3
  import { ToolService } from "./tool.ts";
4
4
 
5
5
  export class TsdownService extends ToolService {
6
6
  constructor(shellService: ShellService) {
7
- super({ bin: "tsdown", ui: TOOL_LABELS.TSDOWN, shellService });
8
- }
9
-
10
- override getBinDir() {
11
- return resolveBinPath("tsdown", { from: import.meta.url });
7
+ super({ pkg: "tsdown", ui: TOOL_LABELS.TSDOWN, shellService });
12
8
  }
13
9
 
14
10
  async buildLib() {