@repokit/core 2.0.7 → 3.0.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/Cargo.lock +113 -7
- package/Cargo.toml +3 -2
- package/README.md +45 -0
- package/dist/RepoKitConfig.d.mts +4 -1
- package/dist/RepoKitConfig.mjs +3 -1
- package/dist/RepoKitTheme.d.mts +47 -0
- package/dist/RepoKitTheme.mjs +45 -0
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +2 -1
- package/dist/types.d.mts +18 -5
- package/externals/RepoKitConfig.ts +10 -2
- package/externals/RepoKitTheme.ts +44 -0
- package/externals/index.ts +1 -0
- package/externals/types.ts +25 -4
- package/installation/install.sh +9 -3
- package/internals/argv/argv.rs +133 -0
- package/internals/argv/mod.rs +1 -0
- package/internals/configuration/configuration.rs +2 -2
- package/internals/internal_commands/help.rs +57 -45
- package/internals/internal_commands/internal_registry.rs +5 -4
- package/internals/internal_commands/list_commands.rs +3 -3
- package/internals/internal_commands/list_owners.rs +10 -10
- package/internals/internal_commands/list_themes.rs +113 -0
- package/internals/internal_commands/locate_command.rs +8 -2
- package/internals/internal_commands/mod.rs +1 -0
- package/internals/internal_commands/onboarder.rs +10 -4
- package/internals/internal_commands/register_command.rs +3 -3
- package/internals/internal_commands/search_commands.rs +3 -3
- package/internals/internal_commands/upgrade_repokit.rs +5 -1
- package/internals/internal_filesystem/internal_filesystem.rs +124 -3
- package/internals/logger/logger.rs +44 -56
- package/internals/main.rs +2 -0
- package/internals/repokit/interfaces.rs +3 -0
- package/internals/repokit/repokit.rs +9 -6
- package/internals/themes/built_in_themes/mod.rs +3 -0
- package/internals/themes/built_in_themes/money.rs +41 -0
- package/internals/themes/built_in_themes/seeing_red.rs +41 -0
- package/internals/themes/built_in_themes/the_blues.rs +41 -0
- package/internals/themes/mod.rs +5 -0
- package/internals/themes/theme.rs +108 -0
- package/internals/themes/theme_colors.rs +36 -0
- package/internals/themes/theme_inputs.rs +34 -0
- package/internals/themes/theme_registry.rs +102 -0
- package/internals/validations/command_validations.rs +8 -8
- package/media/seeing-red.webp +0 -0
- package/package.json +5 -4
package/Cargo.lock
CHANGED
|
@@ -27,6 +27,12 @@ dependencies = [
|
|
|
27
27
|
"serde",
|
|
28
28
|
]
|
|
29
29
|
|
|
30
|
+
[[package]]
|
|
31
|
+
name = "cfg-if"
|
|
32
|
+
version = "1.0.4"
|
|
33
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
34
|
+
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
35
|
+
|
|
30
36
|
[[package]]
|
|
31
37
|
name = "colored"
|
|
32
38
|
version = "3.1.1"
|
|
@@ -61,6 +67,38 @@ version = "0.8.21"
|
|
|
61
67
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
62
68
|
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
|
|
63
69
|
|
|
70
|
+
[[package]]
|
|
71
|
+
name = "dirs"
|
|
72
|
+
version = "6.0.0"
|
|
73
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
74
|
+
checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e"
|
|
75
|
+
dependencies = [
|
|
76
|
+
"dirs-sys",
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
[[package]]
|
|
80
|
+
name = "dirs-sys"
|
|
81
|
+
version = "0.5.0"
|
|
82
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
83
|
+
checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab"
|
|
84
|
+
dependencies = [
|
|
85
|
+
"libc",
|
|
86
|
+
"option-ext",
|
|
87
|
+
"redox_users",
|
|
88
|
+
"windows-sys",
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
[[package]]
|
|
92
|
+
name = "getrandom"
|
|
93
|
+
version = "0.2.17"
|
|
94
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
95
|
+
checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
|
|
96
|
+
dependencies = [
|
|
97
|
+
"cfg-if",
|
|
98
|
+
"libc",
|
|
99
|
+
"wasi",
|
|
100
|
+
]
|
|
101
|
+
|
|
64
102
|
[[package]]
|
|
65
103
|
name = "globset"
|
|
66
104
|
version = "0.4.18"
|
|
@@ -96,6 +134,21 @@ version = "1.0.17"
|
|
|
96
134
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
97
135
|
checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
|
|
98
136
|
|
|
137
|
+
[[package]]
|
|
138
|
+
name = "libc"
|
|
139
|
+
version = "0.2.183"
|
|
140
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
141
|
+
checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d"
|
|
142
|
+
|
|
143
|
+
[[package]]
|
|
144
|
+
name = "libredox"
|
|
145
|
+
version = "0.1.15"
|
|
146
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
147
|
+
checksum = "7ddbf48fd451246b1f8c2610bd3b4ac0cc6e149d89832867093ab69a17194f08"
|
|
148
|
+
dependencies = [
|
|
149
|
+
"libc",
|
|
150
|
+
]
|
|
151
|
+
|
|
99
152
|
[[package]]
|
|
100
153
|
name = "log"
|
|
101
154
|
version = "0.4.29"
|
|
@@ -114,6 +167,12 @@ version = "0.2.1"
|
|
|
114
167
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
115
168
|
checksum = "f5438dd2b2ff4c6df6e1ce22d825ed2fa93ee2922235cc45186991717f0a892d"
|
|
116
169
|
|
|
170
|
+
[[package]]
|
|
171
|
+
name = "option-ext"
|
|
172
|
+
version = "0.2.0"
|
|
173
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
174
|
+
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
|
|
175
|
+
|
|
117
176
|
[[package]]
|
|
118
177
|
name = "pin-project-lite"
|
|
119
178
|
version = "0.2.16"
|
|
@@ -131,13 +190,24 @@ dependencies = [
|
|
|
131
190
|
|
|
132
191
|
[[package]]
|
|
133
192
|
name = "quote"
|
|
134
|
-
version = "1.0.
|
|
193
|
+
version = "1.0.45"
|
|
135
194
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
136
|
-
checksum = "
|
|
195
|
+
checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
|
|
137
196
|
dependencies = [
|
|
138
197
|
"proc-macro2",
|
|
139
198
|
]
|
|
140
199
|
|
|
200
|
+
[[package]]
|
|
201
|
+
name = "redox_users"
|
|
202
|
+
version = "0.5.2"
|
|
203
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
204
|
+
checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac"
|
|
205
|
+
dependencies = [
|
|
206
|
+
"getrandom",
|
|
207
|
+
"libredox",
|
|
208
|
+
"thiserror",
|
|
209
|
+
]
|
|
210
|
+
|
|
141
211
|
[[package]]
|
|
142
212
|
name = "regex"
|
|
143
213
|
version = "1.12.3"
|
|
@@ -169,7 +239,7 @@ checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c"
|
|
|
169
239
|
|
|
170
240
|
[[package]]
|
|
171
241
|
name = "repokit"
|
|
172
|
-
version = "
|
|
242
|
+
version = "3.0.0"
|
|
173
243
|
dependencies = [
|
|
174
244
|
"alphanumeric-sort",
|
|
175
245
|
"colored",
|
|
@@ -178,6 +248,7 @@ dependencies = [
|
|
|
178
248
|
"regex",
|
|
179
249
|
"serde",
|
|
180
250
|
"serde_json",
|
|
251
|
+
"shellexpand",
|
|
181
252
|
"tokio",
|
|
182
253
|
]
|
|
183
254
|
|
|
@@ -233,22 +304,51 @@ dependencies = [
|
|
|
233
304
|
"zmij",
|
|
234
305
|
]
|
|
235
306
|
|
|
307
|
+
[[package]]
|
|
308
|
+
name = "shellexpand"
|
|
309
|
+
version = "3.1.2"
|
|
310
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
311
|
+
checksum = "32824fab5e16e6c4d86dc1ba84489390419a39f97699852b66480bb87d297ed8"
|
|
312
|
+
dependencies = [
|
|
313
|
+
"dirs",
|
|
314
|
+
]
|
|
315
|
+
|
|
236
316
|
[[package]]
|
|
237
317
|
name = "syn"
|
|
238
|
-
version = "2.0.
|
|
318
|
+
version = "2.0.117"
|
|
239
319
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
240
|
-
checksum = "
|
|
320
|
+
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
|
|
241
321
|
dependencies = [
|
|
242
322
|
"proc-macro2",
|
|
243
323
|
"quote",
|
|
244
324
|
"unicode-ident",
|
|
245
325
|
]
|
|
246
326
|
|
|
327
|
+
[[package]]
|
|
328
|
+
name = "thiserror"
|
|
329
|
+
version = "2.0.18"
|
|
330
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
331
|
+
checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"
|
|
332
|
+
dependencies = [
|
|
333
|
+
"thiserror-impl",
|
|
334
|
+
]
|
|
335
|
+
|
|
336
|
+
[[package]]
|
|
337
|
+
name = "thiserror-impl"
|
|
338
|
+
version = "2.0.18"
|
|
339
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
340
|
+
checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"
|
|
341
|
+
dependencies = [
|
|
342
|
+
"proc-macro2",
|
|
343
|
+
"quote",
|
|
344
|
+
"syn",
|
|
345
|
+
]
|
|
346
|
+
|
|
247
347
|
[[package]]
|
|
248
348
|
name = "tokio"
|
|
249
|
-
version = "1.
|
|
349
|
+
version = "1.50.0"
|
|
250
350
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
251
|
-
checksum = "
|
|
351
|
+
checksum = "27ad5e34374e03cfffefc301becb44e9dc3c17584f414349ebe29ed26661822d"
|
|
252
352
|
dependencies = [
|
|
253
353
|
"pin-project-lite",
|
|
254
354
|
]
|
|
@@ -269,6 +369,12 @@ dependencies = [
|
|
|
269
369
|
"winapi-util",
|
|
270
370
|
]
|
|
271
371
|
|
|
372
|
+
[[package]]
|
|
373
|
+
name = "wasi"
|
|
374
|
+
version = "0.11.1+wasi-snapshot-preview1"
|
|
375
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
376
|
+
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
|
377
|
+
|
|
272
378
|
[[package]]
|
|
273
379
|
name = "winapi-util"
|
|
274
380
|
version = "0.1.11"
|
package/Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "repokit"
|
|
3
|
-
version = "
|
|
3
|
+
version = "3.0.0"
|
|
4
4
|
edition = "2024"
|
|
5
5
|
|
|
6
6
|
[[bin]]
|
|
@@ -13,6 +13,7 @@ serde_json = "1.0"
|
|
|
13
13
|
colored = "3"
|
|
14
14
|
normalize-path = "0.2.1"
|
|
15
15
|
alphanumeric-sort = "1.5.5"
|
|
16
|
-
tokio = "1.
|
|
16
|
+
tokio = "1.50.0"
|
|
17
17
|
ignore = "0.4.25"
|
|
18
18
|
regex = { version = "1.12.3", features = ["std", "unicode"] }
|
|
19
|
+
shellexpand = "3.1.2"
|
package/README.md
CHANGED
|
@@ -228,6 +228,51 @@ The commands you register onto the repokit toolchain will always be invoked usin
|
|
|
228
228
|
|
|
229
229
|
If your command needs to reason about the file system, keep this in mind.
|
|
230
230
|
|
|
231
|
+
### Themes
|
|
232
|
+
|
|
233
|
+
The Repokit CLI can be customized to support themes that better match your team's visual preferences.
|
|
234
|
+
|
|
235
|
+
Repokit comes with 4 pre-built themes that you can use in your `RepoKitConfig`.
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
import {
|
|
239
|
+
RepoKitConfig,
|
|
240
|
+
SeeingRed, // A red theme
|
|
241
|
+
TheBlues, // A blue theme
|
|
242
|
+
Green, // A green theme
|
|
243
|
+
} from "@repokit/core";
|
|
244
|
+
|
|
245
|
+
export const Kit = new RepoKitConfig({
|
|
246
|
+
project: "My Project",
|
|
247
|
+
theme: SeeingRed, // Specify a theme here
|
|
248
|
+
});
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
By omitting the `theme` property `RepoKit` will use its default visuals.
|
|
252
|
+
|
|
253
|
+
In addition to built-in themes, you can create your own using the `RepoKitTheme`
|
|
254
|
+
|
|
255
|
+
```typescript
|
|
256
|
+
import { RepoKitConfig, RepoKitTheme } from "@repokit/core";
|
|
257
|
+
|
|
258
|
+
export const Kit = new RepoKitConfig({
|
|
259
|
+
project: "My Project",
|
|
260
|
+
theme: new RepoKitTheme({
|
|
261
|
+
prefixColor: "rgb(220, 36, 91)",
|
|
262
|
+
commandColor: "rgb(220, 36, 36)",
|
|
263
|
+
subcommandColor: "rgb(220, 131, 36)",
|
|
264
|
+
argColor: "rgb(220, 205, 36)",
|
|
265
|
+
descriptionColor: "rgb(179, 100, 151)",
|
|
266
|
+
errorPrefixColor: "rgb(220, 36, 39)",
|
|
267
|
+
highlightColor: "rgb(237, 175, 41)",
|
|
268
|
+
}),
|
|
269
|
+
});
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
All properties on the `RepoKitTheme` are optional overrides for `RepoKit`'s default styling. A color can be any CSS-valid `rgb()` string.
|
|
273
|
+
|
|
274
|
+
<img src="media/seeing-red.webp" width="100%" alt="seeing red theme" />
|
|
275
|
+
|
|
231
276
|
## Motivation
|
|
232
277
|
|
|
233
278
|
I worked in a codebase at Google that used just about every programming language in existence. Each team had their own methodology for exposing commands, scripts, and API's for their team's day-to-day development needs.
|
package/dist/RepoKitConfig.d.mts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import { RepoKitTheme } from "./RepoKitTheme.mjs";
|
|
1
2
|
import { ICommand, IRepoKitConfig } from "./types.mjs";
|
|
2
3
|
import { RepoKitCommand } from "./RepoKitCommand.mjs";
|
|
3
4
|
|
|
4
5
|
//#region externals/RepoKitConfig.d.ts
|
|
5
|
-
declare class RepoKitConfig
|
|
6
|
+
declare class RepoKitConfig {
|
|
6
7
|
project: string;
|
|
8
|
+
themes: RepoKitTheme[];
|
|
7
9
|
thirdParty: RepoKitCommand[];
|
|
8
10
|
commands: Record<string, ICommand>;
|
|
9
11
|
constructor({
|
|
10
12
|
project,
|
|
13
|
+
themes,
|
|
11
14
|
commands,
|
|
12
15
|
thirdParty
|
|
13
16
|
}: IRepoKitConfig);
|
package/dist/RepoKitConfig.mjs
CHANGED
|
@@ -2,9 +2,11 @@ import { RepoKitCommand } from "./RepoKitCommand.mjs";
|
|
|
2
2
|
//#region externals/RepoKitConfig.ts
|
|
3
3
|
var RepoKitConfig = class {
|
|
4
4
|
project;
|
|
5
|
+
themes;
|
|
5
6
|
thirdParty;
|
|
6
7
|
commands;
|
|
7
|
-
constructor({ project, commands = {}, thirdParty = [] }) {
|
|
8
|
+
constructor({ project, themes = [], commands = {}, thirdParty = [] }) {
|
|
9
|
+
this.themes = themes;
|
|
8
10
|
this.project = project;
|
|
9
11
|
this.commands = commands;
|
|
10
12
|
this.thirdParty = thirdParty.map((command) => new RepoKitCommand(command));
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { IRepoKitTheme, RepoKitThemeColors } from "./types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region externals/RepoKitTheme.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Repokit Theme
|
|
6
|
+
*
|
|
7
|
+
* A repokit theme allows you to customize the color
|
|
8
|
+
* usage of the CLI by adding a `RepoKitTheme` instance
|
|
9
|
+
* to your `RepoKitConfig`
|
|
10
|
+
*
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { RepoKitConfig, RepoKitTheme } from "@repokit/core";
|
|
13
|
+
*
|
|
14
|
+
* export const RepoKit = new RepoKitConfig({
|
|
15
|
+
* project: "Repokit",
|
|
16
|
+
* themes: [
|
|
17
|
+
* new RepoKitTheme({
|
|
18
|
+
* name: "my-theme",
|
|
19
|
+
* colors: {
|
|
20
|
+
* prefixColor: "rgb(220, 36, 91)",
|
|
21
|
+
* commandColor: "rgb(220, 36, 36)",
|
|
22
|
+
* subcommandColor: "rgb(220, 131, 36)",
|
|
23
|
+
* argColor: "rgb(220, 205, 36)",
|
|
24
|
+
* descriptionColor: "rgb(95, 28, 71)",
|
|
25
|
+
* errorPrefixColor: "rgb(220, 36, 39)",
|
|
26
|
+
* hightlightColor: "rgb(8, 98, 255)",
|
|
27
|
+
* }
|
|
28
|
+
* }),
|
|
29
|
+
* ]
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* To enable your theme you can run
|
|
34
|
+
* ```bash
|
|
35
|
+
* repokit themes --set my-theme
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
declare class RepoKitTheme implements IRepoKitTheme {
|
|
39
|
+
readonly name: string;
|
|
40
|
+
readonly colors: RepoKitThemeColors;
|
|
41
|
+
constructor({
|
|
42
|
+
name,
|
|
43
|
+
colors
|
|
44
|
+
}: IRepoKitTheme);
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { RepoKitTheme };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//#region externals/RepoKitTheme.ts
|
|
2
|
+
/**
|
|
3
|
+
* Repokit Theme
|
|
4
|
+
*
|
|
5
|
+
* A repokit theme allows you to customize the color
|
|
6
|
+
* usage of the CLI by adding a `RepoKitTheme` instance
|
|
7
|
+
* to your `RepoKitConfig`
|
|
8
|
+
*
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { RepoKitConfig, RepoKitTheme } from "@repokit/core";
|
|
11
|
+
*
|
|
12
|
+
* export const RepoKit = new RepoKitConfig({
|
|
13
|
+
* project: "Repokit",
|
|
14
|
+
* themes: [
|
|
15
|
+
* new RepoKitTheme({
|
|
16
|
+
* name: "my-theme",
|
|
17
|
+
* colors: {
|
|
18
|
+
* prefixColor: "rgb(220, 36, 91)",
|
|
19
|
+
* commandColor: "rgb(220, 36, 36)",
|
|
20
|
+
* subcommandColor: "rgb(220, 131, 36)",
|
|
21
|
+
* argColor: "rgb(220, 205, 36)",
|
|
22
|
+
* descriptionColor: "rgb(95, 28, 71)",
|
|
23
|
+
* errorPrefixColor: "rgb(220, 36, 39)",
|
|
24
|
+
* hightlightColor: "rgb(8, 98, 255)",
|
|
25
|
+
* }
|
|
26
|
+
* }),
|
|
27
|
+
* ]
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* To enable your theme you can run
|
|
32
|
+
* ```bash
|
|
33
|
+
* repokit themes --set my-theme
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
var RepoKitTheme = class {
|
|
37
|
+
name;
|
|
38
|
+
colors;
|
|
39
|
+
constructor({ name, colors }) {
|
|
40
|
+
this.name = name;
|
|
41
|
+
this.colors = colors;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
export { RepoKitTheme };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { RepoKitCommand } from "./RepoKitCommand.mjs";
|
|
1
|
+
import { RepoKitTheme } from "./RepoKitTheme.mjs";
|
|
3
2
|
import { RepoKitConfig } from "./RepoKitConfig.mjs";
|
|
4
|
-
|
|
3
|
+
import { AsyncTask, ICommand, ILocatedCommand, IRepoKitCommand, IRepoKitConfig, IRepoKitTheme, RGBString, RepoKitThemeColors } from "./types.mjs";
|
|
4
|
+
import { RepoKitCommand } from "./RepoKitCommand.mjs";
|
|
5
|
+
export { AsyncTask, ICommand, ILocatedCommand, IRepoKitCommand, IRepoKitConfig, IRepoKitTheme, RGBString, RepoKitCommand, RepoKitConfig, RepoKitTheme, RepoKitThemeColors };
|
package/dist/index.mjs
CHANGED
package/dist/types.d.mts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RepoKitConfig } from "./RepoKitConfig.mjs";
|
|
2
2
|
|
|
3
3
|
//#region externals/types.d.ts
|
|
4
|
-
interface IRepoKitConfig {
|
|
4
|
+
interface IRepoKitConfig extends Omit<Partial<RepoKitConfig>, "project"> {
|
|
5
5
|
project: string;
|
|
6
|
-
thirdParty?: RepoKitCommand[];
|
|
7
|
-
commands?: Record<string, ICommand>;
|
|
8
6
|
}
|
|
9
7
|
interface IRepoKitCommand {
|
|
10
8
|
name: string;
|
|
@@ -21,5 +19,20 @@ interface ILocatedCommand extends IRepoKitCommand {
|
|
|
21
19
|
location: string;
|
|
22
20
|
}
|
|
23
21
|
type AsyncTask<T> = () => Promise<T>;
|
|
22
|
+
type OptionalSpace = " " | "";
|
|
23
|
+
type RGBString = `rgb(${number},${OptionalSpace}${number},${OptionalSpace}${number})`;
|
|
24
|
+
interface RepoKitThemeColors {
|
|
25
|
+
prefixColor?: RGBString;
|
|
26
|
+
commandColor?: RGBString;
|
|
27
|
+
subcommandColor?: RGBString;
|
|
28
|
+
argColor?: RGBString;
|
|
29
|
+
descriptionColor?: RGBString;
|
|
30
|
+
errorPrefixColor?: RGBString;
|
|
31
|
+
highlightColor?: RGBString;
|
|
32
|
+
}
|
|
33
|
+
interface IRepoKitTheme {
|
|
34
|
+
name: string;
|
|
35
|
+
colors: RepoKitThemeColors;
|
|
36
|
+
}
|
|
24
37
|
//#endregion
|
|
25
|
-
export { AsyncTask, ICommand, ILocatedCommand, IRepoKitCommand, IRepoKitConfig };
|
|
38
|
+
export { AsyncTask, ICommand, ILocatedCommand, IRepoKitCommand, IRepoKitConfig, IRepoKitTheme, RGBString, RepoKitThemeColors };
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import { RepoKitCommand } from "./RepoKitCommand";
|
|
2
|
+
import type { RepoKitTheme } from "./RepoKitTheme";
|
|
2
3
|
import type { ICommand, IRepoKitConfig } from "./types";
|
|
3
4
|
/* eslint-disable typescript-eslint(no-misused-spread */
|
|
4
5
|
|
|
5
|
-
export class RepoKitConfig
|
|
6
|
+
export class RepoKitConfig {
|
|
6
7
|
project: string;
|
|
8
|
+
themes: RepoKitTheme[];
|
|
7
9
|
thirdParty: RepoKitCommand[];
|
|
8
10
|
commands: Record<string, ICommand>;
|
|
9
|
-
constructor({
|
|
11
|
+
constructor({
|
|
12
|
+
project,
|
|
13
|
+
themes = [],
|
|
14
|
+
commands = {},
|
|
15
|
+
thirdParty = [],
|
|
16
|
+
}: IRepoKitConfig) {
|
|
17
|
+
this.themes = themes;
|
|
10
18
|
this.project = project;
|
|
11
19
|
this.commands = commands;
|
|
12
20
|
this.thirdParty = thirdParty.map(command => new RepoKitCommand(command));
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { IRepoKitTheme, RepoKitThemeColors } from "./types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Repokit Theme
|
|
5
|
+
*
|
|
6
|
+
* A repokit theme allows you to customize the color
|
|
7
|
+
* usage of the CLI by adding a `RepoKitTheme` instance
|
|
8
|
+
* to your `RepoKitConfig`
|
|
9
|
+
*
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { RepoKitConfig, RepoKitTheme } from "@repokit/core";
|
|
12
|
+
*
|
|
13
|
+
* export const RepoKit = new RepoKitConfig({
|
|
14
|
+
* project: "Repokit",
|
|
15
|
+
* themes: [
|
|
16
|
+
* new RepoKitTheme({
|
|
17
|
+
* name: "my-theme",
|
|
18
|
+
* colors: {
|
|
19
|
+
* prefixColor: "rgb(220, 36, 91)",
|
|
20
|
+
* commandColor: "rgb(220, 36, 36)",
|
|
21
|
+
* subcommandColor: "rgb(220, 131, 36)",
|
|
22
|
+
* argColor: "rgb(220, 205, 36)",
|
|
23
|
+
* descriptionColor: "rgb(95, 28, 71)",
|
|
24
|
+
* errorPrefixColor: "rgb(220, 36, 39)",
|
|
25
|
+
* hightlightColor: "rgb(8, 98, 255)",
|
|
26
|
+
* }
|
|
27
|
+
* }),
|
|
28
|
+
* ]
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* To enable your theme you can run
|
|
33
|
+
* ```bash
|
|
34
|
+
* repokit themes --set my-theme
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export class RepoKitTheme implements IRepoKitTheme {
|
|
38
|
+
public readonly name: string;
|
|
39
|
+
public readonly colors: RepoKitThemeColors;
|
|
40
|
+
constructor({ name, colors }: IRepoKitTheme) {
|
|
41
|
+
this.name = name;
|
|
42
|
+
this.colors = colors;
|
|
43
|
+
}
|
|
44
|
+
}
|
package/externals/index.ts
CHANGED
package/externals/types.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RepoKitConfig } from "./RepoKitConfig";
|
|
2
2
|
|
|
3
|
-
export interface IRepoKitConfig
|
|
3
|
+
export interface IRepoKitConfig extends Omit<
|
|
4
|
+
Partial<RepoKitConfig>,
|
|
5
|
+
"project"
|
|
6
|
+
> {
|
|
4
7
|
project: string;
|
|
5
|
-
thirdParty?: RepoKitCommand[];
|
|
6
|
-
commands?: Record<string, ICommand>;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
export interface IRepoKitCommand {
|
|
@@ -24,3 +25,23 @@ export interface ILocatedCommand extends IRepoKitCommand {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export type AsyncTask<T> = () => Promise<T>;
|
|
28
|
+
|
|
29
|
+
type OptionalSpace = " " | "";
|
|
30
|
+
|
|
31
|
+
export type RGBString =
|
|
32
|
+
`rgb(${number},${OptionalSpace}${number},${OptionalSpace}${number})`;
|
|
33
|
+
|
|
34
|
+
export interface RepoKitThemeColors {
|
|
35
|
+
prefixColor?: RGBString;
|
|
36
|
+
commandColor?: RGBString;
|
|
37
|
+
subcommandColor?: RGBString;
|
|
38
|
+
argColor?: RGBString;
|
|
39
|
+
descriptionColor?: RGBString;
|
|
40
|
+
errorPrefixColor?: RGBString;
|
|
41
|
+
highlightColor?: RGBString;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface IRepoKitTheme {
|
|
45
|
+
name: string;
|
|
46
|
+
colors: RepoKitThemeColors;
|
|
47
|
+
}
|
package/installation/install.sh
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
CURRENT_VERSION="
|
|
1
|
+
CURRENT_VERSION="3.0.0"
|
|
2
2
|
CWD=$(pwd)
|
|
3
3
|
|
|
4
4
|
REPLACEMENT="/node_modules"
|
|
@@ -36,8 +36,14 @@ if [ -f .repokit ]; then
|
|
|
36
36
|
fi
|
|
37
37
|
fi
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
DOT_FILE=".repokit"
|
|
40
|
+
TEMP_FILE=".repokit_tmp";
|
|
41
|
+
|
|
42
|
+
touch "$DOT_FILE"
|
|
43
|
+
|
|
44
|
+
printf "$CURRENT_VERSION\n" > "$TEMP_FILE"
|
|
45
|
+
tail +2 "$DOT_FILE" >> "$TEMP_FILE"
|
|
46
|
+
mv "$TEMP_FILE" "$DOT_FILE"
|
|
41
47
|
|
|
42
48
|
|
|
43
49
|
cd $CWD
|