@repokit/core 1.7.0 → 1.8.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 +0 -109
- package/Cargo.toml +0 -2
- package/README.md +9 -3
- package/dist/CommandParser.d.mts +3 -2
- package/dist/CommandParser.mjs +9 -16
- package/dist/ConcurrencyPool.mjs +1 -3
- package/dist/ConfigurationParser.d.mts +1 -1
- package/dist/ConfigurationParser.mjs +6 -9
- package/dist/RepoKitCommand.mjs +1 -2
- package/dist/RepoKitConfig.mjs +1 -3
- package/dist/TSCompiler.d.mts +3 -5
- package/dist/TSCompiler.mjs +24 -18
- package/dist/_virtual/_rolldown/runtime.mjs +5 -0
- package/dist/commands/parse_commands.mjs +1 -3
- package/dist/commands/parse_configuration.mjs +2 -6
- package/dist/index.mjs +1 -2
- package/dist/templates/command_template.mjs +1 -2
- package/dist/templates/configuration_template.mjs +1 -2
- package/dist/types.mjs +1 -1
- package/externals/CommandParser.ts +9 -17
- package/externals/ConcurrencyPool.ts +1 -2
- package/externals/ConfigurationParser.ts +5 -7
- package/externals/RepoKitConfig.ts +1 -1
- package/externals/TSCompiler.ts +26 -21
- package/externals/commands/parse_configuration.ts +2 -2
- package/externals/index.ts +1 -1
- package/installation/install.sh +1 -5
- package/package.json +15 -6
package/Cargo.lock
CHANGED
|
@@ -61,95 +61,6 @@ version = "0.8.21"
|
|
|
61
61
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
62
62
|
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
|
|
63
63
|
|
|
64
|
-
[[package]]
|
|
65
|
-
name = "futures"
|
|
66
|
-
version = "0.3.31"
|
|
67
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
68
|
-
checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876"
|
|
69
|
-
dependencies = [
|
|
70
|
-
"futures-channel",
|
|
71
|
-
"futures-core",
|
|
72
|
-
"futures-executor",
|
|
73
|
-
"futures-io",
|
|
74
|
-
"futures-sink",
|
|
75
|
-
"futures-task",
|
|
76
|
-
"futures-util",
|
|
77
|
-
]
|
|
78
|
-
|
|
79
|
-
[[package]]
|
|
80
|
-
name = "futures-channel"
|
|
81
|
-
version = "0.3.31"
|
|
82
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
83
|
-
checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
|
|
84
|
-
dependencies = [
|
|
85
|
-
"futures-core",
|
|
86
|
-
"futures-sink",
|
|
87
|
-
]
|
|
88
|
-
|
|
89
|
-
[[package]]
|
|
90
|
-
name = "futures-core"
|
|
91
|
-
version = "0.3.31"
|
|
92
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
93
|
-
checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
|
|
94
|
-
|
|
95
|
-
[[package]]
|
|
96
|
-
name = "futures-executor"
|
|
97
|
-
version = "0.3.31"
|
|
98
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
99
|
-
checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f"
|
|
100
|
-
dependencies = [
|
|
101
|
-
"futures-core",
|
|
102
|
-
"futures-task",
|
|
103
|
-
"futures-util",
|
|
104
|
-
]
|
|
105
|
-
|
|
106
|
-
[[package]]
|
|
107
|
-
name = "futures-io"
|
|
108
|
-
version = "0.3.31"
|
|
109
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
110
|
-
checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
|
|
111
|
-
|
|
112
|
-
[[package]]
|
|
113
|
-
name = "futures-macro"
|
|
114
|
-
version = "0.3.31"
|
|
115
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
116
|
-
checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
|
|
117
|
-
dependencies = [
|
|
118
|
-
"proc-macro2",
|
|
119
|
-
"quote",
|
|
120
|
-
"syn",
|
|
121
|
-
]
|
|
122
|
-
|
|
123
|
-
[[package]]
|
|
124
|
-
name = "futures-sink"
|
|
125
|
-
version = "0.3.31"
|
|
126
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
127
|
-
checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"
|
|
128
|
-
|
|
129
|
-
[[package]]
|
|
130
|
-
name = "futures-task"
|
|
131
|
-
version = "0.3.31"
|
|
132
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
133
|
-
checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
|
|
134
|
-
|
|
135
|
-
[[package]]
|
|
136
|
-
name = "futures-util"
|
|
137
|
-
version = "0.3.31"
|
|
138
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
139
|
-
checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
|
|
140
|
-
dependencies = [
|
|
141
|
-
"futures-channel",
|
|
142
|
-
"futures-core",
|
|
143
|
-
"futures-io",
|
|
144
|
-
"futures-macro",
|
|
145
|
-
"futures-sink",
|
|
146
|
-
"futures-task",
|
|
147
|
-
"memchr",
|
|
148
|
-
"pin-project-lite",
|
|
149
|
-
"pin-utils",
|
|
150
|
-
"slab",
|
|
151
|
-
]
|
|
152
|
-
|
|
153
64
|
[[package]]
|
|
154
65
|
name = "globset"
|
|
155
66
|
version = "0.4.18"
|
|
@@ -185,12 +96,6 @@ version = "1.0.17"
|
|
|
185
96
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
186
97
|
checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
|
|
187
98
|
|
|
188
|
-
[[package]]
|
|
189
|
-
name = "lexopt"
|
|
190
|
-
version = "0.3.1"
|
|
191
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
192
|
-
checksum = "9fa0e2a1fcbe2f6be6c42e342259976206b383122fc152e872795338b5a3f3a7"
|
|
193
|
-
|
|
194
99
|
[[package]]
|
|
195
100
|
name = "log"
|
|
196
101
|
version = "0.4.29"
|
|
@@ -215,12 +120,6 @@ version = "0.2.16"
|
|
|
215
120
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
216
121
|
checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
|
|
217
122
|
|
|
218
|
-
[[package]]
|
|
219
|
-
name = "pin-utils"
|
|
220
|
-
version = "0.1.0"
|
|
221
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
222
|
-
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
|
223
|
-
|
|
224
123
|
[[package]]
|
|
225
124
|
name = "proc-macro2"
|
|
226
125
|
version = "1.0.106"
|
|
@@ -274,9 +173,7 @@ version = "0.1.0"
|
|
|
274
173
|
dependencies = [
|
|
275
174
|
"alphanumeric-sort",
|
|
276
175
|
"colored",
|
|
277
|
-
"futures",
|
|
278
176
|
"ignore",
|
|
279
|
-
"lexopt",
|
|
280
177
|
"normalize-path",
|
|
281
178
|
"regex",
|
|
282
179
|
"serde",
|
|
@@ -336,12 +233,6 @@ dependencies = [
|
|
|
336
233
|
"zmij",
|
|
337
234
|
]
|
|
338
235
|
|
|
339
|
-
[[package]]
|
|
340
|
-
name = "slab"
|
|
341
|
-
version = "0.4.11"
|
|
342
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
343
|
-
checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589"
|
|
344
|
-
|
|
345
236
|
[[package]]
|
|
346
237
|
name = "syn"
|
|
347
238
|
version = "2.0.114"
|
package/Cargo.toml
CHANGED
|
@@ -11,9 +11,7 @@ path = "internals/main.rs"
|
|
|
11
11
|
serde = { version = "1.0", features = ["derive"] }
|
|
12
12
|
serde_json = "1.0"
|
|
13
13
|
colored = "3"
|
|
14
|
-
lexopt = "0.3.1"
|
|
15
14
|
normalize-path = "0.2.1"
|
|
16
|
-
futures = "0.3.31"
|
|
17
15
|
alphanumeric-sort = "1.5.5"
|
|
18
16
|
tokio = "1.49.0"
|
|
19
17
|
ignore = "0.4.25"
|
package/README.md
CHANGED
|
@@ -38,9 +38,15 @@ yarn add -D @repokit/core
|
|
|
38
38
|
pnpm add -D @repokit/core
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
Once installed, run
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
```bash
|
|
44
|
+
repokit
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Repokit will create a config file named `repokit.ts` on your first run. Fill out this file with your desired settings.
|
|
48
|
+
|
|
49
|
+
Here's an example of what our intenral Repokit config looks like:
|
|
44
50
|
|
|
45
51
|
```typescript
|
|
46
52
|
import { RepoKitConfig } from "@repokit/core";
|
|
@@ -65,7 +71,7 @@ export const RepoKit = new RepoKitConfig({
|
|
|
65
71
|
});
|
|
66
72
|
```
|
|
67
73
|
|
|
68
|
-
Commands are optional, but your `repokit.ts` config is a good place to store any commonly run commands that aren't specific to any library or package in your repository.
|
|
74
|
+
Commands in your config file are optional, but in your `repokit.ts` config is a good place to store any commonly run commands that aren't specific to any library or package in your repository.
|
|
69
75
|
|
|
70
76
|
To verify your configuration, run
|
|
71
77
|
|
package/dist/CommandParser.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { TSCompiler } from "./TSCompiler.mjs";
|
|
2
|
+
|
|
1
3
|
//#region externals/CommandParser.d.ts
|
|
2
|
-
declare class CommandParser {
|
|
3
|
-
private static compiler?;
|
|
4
|
+
declare class CommandParser extends TSCompiler {
|
|
4
5
|
static parse(): Promise<void>;
|
|
5
6
|
private static parseCommand;
|
|
6
7
|
private static parsePaths;
|
package/dist/CommandParser.mjs
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
import { TSCompiler } from "./TSCompiler.mjs";
|
|
2
1
|
import { RepoKitCommand } from "./RepoKitCommand.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { parseArgs } from "node:util";
|
|
5
|
-
import { join } from "node:path";
|
|
6
|
-
import { stat } from "node:fs/promises";
|
|
2
|
+
import { TSCompiler } from "./TSCompiler.mjs";
|
|
7
3
|
import { existsSync } from "node:fs";
|
|
8
|
-
|
|
4
|
+
import { stat } from "node:fs/promises";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { parseArgs } from "node:util";
|
|
9
7
|
//#region externals/CommandParser.ts
|
|
10
|
-
var CommandParser = class {
|
|
11
|
-
static compiler;
|
|
8
|
+
var CommandParser = class extends TSCompiler {
|
|
12
9
|
static async parse() {
|
|
13
10
|
const { paths, root } = this.parsePaths();
|
|
14
11
|
if (!root || !existsSync(root) || !(await stat(root)).isDirectory()) return console.log(JSON.stringify([]));
|
|
15
|
-
|
|
16
|
-
const pool = new ConcurrencyPool();
|
|
17
|
-
const pathList = paths.split(",").filter(Boolean);
|
|
18
|
-
const commands = await Promise.all(pathList.map((path) => pool.enqueue(() => this.parseCommand(root, path))));
|
|
12
|
+
const commands = paths.split(",").filter(Boolean).map((path) => this.parseCommand(join(root, path)));
|
|
19
13
|
console.log(JSON.stringify(commands.flat()));
|
|
20
14
|
}
|
|
21
|
-
static
|
|
15
|
+
static parseCommand(path) {
|
|
22
16
|
const commands = [];
|
|
23
|
-
const declaredExports =
|
|
17
|
+
const declaredExports = super.compile(path);
|
|
24
18
|
for (const key in declaredExports) if (declaredExports[key] instanceof RepoKitCommand) commands.push({
|
|
25
19
|
...declaredExports[key],
|
|
26
20
|
location: path
|
|
@@ -51,6 +45,5 @@ var CommandParser = class {
|
|
|
51
45
|
}
|
|
52
46
|
}
|
|
53
47
|
};
|
|
54
|
-
|
|
55
48
|
//#endregion
|
|
56
|
-
export { CommandParser };
|
|
49
|
+
export { CommandParser };
|
package/dist/ConcurrencyPool.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AutoIncrementingID } from "@figliolia/event-emitter";
|
|
2
|
-
|
|
3
2
|
//#region externals/ConcurrencyPool.ts
|
|
4
3
|
var ConcurrencyPool = class {
|
|
5
4
|
IDs = new AutoIncrementingID();
|
|
@@ -19,6 +18,5 @@ var ConcurrencyPool = class {
|
|
|
19
18
|
return promise;
|
|
20
19
|
}
|
|
21
20
|
};
|
|
22
|
-
|
|
23
21
|
//#endregion
|
|
24
|
-
export { ConcurrencyPool };
|
|
22
|
+
export { ConcurrencyPool };
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { TSCompiler } from "./TSCompiler.mjs";
|
|
2
2
|
import { RepoKitConfig } from "./RepoKitConfig.mjs";
|
|
3
|
-
import { parseArgs } from "node:util";
|
|
4
|
-
import { join } from "node:path";
|
|
5
3
|
import { existsSync } from "node:fs";
|
|
6
|
-
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { parseArgs } from "node:util";
|
|
7
6
|
//#region externals/ConfigurationParser.ts
|
|
8
7
|
var ConfigurationParser = class extends TSCompiler {
|
|
9
|
-
static
|
|
10
|
-
const
|
|
11
|
-
const path = join(root, "repokit.ts");
|
|
8
|
+
static parse() {
|
|
9
|
+
const path = join(this.parseRoot(), "repokit.ts");
|
|
12
10
|
if (!existsSync(path)) return;
|
|
13
|
-
const config =
|
|
11
|
+
const config = super.compile(path);
|
|
14
12
|
for (const key in config) if (config[key] instanceof RepoKitConfig) return console.log(JSON.stringify(config[key].toScoped(path)));
|
|
15
13
|
}
|
|
16
14
|
static parseRoot() {
|
|
@@ -22,6 +20,5 @@ var ConfigurationParser = class extends TSCompiler {
|
|
|
22
20
|
} } }).values.root;
|
|
23
21
|
}
|
|
24
22
|
};
|
|
25
|
-
|
|
26
23
|
//#endregion
|
|
27
|
-
export { ConfigurationParser };
|
|
24
|
+
export { ConfigurationParser };
|
package/dist/RepoKitCommand.mjs
CHANGED
package/dist/RepoKitConfig.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { RepoKitCommand } from "./RepoKitCommand.mjs";
|
|
2
|
-
|
|
3
2
|
//#region externals/RepoKitConfig.ts
|
|
4
3
|
var RepoKitConfig = class {
|
|
5
4
|
project;
|
|
@@ -20,6 +19,5 @@ var RepoKitConfig = class {
|
|
|
20
19
|
};
|
|
21
20
|
}
|
|
22
21
|
};
|
|
23
|
-
|
|
24
22
|
//#endregion
|
|
25
|
-
export { RepoKitConfig };
|
|
23
|
+
export { RepoKitConfig };
|
package/dist/TSCompiler.d.mts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
//#region externals/TSCompiler.d.ts
|
|
2
2
|
declare class TSCompiler {
|
|
3
|
-
readonly
|
|
4
|
-
|
|
5
|
-
private static
|
|
6
|
-
constructor(root: string, command: string);
|
|
7
|
-
compile(path: string): Promise<any>;
|
|
3
|
+
private static readonly compilerOptions;
|
|
4
|
+
static compile<T extends Record<string, unknown>>(path: string): T;
|
|
5
|
+
private static import;
|
|
8
6
|
}
|
|
9
7
|
//#endregion
|
|
10
8
|
export { TSCompiler };
|
package/dist/TSCompiler.mjs
CHANGED
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { transform } from "@swc/core";
|
|
4
|
-
|
|
1
|
+
import { __require } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { register } from "ts-node";
|
|
5
3
|
//#region externals/TSCompiler.ts
|
|
6
|
-
var TSCompiler = class
|
|
7
|
-
static
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
var TSCompiler = class {
|
|
5
|
+
static compilerOptions = {
|
|
6
|
+
swc: true,
|
|
7
|
+
typeCheck: false,
|
|
8
|
+
transpileOnly: true,
|
|
9
|
+
compilerOptions: {
|
|
10
|
+
noEmit: true,
|
|
11
|
+
module: "commonjs",
|
|
12
|
+
isolatedModules: false
|
|
13
|
+
},
|
|
14
|
+
moduleTypes: { "**": "cjs" }
|
|
15
|
+
};
|
|
16
|
+
static compile(path) {
|
|
17
|
+
const compiler = register(this.compilerOptions);
|
|
18
|
+
compiler.enabled(true);
|
|
19
|
+
const result = this.import(path);
|
|
20
|
+
compiler.enabled(false);
|
|
21
|
+
return result;
|
|
11
22
|
}
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
await writeFile(target, result.code);
|
|
16
|
-
const config = await import(target);
|
|
17
|
-
await rm(target, { force: true });
|
|
18
|
-
return config;
|
|
23
|
+
static import(filePath) {
|
|
24
|
+
const _module = __require(filePath);
|
|
25
|
+
return _module?.__esModule ? _module : { default: _module };
|
|
19
26
|
}
|
|
20
27
|
};
|
|
21
|
-
|
|
22
28
|
//#endregion
|
|
23
|
-
export { TSCompiler };
|
|
29
|
+
export { TSCompiler };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
//#region externals/templates/command_template.txt
|
|
2
2
|
var command_template_default = "import { RepoKitCommand } from \"@repokit/core\";\n\n/**\n * Please fill out this command file with your desired settings\n */\nexport const Commands = new RepoKitCommand({\n name: \"<Your Package Name>\",\n owner: \"<Optional Team or Individual>\",\n description: \"<Your Package Description>\",\n commands: {\n \"<your-first-command>\": {\n command: \"<insert shell command here>\",\n description: \"A description for your command\",\n },\n \"<your-second-command>\": {\n command: \"<insert shell command here>\",\n description: \"A description for your command\",\n },\n \"<your-third-command>\": {\n command: \"<insert shell command here>\",\n description: \"A description for your command\",\n },\n },\n});\n";
|
|
3
|
-
|
|
4
3
|
//#endregion
|
|
5
|
-
export { command_template_default as default };
|
|
4
|
+
export { command_template_default as default };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
//#region externals/templates/configuration_template.txt
|
|
2
2
|
var configuration_template_default = "import { RepoKitConfig } from \"@repokit/core\";\n\n/**\n * Please fill out this config file with your desired\n * repokit settings\n */\nexport const RepoKit = new RepoKitConfig({\n project: \"Your Project Name\",\n commands: {\n \"<your-first-command>\": {\n command: \"<insert shell command here>\",\n description: \"A description for your command\",\n },\n \"<your-second-command>\": {\n command: \"<insert shell command here>\",\n description: \"A description for your command\",\n },\n \"<your-third-command>\": {\n command: \"<insert shell command here>\",\n description: \"A description for your command\",\n },\n },\n});\n";
|
|
3
|
-
|
|
4
3
|
//#endregion
|
|
5
|
-
export { configuration_template_default as default };
|
|
4
|
+
export { configuration_template_default as default };
|
package/dist/types.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
|
@@ -1,34 +1,26 @@
|
|
|
1
|
-
import { parseArgs } from "node:util";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { stat } from "node:fs/promises";
|
|
4
1
|
import { existsSync } from "node:fs";
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
2
|
+
import { stat } from "node:fs/promises";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { parseArgs } from "node:util";
|
|
8
5
|
import { RepoKitCommand } from "./RepoKitCommand";
|
|
9
|
-
import {
|
|
6
|
+
import { TSCompiler } from "./TSCompiler";
|
|
7
|
+
import type { ILocatedCommand } from "./types";
|
|
10
8
|
/* oxlint-disable typescript-eslint(no-misused-spread) */
|
|
11
9
|
|
|
12
|
-
export class CommandParser {
|
|
13
|
-
private static compiler?: TSCompiler;
|
|
14
|
-
|
|
10
|
+
export class CommandParser extends TSCompiler {
|
|
15
11
|
public static async parse() {
|
|
16
12
|
const { paths, root } = this.parsePaths();
|
|
17
13
|
if (!root || !existsSync(root) || !(await stat(root)).isDirectory()) {
|
|
18
14
|
return console.log(JSON.stringify([]));
|
|
19
15
|
}
|
|
20
|
-
this.compiler = new TSCompiler(root, "parse_commands");
|
|
21
|
-
const pool = new ConcurrencyPool<ILocatedCommand[]>();
|
|
22
16
|
const pathList = paths.split(",").filter(Boolean);
|
|
23
|
-
const commands =
|
|
24
|
-
pathList.map(path => pool.enqueue(() => this.parseCommand(root, path))),
|
|
25
|
-
);
|
|
17
|
+
const commands = pathList.map(path => this.parseCommand(join(root, path)));
|
|
26
18
|
console.log(JSON.stringify(commands.flat()));
|
|
27
19
|
}
|
|
28
20
|
|
|
29
|
-
private static
|
|
21
|
+
private static parseCommand(path: string) {
|
|
30
22
|
const commands: ILocatedCommand[] = [];
|
|
31
|
-
const declaredExports =
|
|
23
|
+
const declaredExports = super.compile(path);
|
|
32
24
|
for (const key in declaredExports) {
|
|
33
25
|
if (declaredExports[key] instanceof RepoKitCommand) {
|
|
34
26
|
commands.push({ ...declaredExports[key], location: path });
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { AutoIncrementingID } from "@figliolia/event-emitter";
|
|
2
|
-
|
|
3
2
|
import type { AsyncTask } from "./types";
|
|
4
3
|
|
|
5
4
|
export class ConcurrencyPool<T> {
|
|
6
5
|
private readonly IDs = new AutoIncrementingID();
|
|
7
6
|
private readonly activeTasks = new Map<string, Promise<T>>();
|
|
8
|
-
constructor(public readonly maxConcurrency
|
|
7
|
+
constructor(public readonly maxConcurrency = 10) {}
|
|
9
8
|
|
|
10
9
|
public async enqueue(task: AsyncTask<T>) {
|
|
11
10
|
if (this.activeTasks.size === this.maxConcurrency) {
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import { parseArgs } from "node:util";
|
|
2
|
-
import { join } from "node:path";
|
|
3
1
|
import { existsSync } from "node:fs";
|
|
4
|
-
|
|
5
|
-
import {
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { parseArgs } from "node:util";
|
|
6
4
|
import { RepoKitConfig } from "./RepoKitConfig";
|
|
5
|
+
import { TSCompiler } from "./TSCompiler";
|
|
7
6
|
|
|
8
7
|
export class ConfigurationParser extends TSCompiler {
|
|
9
|
-
public static
|
|
8
|
+
public static parse() {
|
|
10
9
|
const root = this.parseRoot();
|
|
11
10
|
const path = join(root, "repokit.ts");
|
|
12
11
|
if (!existsSync(path)) {
|
|
13
12
|
return;
|
|
14
13
|
}
|
|
15
|
-
const
|
|
16
|
-
const config = await compiler.compile(path);
|
|
14
|
+
const config = super.compile(path);
|
|
17
15
|
for (const key in config) {
|
|
18
16
|
if (config[key] instanceof RepoKitConfig) {
|
|
19
17
|
return console.log(JSON.stringify(config[key].toScoped(path)));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ICommand, IRepoKitConfig } from "./types";
|
|
2
1
|
import { RepoKitCommand } from "./RepoKitCommand";
|
|
2
|
+
import type { ICommand, IRepoKitConfig } from "./types";
|
|
3
3
|
/* eslint-disable typescript-eslint(no-misused-spread */
|
|
4
4
|
|
|
5
5
|
export class RepoKitConfig implements Required<IRepoKitConfig> {
|
package/externals/TSCompiler.ts
CHANGED
|
@@ -1,26 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { transform } from "@swc/core";
|
|
1
|
+
import type { RegisterOptions } from "ts-node";
|
|
2
|
+
import { register } from "ts-node";
|
|
5
3
|
|
|
6
4
|
export class TSCompiler {
|
|
7
|
-
private static readonly
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
private static readonly compilerOptions: RegisterOptions = {
|
|
6
|
+
swc: true,
|
|
7
|
+
typeCheck: false,
|
|
8
|
+
transpileOnly: true,
|
|
9
|
+
compilerOptions: {
|
|
10
|
+
noEmit: true,
|
|
11
|
+
module: "commonjs",
|
|
12
|
+
isolatedModules: false,
|
|
13
|
+
},
|
|
14
|
+
moduleTypes: {
|
|
15
|
+
"**": "cjs",
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
public static compile<T extends Record<string, unknown>>(path: string) {
|
|
20
|
+
const compiler = register(this.compilerOptions);
|
|
21
|
+
compiler.enabled(true);
|
|
22
|
+
const result = this.import(path) as T;
|
|
23
|
+
compiler.enabled(false);
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
12
26
|
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
module: {
|
|
17
|
-
type: "es6",
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
const target = `${resolve(path, "../")}/${basename(path)}${TSCompiler.TMP_FILE_NAME}`;
|
|
21
|
-
await writeFile(target, result.code);
|
|
22
|
-
const config = await import(target);
|
|
23
|
-
await rm(target, { force: true });
|
|
24
|
-
return config;
|
|
27
|
+
private static import(filePath: string) {
|
|
28
|
+
const _module = require(filePath);
|
|
29
|
+
return _module?.__esModule ? _module : { default: _module };
|
|
25
30
|
}
|
|
26
31
|
}
|
package/externals/index.ts
CHANGED
package/installation/install.sh
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@repokit/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "A knowledgebase for your repository - wrapped in a CLI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -47,16 +47,25 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@figliolia/event-emitter": "^1.2.0",
|
|
50
|
-
"@swc/core": "^1.15.18"
|
|
50
|
+
"@swc/core": "^1.15.18",
|
|
51
|
+
"ts-node": "^10.9.2"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@figliolia/child-process": "^1.0.4",
|
|
54
55
|
"@types/node": "^25.3.0",
|
|
55
|
-
"
|
|
56
|
+
"@typescript-eslint/eslint-plugin": "^8.57.1",
|
|
57
|
+
"@typescript-eslint/parser": "^8.57.1",
|
|
58
|
+
"eslint": "^10.0.3",
|
|
59
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
60
|
+
"eslint-plugin-import": "^2.32.0",
|
|
61
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
62
|
+
"eslint-plugin-unused-imports": "^4.4.1",
|
|
63
|
+
"oxfmt": "^0.41.0",
|
|
56
64
|
"oxlint": "^1.42.0",
|
|
57
|
-
"oxlint-tsgolint": "^0.
|
|
58
|
-
"tsdown": "^0.
|
|
65
|
+
"oxlint-tsgolint": "^0.17.0",
|
|
66
|
+
"tsdown": "^0.21.0",
|
|
59
67
|
"tsx": "^4.21.0",
|
|
60
68
|
"typescript": "^5.9.3"
|
|
61
|
-
}
|
|
69
|
+
},
|
|
70
|
+
"packageManager": "yarn@4.0.2"
|
|
62
71
|
}
|