Skip to content

Commit 4652f97

Browse files
committed
fix: link to local bin files
1 parent 9890e8b commit 4652f97

File tree

7 files changed

+14
-6
lines changed

7 files changed

+14
-6
lines changed

.changeset/soft-ghosts-type.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@bomb.sh/tools": patch
3+
---
4+
5+
link to nested local `.bin` files

src/commands/dev.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
// standardized `dev` command, shells out to `node --strip-types`
2-
import { argv } from "node:process";
3-
41
import { x } from "tinyexec";
52
import type { CommandContext } from "../context.ts";
63

4+
// standardized `dev` command, shells out to `node --strip-types`
75
export async function dev(ctx: CommandContext) {
86
const { args } = ctx;
97
const [file = "./src/index.ts", ...rest] = args;

src/commands/format.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { x } from "tinyexec";
22
import type { CommandContext } from "../context.ts";
3+
import { local } from "../utils.ts";
34

45
// standardized `format` command, runs `@biomejs/biome` and fixes formatting
56
export async function format(ctx: CommandContext) {
67
console.log("Formatting with Biome");
7-
const stdio = x("biome", ["check", "--write", "./src"]);
8+
const stdio = x(local('biome'), ["check", "--write", "./src"]);
89

910
for await (const line of stdio) {
1011
console.log(line);

src/commands/lint.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { x } from "tinyexec";
22
import type { CommandContext } from "../context.ts";
3+
import { local } from "../utils.ts";
34

45
// standardized `lint` command, runs `@biomejs/biome` and generates a lint report
56
export async function lint(ctx: CommandContext) {
67
console.log("Linting with Biome");
7-
const stdio = x("biome", ["lint", "./src"]);
8+
const stdio = x(local('biome'), ["lint", "./src"]);
89

910
for await (const line of stdio) {
1011
console.log(line);

src/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/utils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { fileURLToPath, pathToFileURL } from "node:url";
22
import escalade from "escalade";
33

4+
export function local(file: string) {
5+
return fileURLToPath(new URL(`../node_modules/.bin/${file}`, import.meta.url))
6+
}
7+
48
export async function getPackageJSON() {
59
const pkg = await escalade(fileURLToPath(import.meta.url), (dir, files) => {
610
return files.find((file) => file === "package.json");

0 commit comments

Comments
 (0)