electron-reactive-event-cli 1.0.39 → 1.0.41
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/Distribution/Initialize.Types.d.ts +0 -11
- package/Distribution/Initialize.Types.d.ts.map +1 -1
- package/Distribution/Register/RegisterCommand.Types.d.ts +2 -0
- package/Distribution/Register/RegisterCommand.Types.d.ts.map +1 -0
- package/Distribution/Register/RegisterCommand.Types.js +7 -0
- package/Distribution/Register/RegisterCommand.Types.js.map +1 -0
- package/Distribution/Register/RegisterCommand.d.ts +3 -0
- package/Distribution/Register/RegisterCommand.d.ts.map +1 -0
- package/Distribution/Register/RegisterCommand.js +120 -0
- package/Distribution/Register/RegisterCommand.js.map +1 -0
- package/Distribution/Register/RegisterCommandBin.d.ts +2 -0
- package/Distribution/Register/RegisterCommandBin.d.ts.map +1 -0
- package/Distribution/Register/RegisterCommandBin.js +8 -0
- package/Distribution/Register/RegisterCommandBin.js.map +1 -0
- package/Distribution/Register/index.d.ts +2 -0
- package/Distribution/Register/index.d.ts.map +1 -0
- package/Distribution/Register/index.js +7 -0
- package/Distribution/Register/index.js.map +1 -0
- package/Distribution/Schema.Types.d.ts +0 -7
- package/Distribution/Schema.Types.d.ts.map +1 -1
- package/Distribution/Select.Types.d.ts +1 -4
- package/Distribution/Select.Types.d.ts.map +1 -1
- package/Distribution/Select.d.ts +1 -8
- package/Distribution/Select.d.ts.map +1 -1
- package/Distribution/Select.js +1 -344
- package/Distribution/Select.js.map +1 -1
- package/Distribution/Setup/Prompt.Types.d.ts +12 -0
- package/Distribution/Setup/Prompt.Types.d.ts.map +1 -0
- package/Distribution/Setup/Prompt.Types.js +7 -0
- package/Distribution/Setup/Prompt.Types.js.map +1 -0
- package/Distribution/Setup/Prompt.d.ts +10 -0
- package/Distribution/Setup/Prompt.d.ts.map +1 -0
- package/Distribution/Setup/Prompt.js +250 -0
- package/Distribution/Setup/Prompt.js.map +1 -0
- package/Distribution/Setup/SetupCommand.Types.d.ts +5 -0
- package/Distribution/Setup/SetupCommand.Types.d.ts.map +1 -0
- package/Distribution/Setup/SetupCommand.Types.js +7 -0
- package/Distribution/Setup/SetupCommand.Types.js.map +1 -0
- package/Distribution/Setup/SetupCommand.d.ts +3 -0
- package/Distribution/Setup/SetupCommand.d.ts.map +1 -0
- package/Distribution/Setup/SetupCommand.js +259 -0
- package/Distribution/Setup/SetupCommand.js.map +1 -0
- package/Distribution/Setup/TsConfig.Types.d.ts +10 -0
- package/Distribution/Setup/TsConfig.Types.d.ts.map +1 -0
- package/Distribution/Setup/TsConfig.Types.js +7 -0
- package/Distribution/Setup/TsConfig.Types.js.map +1 -0
- package/Distribution/Setup/TsConfig.d.ts +7 -0
- package/Distribution/Setup/TsConfig.d.ts.map +1 -0
- package/Distribution/Setup/TsConfig.js +62 -0
- package/Distribution/Setup/TsConfig.js.map +1 -0
- package/Distribution/Setup/index.d.ts +6 -0
- package/Distribution/Setup/index.d.ts.map +1 -0
- package/Distribution/Setup/index.js +11 -0
- package/Distribution/Setup/index.js.map +1 -0
- package/Distribution/Setup.js +1 -115
- package/Distribution/Setup.js.map +1 -1
- package/Distribution/Shared.d.ts +1 -2
- package/Distribution/Shared.d.ts.map +1 -1
- package/Distribution/Shared.js +1 -11
- package/Distribution/Shared.js.map +1 -1
- package/Distribution/Utility.Types.d.ts +2 -0
- package/Distribution/Utility.Types.d.ts.map +1 -0
- package/Distribution/Utility.Types.js +7 -0
- package/Distribution/Utility.Types.js.map +1 -0
- package/Distribution/Utility.d.ts +2 -1
- package/Distribution/Utility.d.ts.map +1 -1
- package/Distribution/Utility.js +16 -1
- package/Distribution/Utility.js.map +1 -1
- package/Distribution/index.d.ts +2 -3
- package/Distribution/index.d.ts.map +1 -1
- package/Distribution/index.js +2 -3
- package/Distribution/index.js.map +1 -1
- package/package.json +5 -4
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PromptConfig } from "@sorrell/inquirer-file-selector";
|
|
2
|
+
export type FRegistrarDefinition = {
|
|
3
|
+
Name: string;
|
|
4
|
+
Path: string;
|
|
5
|
+
};
|
|
6
|
+
export type FFileSelectorConfigFull = PromptConfig & {
|
|
7
|
+
allowCancel?: false;
|
|
8
|
+
multiple?: false;
|
|
9
|
+
};
|
|
10
|
+
export type FFileSelectorConfigBase = Omit<FFileSelectorConfigFull, "message" | "allowCancel">;
|
|
11
|
+
export type FFileSelectorConfig = Pick<FFileSelectorConfigFull, "filter" | "message" | "type"> & Partial<Pick<FFileSelectorConfigFull, "allowCancel" | "basePath">>;
|
|
12
|
+
//# sourceMappingURL=Prompt.Types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Prompt.Types.d.ts","sourceRoot":"","sources":["../../Source/Setup/Prompt.Types.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpE,MAAM,MAAM,oBAAoB,GAC5B;IACI,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEN,MAAM,MAAM,uBAAuB,GAC/B,YAAY,GACZ;IACI,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC;CACpB,CAAC;AAEN,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,uBAAuB,EAAG,SAAS,GAAG,aAAa,CAAC,CAAC;AAEhG,MAAM,MAAM,mBAAmB,GAC3B,IAAI,CAAC,uBAAuB,EACtB,QAAQ,GACR,SAAS,GACT,MAAM,CACX,GACD,OAAO,CAAC,IAAI,CACR,uBAAuB,EACrB,aAAa,GACb,UAAU,CACf,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Prompt.Types.js","sourceRoot":"","sources":["../../Source/Setup/Prompt.Types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type FBaseInterfaceName } from "../index.js";
|
|
2
|
+
import { type FFileSelectorConfig, type FRegistrarDefinition } from "./index.js";
|
|
3
|
+
import { type Item } from "@sorrell/inquirer-file-selector";
|
|
4
|
+
export declare function SelectRegistrarInterface(RegistrarBase: FBaseInterfaceName): Promise<FRegistrarDefinition>;
|
|
5
|
+
export declare function FileSelector(Config: FFileSelectorConfig): Promise<Item>;
|
|
6
|
+
export declare function SelectBuiltModulePath(): Promise<string>;
|
|
7
|
+
export declare function SelectConfigDirectoryPath(): Promise<string>;
|
|
8
|
+
export declare function IsPackageJsonConfigNeeded(ConfigDirectoryPath: string, ConfigFileName?: string | undefined): Promise<boolean>;
|
|
9
|
+
export declare function SelectConfigName(SelectedDirectory: string): Promise<string>;
|
|
10
|
+
//# sourceMappingURL=Prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Prompt.d.ts","sourceRoot":"","sources":["../../Source/Setup/Prompt.ts"],"names":[],"mappings":"AAQA,OAAO,EAAyB,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EACH,KAAK,mBAAmB,EAKxB,KAAK,oBAAoB,EAGM,MAAM,YAAY,CAAC;AAGtD,OAAO,EAAE,KAAK,IAAI,EAAgB,MAAM,iCAAiC,CAAC;AAyF1E,wBAAsB,wBAAwB,CAC1C,aAAa,EAAE,kBAAkB,GAClC,OAAO,CAAC,oBAAoB,CAAC,CA8G/B;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0D7E;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,MAAM,CAAC,CAY7D;AAED,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,MAAM,CAAC,CAejE;AAOD,wBAAsB,yBAAyB,CAC3C,mBAAmB,EAAE,MAAM,EAC3B,cAAc,GAAE,MAAM,GAAG,SAAqB,GAC/C,OAAO,CAAC,OAAO,CAAC,CAWlB;AAED,wBAAsB,gBAAgB,CAAC,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkDjF"}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/* File: Prompt.ts
|
|
2
|
+
* Author: Gage Sorrell <gage@sorrell.sh>
|
|
3
|
+
* Copyright: (c) 2026 Gage Sorrell
|
|
4
|
+
* License: MIT
|
|
5
|
+
*/
|
|
6
|
+
/* eslint-disable no-console */
|
|
7
|
+
import { DefaultConfigFileName } from "../index.js";
|
|
8
|
+
import { FormatDiagnostics, GetMatchingInterfacesInSourceFile, IsSearchableProjectSourceFile } from "./index.js";
|
|
9
|
+
import { constants as FileSystemConstants, access } from "fs/promises";
|
|
10
|
+
import { GetPackageRootDirectory, IsValidFileName } from "@sorrell/utilities";
|
|
11
|
+
import { fileSelector } from "@sorrell/inquirer-file-selector";
|
|
12
|
+
import TypeScript from "typescript";
|
|
13
|
+
import { basename, join, normalize, resolve } from "path";
|
|
14
|
+
import { confirm, input, select } from "@inquirer/prompts";
|
|
15
|
+
import ora from "ora";
|
|
16
|
+
import Chalk from "chalk";
|
|
17
|
+
import { Code } from "@sorrell/cli-utilities";
|
|
18
|
+
async function GetRegistrarModules(InterfaceName) {
|
|
19
|
+
const ProjectRootDirectoryPathResolved = resolve(await GetPackageRootDirectory());
|
|
20
|
+
const TsConfigFilePath = join(ProjectRootDirectoryPathResolved, "tsconfig.json");
|
|
21
|
+
await access(TsConfigFilePath, FileSystemConstants.F_OK);
|
|
22
|
+
const ConfigFileResult = TypeScript.readConfigFile(TsConfigFilePath, TypeScript.sys.readFile);
|
|
23
|
+
if (ConfigFileResult.error !== undefined) {
|
|
24
|
+
throw new Error(`Failed to read "${TsConfigFilePath}".\n${FormatDiagnostics([ConfigFileResult.error])}`);
|
|
25
|
+
}
|
|
26
|
+
const ParsedConfig = TypeScript.parseJsonConfigFileContent(ConfigFileResult.config, TypeScript.sys, ProjectRootDirectoryPathResolved, undefined, TsConfigFilePath);
|
|
27
|
+
if (ParsedConfig.errors.length > 0) {
|
|
28
|
+
throw new Error(`Failed to parse "${TsConfigFilePath}".\n${FormatDiagnostics(ParsedConfig.errors)}`);
|
|
29
|
+
}
|
|
30
|
+
const projectReferences = ParsedConfig.projectReferences;
|
|
31
|
+
if (projectReferences === undefined) {
|
|
32
|
+
/* eslint-disable-next-line @stylistic/max-len */
|
|
33
|
+
console.error(`When trying to read the project's ${Code("tsconfig.json")}, the resulting ${Code("projectReferences")} property was ${Code("undefined")}. Exiting...`);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
const Program = TypeScript.createProgram({
|
|
37
|
+
options: ParsedConfig.options,
|
|
38
|
+
projectReferences,
|
|
39
|
+
rootNames: ParsedConfig.fileNames
|
|
40
|
+
});
|
|
41
|
+
const Matches = [];
|
|
42
|
+
for (const RootFilePath of ParsedConfig.fileNames) {
|
|
43
|
+
const SourceFile = Program.getSourceFile(RootFilePath);
|
|
44
|
+
if (SourceFile === undefined) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (!IsSearchableProjectSourceFile(SourceFile)) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
const MatchingInterfaceNames = GetMatchingInterfacesInSourceFile(SourceFile, InterfaceName);
|
|
51
|
+
for (const MatchingInterfaceName of MatchingInterfaceNames) {
|
|
52
|
+
Matches.push({
|
|
53
|
+
Name: MatchingInterfaceName,
|
|
54
|
+
Path: SourceFile.fileName
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return Matches;
|
|
59
|
+
}
|
|
60
|
+
export async function SelectRegistrarInterface(RegistrarBase) {
|
|
61
|
+
const RegistrarBaseFormatted = Code(RegistrarBase);
|
|
62
|
+
const Out = { Name: "", Path: "" };
|
|
63
|
+
while (true) {
|
|
64
|
+
const text = `Searching for modules that contain an interface that extends ${RegistrarBaseFormatted}...`;
|
|
65
|
+
const Ora = ora({ text }).start();
|
|
66
|
+
const RegistrarModules = await GetRegistrarModules(RegistrarBase);
|
|
67
|
+
if (RegistrarModules.length > 0) {
|
|
68
|
+
Ora.succeed();
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
Ora.fail();
|
|
72
|
+
}
|
|
73
|
+
if (RegistrarModules.length === 0) {
|
|
74
|
+
const NoModulesFoundMessage = `There were no modules found in your project that \
|
|
75
|
+
define an interface that extends ${RegistrarBaseFormatted}.\n\nTo fix this, please \
|
|
76
|
+
create a new module anywhere in your project (that is included by your \
|
|
77
|
+
${Code("tsconfig.json")}), then hit ${Code("Return")} for \
|
|
78
|
+
${Code("electron-reactive-event-cli")} to search again.`;
|
|
79
|
+
console.log(NoModulesFoundMessage);
|
|
80
|
+
const Result = await confirm({
|
|
81
|
+
default: true,
|
|
82
|
+
message: "Has the desired module been created?"
|
|
83
|
+
});
|
|
84
|
+
if (Result) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else if (RegistrarModules.length === 1) {
|
|
92
|
+
const InterfaceName = RegistrarModules[0]?.Name || "";
|
|
93
|
+
const InterfaceNameFormatted = Code(InterfaceName);
|
|
94
|
+
const ModulePath = RegistrarModules[0]?.Path || "";
|
|
95
|
+
const ModulePathFormatted = Code(ModulePath);
|
|
96
|
+
const ModuleName = basename(RegistrarModules[0]?.Path || "");
|
|
97
|
+
const ModuleNameFormatted = Code(ModuleName);
|
|
98
|
+
const ConfirmationMessage = `The interface ${InterfaceNameFormatted} was found in\
|
|
99
|
+
module ${ModuleNameFormatted}. The module's full path is\n\n${ModulePathFormatted}\n\n`;
|
|
100
|
+
console.log(ConfirmationMessage);
|
|
101
|
+
const Confirms = await confirm({
|
|
102
|
+
default: true,
|
|
103
|
+
message: "Is this the interface definition that you wish to use?"
|
|
104
|
+
});
|
|
105
|
+
if (Confirms) {
|
|
106
|
+
Out.Name = InterfaceName;
|
|
107
|
+
Out.Path = ModulePath;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else // RegistrarModules.length > 1
|
|
115
|
+
{
|
|
116
|
+
const ManyFoundMessage = `There were ${RegistrarModules.length} interfaces found\
|
|
117
|
+
that extend ${RegistrarBaseFormatted}. Their names and the paths in which they reside are\
|
|
118
|
+
given below.`;
|
|
119
|
+
console.log(ManyFoundMessage);
|
|
120
|
+
const InterfaceDefinitionToString = (Definition) => {
|
|
121
|
+
return `${Code(Definition.Name)} (${Code(Definition.Path)})`;
|
|
122
|
+
};
|
|
123
|
+
const choices = RegistrarModules.map(InterfaceDefinitionToString);
|
|
124
|
+
const Choice = await select({
|
|
125
|
+
choices,
|
|
126
|
+
loop: true,
|
|
127
|
+
message: "Which interface would you like to use?"
|
|
128
|
+
});
|
|
129
|
+
const Selection = RegistrarModules[choices.indexOf(Choice)];
|
|
130
|
+
if (Selection === undefined) {
|
|
131
|
+
console.error("Despite selecting a module definition, inquirer returned undefined.");
|
|
132
|
+
process.exit(1);
|
|
133
|
+
}
|
|
134
|
+
Out.Name = Selection.Name;
|
|
135
|
+
Out.Path = Selection.Path;
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return Out;
|
|
140
|
+
}
|
|
141
|
+
export async function FileSelector(Config) {
|
|
142
|
+
const filter = (In) => {
|
|
143
|
+
let FilteredByGivenConfig = false;
|
|
144
|
+
if (Config.filter !== undefined) {
|
|
145
|
+
FilteredByGivenConfig = Config.filter(In);
|
|
146
|
+
}
|
|
147
|
+
return (!In.name.includes("node_modules") &&
|
|
148
|
+
!FilteredByGivenConfig);
|
|
149
|
+
};
|
|
150
|
+
const BaseConfig = {
|
|
151
|
+
basePath: await GetPackageRootDirectory(),
|
|
152
|
+
filter,
|
|
153
|
+
keybinds: {
|
|
154
|
+
back: ["left"],
|
|
155
|
+
confirm: ["enter", "return"],
|
|
156
|
+
down: ["down"],
|
|
157
|
+
forward: ["right"],
|
|
158
|
+
up: ["up"]
|
|
159
|
+
},
|
|
160
|
+
loop: true,
|
|
161
|
+
multiple: false,
|
|
162
|
+
theme: {
|
|
163
|
+
labels: {
|
|
164
|
+
hints: {
|
|
165
|
+
confirm: "{{confirm}} to place the new module here."
|
|
166
|
+
},
|
|
167
|
+
keys: {
|
|
168
|
+
back: "←",
|
|
169
|
+
down: "↓",
|
|
170
|
+
forward: "→",
|
|
171
|
+
up: "↑"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
type: "directory"
|
|
176
|
+
};
|
|
177
|
+
const { filter: _, ...RemainingConfig } = Config;
|
|
178
|
+
const MergedConfig = {
|
|
179
|
+
...BaseConfig,
|
|
180
|
+
...RemainingConfig
|
|
181
|
+
};
|
|
182
|
+
return await fileSelector(MergedConfig);
|
|
183
|
+
}
|
|
184
|
+
export async function SelectBuiltModulePath() {
|
|
185
|
+
const Message = `The ${Code("register")} command provided by this package will register your \
|
|
186
|
+
event declaration types for you, by maintaining a module in your project which adds the declaration \
|
|
187
|
+
types to your registrar interfaces. The module does not need to be imported anywhere, it just needs to \
|
|
188
|
+
be somewhere that is recognized by your ${Code("tsconfig.json")}.`;
|
|
189
|
+
console.log(Message);
|
|
190
|
+
return (await FileSelector({
|
|
191
|
+
message: "Please choose the directory where you want the module to reside."
|
|
192
|
+
})).path;
|
|
193
|
+
}
|
|
194
|
+
export async function SelectConfigDirectoryPath() {
|
|
195
|
+
const WarningMessage = `If you choose a directory that is not the root of your project, then \
|
|
196
|
+
the path to the config file will be written to your ${Code("package.json")} file \
|
|
197
|
+
via the ${Code("config")} property (${Chalk.italic("i.e.")}, \
|
|
198
|
+
${Code("config.electron-reactive-event-cli")}).`;
|
|
199
|
+
const Message = `The ${Code("register")} command will need to know what choices you have \
|
|
200
|
+
selected in this wizard. A JSON file will be saved to your project for the ${Code("register")} \
|
|
201
|
+
command to read from later.\n\n${FormatWarning(WarningMessage)}\n`;
|
|
202
|
+
console.log(Message);
|
|
203
|
+
return (await FileSelector({
|
|
204
|
+
message: "Please choose the directory where you want the config file to reside."
|
|
205
|
+
})).path;
|
|
206
|
+
}
|
|
207
|
+
function FormatWarning(Message) {
|
|
208
|
+
return `⚠️ ${Chalk.yellow("Note:")} ${Message}`;
|
|
209
|
+
}
|
|
210
|
+
export async function IsPackageJsonConfigNeeded(ConfigDirectoryPath, ConfigFileName = undefined) {
|
|
211
|
+
const IsFileNameCustom = (ConfigFileName !== undefined &&
|
|
212
|
+
ConfigFileName !== DefaultConfigFileName);
|
|
213
|
+
const IsInRootDirectory = normalize(ConfigDirectoryPath) !== normalize(await GetPackageRootDirectory());
|
|
214
|
+
return IsFileNameCustom || IsInRootDirectory;
|
|
215
|
+
}
|
|
216
|
+
export async function SelectConfigName(SelectedDirectory) {
|
|
217
|
+
const AlreadyNeedsPackageJsonConfig = await IsPackageJsonConfigNeeded(SelectedDirectory);
|
|
218
|
+
const WarningMessage = `If you choose a name that is not the default, then \
|
|
219
|
+
the path to the config file will be written to your ${Code("package.json")} file \
|
|
220
|
+
via the ${Code("config")} property (${Chalk.italic("i.e.")}, \
|
|
221
|
+
${Code("config.electron-reactive-event-cli")}).`;
|
|
222
|
+
const WarningMessageFormatted = `\n\n${FormatWarning(WarningMessage)}`;
|
|
223
|
+
const Message = `Please choose the name that the config file will have.\
|
|
224
|
+
${AlreadyNeedsPackageJsonConfig ? "" : WarningMessageFormatted}\n`;
|
|
225
|
+
console.log(Message);
|
|
226
|
+
let HasTriedOnce = false;
|
|
227
|
+
while (true) {
|
|
228
|
+
const message = HasTriedOnce
|
|
229
|
+
? "Please choose a valid JSON file name."
|
|
230
|
+
: "Please choose the name that the config file will have.";
|
|
231
|
+
const FileName = await input({
|
|
232
|
+
default: DefaultConfigFileName,
|
|
233
|
+
message
|
|
234
|
+
});
|
|
235
|
+
HasTriedOnce = true;
|
|
236
|
+
const JsonExtension = ".json";
|
|
237
|
+
const IsFileNameValid = await IsValidFileName(SelectedDirectory, FileName, false, JsonExtension);
|
|
238
|
+
if (IsFileNameValid) {
|
|
239
|
+
return FileName;
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
const IsExtensionBad = !FileName.endsWith(JsonExtension);
|
|
243
|
+
const ExtensionMessage = ` The name must end with ${Code(JsonExtension)}.`;
|
|
244
|
+
const Message = `The name ${FileName} is not a valid JSON file name.\
|
|
245
|
+
${IsExtensionBad ? ExtensionMessage : ""}`;
|
|
246
|
+
console.log(Message);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=Prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Prompt.js","sourceRoot":"","sources":["../../Source/Setup/Prompt.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+BAA+B;AAE/B,OAAO,EAAE,qBAAqB,EAA2B,MAAM,aAAa,CAAC;AAC7E,OAAO,EAOH,iBAAiB,EACjB,iCAAiC,EACjC,6BAA6B,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,SAAS,IAAI,mBAAmB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAa,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,UAAqC,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,GAAyB,MAAM,KAAK,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C,KAAK,UAAU,mBAA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EAAE,CAAC;YAE7C,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACzB,CAAC;IACL,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetupCommand.Types.d.ts","sourceRoot":"","sources":["../../Source/Setup/SetupCommand.Types.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,mBAAmB,GAC3B;IACI,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetupCommand.Types.js","sourceRoot":"","sources":["../../Source/Setup/SetupCommand.Types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetupCommand.d.ts","sourceRoot":"","sources":["../../Source/Setup/SetupCommand.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* File: SetupCommand.ts
|
|
3
|
+
* Author: Gage Sorrell <gage@sorrell.sh>
|
|
4
|
+
* Copyright: (c) 2026 Gage Sorrell
|
|
5
|
+
* License: MIT
|
|
6
|
+
*/
|
|
7
|
+
/* eslint-disable no-console */
|
|
8
|
+
import { DefaultConfigFileName, RunCommand } from "../index.js";
|
|
9
|
+
import { IsPackageJsonConfigNeeded, SelectBuiltModulePath, SelectConfigDirectoryPath, SelectConfigName, SelectRegistrarInterface } from "./index.js";
|
|
10
|
+
import { GetPackageRootDirectory, GetSafeNewPath, Try } from "@sorrell/utilities";
|
|
11
|
+
import { access, mkdir, readFile, writeFile } from "fs/promises";
|
|
12
|
+
import { basename, dirname, extname, relative, resolve } from "path";
|
|
13
|
+
import ora from "ora";
|
|
14
|
+
import Chalk from "chalk";
|
|
15
|
+
import { Code } from "@sorrell/cli-utilities";
|
|
16
|
+
import { Command } from "commander";
|
|
17
|
+
import { constants as FileSystemConstants } from "fs";
|
|
18
|
+
import { Register } from "../Register/RegisterCommand.js";
|
|
19
|
+
import { confirm } from "@inquirer/prompts";
|
|
20
|
+
function GetEmptyCliConfig() {
|
|
21
|
+
return {
|
|
22
|
+
main: {
|
|
23
|
+
name: "",
|
|
24
|
+
path: ""
|
|
25
|
+
},
|
|
26
|
+
outPath: "",
|
|
27
|
+
renderer: {
|
|
28
|
+
name: "",
|
|
29
|
+
path: ""
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
async function WriteCliConfig(FileName, CliConfig) {
|
|
34
|
+
const Ora = ora({
|
|
35
|
+
spinner: "dots",
|
|
36
|
+
text: `Writing ${Code(FileName)} to your package's root directory...`
|
|
37
|
+
});
|
|
38
|
+
const RootDirectory = await GetPackageRootDirectory();
|
|
39
|
+
const ConfigPathBase = resolve(RootDirectory, FileName);
|
|
40
|
+
const ConfigPath = await GetSafeNewPath(ConfigPathBase);
|
|
41
|
+
const ConfigContents = JSON.stringify(CliConfig, null, 4);
|
|
42
|
+
const { Error } = await Try(writeFile(ConfigPath, ConfigContents));
|
|
43
|
+
const ConfigPathFileName = basename(ConfigPath);
|
|
44
|
+
if (Error === undefined) {
|
|
45
|
+
/* eslint-disable-next-line @stylistic/max-len */
|
|
46
|
+
Ora.succeed(`The file ${Code(ConfigPath)} was written successfully!`);
|
|
47
|
+
console.log(`Please open the file and fill out its fields to use the ${Code("register")} command.`);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
/* eslint-disable-next-line @stylistic/max-len */
|
|
51
|
+
Ora.fail(`The file ${Code(ConfigPathFileName)} could not be written in ${Code(RootDirectory)}. Here is the error:`);
|
|
52
|
+
console.error(JSON.stringify(Error, null, 4) + "\n");
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async function PathExists(FilePath) {
|
|
56
|
+
try {
|
|
57
|
+
await access(FilePath, FileSystemConstants.F_OK);
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function GetOutputModuleSpecifierExtension(FilePath) {
|
|
65
|
+
const Extension = extname(FilePath).toLowerCase();
|
|
66
|
+
switch (Extension) {
|
|
67
|
+
case ".ts":
|
|
68
|
+
case ".tsx":
|
|
69
|
+
{
|
|
70
|
+
return ".js";
|
|
71
|
+
}
|
|
72
|
+
case ".mts":
|
|
73
|
+
{
|
|
74
|
+
return ".mjs";
|
|
75
|
+
}
|
|
76
|
+
case ".cts":
|
|
77
|
+
{
|
|
78
|
+
return ".cjs";
|
|
79
|
+
}
|
|
80
|
+
default:
|
|
81
|
+
{
|
|
82
|
+
return Extension;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function ReplaceFileExtension(FilePath, NewExtension) {
|
|
87
|
+
const CurrentExtension = extname(FilePath);
|
|
88
|
+
if (CurrentExtension.length === 0) {
|
|
89
|
+
return FilePath;
|
|
90
|
+
}
|
|
91
|
+
return FilePath.slice(0, -CurrentExtension.length) + NewExtension;
|
|
92
|
+
}
|
|
93
|
+
function GetRelativeModuleSpecifier(FromModulePath, ToModulePath) {
|
|
94
|
+
const FromDirectoryPath = dirname(resolve(FromModulePath));
|
|
95
|
+
const ToAbsolutePath = resolve(ToModulePath);
|
|
96
|
+
let RelativePath = relative(FromDirectoryPath, ToAbsolutePath).replaceAll("\\", "/");
|
|
97
|
+
if (!RelativePath.startsWith(".")) {
|
|
98
|
+
RelativePath = `./${RelativePath}`;
|
|
99
|
+
}
|
|
100
|
+
return ReplaceFileExtension(RelativePath, GetOutputModuleSpecifierExtension(ToAbsolutePath));
|
|
101
|
+
}
|
|
102
|
+
function GetGeneratedModuleText(MainRegistrar, RendererRegistrar, OutputModulePath) {
|
|
103
|
+
const MainModuleSpecifier = GetRelativeModuleSpecifier(OutputModulePath, MainRegistrar.Path);
|
|
104
|
+
const RendererModuleSpecifier = GetRelativeModuleSpecifier(OutputModulePath, RendererRegistrar.Path);
|
|
105
|
+
const MainImportedAlias = "__ImportedMainRegistrarInterface";
|
|
106
|
+
const RendererImportedAlias = "__ImportedRendererRegistrarInterface";
|
|
107
|
+
return [
|
|
108
|
+
`import type { ${MainRegistrar.Name} as ${MainImportedAlias} } from "${MainModuleSpecifier}";`,
|
|
109
|
+
`import type { ${RendererRegistrar.Name} as ${RendererImportedAlias} } from "${RendererModuleSpecifier}";`,
|
|
110
|
+
"",
|
|
111
|
+
"export type __RegistrarAugmentationImports = readonly [",
|
|
112
|
+
` ${MainImportedAlias},`,
|
|
113
|
+
` ${RendererImportedAlias}`,
|
|
114
|
+
"];",
|
|
115
|
+
"",
|
|
116
|
+
`declare module "${MainModuleSpecifier}"`,
|
|
117
|
+
"{",
|
|
118
|
+
` interface ${MainRegistrar.Name}`,
|
|
119
|
+
" {",
|
|
120
|
+
" }",
|
|
121
|
+
"}",
|
|
122
|
+
"",
|
|
123
|
+
`declare module "${RendererModuleSpecifier}"`,
|
|
124
|
+
"{",
|
|
125
|
+
` interface ${RendererRegistrar.Name}`,
|
|
126
|
+
" {",
|
|
127
|
+
" }",
|
|
128
|
+
"}",
|
|
129
|
+
""
|
|
130
|
+
].join("\n");
|
|
131
|
+
}
|
|
132
|
+
async function WriteBuiltModule(MainRegistrar, RendererRegistrar, ModulePath) {
|
|
133
|
+
const OutputModulePathResolved = resolve(ModulePath);
|
|
134
|
+
if (await PathExists(OutputModulePathResolved)) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
await mkdir(dirname(OutputModulePathResolved), { recursive: true });
|
|
138
|
+
const ModuleText = GetGeneratedModuleText(MainRegistrar, RendererRegistrar, OutputModulePathResolved);
|
|
139
|
+
await writeFile(OutputModulePathResolved, ModuleText, "utf8");
|
|
140
|
+
}
|
|
141
|
+
async function GetPackageJson() {
|
|
142
|
+
const Path = resolve(await GetPackageRootDirectory(), "package.json");
|
|
143
|
+
const { Data: PackageJsonContents, Error } = await Try(readFile(Path, { encoding: "utf-8" }));
|
|
144
|
+
if (PackageJsonContents === undefined) {
|
|
145
|
+
const ErrorMessage = `Could not open your project's ${Code("package.json")}. \
|
|
146
|
+
The attempted path was ${Code(Path)}.\n`;
|
|
147
|
+
console.error(ErrorMessage, JSON.stringify(Error, null, 4));
|
|
148
|
+
process.exit(1);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
return JSON.parse(PackageJsonContents);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
async function SetPackageJson(PackageJson, Path = undefined) {
|
|
155
|
+
const OutPath = Path || await GetPackageRootDirectory();
|
|
156
|
+
const PackageJsonContents = JSON.stringify(PackageJson, null, 4);
|
|
157
|
+
await writeFile(OutPath, PackageJsonContents, { encoding: "utf-8" });
|
|
158
|
+
}
|
|
159
|
+
async function SetupInteractive() {
|
|
160
|
+
const MainRegistrar = await SelectRegistrarInterface("IMainRegistrarBase");
|
|
161
|
+
const RendererRegistrar = await SelectRegistrarInterface("IRendererRegistrarBase");
|
|
162
|
+
const BuiltModulePath = await SelectBuiltModulePath();
|
|
163
|
+
const OraWriteBuiltModule = ora({ text: "Writing new module at the selected path..." }).start();
|
|
164
|
+
await WriteBuiltModule(MainRegistrar, RendererRegistrar, BuiltModulePath);
|
|
165
|
+
OraWriteBuiltModule.succeed();
|
|
166
|
+
const ConfigDirectoryPath = await SelectConfigDirectoryPath();
|
|
167
|
+
const ConfigFileName = await SelectConfigName(ConfigDirectoryPath);
|
|
168
|
+
const OraWriteConfig = ora({ text: `Writing ${Code(ConfigFileName)}...` }).start();
|
|
169
|
+
const Config = {
|
|
170
|
+
main: {
|
|
171
|
+
name: MainRegistrar.Name,
|
|
172
|
+
path: MainRegistrar.Path
|
|
173
|
+
},
|
|
174
|
+
outPath: BuiltModulePath,
|
|
175
|
+
renderer: {
|
|
176
|
+
name: RendererRegistrar.Name,
|
|
177
|
+
path: RendererRegistrar.Path
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
const ConfigString = JSON.stringify(Config, null, 4);
|
|
181
|
+
const ConfigPath = resolve(ConfigDirectoryPath, ConfigFileName);
|
|
182
|
+
const { Error } = await Try(writeFile(ConfigPath, ConfigString, { encoding: "utf-8" }));
|
|
183
|
+
if (Error === undefined) {
|
|
184
|
+
OraWriteConfig.succeed();
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
OraWriteConfig.fail();
|
|
188
|
+
const ErrorMessage = `Failed to write the config file ${ConfigFileName} in \
|
|
189
|
+
${ConfigDirectoryPath}.\n`;
|
|
190
|
+
console.error(ErrorMessage, JSON.stringify(Error, null, 4));
|
|
191
|
+
process.exit(1);
|
|
192
|
+
}
|
|
193
|
+
if (await IsPackageJsonConfigNeeded(ConfigDirectoryPath, ConfigFileName)) {
|
|
194
|
+
const text = `Setting ${Code("config.electron-reactive-event-cli")} \
|
|
195
|
+
in your project's ${Code("package.json")}...`;
|
|
196
|
+
const OraWriteConfigProperty = ora({ text }).start();
|
|
197
|
+
const ConfigPart = {
|
|
198
|
+
"electron-reactive-event-cli": ConfigPath
|
|
199
|
+
};
|
|
200
|
+
const PackageJson = await GetPackageJson();
|
|
201
|
+
const HasConfigProperty = ("config" in PackageJson &&
|
|
202
|
+
typeof PackageJson.config === "object" &&
|
|
203
|
+
PackageJson.config !== null);
|
|
204
|
+
if (!HasConfigProperty) {
|
|
205
|
+
PackageJson.config = ConfigPart;
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
PackageJson.config =
|
|
209
|
+
{
|
|
210
|
+
...PackageJson.config,
|
|
211
|
+
...ConfigPart
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
const { Error: UpdatePackageJsonError } = await Try(SetPackageJson(PackageJson));
|
|
215
|
+
if (UpdatePackageJsonError !== undefined) {
|
|
216
|
+
OraWriteConfigProperty.fail();
|
|
217
|
+
const ErrorMessage = `Failed to write the updated ${Code("package.json")}.\n`;
|
|
218
|
+
console.error(ErrorMessage, JSON.stringify(UpdatePackageJsonError, null, 4));
|
|
219
|
+
process.exit(1);
|
|
220
|
+
}
|
|
221
|
+
OraWriteConfigProperty.succeed();
|
|
222
|
+
console.log(`Your project has been configured to support the ${Code("register")} command \
|
|
223
|
+
provided by ${Code("electron-reactive-event-cli")}.\n`);
|
|
224
|
+
const ShouldRunRegister = await confirm({
|
|
225
|
+
default: true,
|
|
226
|
+
message: `Run the ${Code("register")} command?`
|
|
227
|
+
});
|
|
228
|
+
if (ShouldRunRegister) {
|
|
229
|
+
await Register();
|
|
230
|
+
}
|
|
231
|
+
console.log("🥳 " + Chalk.greenBright(`Completed ${Code("setup")} successfully!`));
|
|
232
|
+
process.exit(0);
|
|
233
|
+
}
|
|
234
|
+
console.log(`The module was successfully created at ${Code(BuiltModulePath)}.`);
|
|
235
|
+
}
|
|
236
|
+
async function SetupNoInteractive() {
|
|
237
|
+
await WriteCliConfig(DefaultConfigFileName, GetEmptyCliConfig());
|
|
238
|
+
}
|
|
239
|
+
async function Setup() {
|
|
240
|
+
const { interactive: IsInteractive } = this.opts();
|
|
241
|
+
if (IsInteractive) {
|
|
242
|
+
await SetupInteractive.call(this);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
await SetupNoInteractive.call(this);
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
async function Main() {
|
|
251
|
+
const SetupCommand = new Command("setup")
|
|
252
|
+
/* eslint-disable-next-line @stylistic/max-len */
|
|
253
|
+
.description("Create the config file needed to register your event declarations automatically in your project's build step.")
|
|
254
|
+
.option("--no-interactive", "Write an empty settings file to the root of your package.", true)
|
|
255
|
+
.action(Setup);
|
|
256
|
+
await RunCommand(SetupCommand);
|
|
257
|
+
}
|
|
258
|
+
Main();
|
|
259
|
+
//# sourceMappingURL=SetupCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetupCommand.js","sourceRoot":"","sources":["../../Source/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,CAAC,OAAO,CAAC;QAC9C,iDAAiD;SAChD,WAAW,CAAC,+GAA+G,CAAC;SAC5H,MAAM,CAAC,kBAAkB,EAAE,2DAA2D,EAAE,IAAI,CAAC;SAC7F,MAAM,CAAC,KAAK,CAAC,CAAC;IAEnB,MAAM,UAAU,CAAC,YAAY,CAAC,CAAC;AACnC,CAAC;AAED,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IPackageJson } from "package-json-type";
|
|
2
|
+
import type { TDeepWriteable } from "@sorrell/utilities";
|
|
3
|
+
import type TypeScript from "typescript";
|
|
4
|
+
export type FReadConfigFileResult = ReturnType<typeof TypeScript.readConfigFile>;
|
|
5
|
+
export type FRegistrarBaseMatch = Readonly<{
|
|
6
|
+
Name: string;
|
|
7
|
+
Path: string;
|
|
8
|
+
}>;
|
|
9
|
+
export type FPackageJson = TDeepWriteable<IPackageJson>;
|
|
10
|
+
//# sourceMappingURL=TsConfig.Types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TsConfig.Types.d.ts","sourceRoot":"","sources":["../../Source/Setup/TsConfig.Types.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AAEzC,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,cAAc,CAAC,CAAC;AAEjF,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TsConfig.Types.js","sourceRoot":"","sources":["../../Source/Setup/TsConfig.Types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|