@repokit/core 2.0.0 → 2.0.2

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
@@ -81,6 +81,8 @@ repokit
81
81
 
82
82
  The CLI will list out its internal commands as well as any commands you registered in your config file.
83
83
 
84
+ <img src="media/post-init.webp" alt="Help screen after initialization" />
85
+
84
86
  Next run:
85
87
 
86
88
  ```bash
@@ -95,16 +97,49 @@ To begin building your CLI, run:
95
97
  repokit register ./path/to/your/feature
96
98
  ```
97
99
 
98
- This command generates a tool definition for your feature that you can fill out using your tool's API's. When complete, save the file and run:
100
+ This command generates a tool definition for your feature that you can fill out using your tool's API's. A tool definition might look something like the following:
101
+
102
+ ```typescript
103
+ import { RepoKitCommand } from "@repokit/core";
104
+
105
+ export const Commands = new RepoKitCommand({
106
+ name: "user-interface",
107
+ description: "Build commands for the UI",
108
+ commands: {
109
+ "build:production": {
110
+ command: "vite build",
111
+ description: "Build the UI for production",
112
+ args: {
113
+ "(--optimization | -o)":
114
+ "Run post-build optimizers such as compression and css purging",
115
+ },
116
+ },
117
+ "run:development": {
118
+ command: "vite",
119
+ description: "Run the UI in development mode",
120
+ args: {
121
+ "(--port | -p)":
122
+ "Specifies the port number to run the development server on",
123
+ "(--open | -o)": "Opens your OS' preferred browser",
124
+ },
125
+ },
126
+ },
127
+ });
128
+ ```
129
+
130
+ When finished with your definition, save the file and run:
99
131
 
100
132
  ```bash
101
- repokit <your-tool-name>
133
+ repokit user-interface
102
134
  ```
103
135
 
104
- The CLI will list out your new tool's API's. To invoke any of them, run:
136
+ The CLI will list out your new tool's API's:
137
+ <img src="media/new-command.webp" alt="Command definition" />
138
+
139
+ To invoke any of them, run:
105
140
 
106
141
  ```bash
107
- repokit <your-tool-name> <your-command-name>
142
+ repokit user-interface <sub-command> <args>
108
143
  ```
109
144
 
110
145
  ### Reasoning about your toolchain
@@ -1,5 +1,5 @@
1
- import { TSCompiler } from "./TSCompiler.mjs";
2
1
  import { RepoKitConfig } from "./RepoKitConfig.mjs";
2
+ import { TSCompiler } from "./TSCompiler.mjs";
3
3
  import { existsSync } from "node:fs";
4
4
  import { join } from "node:path";
5
5
  import { parseArgs } from "node:util";
@@ -1,5 +1,5 @@
1
- import { RepoKitCommand } from "./RepoKitCommand.mjs";
2
1
  import { ICommand, IRepoKitConfig } from "./types.mjs";
2
+ import { RepoKitCommand } from "./RepoKitCommand.mjs";
3
3
 
4
4
  //#region externals/RepoKitConfig.d.ts
5
5
  declare class RepoKitConfig implements Required<IRepoKitConfig> {
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { RepoKitCommand } from "./RepoKitCommand.mjs";
2
1
  import { AsyncTask, ICommand, ILocatedCommand, IRepoKitCommand, IRepoKitConfig } from "./types.mjs";
2
+ import { RepoKitCommand } from "./RepoKitCommand.mjs";
3
3
  import { RepoKitConfig } from "./RepoKitConfig.mjs";
4
4
  export { AsyncTask, ICommand, ILocatedCommand, IRepoKitCommand, IRepoKitConfig, RepoKitCommand, RepoKitConfig };
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@repokit/core",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "A knowledgebase for your repository - wrapped in a CLI",
5
5
  "keywords": [
6
6
  "cli",
@@ -1,10 +0,0 @@
1
- import { TSCompiler } from "./TSCompiler.mjs";
2
-
3
- //#region externals/CommandParser.d.ts
4
- declare class CommandParser extends TSCompiler {
5
- static parse(): Promise<void>;
6
- private static parseCommand;
7
- private static parsePaths;
8
- }
9
- //#endregion
10
- export { CommandParser };
@@ -1,13 +0,0 @@
1
- import { AsyncTask } from "./types.mjs";
2
-
3
- //#region externals/ConcurrencyPool.d.ts
4
- declare class ConcurrencyPool<T> {
5
- readonly maxConcurrency: number;
6
- private readonly IDs;
7
- private readonly activeTasks;
8
- constructor(maxConcurrency?: number);
9
- enqueue(task: AsyncTask<T>): Promise<T>;
10
- private executeTask;
11
- }
12
- //#endregion
13
- export { ConcurrencyPool };
@@ -1,22 +0,0 @@
1
- import { AutoIncrementingID } from "@figliolia/event-emitter";
2
- //#region externals/ConcurrencyPool.ts
3
- var ConcurrencyPool = class {
4
- IDs = new AutoIncrementingID();
5
- activeTasks = /* @__PURE__ */ new Map();
6
- constructor(maxConcurrency = 10) {
7
- this.maxConcurrency = maxConcurrency;
8
- }
9
- async enqueue(task) {
10
- if (this.activeTasks.size === this.maxConcurrency) await Promise.race(Array.from(this.activeTasks.values()));
11
- return this.executeTask(task);
12
- }
13
- executeTask(task) {
14
- const ID = this.IDs.get();
15
- const promise = task();
16
- this.activeTasks.set(ID, promise);
17
- promise.finally(() => this.activeTasks.delete(ID));
18
- return promise;
19
- }
20
- };
21
- //#endregion
22
- export { ConcurrencyPool };
@@ -1,9 +0,0 @@
1
- import { TSCompiler } from "./TSCompiler.mjs";
2
-
3
- //#region externals/ConfigurationParser.d.ts
4
- declare class ConfigurationParser extends TSCompiler {
5
- static parse(): void;
6
- private static parseRoot;
7
- }
8
- //#endregion
9
- export { ConfigurationParser };
@@ -1,8 +0,0 @@
1
- //#region externals/TSCompiler.d.ts
2
- declare class TSCompiler {
3
- private static readonly compilerOptions;
4
- static compile<T extends Record<string, unknown>>(path: string): T;
5
- private static import;
6
- }
7
- //#endregion
8
- export { TSCompiler };
@@ -1,4 +0,0 @@
1
- //#region externals/templates/command_template.txt
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
- //#endregion
4
- export { command_template_default as default };
@@ -1,4 +0,0 @@
1
- //#region externals/templates/configuration_template.txt
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
- //#endregion
4
- export { configuration_template_default as default };
package/dist/types.mjs DELETED
@@ -1 +0,0 @@
1
- export {};