@vlandoss/run-run 0.0.16-git-474ac67.0 โ 0.0.16
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/package.json +9 -8
- package/src/program/__tests__/__snapshots__/snapshots.test.ts.snap +54 -72
- package/src/program/__tests__/snapshots.test.ts +1 -1
- package/src/program/commands/build-lib.ts +12 -0
- package/src/program/commands/check.ts +4 -3
- package/src/program/commands/clean.ts +3 -2
- package/src/program/commands/config.ts +3 -3
- package/src/program/commands/format.ts +2 -2
- package/src/program/commands/lint.ts +2 -2
- package/src/program/commands/typecheck.ts +6 -6
- package/src/program/index.ts +16 -11
- package/src/program/ui.ts +61 -9
- package/src/services/biome.ts +2 -1
- package/src/services/oxfmt.ts +2 -1
- package/src/services/oxlint.ts +2 -1
- package/src/services/tool.ts +9 -2
- package/src/types/tool.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vlandoss/run-run",
|
|
3
|
-
"version": "0.0.16
|
|
3
|
+
"version": "0.0.16",
|
|
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": {
|
|
@@ -32,16 +32,17 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@biomejs/biome": "2.4.4",
|
|
34
34
|
"commander": "14.0.3",
|
|
35
|
-
"glob": "
|
|
35
|
+
"glob": "13.0.6",
|
|
36
36
|
"is-ci": "4.1.0",
|
|
37
|
-
"lilconfig": "
|
|
38
|
-
"memoize": "
|
|
39
|
-
"oxfmt": "
|
|
40
|
-
"oxlint": "
|
|
41
|
-
"oxlint-tsgolint": "
|
|
37
|
+
"lilconfig": "3.1.3",
|
|
38
|
+
"memoize": "10.2.0",
|
|
39
|
+
"oxfmt": "0.35.0",
|
|
40
|
+
"oxlint": "1.50.0",
|
|
41
|
+
"oxlint-tsgolint": "0.15.0",
|
|
42
42
|
"rimraf": "6.1.3",
|
|
43
|
+
"tsdown": "0.21.0-beta.2",
|
|
43
44
|
"typescript": "5.9.3",
|
|
44
|
-
"@vlandoss/clibuddy": "0.0.8
|
|
45
|
+
"@vlandoss/clibuddy": "0.0.8",
|
|
45
46
|
"@vlandoss/loggy": "0.0.6"
|
|
46
47
|
},
|
|
47
48
|
"publishConfig": {
|
|
@@ -1,37 +1,8 @@
|
|
|
1
1
|
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
|
|
2
2
|
|
|
3
|
-
exports[`should match all root commands: root-command-help 1`] = `
|
|
4
|
-
"๐ฆ R U N - R U N: The CLI toolbox to fullstack common scripts in Variable Land ๐
|
|
5
|
-
|
|
6
|
-
Usage: rr|run-run [options] <command...>
|
|
7
|
-
|
|
8
|
-
Options:
|
|
9
|
-
-v, --version output the version number
|
|
10
|
-
-h, --help display help for command
|
|
11
|
-
|
|
12
|
-
Commands:
|
|
13
|
-
config|cfg display the current config ๐ ๏ธ
|
|
14
|
-
check|test:static [options] check format and lint issues ๐
|
|
15
|
-
lint [options] lint the code ๐งน
|
|
16
|
-
fmt|format [options] format the code ๐จ
|
|
17
|
-
tsc|typecheck check if TypeScript code is well typed ๐จ
|
|
18
|
-
clean [options] delete dirty folders or files such as
|
|
19
|
-
node_modules, etc ๐๏ธ
|
|
20
|
-
pkgs|packages [options] list unique affected packages from list of files
|
|
21
|
-
๐ฆ
|
|
22
|
-
help [command] display help for command
|
|
23
|
-
|
|
24
|
-
Acknowledgment:
|
|
25
|
-
- kcd-scripts: for main inspiration
|
|
26
|
-
https://github.com/kentcdodds/kcd-scripts
|
|
27
|
-
|
|
28
|
-
- peruvian news: in honor to Run Run
|
|
29
|
-
https://es.wikipedia.org/wiki/Run_Run
|
|
30
|
-
"
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
3
|
exports[`should match all root commands: root-command---help 1`] = `
|
|
34
|
-
"๐ฆ R U N - R U N
|
|
4
|
+
"๐ฆ R U N - R U N v0.0.0-test
|
|
5
|
+
The CLI toolbox for Variable Land ๐
|
|
35
6
|
|
|
36
7
|
Usage: rr|run-run [options] <command...>
|
|
37
8
|
|
|
@@ -40,16 +11,15 @@ Options:
|
|
|
40
11
|
-h, --help display help for command
|
|
41
12
|
|
|
42
13
|
Commands:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
tsc|typecheck check if
|
|
48
|
-
clean [options] delete dirty folders or files
|
|
49
|
-
node_modules, etc ๐๏ธ
|
|
14
|
+
build:lib build a ts project ๐๏ธ (tsdown)
|
|
15
|
+
lint [options] lint the code ๐งน (biome)
|
|
16
|
+
fmt|format [options] format the code ๐จ (biome)
|
|
17
|
+
check|test:static [options] check format and lint ๐ (biome)
|
|
18
|
+
tsc|typecheck check if ts code is well typed ๐จ (tsc)
|
|
19
|
+
clean [options] delete dirty folders or files ๐๏ธ (rimraf)
|
|
50
20
|
pkgs|packages [options] list unique affected packages from list of files
|
|
51
21
|
๐ฆ
|
|
52
|
-
|
|
22
|
+
config|cfg display the current config ๐ ๏ธ
|
|
53
23
|
|
|
54
24
|
Acknowledgment:
|
|
55
25
|
- kcd-scripts: for main inspiration
|
|
@@ -70,45 +40,22 @@ exports[`should match all root commands: root-command--v 1`] = `
|
|
|
70
40
|
"
|
|
71
41
|
`;
|
|
72
42
|
|
|
73
|
-
exports[`should match help messages for all commands: help-command-
|
|
74
|
-
"Usage: rr
|
|
43
|
+
exports[`should match help messages for all commands: help-command-build:lib 1`] = `
|
|
44
|
+
"Usage: rr build:lib [options]
|
|
75
45
|
|
|
76
|
-
|
|
77
|
-
cmds commands to execute concurrently (e.g. 'check tsc')
|
|
46
|
+
build a ts project ๐๏ธ (tsdown)
|
|
78
47
|
|
|
79
48
|
Options:
|
|
80
49
|
-h, --help display help for command
|
|
81
|
-
"
|
|
82
|
-
`;
|
|
83
|
-
|
|
84
|
-
exports[`should match help messages for all commands: help-command-config 1`] = `
|
|
85
|
-
"Usage: rr config|cfg [options]
|
|
86
50
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
Options:
|
|
90
|
-
-h, --help display help for command
|
|
91
|
-
"
|
|
92
|
-
`;
|
|
93
|
-
|
|
94
|
-
exports[`should match help messages for all commands: help-command-check 1`] = `
|
|
95
|
-
"Usage: rr check|test:static [options]
|
|
96
|
-
|
|
97
|
-
check format and lint issues ๐
|
|
98
|
-
|
|
99
|
-
Options:
|
|
100
|
-
-f, --fix try to fix issues automatically
|
|
101
|
-
--fix-staged try to fix staged files only
|
|
102
|
-
-h, --help display help for command
|
|
103
|
-
|
|
104
|
-
Under the hood, this command uses the biome CLI to check the code.
|
|
51
|
+
Under the hood, this command uses the tsdown CLI to build the project.
|
|
105
52
|
"
|
|
106
53
|
`;
|
|
107
54
|
|
|
108
55
|
exports[`should match help messages for all commands: help-command-lint 1`] = `
|
|
109
56
|
"Usage: rr lint [options]
|
|
110
57
|
|
|
111
|
-
lint the code ๐งน
|
|
58
|
+
lint the code ๐งน (biome)
|
|
112
59
|
|
|
113
60
|
Options:
|
|
114
61
|
-c, --check check if the code is valid (default: true)
|
|
@@ -122,7 +69,7 @@ Under the hood, this command uses the biome CLI to lint the code.
|
|
|
122
69
|
exports[`should match help messages for all commands: help-command-fmt 1`] = `
|
|
123
70
|
"Usage: rr fmt|format [options]
|
|
124
71
|
|
|
125
|
-
format the code ๐จ
|
|
72
|
+
format the code ๐จ (biome)
|
|
126
73
|
|
|
127
74
|
Options:
|
|
128
75
|
-c, --check check if the code is formatted (default: true)
|
|
@@ -133,29 +80,43 @@ Under the hood, this command uses the biome CLI to format the code.
|
|
|
133
80
|
"
|
|
134
81
|
`;
|
|
135
82
|
|
|
83
|
+
exports[`should match help messages for all commands: help-command-check 1`] = `
|
|
84
|
+
"Usage: rr check|test:static [options]
|
|
85
|
+
|
|
86
|
+
check format and lint ๐ (biome)
|
|
87
|
+
|
|
88
|
+
Options:
|
|
89
|
+
-f, --fix try to fix issues automatically
|
|
90
|
+
--fix-staged try to fix staged files only
|
|
91
|
+
-h, --help display help for command
|
|
92
|
+
|
|
93
|
+
Under the hood, this command uses the biome CLI to check the code.
|
|
94
|
+
"
|
|
95
|
+
`;
|
|
96
|
+
|
|
136
97
|
exports[`should match help messages for all commands: help-command-tsc 1`] = `
|
|
137
98
|
"Usage: rr tsc|typecheck [options]
|
|
138
99
|
|
|
139
|
-
check if
|
|
100
|
+
check if ts code is well typed ๐จ (tsc)
|
|
140
101
|
|
|
141
102
|
Options:
|
|
142
103
|
-h, --help display help for command
|
|
143
104
|
|
|
144
|
-
Under the hood, this command uses the
|
|
105
|
+
Under the hood, this command uses the tsc CLI to check the code.
|
|
145
106
|
"
|
|
146
107
|
`;
|
|
147
108
|
|
|
148
109
|
exports[`should match help messages for all commands: help-command-clean 1`] = `
|
|
149
110
|
"Usage: rr clean [options]
|
|
150
111
|
|
|
151
|
-
delete dirty folders or files
|
|
112
|
+
delete dirty folders or files ๐๏ธ (rimraf)
|
|
152
113
|
|
|
153
114
|
Options:
|
|
154
115
|
--only-dist delete 'dist' folders only
|
|
155
116
|
--dry-run outputs the paths that would be deleted
|
|
156
117
|
-h, --help display help for command
|
|
157
118
|
|
|
158
|
-
Under the hood, this command uses
|
|
119
|
+
Under the hood, this command uses rimraf to delete dirty folders or files.
|
|
159
120
|
"
|
|
160
121
|
`;
|
|
161
122
|
|
|
@@ -171,6 +132,27 @@ Options:
|
|
|
171
132
|
"
|
|
172
133
|
`;
|
|
173
134
|
|
|
135
|
+
exports[`should match help messages for all commands: help-command-config 1`] = `
|
|
136
|
+
"Usage: rr config|cfg [options]
|
|
137
|
+
|
|
138
|
+
display the current config ๐ ๏ธ
|
|
139
|
+
|
|
140
|
+
Options:
|
|
141
|
+
-h, --help display help for command
|
|
142
|
+
"
|
|
143
|
+
`;
|
|
144
|
+
|
|
145
|
+
exports[`should match help messages for all commands: help-command-run 1`] = `
|
|
146
|
+
"Usage: rr run [options] <cmds...>
|
|
147
|
+
|
|
148
|
+
Arguments:
|
|
149
|
+
cmds commands to execute concurrently (e.g. 'check tsc')
|
|
150
|
+
|
|
151
|
+
Options:
|
|
152
|
+
-h, --help display help for command
|
|
153
|
+
"
|
|
154
|
+
`;
|
|
155
|
+
|
|
174
156
|
exports[`should match help messages for all commands: help-command-tools 1`] = `
|
|
175
157
|
"Usage: rr tools [options] [command]
|
|
176
158
|
|
|
@@ -4,7 +4,7 @@ import { createTestProgram, execCli, mocked } from "#test/helpers";
|
|
|
4
4
|
const { program, ctx } = await createTestProgram();
|
|
5
5
|
const $ = ctx.shell.$;
|
|
6
6
|
|
|
7
|
-
const rootCommands = ["
|
|
7
|
+
const rootCommands = ["--help", "--version", "-v"];
|
|
8
8
|
|
|
9
9
|
afterEach(() => {
|
|
10
10
|
mocked($).mockClear();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createCommand } from "commander";
|
|
2
|
+
import { TOOL_LABELS } from "#/program/ui";
|
|
3
|
+
import type { Context } from "#/services/ctx";
|
|
4
|
+
|
|
5
|
+
export function createBuildLibCommand(ctx: Context) {
|
|
6
|
+
return createCommand("build:lib")
|
|
7
|
+
.description(`build a ts project ๐๏ธ (${TOOL_LABELS.TSDOWN})`)
|
|
8
|
+
.action(async function buildAction() {
|
|
9
|
+
await ctx.shell.$`tsdown`;
|
|
10
|
+
})
|
|
11
|
+
.addHelpText("afterAll", `\nUnder the hood, this command uses the ${TOOL_LABELS.TSDOWN} CLI to build the project.`);
|
|
12
|
+
}
|
|
@@ -4,13 +4,14 @@ import { BiomeService } from "#/services/biome";
|
|
|
4
4
|
import type { Context } from "#/services/ctx";
|
|
5
5
|
|
|
6
6
|
export function createCheckCommand(ctx: Context) {
|
|
7
|
+
const biome = new BiomeService(ctx.shell);
|
|
8
|
+
|
|
7
9
|
return createCommand("check")
|
|
8
10
|
.alias("test:static")
|
|
9
|
-
.description(
|
|
11
|
+
.description(`check format and lint ๐ (${biome.ui})`)
|
|
10
12
|
.option("-f, --fix", "try to fix issues automatically")
|
|
11
13
|
.option("--fix-staged", "try to fix staged files only")
|
|
12
14
|
.action(async function checkAction(options) {
|
|
13
|
-
const biome = new BiomeService(ctx.shell);
|
|
14
15
|
const toolCmd = (cmd = "check") => `${cmd} --colors=force`;
|
|
15
16
|
|
|
16
17
|
if (options.fix) {
|
|
@@ -21,5 +22,5 @@ export function createCheckCommand(ctx: Context) {
|
|
|
21
22
|
await biome.exec(`${toolCmd(isCI ? "ci" : "check")}`);
|
|
22
23
|
}
|
|
23
24
|
})
|
|
24
|
-
.addHelpText("afterAll",
|
|
25
|
+
.addHelpText("afterAll", `\nUnder the hood, this command uses the ${biome.ui} CLI to check the code.`);
|
|
25
26
|
}
|
|
@@ -3,6 +3,7 @@ import { createCommand } from "commander";
|
|
|
3
3
|
import { type GlobOptions, glob } from "glob";
|
|
4
4
|
import { rimraf } from "rimraf";
|
|
5
5
|
import { logger } from "#/services/logger";
|
|
6
|
+
import { TOOL_LABELS } from "../ui";
|
|
6
7
|
|
|
7
8
|
type Options = {
|
|
8
9
|
onlyDist: boolean;
|
|
@@ -11,7 +12,7 @@ type Options = {
|
|
|
11
12
|
|
|
12
13
|
export function createCleanCommand() {
|
|
13
14
|
return createCommand("clean")
|
|
14
|
-
.description(
|
|
15
|
+
.description(`delete dirty folders or files ๐๏ธ (${TOOL_LABELS.RIMRAF})`)
|
|
15
16
|
.option("--only-dist", "delete 'dist' folders only")
|
|
16
17
|
.option("--dry-run", "outputs the paths that would be deleted")
|
|
17
18
|
.action(async function cleanCommandAction(options: Options) {
|
|
@@ -47,5 +48,5 @@ export function createCleanCommand() {
|
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
50
|
})
|
|
50
|
-
.addHelpText("afterAll",
|
|
51
|
+
.addHelpText("afterAll", `\nUnder the hood, this command uses ${TOOL_LABELS.RIMRAF} to delete dirty folders or files.`);
|
|
51
52
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { palette } from "@vlandoss/clibuddy";
|
|
2
2
|
import { createCommand } from "commander";
|
|
3
3
|
import type { Context } from "#/services/ctx";
|
|
4
4
|
|
|
@@ -8,8 +8,8 @@ export function createConfigCommand(ctx: Context) {
|
|
|
8
8
|
.description("display the current config ๐ ๏ธ")
|
|
9
9
|
.action(async function configAction() {
|
|
10
10
|
const { config, meta } = ctx.config;
|
|
11
|
-
console.log(
|
|
11
|
+
console.log(palette.muted("Config:"));
|
|
12
12
|
console.log(config);
|
|
13
|
-
console.log(
|
|
13
|
+
console.log(palette.muted(`Loaded from ${meta.filepath ? palette.link(meta.filepath) : "n/a"}`));
|
|
14
14
|
});
|
|
15
15
|
}
|
|
@@ -24,11 +24,11 @@ export function createFormatCommand(ctx: Context) {
|
|
|
24
24
|
|
|
25
25
|
return createCommand("fmt")
|
|
26
26
|
.alias("format")
|
|
27
|
-
.description(
|
|
27
|
+
.description(`format the code ๐จ (${toolService.ui})`)
|
|
28
28
|
.option("-c, --check", "check if the code is formatted", true)
|
|
29
29
|
.option("-f, --fix", "format all the code")
|
|
30
30
|
.action(async function formatAction(options: ActionOptions) {
|
|
31
31
|
await toolService.format(options);
|
|
32
32
|
})
|
|
33
|
-
.addHelpText("afterAll", `\nUnder the hood, this command uses the ${toolService.
|
|
33
|
+
.addHelpText("afterAll", `\nUnder the hood, this command uses the ${toolService.ui} CLI to format the code.`);
|
|
34
34
|
}
|
|
@@ -23,11 +23,11 @@ export function createLintCommand(ctx: Context) {
|
|
|
23
23
|
const toolService = getToolService(ctx);
|
|
24
24
|
|
|
25
25
|
return createCommand("lint")
|
|
26
|
-
.description(
|
|
26
|
+
.description(`lint the code ๐งน (${toolService.ui})`)
|
|
27
27
|
.option("-c, --check", "check if the code is valid", true)
|
|
28
28
|
.option("-f, --fix", "try to fix all the code")
|
|
29
29
|
.action(async function lintAction(options: ActionOptions) {
|
|
30
30
|
await toolService.lint(options);
|
|
31
31
|
})
|
|
32
|
-
.addHelpText("afterAll", `\nUnder the hood, this command uses the ${toolService.
|
|
32
|
+
.addHelpText("afterAll", `\nUnder the hood, this command uses the ${toolService.ui} CLI to lint the code.`);
|
|
33
33
|
}
|
|
@@ -4,6 +4,7 @@ import { createCommand } from "commander";
|
|
|
4
4
|
import type { Context } from "#/services/ctx";
|
|
5
5
|
import { logger } from "#/services/logger";
|
|
6
6
|
import { OxlintService } from "#/services/oxlint";
|
|
7
|
+
import { TOOL_LABELS } from "../ui";
|
|
7
8
|
|
|
8
9
|
type TypecheckAtOptions = {
|
|
9
10
|
dir: string;
|
|
@@ -51,13 +52,12 @@ export function createTypecheckCommand(ctx: Context) {
|
|
|
51
52
|
config: { config },
|
|
52
53
|
} = ctx;
|
|
53
54
|
|
|
55
|
+
const toolUi = config.future?.oxc ? TOOL_LABELS.OXLINT : TOOL_LABELS.TSC;
|
|
56
|
+
|
|
54
57
|
return createCommand("tsc")
|
|
55
58
|
.alias("typecheck")
|
|
56
|
-
.description(
|
|
57
|
-
.addHelpText(
|
|
58
|
-
"afterAll",
|
|
59
|
-
`\nUnder the hood, this command uses the ${config.future?.oxc ? "oxlint" : "TypeScript"} CLI to check the code.`,
|
|
60
|
-
)
|
|
59
|
+
.description(`check if ts code is well typed ๐จ (${toolUi})`)
|
|
60
|
+
.addHelpText("afterAll", `\nUnder the hood, this command uses the ${toolUi} CLI to check the code.`)
|
|
61
61
|
.action(async function typecheckAction() {
|
|
62
62
|
const isTsProject = (dir: string) => appPkg.hasFile("tsconfig.json", dir);
|
|
63
63
|
|
|
@@ -91,7 +91,7 @@ export function createTypecheckCommand(ctx: Context) {
|
|
|
91
91
|
const tsProjects = projects.filter((project) => isTsProject(project.rootDir));
|
|
92
92
|
|
|
93
93
|
if (!tsProjects.length) {
|
|
94
|
-
logger.warn("No
|
|
94
|
+
logger.warn("No ts projects found in the monorepo, skipping typecheck");
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
97
|
|
package/src/program/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getVersion } from "@vlandoss/clibuddy";
|
|
2
2
|
import { createCommand } from "commander";
|
|
3
3
|
import { createContext } from "#/services/ctx";
|
|
4
|
+
import { createBuildLibCommand } from "./commands/build-lib";
|
|
4
5
|
import { createCheckCommand } from "./commands/check";
|
|
5
6
|
import { createCleanCommand } from "./commands/clean";
|
|
6
7
|
import { createConfigCommand } from "./commands/config";
|
|
@@ -10,7 +11,7 @@ import { createPkgsCommand } from "./commands/pkgs";
|
|
|
10
11
|
import { createRunCommand } from "./commands/run";
|
|
11
12
|
import { createToolsCommand } from "./commands/tools";
|
|
12
13
|
import { createTypecheckCommand } from "./commands/typecheck";
|
|
13
|
-
import {
|
|
14
|
+
import { CREDITS_TEXT, getBannerText } from "./ui";
|
|
14
15
|
|
|
15
16
|
export type Options = {
|
|
16
17
|
binDir: string;
|
|
@@ -18,26 +19,30 @@ export type Options = {
|
|
|
18
19
|
|
|
19
20
|
export async function createProgram(options: Options) {
|
|
20
21
|
const ctx = await createContext(options.binDir);
|
|
22
|
+
const version = getVersion(ctx.binPkg);
|
|
21
23
|
|
|
22
24
|
const program = createCommand("rr")
|
|
23
25
|
.alias("run-run")
|
|
24
26
|
.usage("[options] <command...>")
|
|
25
|
-
.
|
|
26
|
-
.
|
|
27
|
+
.helpCommand(false)
|
|
28
|
+
.version(version, "-v, --version")
|
|
29
|
+
.addHelpText("before", getBannerText(version))
|
|
27
30
|
.addHelpText("after", CREDITS_TEXT)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
.addCommand(createConfigCommand(ctx))
|
|
32
|
-
.addCommand(createCheckCommand(ctx))
|
|
31
|
+
// build
|
|
32
|
+
.addCommand(createBuildLibCommand(ctx))
|
|
33
|
+
// check
|
|
33
34
|
.addCommand(createLintCommand(ctx))
|
|
34
35
|
.addCommand(createFormatCommand(ctx))
|
|
36
|
+
.addCommand(createCheckCommand(ctx))
|
|
35
37
|
.addCommand(createTypecheckCommand(ctx))
|
|
38
|
+
// misc
|
|
36
39
|
.addCommand(createCleanCommand())
|
|
37
40
|
.addCommand(createPkgsCommand(ctx))
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
// config
|
|
42
|
+
.addCommand(createConfigCommand(ctx))
|
|
43
|
+
// hidden
|
|
44
|
+
.addCommand(createRunCommand(ctx), { hidden: true })
|
|
45
|
+
.addCommand(createToolsCommand(ctx), { hidden: true });
|
|
41
46
|
|
|
42
47
|
return { program, ctx };
|
|
43
48
|
}
|
package/src/program/ui.ts
CHANGED
|
@@ -1,14 +1,66 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export const UI_LOGO = `๐ฆ ${colors.blueBright("R")} ${colors.redBright("U")} ${colors.greenBright("N")} - ${colors.blueBright("R")} ${colors.redBright("U")} ${colors.greenBright("N")}`;
|
|
4
|
-
|
|
5
|
-
const COMPANY_LOGO = `${colors.redBright("Variable Land")} ๐`;
|
|
6
|
-
|
|
7
|
-
export const BANNER_TEXT = `${UI_LOGO}: The CLI toolbox to fullstack common scripts in ${COMPANY_LOGO}\n`;
|
|
1
|
+
import { colorIsSupported, colorize, palette } from "@vlandoss/clibuddy";
|
|
8
2
|
|
|
9
3
|
export const CREDITS_TEXT = `\nAcknowledgment:
|
|
10
4
|
- kcd-scripts: for main inspiration
|
|
11
|
-
https://github.com/kentcdodds/kcd-scripts
|
|
5
|
+
${palette.link("https://github.com/kentcdodds/kcd-scripts")}
|
|
12
6
|
|
|
13
7
|
- peruvian news: in honor to Run Run
|
|
14
|
-
https://es.wikipedia.org/wiki/Run_Run`;
|
|
8
|
+
${palette.link("https://es.wikipedia.org/wiki/Run_Run")}`;
|
|
9
|
+
|
|
10
|
+
const tsdownColor = colorize("#FF7E18");
|
|
11
|
+
const biomeColor = colorize("#61A5FA");
|
|
12
|
+
const oxlintColor = colorize("#32F3E9");
|
|
13
|
+
const oxfmtColor = colorize("#32F3E9");
|
|
14
|
+
const tscColor = colorize("#3178C6");
|
|
15
|
+
const rimrafColor = colorize("#7C7270");
|
|
16
|
+
|
|
17
|
+
export const TOOL_LABELS = {
|
|
18
|
+
TSDOWN: tsdownColor("tsdown"),
|
|
19
|
+
BIOME: biomeColor("biome"),
|
|
20
|
+
OXLINT: oxlintColor("oxlint"),
|
|
21
|
+
OXFMT: oxfmtColor("oxfmt"),
|
|
22
|
+
TSC: tscColor("tsc"),
|
|
23
|
+
RIMRAF: rimrafColor("rimraf"),
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export function getBannerText(version: string) {
|
|
27
|
+
const uiLogo = `๐ฆ ${palette.bold("R")} ${palette.bold("U")} ${palette.bold("N")} - ${palette.bold("R")} ${palette.bold("U")} ${palette.bold("N")}`;
|
|
28
|
+
const vlandLogo = `${palette.vland("Variable Land")} ๐`;
|
|
29
|
+
|
|
30
|
+
const title = `${uiLogo} ${palette.muted(`v${version}`)}`;
|
|
31
|
+
const subtitle = `${palette.italic(palette.muted("The CLI toolbox for"))} ${vlandLogo}`;
|
|
32
|
+
|
|
33
|
+
if (!colorIsSupported()) {
|
|
34
|
+
return `${title}\n${subtitle}\n`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const FOX_COLORS = {
|
|
38
|
+
BLACK: colorize("#39393A"),
|
|
39
|
+
ORANGE: colorize("FC7A1e"),
|
|
40
|
+
WHITE: colorize("#FFFFFF"),
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const _ = " "; // hole
|
|
44
|
+
const B = FOX_COLORS.BLACK("โโ"); // black
|
|
45
|
+
const O = FOX_COLORS.ORANGE("โโ"); // orange
|
|
46
|
+
const W = FOX_COLORS.WHITE("โโ"); // white
|
|
47
|
+
|
|
48
|
+
const grid = [
|
|
49
|
+
[_, B, _, _, _, _, _, B, _],
|
|
50
|
+
[_, O, W, _, _, _, W, O, _],
|
|
51
|
+
[_, O, W, O, _, O, W, O, _],
|
|
52
|
+
[B, O, O, O, O, O, O, O, B],
|
|
53
|
+
[O, O, O, O, O, O, O, O, O],
|
|
54
|
+
[W, O, B, O, O, O, B, O, W],
|
|
55
|
+
[_, W, W, O, O, O, W, W, _],
|
|
56
|
+
[_, _, W, W, B, W, W, _, _],
|
|
57
|
+
[_, _, _, W, W, W, _, _, _],
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
const lines = grid.map((row) => row.join(""));
|
|
61
|
+
|
|
62
|
+
lines[3] += ` ${title}`;
|
|
63
|
+
lines[4] += ` ${subtitle}`;
|
|
64
|
+
|
|
65
|
+
return `${lines.join("\n")}\n`;
|
|
66
|
+
}
|
package/src/services/biome.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { ShellService } from "@vlandoss/clibuddy";
|
|
2
|
+
import { TOOL_LABELS } from "#/program/ui";
|
|
2
3
|
import type { FormatOptions, Formatter, Linter, LintOptions } from "#/types/tool";
|
|
3
4
|
import { ToolService } from "./tool";
|
|
4
5
|
|
|
5
6
|
export class BiomeService extends ToolService implements Formatter, Linter {
|
|
6
7
|
constructor(shellService: ShellService) {
|
|
7
|
-
super({ bin: "biome", shellService });
|
|
8
|
+
super({ bin: "biome", ui: TOOL_LABELS.BIOME, shellService });
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
getBinDir() {
|
package/src/services/oxfmt.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { ShellService } from "@vlandoss/clibuddy";
|
|
2
|
+
import { TOOL_LABELS } from "#/program/ui";
|
|
2
3
|
import type { FormatOptions, Formatter } from "#/types/tool";
|
|
3
4
|
import { ToolService } from "./tool";
|
|
4
5
|
|
|
5
6
|
export class OxfmtService extends ToolService implements Formatter {
|
|
6
7
|
constructor(shellService: ShellService) {
|
|
7
|
-
super({ bin: "oxfmt", shellService });
|
|
8
|
+
super({ bin: "oxfmt", ui: TOOL_LABELS.OXFMT, shellService });
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
getBinDir() {
|
package/src/services/oxlint.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { ShellService } from "@vlandoss/clibuddy";
|
|
2
|
+
import { TOOL_LABELS } from "#/program/ui";
|
|
2
3
|
import type { Linter, LintOptions } from "#/types/tool";
|
|
3
4
|
import { ToolService } from "./tool";
|
|
4
5
|
|
|
5
6
|
export class OxlintService extends ToolService implements Linter {
|
|
6
7
|
constructor(shellService: ShellService) {
|
|
7
|
-
super({ bin: "oxlint", shellService });
|
|
8
|
+
super({ bin: "oxlint", ui: TOOL_LABELS.OXLINT, shellService });
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
getBinDir() {
|
package/src/services/tool.ts
CHANGED
|
@@ -4,15 +4,18 @@ import { gracefullBinDir } from "#/utils/gracefullBinDir";
|
|
|
4
4
|
|
|
5
5
|
type CreateOptions = {
|
|
6
6
|
bin: string;
|
|
7
|
+
ui?: string;
|
|
7
8
|
shellService: ShellService;
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
export abstract class ToolService {
|
|
11
12
|
#shellService: ShellService;
|
|
12
13
|
#bin: string;
|
|
14
|
+
#ui: string;
|
|
13
15
|
|
|
14
|
-
constructor({ bin
|
|
15
|
-
this.#bin =
|
|
16
|
+
constructor({ bin, ui, shellService }: CreateOptions) {
|
|
17
|
+
this.#bin = bin;
|
|
18
|
+
this.#ui = ui ?? bin;
|
|
16
19
|
this.#shellService = shellService;
|
|
17
20
|
}
|
|
18
21
|
|
|
@@ -37,4 +40,8 @@ export abstract class ToolService {
|
|
|
37
40
|
get bin() {
|
|
38
41
|
return this.#bin;
|
|
39
42
|
}
|
|
43
|
+
|
|
44
|
+
get ui() {
|
|
45
|
+
return this.#ui;
|
|
46
|
+
}
|
|
40
47
|
}
|
package/src/types/tool.ts
CHANGED
|
@@ -10,10 +10,12 @@ export type LintOptions = {
|
|
|
10
10
|
|
|
11
11
|
export type Formatter = {
|
|
12
12
|
bin: string;
|
|
13
|
+
ui: string;
|
|
13
14
|
format(options: FormatOptions): Promise<void>;
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
export type Linter = {
|
|
17
18
|
bin: string;
|
|
19
|
+
ui: string;
|
|
18
20
|
lint(options: LintOptions): Promise<void>;
|
|
19
21
|
};
|