reciple 10.0.1-dev.6 → 10.0.1-dev.7
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/dist/bin/commands/create.mjs +2 -2
- package/dist/bin/commands/create.mjs.map +1 -1
- package/dist/classes/cli/CLI.mjs +1 -1
- package/dist/classes/templates/TemplateBuilder.d.mts +2 -2
- package/dist/classes/templates/TemplateBuilder.mjs +80 -80
- package/dist/classes/templates/TemplateBuilder.mjs.map +1 -1
- package/dist/classes/validation/BaseModuleValidator.d.mts +11 -11
- package/dist/classes/validation/CommandModuleValidator.d.mts +18 -18
- package/dist/classes/validation/EventModuleValidator.d.mts +9 -9
- package/dist/classes/validation/PostconditionModule.d.mts +9 -9
- package/dist/classes/validation/PreconditionModule.d.mts +7 -7
- package/dist/package.mjs +3 -3
- package/dist/package.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -30,10 +30,10 @@ var CreateSubcommand = class extends CLISubcommand {
|
|
|
30
30
|
await template.createDirectory();
|
|
31
31
|
await template.setupLanguage();
|
|
32
32
|
await template.createConfig();
|
|
33
|
+
await template.createEnvFile({ envFile: this.cli.flags.env[0] });
|
|
34
|
+
await template.createTemplate();
|
|
33
35
|
await template.setPackageManager();
|
|
34
36
|
await template.installDependencies({ value: flags?.install });
|
|
35
|
-
await template.createTemplate();
|
|
36
|
-
await template.createEnvFile({ envFile: this.cli.flags.env[0] });
|
|
37
37
|
await template.build({ skipBuild: !flags?.build });
|
|
38
38
|
} catch (error) {
|
|
39
39
|
cancel(colors.red(error instanceof NotAnError ? error.message : inspect(error)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.mjs","names":[],"sources":["../../../src/bin/commands/create.ts"],"sourcesContent":["import { Command, Option } from 'commander';\nimport { CLISubcommand } from '../../classes/cli/CLISubcommand.js';\nimport { colors } from '@reciple/utils';\nimport { TemplateBuilder } from '../../classes/templates/TemplateBuilder.js';\nimport { cancel } from '@clack/prompts';\nimport { inspect } from 'node:util';\nimport { NotAnError } from '../../classes/NotAnError.js';\nimport type { PackageManagerName } from 'nypm';\n\nexport default class CreateSubcommand extends CLISubcommand {\n public subcommand: Command = new Command('create')\n .description('Create a new reciple project')\n .argument('[output]', 'The directory to create the project in')\n .option('-c, --config <path>', 'Path to the configuration file')\n .option('-t, --token <DiscordToken>', 'Set your Discord Bot token')\n .option('-T, --typescript', 'Use TypeScript')\n .addOption(new Option('-p, --package-manager <name>', 'The name of the package manager to use')\n .choices(['npm', 'yarn', 'pnpm', 'bun', 'deno'])\n )\n .option('-D, --default', 'Use defaults for prompts')\n .option('--install', 'Install dependencies during setup', true)\n .option('--build', 'Build the project after creation', true)\n .allowUnknownOption(true);\n\n public async execute(): Promise<void> {\n const flags = this.cli.getFlags<CreateSubcommand.Flags>('create');\n const template = new TemplateBuilder({\n cli: this.cli,\n directory: this.subcommand.args[0],\n typescript: flags?.typescript,\n packageManager: flags?.packageManager,\n defaultAll: flags?.default,\n token: flags?.token,\n });\n\n try {\n await template.init();\n await template.createDirectory();\n await template.setupLanguage();\n await template.createConfig();\n await template.
|
|
1
|
+
{"version":3,"file":"create.mjs","names":[],"sources":["../../../src/bin/commands/create.ts"],"sourcesContent":["import { Command, Option } from 'commander';\nimport { CLISubcommand } from '../../classes/cli/CLISubcommand.js';\nimport { colors } from '@reciple/utils';\nimport { TemplateBuilder } from '../../classes/templates/TemplateBuilder.js';\nimport { cancel } from '@clack/prompts';\nimport { inspect } from 'node:util';\nimport { NotAnError } from '../../classes/NotAnError.js';\nimport type { PackageManagerName } from 'nypm';\n\nexport default class CreateSubcommand extends CLISubcommand {\n public subcommand: Command = new Command('create')\n .description('Create a new reciple project')\n .argument('[output]', 'The directory to create the project in')\n .option('-c, --config <path>', 'Path to the configuration file')\n .option('-t, --token <DiscordToken>', 'Set your Discord Bot token')\n .option('-T, --typescript', 'Use TypeScript')\n .addOption(new Option('-p, --package-manager <name>', 'The name of the package manager to use')\n .choices(['npm', 'yarn', 'pnpm', 'bun', 'deno'])\n )\n .option('-D, --default', 'Use defaults for prompts')\n .option('--install', 'Install dependencies during setup', true)\n .option('--build', 'Build the project after creation', true)\n .allowUnknownOption(true);\n\n public async execute(): Promise<void> {\n const flags = this.cli.getFlags<CreateSubcommand.Flags>('create');\n const template = new TemplateBuilder({\n cli: this.cli,\n directory: this.subcommand.args[0],\n typescript: flags?.typescript,\n packageManager: flags?.packageManager,\n defaultAll: flags?.default,\n token: flags?.token,\n });\n\n try {\n await template.init();\n await template.createDirectory();\n await template.setupLanguage();\n await template.createConfig();\n await template.createEnvFile({ envFile: this.cli.flags.env[0] });\n await template.createTemplate();\n await template.setPackageManager();\n await template.installDependencies({ value: flags?.install });\n await template.build({ skipBuild: !flags?.build });\n } catch (error) {\n cancel(colors.red(error instanceof NotAnError ? error.message : inspect(error)));\n }\n }\n}\n\nexport namespace CreateSubcommand {\n export interface Flags {\n config?: string;\n token?: string;\n default?: boolean;\n typescript?: boolean;\n packageManager?: PackageManagerName;\n install: boolean;\n build: boolean;\n }\n}\n"],"mappings":";;;;;;;;;AASA,IAAqB,mBAArB,cAA8C,cAAc;CACxD,AAAO,aAAsB,IAAI,QAAQ,SAAS,CAC7C,YAAY,+BAA+B,CAC3C,SAAS,YAAY,yCAAyC,CAC9D,OAAO,uBAAuB,iCAAiC,CAC/D,OAAO,8BAA8B,6BAA6B,CAClE,OAAO,oBAAoB,iBAAiB,CAC5C,UAAU,IAAI,OAAO,gCAAgC,yCAAyC,CAC1F,QAAQ;EAAC;EAAO;EAAQ;EAAQ;EAAO;EAAO,CAAC,CACnD,CACA,OAAO,iBAAiB,2BAA2B,CACnD,OAAO,aAAa,qCAAqC,KAAK,CAC9D,OAAO,WAAW,oCAAoC,KAAK,CAC3D,mBAAmB,KAAK;CAE7B,MAAa,UAAyB;EAClC,MAAM,QAAQ,KAAK,IAAI,SAAiC,SAAS;EACjE,MAAM,WAAW,IAAI,gBAAgB;GACjC,KAAK,KAAK;GACV,WAAW,KAAK,WAAW,KAAK;GAChC,YAAY,OAAO;GACnB,gBAAgB,OAAO;GACvB,YAAY,OAAO;GACnB,OAAO,OAAO;GACjB,CAAC;AAEF,MAAI;AACA,SAAM,SAAS,MAAM;AACrB,SAAM,SAAS,iBAAiB;AAChC,SAAM,SAAS,eAAe;AAC9B,SAAM,SAAS,cAAc;AAC7B,SAAM,SAAS,cAAc,EAAE,SAAS,KAAK,IAAI,MAAM,IAAI,IAAI,CAAC;AAChE,SAAM,SAAS,gBAAgB;AAC/B,SAAM,SAAS,mBAAmB;AAClC,SAAM,SAAS,oBAAoB,EAAE,OAAO,OAAO,SAAS,CAAC;AAC7D,SAAM,SAAS,MAAM,EAAE,WAAW,CAAC,OAAO,OAAO,CAAC;WAC7C,OAAO;AACZ,UAAO,OAAO,IAAI,iBAAiB,aAAa,MAAM,UAAU,QAAQ,MAAM,CAAC,CAAC"}
|
package/dist/classes/cli/CLI.mjs
CHANGED
|
@@ -86,7 +86,7 @@ var CLI = class {
|
|
|
86
86
|
(function(_CLI) {
|
|
87
87
|
_CLI.root = path.join(path.dirname(fileURLToPath(import.meta.url)), "../../../");
|
|
88
88
|
_CLI.bin = path.join(CLI.root, "dist/bin/reciple.js");
|
|
89
|
-
_CLI.version = "10.0.1-dev.
|
|
89
|
+
_CLI.version = "10.0.1-dev.7";
|
|
90
90
|
function stringifyFlags(flags, command, ignored = []) {
|
|
91
91
|
let arr = [];
|
|
92
92
|
for (const [key, value] of Object.entries(flags)) {
|
|
@@ -22,12 +22,12 @@ declare class TemplateBuilder {
|
|
|
22
22
|
init(): Promise<this>;
|
|
23
23
|
createDirectory(options?: TemplateBuilder.CreateDirectoryOptions): Promise<this>;
|
|
24
24
|
setupLanguage(options?: TemplateBuilder.SetupLanguageOptions): Promise<this>;
|
|
25
|
+
createEnvFile(options?: TemplateBuilder.CreateEnvFileOptions): Promise<this>;
|
|
25
26
|
createConfig(options?: TemplateBuilder.CreateConfigOptions): Promise<this>;
|
|
26
27
|
createTemplate(options?: TemplateBuilder.CreateModulesOptions): Promise<this>;
|
|
28
|
+
setPackageManager(options?: TemplateBuilder.SetPackageManagerOptions): Promise<this>;
|
|
27
29
|
installDependencies(options?: TemplateBuilder.InstallDependenciesOptions): Promise<this>;
|
|
28
30
|
createModules(): Promise<this>;
|
|
29
|
-
setPackageManager(options?: TemplateBuilder.SetPackageManagerOptions): Promise<this>;
|
|
30
|
-
createEnvFile(options?: TemplateBuilder.CreateEnvFileOptions): Promise<this>;
|
|
31
31
|
build(options?: TemplateBuilder.BuildOptions): Promise<this>;
|
|
32
32
|
}
|
|
33
33
|
declare namespace TemplateBuilder {
|
|
@@ -99,6 +99,35 @@ var TemplateBuilder = class TemplateBuilder {
|
|
|
99
99
|
}
|
|
100
100
|
return this;
|
|
101
101
|
}
|
|
102
|
+
async createEnvFile(options) {
|
|
103
|
+
const tokenKey = options?.tokenKey ?? "DISCORD_TOKEN";
|
|
104
|
+
const envFile = options?.envFile ? path.resolve(options.envFile) : path.join(this.directory, ".env");
|
|
105
|
+
const stats = await stat(envFile).catch(() => void 0);
|
|
106
|
+
let env = options?.env ?? {};
|
|
107
|
+
env = stats ? parse(await readFile(envFile, "utf-8"), { processEnv: env }) : env;
|
|
108
|
+
if (env[tokenKey]) {
|
|
109
|
+
const skip = this.defaultAll || await confirm({
|
|
110
|
+
message: "Discord bot token already exists in .env file, do you want to skip?",
|
|
111
|
+
initialValue: true,
|
|
112
|
+
active: "Yes",
|
|
113
|
+
inactive: "No"
|
|
114
|
+
});
|
|
115
|
+
if (isCancel(skip)) throw new NotAnError("Operation cancelled");
|
|
116
|
+
if (skip) return this;
|
|
117
|
+
}
|
|
118
|
+
const token = await text({
|
|
119
|
+
message: "Enter Discord Bot Token",
|
|
120
|
+
placeholder: "Bot Token from Discord Developer Portal",
|
|
121
|
+
defaultValue: env[tokenKey]
|
|
122
|
+
});
|
|
123
|
+
if (isCancel(token)) throw new NotAnError("Operation cancelled");
|
|
124
|
+
env[tokenKey] = token;
|
|
125
|
+
await writeFile(envFile, `\n${tokenKey}="${token}"\n`, {
|
|
126
|
+
encoding: "utf-8",
|
|
127
|
+
flag: "a"
|
|
128
|
+
});
|
|
129
|
+
return this;
|
|
130
|
+
}
|
|
102
131
|
async createConfig(options) {
|
|
103
132
|
let filepath = options?.filepath;
|
|
104
133
|
if (!filepath) filepath = await ConfigReader.findConfig(this.directory, this.typescript ? "ts" : this.typescript === false ? "js" : void 0) ?? path.join(this.directory, ConfigReader.createConfigFilename(this.typescript ? "ts" : "js"));
|
|
@@ -154,6 +183,57 @@ var TemplateBuilder = class TemplateBuilder {
|
|
|
154
183
|
await template;
|
|
155
184
|
return this;
|
|
156
185
|
}
|
|
186
|
+
async setPackageManager(options) {
|
|
187
|
+
this.packageManager = options?.packageManager ?? this.packageManager;
|
|
188
|
+
if (!this.packageManager) {
|
|
189
|
+
const defaultPackageManager = await detectPackageManager(this.directory).then((pm) => pm?.name ?? "npm");
|
|
190
|
+
const packageManager = this.defaultAll ? defaultPackageManager : await select({
|
|
191
|
+
message: "Select package manager",
|
|
192
|
+
options: [{
|
|
193
|
+
value: defaultPackageManager,
|
|
194
|
+
label: defaultPackageManager
|
|
195
|
+
}, ...[
|
|
196
|
+
{
|
|
197
|
+
value: "npm",
|
|
198
|
+
label: "npm"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
value: "yarn",
|
|
202
|
+
label: "yarn"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
value: "pnpm",
|
|
206
|
+
label: "pnpm"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
value: "bun",
|
|
210
|
+
label: "bun"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
value: "deno",
|
|
214
|
+
label: "deno"
|
|
215
|
+
}
|
|
216
|
+
].filter((o) => o.value !== defaultPackageManager)],
|
|
217
|
+
initialValue: defaultPackageManager
|
|
218
|
+
});
|
|
219
|
+
if (isCancel(packageManager)) throw new NotAnError("Operation cancelled");
|
|
220
|
+
this.packageManager = packageManager;
|
|
221
|
+
}
|
|
222
|
+
this.packageJson = await PackageJsonBuilder.read(this.packageJsonPath, true);
|
|
223
|
+
this.packageJson.merge({
|
|
224
|
+
name: this.name,
|
|
225
|
+
version: "0.0.1",
|
|
226
|
+
type: "module",
|
|
227
|
+
scripts: {
|
|
228
|
+
build: `reciple build`,
|
|
229
|
+
start: "reciple start",
|
|
230
|
+
dev: "nodemon"
|
|
231
|
+
},
|
|
232
|
+
...TemplateBuilder.createDependencyRecord(this.typescript ? "ts" : "js"),
|
|
233
|
+
private: true
|
|
234
|
+
});
|
|
235
|
+
return this;
|
|
236
|
+
}
|
|
157
237
|
async installDependencies(options) {
|
|
158
238
|
if (options?.value !== false) {
|
|
159
239
|
if (options?.value === void 0) {
|
|
@@ -214,86 +294,6 @@ var TemplateBuilder = class TemplateBuilder {
|
|
|
214
294
|
await template;
|
|
215
295
|
return this;
|
|
216
296
|
}
|
|
217
|
-
async setPackageManager(options) {
|
|
218
|
-
this.packageManager = options?.packageManager ?? this.packageManager;
|
|
219
|
-
if (!this.packageManager) {
|
|
220
|
-
const defaultPackageManager = await detectPackageManager(this.directory).then((pm) => pm?.name ?? "npm");
|
|
221
|
-
const packageManager = this.defaultAll ? defaultPackageManager : await select({
|
|
222
|
-
message: "Select package manager",
|
|
223
|
-
options: [{
|
|
224
|
-
value: defaultPackageManager,
|
|
225
|
-
label: defaultPackageManager
|
|
226
|
-
}, ...[
|
|
227
|
-
{
|
|
228
|
-
value: "npm",
|
|
229
|
-
label: "npm"
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
value: "yarn",
|
|
233
|
-
label: "yarn"
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
value: "pnpm",
|
|
237
|
-
label: "pnpm"
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
value: "bun",
|
|
241
|
-
label: "bun"
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
value: "deno",
|
|
245
|
-
label: "deno"
|
|
246
|
-
}
|
|
247
|
-
].filter((o) => o.value !== defaultPackageManager)],
|
|
248
|
-
initialValue: defaultPackageManager
|
|
249
|
-
});
|
|
250
|
-
if (isCancel(packageManager)) throw new NotAnError("Operation cancelled");
|
|
251
|
-
this.packageManager = packageManager;
|
|
252
|
-
}
|
|
253
|
-
this.packageJson = await PackageJsonBuilder.read(this.packageJsonPath);
|
|
254
|
-
this.packageJson.merge({
|
|
255
|
-
name: this.name,
|
|
256
|
-
version: "0.0.1",
|
|
257
|
-
type: "module",
|
|
258
|
-
scripts: {
|
|
259
|
-
build: `reciple build`,
|
|
260
|
-
start: "reciple start",
|
|
261
|
-
dev: "nodemon"
|
|
262
|
-
},
|
|
263
|
-
...TemplateBuilder.createDependencyRecord(this.typescript ? "ts" : "js"),
|
|
264
|
-
private: true
|
|
265
|
-
});
|
|
266
|
-
return this;
|
|
267
|
-
}
|
|
268
|
-
async createEnvFile(options) {
|
|
269
|
-
const tokenKey = options?.tokenKey ?? "DISCORD_TOKEN";
|
|
270
|
-
const envFile = options?.envFile ? path.resolve(options.envFile) : path.join(this.directory, ".env");
|
|
271
|
-
const stats = await stat(envFile).catch(() => void 0);
|
|
272
|
-
let env = options?.env ?? {};
|
|
273
|
-
env = stats ? parse(await readFile(envFile, "utf-8"), { processEnv: env }) : env;
|
|
274
|
-
if (env[tokenKey]) {
|
|
275
|
-
const skip = this.defaultAll || await confirm({
|
|
276
|
-
message: "Discord bot token already exists in .env file, do you want to skip?",
|
|
277
|
-
initialValue: true,
|
|
278
|
-
active: "Yes",
|
|
279
|
-
inactive: "No"
|
|
280
|
-
});
|
|
281
|
-
if (isCancel(skip)) throw new NotAnError("Operation cancelled");
|
|
282
|
-
if (skip) return this;
|
|
283
|
-
}
|
|
284
|
-
const token = await text({
|
|
285
|
-
message: "Enter Discord Bot Token",
|
|
286
|
-
placeholder: "Bot Token from Discord Developer Portal",
|
|
287
|
-
defaultValue: env[tokenKey]
|
|
288
|
-
});
|
|
289
|
-
if (isCancel(token)) throw new NotAnError("Operation cancelled");
|
|
290
|
-
env[tokenKey] = token;
|
|
291
|
-
await writeFile(envFile, `\n${tokenKey}="${token}"\n`, {
|
|
292
|
-
encoding: "utf-8",
|
|
293
|
-
flag: "a"
|
|
294
|
-
});
|
|
295
|
-
return this;
|
|
296
|
-
}
|
|
297
297
|
async build(options) {
|
|
298
298
|
await this.packageJson?.write(this.packageJsonPath, true);
|
|
299
299
|
if (!options?.skipBuild) await CLI.createSpinnerPromise({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateBuilder.mjs","names":["dir","moduleOptions: ModuleTemplateBuilder.Options","packageManager: PackageManagerName|symbol","parseDotenv","dependencies: Record<'ts'|'js'|'both', Partial<Record<'dependencies'|'devDependencies', Record<string, string>>>>","data: CopyMetadata","data"],"sources":["../../../src/classes/templates/TemplateBuilder.ts"],"sourcesContent":["import { colors, PackageJsonBuilder } from '@reciple/utils';\nimport { ConfigReader } from '../cli/ConfigReader.js';\nimport { copyFile, mkdir, readdir, readFile, stat, writeFile } from 'node:fs/promises';\nimport { confirm, intro, isCancel, outro, select, text, log } from '@clack/prompts';\nimport micromatch from 'micromatch';\nimport { CLI } from '../cli/CLI.js';\nimport path from 'node:path';\nimport { existsSync, statSync } from 'node:fs';\nimport { NotAnError } from '../NotAnError.js';\nimport { slug } from 'github-slugger';\nimport { packageJSON } from '../../helpers/constants.js';\nimport { parse as parseDotenv } from '@dotenvx/dotenvx';\nimport { ModuleTemplateBuilder } from './ModuleTemplateBuilder.js';\nimport { detectPackageManager, installDependencies, installDependenciesCommand, runScript, runScriptCommand, type PackageManagerName } from 'nypm';\n\nexport class TemplateBuilder {\n private _directory?: string;\n\n public cli: CLI;\n public typescript?: boolean;\n public token?: string;\n public defaultAll: boolean;\n\n public config?: ConfigReader;\n public packageJson?: PackageJsonBuilder;\n\n public packageManager?: PackageManagerName;\n public dependenciesInstalled: boolean = false;\n\n get directory() {\n return this._directory ?? process.cwd();\n }\n\n get relativeDirectory() {\n return path.relative(process.cwd(), this.directory) || './';\n }\n\n get packageJsonPath() {\n return path.join(this.directory, 'package.json');\n }\n\n get name() {\n return slug(path.basename(this.directory));\n }\n\n constructor(options: TemplateBuilder.Options) {\n this.cli = options.cli;\n this._directory = options.directory;\n this.typescript = options.typescript;\n this.defaultAll = options.defaultAll ?? false;\n this.packageManager = options.packageManager;\n this.token = options.token;\n }\n\n public async init(): Promise<this> {\n intro(colors.bold(colors.black(colors.bgCyan(` ${this.cli.command.name()} create - v${this.cli.build} `))));\n return this;\n }\n\n public async createDirectory(options?: TemplateBuilder.CreateDirectoryOptions): Promise<this> {\n this._directory = options?.directory ?? this._directory;\n\n if (!this._directory) {\n const dir = this.defaultAll\n ? process.cwd()\n : await text({\n message: `Enter project directory`,\n placeholder: `Leave empty to use current directory`,\n defaultValue: process.cwd(),\n validate: value => {\n const dir = path.resolve(value);\n if (existsSync(dir) && !statSync(dir).isDirectory()) return 'Invalid folder directory';\n }\n });\n\n if (isCancel(dir)) throw new NotAnError('Operation cancelled');\n this._directory = dir;\n }\n\n this._directory = path.resolve(this._directory);\n\n const stats = await stat(this.directory).catch(() => undefined);\n\n if (stats) {\n let files = await readdir(this.directory);\n files = micromatch.not(files, options?.ignoredFiles ?? TemplateBuilder.ignoredDirectoryFiles, { dot: true });\n\n if (files.length) {\n switch (options?.onNotEmpty) {\n case 'throw':\n throw new NotAnError(`Directory ${colors.cyan(this.relativeDirectory)} is not empty`);\n case 'ignore':\n return this;\n default:\n const overwrite = this.defaultAll\n ? false\n : await confirm({\n message: `Directory ${colors.cyan(this.relativeDirectory)} is not empty. Would you like to continue?`,\n active: 'Yes',\n inactive: 'No',\n initialValue: false\n });\n\n if (!overwrite) throw new NotAnError(`Directory ${colors.cyan(this.relativeDirectory)} is not empty`);\n if (isCancel(overwrite)) throw new NotAnError('Operation cancelled');\n break;\n }\n }\n }\n\n await mkdir(this.directory, { recursive: true });\n return this;\n }\n\n public async setupLanguage(options?: TemplateBuilder.SetupLanguageOptions): Promise<this> {\n this.typescript = options?.typescript ?? this.typescript;\n\n if (!this.typescript) {\n const isTypeScript = this.defaultAll\n ? false\n : await confirm({\n message: 'Would you like to use TypeScript?',\n active: 'Yes',\n inactive: 'No',\n initialValue: false\n });\n\n if (isCancel(isTypeScript)) throw new NotAnError('Operation cancelled');\n this.typescript = isTypeScript;\n }\n\n return this;\n }\n\n public async createConfig(options?: TemplateBuilder.CreateConfigOptions): Promise<this> {\n let filepath = options?.filepath;\n\n if (!filepath) {\n filepath = await ConfigReader.findConfig(\n this.directory,\n this.typescript\n ? 'ts'\n : this.typescript === false\n ? 'js'\n : undefined\n )\n ?? path.join(\n this.directory,\n ConfigReader.createConfigFilename(this.typescript ? 'ts' : 'js')\n );\n }\n\n const exists = await ConfigReader.hasFile(filepath);\n\n if (exists) {\n const overwrite = this.defaultAll\n ? false\n : await confirm({\n message: `Config file already exists at ${colors.green(path.relative(process.cwd(), filepath))}. Would you like to overwrite it?`,\n active: 'Yes',\n inactive: 'No',\n initialValue: false\n });\n\n if (!overwrite) return this;\n if (isCancel(overwrite)) throw new NotAnError('Operation cancelled');\n }\n\n this.config = await ConfigReader.create({\n ...options,\n filepath,\n type: this.typescript ? 'ts' : 'js',\n overwrite: true\n });\n\n return this;\n }\n\n public async createTemplate(options?: TemplateBuilder.CreateModulesOptions): Promise<this> {\n const source = path.join(CLI.root, './assets/templates/', this.typescript ? 'typescript' : 'javascript');\n const globals = path.join(CLI.root, './assets/global/');\n\n function rename(data: TemplateBuilder.CopyMetadata) {\n switch (data.basename) {\n case 'gitignore':\n return '.gitignore';\n default:\n return options?.rename?.(data) ?? data.basename;\n }\n }\n\n function overwrite(data: TemplateBuilder.CopyMetadata) {\n switch (data.basename) {\n case 'gitignore':\n return false;\n case 'tsconfig.json':\n case 'jsconfig.json':\n return true;\n default:\n return (typeof options?.overwrite === 'boolean' ? options.overwrite : options?.overwrite?.(data)) ?? true;\n }\n }\n\n const [template, loader] = CLI.createSpinnerPromise({\n promise: Promise.all([\n TemplateBuilder.copy(source, this.directory, { ...options, rename, overwrite }),\n TemplateBuilder.copy(globals, this.directory, { ...options, rename, overwrite })\n ]),\n message: 'Copying template files',\n successMessage: 'Files copied successfully',\n errorMessage: 'Failed to copy files'\n });\n\n await template;\n return this;\n }\n\n public async installDependencies(options?: TemplateBuilder.InstallDependenciesOptions): Promise<this> {\n if (options?.value !== false) {\n if (options?.value === undefined) {\n const install = this.defaultAll\n ? true\n : await confirm({\n message: `Would you like to install dependencies?`,\n active: 'Yes',\n inactive: 'No',\n initialValue: true\n });\n\n if (isCancel(install)) throw new NotAnError('Operation cancelled');\n if (!install) return this;\n }\n\n await CLI.createSpinnerPromise({\n promise: installDependencies({\n cwd: this.directory,\n packageManager: this.packageManager,\n silent: true\n }),\n indicator: 'timer',\n errorMessage: `${colors.bold(colors.red('✗'))} Failed to install dependencies`,\n successMessage: `${colors.bold(colors.green('✔'))} Dependencies installed successfully`,\n message: `${colors.bold(colors.dim('$'))} Installing dependencies`\n })[0];\n\n this.dependenciesInstalled = true;\n }\n\n return this;\n }\n\n public async createModules(): Promise<this> {\n const modulesDirectory = path.join(this.directory, 'src');\n const moduleTemplates = await ModuleTemplateBuilder.resolveModuleTemplates(this.typescript ? 'ts' : 'js');\n\n await mkdir(modulesDirectory, { recursive: true });\n\n if (!this.dependenciesInstalled) {\n log.warn('Dependencies not installed. Skipping module creation.');\n return this;\n }\n\n const moduleOptions: ModuleTemplateBuilder.Options = {\n cli: this.cli,\n config: await this.config?.read()!,\n defaultAll: true,\n typescript: this.typescript,\n };\n\n const [template, loader] = CLI.createSpinnerPromise({\n promise: Promise.all([\n new ModuleTemplateBuilder({\n ...moduleOptions,\n directory: path.join(modulesDirectory, 'commands'),\n filename: `SlashCommand.${this.typescript ? 'ts' : 'js'}`,\n template: moduleTemplates.find(t => t.name === 'SlashCommand')\n })\n .setupPlaceholders()\n .then(m => m.build({ silent: true })),\n new ModuleTemplateBuilder({\n ...moduleOptions,\n directory: path.join(modulesDirectory, 'events'),\n filename: `ClientEvent.${this.typescript ? 'ts' : 'js'}`,\n template: moduleTemplates.find(t => t.name === 'ClientEvent')\n })\n .setupPlaceholders()\n .then(m => m.build({ silent: true }))\n ]),\n message: 'Creating module templates',\n successMessage: 'Module templates created successfully',\n errorMessage: 'Failed to create module templates'\n });\n\n await template;\n return this;\n }\n\n public async setPackageManager(options?: TemplateBuilder.SetPackageManagerOptions) {\n this.packageManager = options?.packageManager ?? this.packageManager;\n\n if (!this.packageManager) {\n const defaultPackageManager = await detectPackageManager(this.directory).then(pm => pm?.name ?? 'npm');\n const packageManager: PackageManagerName|symbol = this.defaultAll\n ? defaultPackageManager\n : await select({\n message: 'Select package manager',\n options: [\n { value: defaultPackageManager, label: defaultPackageManager },\n ...[\n { value: 'npm', label: 'npm' },\n { value: 'yarn', label: 'yarn' },\n { value: 'pnpm', label: 'pnpm' },\n { value: 'bun', label: 'bun' },\n { value: 'deno', label: 'deno' }\n ].filter(o => o.value !== defaultPackageManager) as { value: PackageManagerName; label: string; }[]\n ],\n initialValue: defaultPackageManager\n });\n\n if (isCancel(packageManager)) throw new NotAnError('Operation cancelled');\n this.packageManager = packageManager;\n }\n\n this.packageJson = await PackageJsonBuilder.read(this.packageJsonPath);\n this.packageJson.merge({\n name: this.name,\n version: '0.0.1',\n type: 'module',\n scripts: {\n build: `reciple build`,\n start: 'reciple start',\n dev: 'nodemon',\n },\n ...TemplateBuilder.createDependencyRecord(this.typescript ? 'ts' : 'js'),\n private: true\n });\n\n return this;\n }\n\n public async createEnvFile(options?: TemplateBuilder.CreateEnvFileOptions): Promise<this> {\n const tokenKey = options?.tokenKey ?? 'DISCORD_TOKEN';\n const envFile = options?.envFile ? path.resolve(options.envFile) : path.join(this.directory, '.env');\n const stats = await stat(envFile).catch(() => undefined);\n\n let env = options?.env ?? {};\n env = stats\n ? parseDotenv(await readFile(envFile, 'utf-8'), {\n processEnv: env\n })\n : env;\n\n if (env[tokenKey]) {\n const skip = this.defaultAll || await confirm({\n message: 'Discord bot token already exists in .env file, do you want to skip?',\n initialValue: true,\n active: 'Yes',\n inactive: 'No'\n });\n\n if (isCancel(skip)) throw new NotAnError('Operation cancelled');\n if (skip) return this;\n }\n\n const token = await text({\n message: 'Enter Discord Bot Token',\n placeholder: 'Bot Token from Discord Developer Portal',\n defaultValue: env[tokenKey]\n });\n\n if (isCancel(token)) throw new NotAnError('Operation cancelled');\n env[tokenKey] = token;\n\n await writeFile(envFile, `\\n${tokenKey}=\"${token}\"\\n`, {\n encoding: 'utf-8',\n flag: 'a'\n });\n\n return this;\n }\n\n public async build(options?: TemplateBuilder.BuildOptions): Promise<this> {\n await this.packageJson?.write(this.packageJsonPath, true);\n\n if (!options?.skipBuild) await CLI.createSpinnerPromise({\n promise: runScript('build', {\n cwd: this.directory,\n packageManager: this.packageManager,\n silent: true\n }),\n indicator: 'timer',\n errorMessage: `${colors.bold(colors.red('✗'))} Failed to build project`,\n successMessage: `${colors.bold(colors.green('✔'))} Project built successfully`,\n message: `${colors.bold(colors.dim('$'))} Building project`\n })[0];\n\n outro(`Project created in ${colors.cyan(this.relativeDirectory)}`);\n\n console.log(`\\n${colors.bold(colors.green('✔'))} Start developing:`);\n\n if (this.relativeDirectory !== './') {\n console.log(` • ${colors.cyan(colors.bold(`cd ${this.relativeDirectory}`))}`);\n }\n\n console.log(` • ${colors.cyan(colors.bold(installDependenciesCommand(this.packageManager ?? 'npm')))} ${colors.dim('(Install dependencies)')}`);\n console.log(` • ${colors.cyan(colors.bold(runScriptCommand(this.packageManager ?? 'npm', 'build')))} ${colors.dim('(Build)')}`);\n console.log(` • ${colors.cyan(colors.bold(runScriptCommand(this.packageManager ?? 'npm', 'dev')))} ${colors.dim('(Development)')}`);\n console.log(` • ${colors.cyan(colors.bold(runScriptCommand(this.packageManager ?? 'npm', 'start')))} ${colors.dim('(Production)')}`);\n\n\n return this;\n }\n}\n\nexport namespace TemplateBuilder {\n export interface Options {\n cli: CLI;\n directory?: string;\n typescript?: boolean;\n packageManager?: PackageManagerName;\n defaultAll?: boolean;\n token?: string;\n }\n\n export const ignoredDirectoryFiles = ['.*', 'LICENSE'];\n\n export const dependencies: Record<'ts'|'js'|'both', Partial<Record<'dependencies'|'devDependencies', Record<string, string>>>> = {\n both: {\n dependencies: {\n '@reciple/core': packageJSON.dependencies?.['@reciple/core']!,\n '@reciple/jsx': packageJSON.dependencies?.['@reciple/jsx']!,\n 'reciple': `^${packageJSON.version}`,\n },\n devDependencies: {\n '@types/node': packageJSON.devDependencies?.['@types/node']!,\n nodemon: packageJSON.devDependencies?.nodemon!\n }\n },\n ts: {},\n js: {}\n };\n\n export function createDependencyRecord(type: 'ts'|'js'): Partial<Record<'dependencies'|'devDependencies', Record<string, string>>> {\n const record = type === 'ts'\n ? dependencies.ts\n : type === 'js'\n ? dependencies.js\n : {};\n\n record.dependencies = { ...record.dependencies, ...dependencies.both.dependencies };\n record.devDependencies = { ...record.devDependencies, ...dependencies.both.devDependencies };\n\n return record;\n }\n\n export interface CreateDirectoryOptions {\n directory?: string;\n ignoredFiles?: string[];\n onNotEmpty?: 'prompt'|'throw'|'ignore';\n }\n\n export interface SetupLanguageOptions {\n typescript?: boolean;\n }\n\n export interface CreateConfigOptions extends Partial<ConfigReader.CreateOptions> {}\n\n export interface CreateModulesOptions extends Partial<CopyOptions> {}\n\n export interface SetPackageManagerOptions {\n packageManager?: PackageManagerName;\n }\n\n export interface InstallDependenciesOptions {\n value?: boolean;\n }\n\n export interface CreateEnvFileOptions {\n envFile?: string;\n tokenKey?: string;\n env?: Record<string, string>;\n }\n\n export interface BuildOptions {\n skipBuild?: boolean;\n }\n\n export interface CopyOptions {\n overwrite?: boolean|((data: CopyMetadata) => boolean);\n filter?: (data: CopyMetadata) => boolean;\n rename?: (data: CopyMetadata) => string;\n }\n\n export interface CopyMetadata {\n basename: string;\n src: string;\n dest: string;\n }\n\n export async function copy(from: string, to: string, options?: CopyOptions): Promise<void> {\n const fromStats = await stat(from).catch(() => undefined);\n if (!fromStats) return;\n\n if (fromStats.isDirectory()) {\n const files = await readdir(from);\n\n for (const file of files) {\n const data: CopyMetadata = {\n basename: file,\n src: path.join(from, file),\n dest: to\n };\n\n await copy(\n data.src,\n path.join(to,\n options?.rename\n ? options.rename(data)\n : file\n ),\n options\n );\n }\n return;\n }\n\n const data: CopyMetadata = {\n basename: path.basename(from),\n src: from,\n dest: to\n };\n\n if (options?.filter && !options.filter(data)) return;\n\n const toStats = await stat(to).catch(() => undefined);\n const overwrite = typeof options?.overwrite === 'function'\n ? options.overwrite(data)\n : options?.overwrite ?? true;\n\n if (toStats && overwrite) return;\n\n await mkdir(path.dirname(to), { recursive: true });\n await copyFile(from, to);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,IAAa,kBAAb,MAAa,gBAAgB;CACzB,AAAQ;CAER,AAAO;CACP,AAAO;CACP,AAAO;CACP,AAAO;CAEP,AAAO;CACP,AAAO;CAEP,AAAO;CACP,AAAO,wBAAiC;CAExC,IAAI,YAAY;AACZ,SAAO,KAAK,cAAc,QAAQ,KAAK;;CAG3C,IAAI,oBAAoB;AACpB,SAAO,KAAK,SAAS,QAAQ,KAAK,EAAE,KAAK,UAAU,IAAI;;CAG3D,IAAI,kBAAkB;AAClB,SAAO,KAAK,KAAK,KAAK,WAAW,eAAe;;CAGpD,IAAI,OAAO;AACP,SAAO,KAAK,KAAK,SAAS,KAAK,UAAU,CAAC;;CAG9C,YAAY,SAAkC;AAC1C,OAAK,MAAM,QAAQ;AACnB,OAAK,aAAa,QAAQ;AAC1B,OAAK,aAAa,QAAQ;AAC1B,OAAK,aAAa,QAAQ,cAAc;AACxC,OAAK,iBAAiB,QAAQ;AAC9B,OAAK,QAAQ,QAAQ;;CAGzB,MAAa,OAAsB;AAC/B,QAAM,OAAO,KAAK,OAAO,MAAM,OAAO,OAAO,IAAI,KAAK,IAAI,QAAQ,MAAM,CAAC,aAAa,KAAK,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC;AAC3G,S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AS,cAAc,aAC1C,QAAQ,UAAU,KAAK,GACvB,SAAS,aAAa;AAE5B,MAAI,WAAW,UAAW;AAE1B,QAAM,MAAM,KAAK,QAAQ,GAAG,EAAE,EAAE,WAAW,MAAM,CAAC;AAClD,QAAM,SAAS,MAAM,GAAG"}
|
|
1
|
+
{"version":3,"file":"TemplateBuilder.mjs","names":["dir","parseDotenv","packageManager: PackageManagerName|symbol","moduleOptions: ModuleTemplateBuilder.Options","dependencies: Record<'ts'|'js'|'both', Partial<Record<'dependencies'|'devDependencies', Record<string, string>>>>","data: CopyMetadata","data"],"sources":["../../../src/classes/templates/TemplateBuilder.ts"],"sourcesContent":["import { colors, PackageJsonBuilder } from '@reciple/utils';\nimport { ConfigReader } from '../cli/ConfigReader.js';\nimport { copyFile, mkdir, readdir, readFile, stat, writeFile } from 'node:fs/promises';\nimport { confirm, intro, isCancel, outro, select, text, log } from '@clack/prompts';\nimport micromatch from 'micromatch';\nimport { CLI } from '../cli/CLI.js';\nimport path from 'node:path';\nimport { existsSync, statSync } from 'node:fs';\nimport { NotAnError } from '../NotAnError.js';\nimport { slug } from 'github-slugger';\nimport { packageJSON } from '../../helpers/constants.js';\nimport { parse as parseDotenv } from '@dotenvx/dotenvx';\nimport { ModuleTemplateBuilder } from './ModuleTemplateBuilder.js';\nimport { detectPackageManager, installDependencies, installDependenciesCommand, runScript, runScriptCommand, type PackageManagerName } from 'nypm';\n\nexport class TemplateBuilder {\n private _directory?: string;\n\n public cli: CLI;\n public typescript?: boolean;\n public token?: string;\n public defaultAll: boolean;\n\n public config?: ConfigReader;\n public packageJson?: PackageJsonBuilder;\n\n public packageManager?: PackageManagerName;\n public dependenciesInstalled: boolean = false;\n\n get directory() {\n return this._directory ?? process.cwd();\n }\n\n get relativeDirectory() {\n return path.relative(process.cwd(), this.directory) || './';\n }\n\n get packageJsonPath() {\n return path.join(this.directory, 'package.json');\n }\n\n get name() {\n return slug(path.basename(this.directory));\n }\n\n constructor(options: TemplateBuilder.Options) {\n this.cli = options.cli;\n this._directory = options.directory;\n this.typescript = options.typescript;\n this.defaultAll = options.defaultAll ?? false;\n this.packageManager = options.packageManager;\n this.token = options.token;\n }\n\n public async init(): Promise<this> {\n intro(colors.bold(colors.black(colors.bgCyan(` ${this.cli.command.name()} create - v${this.cli.build} `))));\n return this;\n }\n\n public async createDirectory(options?: TemplateBuilder.CreateDirectoryOptions): Promise<this> {\n this._directory = options?.directory ?? this._directory;\n\n if (!this._directory) {\n const dir = this.defaultAll\n ? process.cwd()\n : await text({\n message: `Enter project directory`,\n placeholder: `Leave empty to use current directory`,\n defaultValue: process.cwd(),\n validate: value => {\n const dir = path.resolve(value);\n if (existsSync(dir) && !statSync(dir).isDirectory()) return 'Invalid folder directory';\n }\n });\n\n if (isCancel(dir)) throw new NotAnError('Operation cancelled');\n this._directory = dir;\n }\n\n this._directory = path.resolve(this._directory);\n\n const stats = await stat(this.directory).catch(() => undefined);\n\n if (stats) {\n let files = await readdir(this.directory);\n files = micromatch.not(files, options?.ignoredFiles ?? TemplateBuilder.ignoredDirectoryFiles, { dot: true });\n\n if (files.length) {\n switch (options?.onNotEmpty) {\n case 'throw':\n throw new NotAnError(`Directory ${colors.cyan(this.relativeDirectory)} is not empty`);\n case 'ignore':\n return this;\n default:\n const overwrite = this.defaultAll\n ? false\n : await confirm({\n message: `Directory ${colors.cyan(this.relativeDirectory)} is not empty. Would you like to continue?`,\n active: 'Yes',\n inactive: 'No',\n initialValue: false\n });\n\n if (!overwrite) throw new NotAnError(`Directory ${colors.cyan(this.relativeDirectory)} is not empty`);\n if (isCancel(overwrite)) throw new NotAnError('Operation cancelled');\n break;\n }\n }\n }\n\n await mkdir(this.directory, { recursive: true });\n return this;\n }\n\n public async setupLanguage(options?: TemplateBuilder.SetupLanguageOptions): Promise<this> {\n this.typescript = options?.typescript ?? this.typescript;\n\n if (!this.typescript) {\n const isTypeScript = this.defaultAll\n ? false\n : await confirm({\n message: 'Would you like to use TypeScript?',\n active: 'Yes',\n inactive: 'No',\n initialValue: false\n });\n\n if (isCancel(isTypeScript)) throw new NotAnError('Operation cancelled');\n this.typescript = isTypeScript;\n }\n\n return this;\n }\n\n public async createEnvFile(options?: TemplateBuilder.CreateEnvFileOptions): Promise<this> {\n const tokenKey = options?.tokenKey ?? 'DISCORD_TOKEN';\n const envFile = options?.envFile ? path.resolve(options.envFile) : path.join(this.directory, '.env');\n const stats = await stat(envFile).catch(() => undefined);\n\n let env = options?.env ?? {};\n env = stats\n ? parseDotenv(await readFile(envFile, 'utf-8'), {\n processEnv: env\n })\n : env;\n\n if (env[tokenKey]) {\n const skip = this.defaultAll || await confirm({\n message: 'Discord bot token already exists in .env file, do you want to skip?',\n initialValue: true,\n active: 'Yes',\n inactive: 'No'\n });\n\n if (isCancel(skip)) throw new NotAnError('Operation cancelled');\n if (skip) return this;\n }\n\n const token = await text({\n message: 'Enter Discord Bot Token',\n placeholder: 'Bot Token from Discord Developer Portal',\n defaultValue: env[tokenKey]\n });\n\n if (isCancel(token)) throw new NotAnError('Operation cancelled');\n env[tokenKey] = token;\n\n await writeFile(envFile, `\\n${tokenKey}=\"${token}\"\\n`, {\n encoding: 'utf-8',\n flag: 'a'\n });\n\n return this;\n }\n\n public async createConfig(options?: TemplateBuilder.CreateConfigOptions): Promise<this> {\n let filepath = options?.filepath;\n\n if (!filepath) {\n filepath = await ConfigReader.findConfig(\n this.directory,\n this.typescript\n ? 'ts'\n : this.typescript === false\n ? 'js'\n : undefined\n )\n ?? path.join(\n this.directory,\n ConfigReader.createConfigFilename(this.typescript ? 'ts' : 'js')\n );\n }\n\n const exists = await ConfigReader.hasFile(filepath);\n\n if (exists) {\n const overwrite = this.defaultAll\n ? false\n : await confirm({\n message: `Config file already exists at ${colors.green(path.relative(process.cwd(), filepath))}. Would you like to overwrite it?`,\n active: 'Yes',\n inactive: 'No',\n initialValue: false\n });\n\n if (!overwrite) return this;\n if (isCancel(overwrite)) throw new NotAnError('Operation cancelled');\n }\n\n this.config = await ConfigReader.create({\n ...options,\n filepath,\n type: this.typescript ? 'ts' : 'js',\n overwrite: true\n });\n\n return this;\n }\n\n public async createTemplate(options?: TemplateBuilder.CreateModulesOptions): Promise<this> {\n const source = path.join(CLI.root, './assets/templates/', this.typescript ? 'typescript' : 'javascript');\n const globals = path.join(CLI.root, './assets/global/');\n\n function rename(data: TemplateBuilder.CopyMetadata) {\n switch (data.basename) {\n case 'gitignore':\n return '.gitignore';\n default:\n return options?.rename?.(data) ?? data.basename;\n }\n }\n\n function overwrite(data: TemplateBuilder.CopyMetadata) {\n switch (data.basename) {\n case 'gitignore':\n return false;\n case 'tsconfig.json':\n case 'jsconfig.json':\n return true;\n default:\n return (typeof options?.overwrite === 'boolean' ? options.overwrite : options?.overwrite?.(data)) ?? true;\n }\n }\n\n const [template, loader] = CLI.createSpinnerPromise({\n promise: Promise.all([\n TemplateBuilder.copy(source, this.directory, { ...options, rename, overwrite }),\n TemplateBuilder.copy(globals, this.directory, { ...options, rename, overwrite })\n ]),\n message: 'Copying template files',\n successMessage: 'Files copied successfully',\n errorMessage: 'Failed to copy files'\n });\n\n await template;\n return this;\n }\n\n public async setPackageManager(options?: TemplateBuilder.SetPackageManagerOptions) {\n this.packageManager = options?.packageManager ?? this.packageManager;\n\n if (!this.packageManager) {\n const defaultPackageManager = await detectPackageManager(this.directory).then(pm => pm?.name ?? 'npm');\n const packageManager: PackageManagerName|symbol = this.defaultAll\n ? defaultPackageManager\n : await select({\n message: 'Select package manager',\n options: [\n { value: defaultPackageManager, label: defaultPackageManager },\n ...[\n { value: 'npm', label: 'npm' },\n { value: 'yarn', label: 'yarn' },\n { value: 'pnpm', label: 'pnpm' },\n { value: 'bun', label: 'bun' },\n { value: 'deno', label: 'deno' }\n ].filter(o => o.value !== defaultPackageManager) as { value: PackageManagerName; label: string; }[]\n ],\n initialValue: defaultPackageManager\n });\n\n if (isCancel(packageManager)) throw new NotAnError('Operation cancelled');\n this.packageManager = packageManager;\n }\n\n this.packageJson = await PackageJsonBuilder.read(this.packageJsonPath, true);\n this.packageJson.merge({\n name: this.name,\n version: '0.0.1',\n type: 'module',\n scripts: {\n build: `reciple build`,\n start: 'reciple start',\n dev: 'nodemon',\n },\n ...TemplateBuilder.createDependencyRecord(this.typescript ? 'ts' : 'js'),\n private: true\n });\n\n return this;\n }\n\n public async installDependencies(options?: TemplateBuilder.InstallDependenciesOptions): Promise<this> {\n if (options?.value !== false) {\n if (options?.value === undefined) {\n const install = this.defaultAll\n ? true\n : await confirm({\n message: `Would you like to install dependencies?`,\n active: 'Yes',\n inactive: 'No',\n initialValue: true\n });\n\n if (isCancel(install)) throw new NotAnError('Operation cancelled');\n if (!install) return this;\n }\n\n await CLI.createSpinnerPromise({\n promise: installDependencies({\n cwd: this.directory,\n packageManager: this.packageManager,\n silent: true\n }),\n indicator: 'timer',\n errorMessage: `${colors.bold(colors.red('✗'))} Failed to install dependencies`,\n successMessage: `${colors.bold(colors.green('✔'))} Dependencies installed successfully`,\n message: `${colors.bold(colors.dim('$'))} Installing dependencies`\n })[0];\n\n this.dependenciesInstalled = true;\n }\n\n return this;\n }\n\n public async createModules(): Promise<this> {\n const modulesDirectory = path.join(this.directory, 'src');\n const moduleTemplates = await ModuleTemplateBuilder.resolveModuleTemplates(this.typescript ? 'ts' : 'js');\n\n await mkdir(modulesDirectory, { recursive: true });\n\n if (!this.dependenciesInstalled) {\n log.warn('Dependencies not installed. Skipping module creation.');\n return this;\n }\n\n const moduleOptions: ModuleTemplateBuilder.Options = {\n cli: this.cli,\n config: await this.config?.read()!,\n defaultAll: true,\n typescript: this.typescript,\n };\n\n const [template, loader] = CLI.createSpinnerPromise({\n promise: Promise.all([\n new ModuleTemplateBuilder({\n ...moduleOptions,\n directory: path.join(modulesDirectory, 'commands'),\n filename: `SlashCommand.${this.typescript ? 'ts' : 'js'}`,\n template: moduleTemplates.find(t => t.name === 'SlashCommand')\n })\n .setupPlaceholders()\n .then(m => m.build({ silent: true })),\n new ModuleTemplateBuilder({\n ...moduleOptions,\n directory: path.join(modulesDirectory, 'events'),\n filename: `ClientEvent.${this.typescript ? 'ts' : 'js'}`,\n template: moduleTemplates.find(t => t.name === 'ClientEvent')\n })\n .setupPlaceholders()\n .then(m => m.build({ silent: true }))\n ]),\n message: 'Creating module templates',\n successMessage: 'Module templates created successfully',\n errorMessage: 'Failed to create module templates'\n });\n\n await template;\n return this;\n }\n\n public async build(options?: TemplateBuilder.BuildOptions): Promise<this> {\n await this.packageJson?.write(this.packageJsonPath, true);\n\n if (!options?.skipBuild) await CLI.createSpinnerPromise({\n promise: runScript('build', {\n cwd: this.directory,\n packageManager: this.packageManager,\n silent: true\n }),\n indicator: 'timer',\n errorMessage: `${colors.bold(colors.red('✗'))} Failed to build project`,\n successMessage: `${colors.bold(colors.green('✔'))} Project built successfully`,\n message: `${colors.bold(colors.dim('$'))} Building project`\n })[0];\n\n outro(`Project created in ${colors.cyan(this.relativeDirectory)}`);\n\n console.log(`\\n${colors.bold(colors.green('✔'))} Start developing:`);\n\n if (this.relativeDirectory !== './') {\n console.log(` • ${colors.cyan(colors.bold(`cd ${this.relativeDirectory}`))}`);\n }\n\n console.log(` • ${colors.cyan(colors.bold(installDependenciesCommand(this.packageManager ?? 'npm')))} ${colors.dim('(Install dependencies)')}`);\n console.log(` • ${colors.cyan(colors.bold(runScriptCommand(this.packageManager ?? 'npm', 'build')))} ${colors.dim('(Build)')}`);\n console.log(` • ${colors.cyan(colors.bold(runScriptCommand(this.packageManager ?? 'npm', 'dev')))} ${colors.dim('(Development)')}`);\n console.log(` • ${colors.cyan(colors.bold(runScriptCommand(this.packageManager ?? 'npm', 'start')))} ${colors.dim('(Production)')}`);\n\n\n return this;\n }\n}\n\nexport namespace TemplateBuilder {\n export interface Options {\n cli: CLI;\n directory?: string;\n typescript?: boolean;\n packageManager?: PackageManagerName;\n defaultAll?: boolean;\n token?: string;\n }\n\n export const ignoredDirectoryFiles = ['.*', 'LICENSE'];\n\n export const dependencies: Record<'ts'|'js'|'both', Partial<Record<'dependencies'|'devDependencies', Record<string, string>>>> = {\n both: {\n dependencies: {\n '@reciple/core': packageJSON.dependencies?.['@reciple/core']!,\n '@reciple/jsx': packageJSON.dependencies?.['@reciple/jsx']!,\n 'reciple': `^${packageJSON.version}`,\n },\n devDependencies: {\n '@types/node': packageJSON.devDependencies?.['@types/node']!,\n nodemon: packageJSON.devDependencies?.nodemon!\n }\n },\n ts: {},\n js: {}\n };\n\n export function createDependencyRecord(type: 'ts'|'js'): Partial<Record<'dependencies'|'devDependencies', Record<string, string>>> {\n const record = type === 'ts'\n ? dependencies.ts\n : type === 'js'\n ? dependencies.js\n : {};\n\n record.dependencies = { ...record.dependencies, ...dependencies.both.dependencies };\n record.devDependencies = { ...record.devDependencies, ...dependencies.both.devDependencies };\n\n return record;\n }\n\n export interface CreateDirectoryOptions {\n directory?: string;\n ignoredFiles?: string[];\n onNotEmpty?: 'prompt'|'throw'|'ignore';\n }\n\n export interface SetupLanguageOptions {\n typescript?: boolean;\n }\n\n export interface CreateConfigOptions extends Partial<ConfigReader.CreateOptions> {}\n\n export interface CreateModulesOptions extends Partial<CopyOptions> {}\n\n export interface SetPackageManagerOptions {\n packageManager?: PackageManagerName;\n }\n\n export interface InstallDependenciesOptions {\n value?: boolean;\n }\n\n export interface CreateEnvFileOptions {\n envFile?: string;\n tokenKey?: string;\n env?: Record<string, string>;\n }\n\n export interface BuildOptions {\n skipBuild?: boolean;\n }\n\n export interface CopyOptions {\n overwrite?: boolean|((data: CopyMetadata) => boolean);\n filter?: (data: CopyMetadata) => boolean;\n rename?: (data: CopyMetadata) => string;\n }\n\n export interface CopyMetadata {\n basename: string;\n src: string;\n dest: string;\n }\n\n export async function copy(from: string, to: string, options?: CopyOptions): Promise<void> {\n const fromStats = await stat(from).catch(() => undefined);\n if (!fromStats) return;\n\n if (fromStats.isDirectory()) {\n const files = await readdir(from);\n\n for (const file of files) {\n const data: CopyMetadata = {\n basename: file,\n src: path.join(from, file),\n dest: to\n };\n\n await copy(\n data.src,\n path.join(to,\n options?.rename\n ? options.rename(data)\n : file\n ),\n options\n );\n }\n return;\n }\n\n const data: CopyMetadata = {\n basename: path.basename(from),\n src: from,\n dest: to\n };\n\n if (options?.filter && !options.filter(data)) return;\n\n const toStats = await stat(to).catch(() => undefined);\n const overwrite = typeof options?.overwrite === 'function'\n ? options.overwrite(data)\n : options?.overwrite ?? true;\n\n if (toStats && overwrite) return;\n\n await mkdir(path.dirname(to), { recursive: true });\n await copyFile(from, to);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,IAAa,kBAAb,MAAa,gBAAgB;CACzB,AAAQ;CAER,AAAO;CACP,AAAO;CACP,AAAO;CACP,AAAO;CAEP,AAAO;CACP,AAAO;CAEP,AAAO;CACP,AAAO,wBAAiC;CAExC,IAAI,YAAY;AACZ,SAAO,KAAK,cAAc,QAAQ,KAAK;;CAG3C,IAAI,oBAAoB;AACpB,SAAO,KAAK,SAAS,QAAQ,KAAK,EAAE,KAAK,UAAU,IAAI;;CAG3D,IAAI,kBAAkB;AAClB,SAAO,KAAK,KAAK,KAAK,WAAW,eAAe;;CAGpD,IAAI,OAAO;AACP,SAAO,KAAK,KAAK,SAAS,KAAK,UAAU,CAAC;;CAG9C,YAAY,SAAkC;AAC1C,OAAK,MAAM,QAAQ;AACnB,OAAK,aAAa,QAAQ;AAC1B,OAAK,aAAa,QAAQ;AAC1B,OAAK,aAAa,QAAQ,cAAc;AACxC,OAAK,iBAAiB,QAAQ;AAC9B,OAAK,QAAQ,QAAQ;;CAGzB,MAAa,OAAsB;AAC/B,QAAM,OAAO,KAAK,OAAO,MAAM,OAAO,OAAO,IAAI,KAAK,IAAI,QAAQ,MAAM,CAAC,aAAa,KAAK,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC;AAC3G,SAAO;;CAGX,MAAa,gBAAgB,SAAiE;AAC1F,OAAK,aAAa,SAAS,aAAa,KAAK;AAE7C,MAAI,CAAC,KAAK,YAAY;GAClB,MAAM,MAAM,KAAK,aACX,QAAQ,KAAK,GAC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M,CAAC;AAClD,QAAM,SAAS,MAAM,GAAG"}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { ModuleType } from "../../helpers/constants.mjs";
|
|
2
2
|
import { AnyModuleData } from "../../helpers/types.mjs";
|
|
3
3
|
import { Validator } from "@reciple/core";
|
|
4
|
-
import * as
|
|
4
|
+
import * as _sapphire_shapeshift33 from "@sapphire/shapeshift";
|
|
5
5
|
|
|
6
6
|
//#region src/classes/validation/BaseModuleValidator.d.ts
|
|
7
7
|
declare class BaseModuleValidator extends Validator {
|
|
8
|
-
static id:
|
|
9
|
-
static moduleType:
|
|
10
|
-
static onEnable:
|
|
11
|
-
static onReady:
|
|
12
|
-
static onDisable:
|
|
13
|
-
static object:
|
|
8
|
+
static id: _sapphire_shapeshift33.StringValidator<string>;
|
|
9
|
+
static moduleType: _sapphire_shapeshift33.NativeEnumValidator<typeof ModuleType>;
|
|
10
|
+
static onEnable: _sapphire_shapeshift33.UnionValidator<Function | undefined>;
|
|
11
|
+
static onReady: _sapphire_shapeshift33.UnionValidator<Function | undefined>;
|
|
12
|
+
static onDisable: _sapphire_shapeshift33.UnionValidator<Function | undefined>;
|
|
13
|
+
static object: _sapphire_shapeshift33.ObjectValidator<{
|
|
14
14
|
id: string | undefined;
|
|
15
15
|
moduleType: ModuleType | undefined;
|
|
16
16
|
onEnable: Function | undefined;
|
|
17
17
|
onReady: Function | undefined;
|
|
18
18
|
onDisable: Function | undefined;
|
|
19
|
-
},
|
|
19
|
+
}, _sapphire_shapeshift33.UndefinedToOptional<{
|
|
20
20
|
id: string | undefined;
|
|
21
21
|
moduleType: ModuleType | undefined;
|
|
22
22
|
onEnable: Function | undefined;
|
|
23
23
|
onReady: Function | undefined;
|
|
24
24
|
onDisable: Function | undefined;
|
|
25
25
|
}>>;
|
|
26
|
-
static resolvable:
|
|
27
|
-
toJSON: Function;
|
|
28
|
-
}> | _sapphire_shapeshift40.UndefinedToOptional<{
|
|
26
|
+
static resolvable: _sapphire_shapeshift33.UnionValidator<_sapphire_shapeshift33.UndefinedToOptional<{
|
|
29
27
|
id: string | undefined;
|
|
30
28
|
moduleType: ModuleType | undefined;
|
|
31
29
|
onEnable: Function | undefined;
|
|
32
30
|
onReady: Function | undefined;
|
|
33
31
|
onDisable: Function | undefined;
|
|
32
|
+
}> | _sapphire_shapeshift33.UndefinedToOptional<{
|
|
33
|
+
toJSON: Function;
|
|
34
34
|
}>>;
|
|
35
35
|
static isValidId(id: unknown): asserts id is string;
|
|
36
36
|
static isValidModuleType(moduleType: unknown): asserts moduleType is ModuleType;
|
|
@@ -3,11 +3,11 @@ import { AnyCommandModuleData } from "../../helpers/types.mjs";
|
|
|
3
3
|
import "../../index.mjs";
|
|
4
4
|
import * as _reciple_core0 from "@reciple/core";
|
|
5
5
|
import { Validator } from "@reciple/core";
|
|
6
|
-
import * as
|
|
6
|
+
import * as _sapphire_shapeshift0 from "@sapphire/shapeshift";
|
|
7
7
|
|
|
8
8
|
//#region src/classes/validation/CommandModuleValidator.d.ts
|
|
9
9
|
declare class CommandModuleValidator extends Validator {
|
|
10
|
-
static object:
|
|
10
|
+
static object: _sapphire_shapeshift0.ObjectValidator<{
|
|
11
11
|
id: string | undefined;
|
|
12
12
|
moduleType: ModuleType | undefined;
|
|
13
13
|
onEnable: Function | undefined;
|
|
@@ -16,23 +16,23 @@ declare class CommandModuleValidator extends Validator {
|
|
|
16
16
|
} & {
|
|
17
17
|
id: string;
|
|
18
18
|
type: _reciple_core0.CommandType;
|
|
19
|
-
data:
|
|
19
|
+
data: _sapphire_shapeshift0.UndefinedToOptional<{
|
|
20
20
|
name: any;
|
|
21
21
|
description: any;
|
|
22
22
|
aliases: any;
|
|
23
23
|
options: any;
|
|
24
24
|
flags: any;
|
|
25
|
-
}> |
|
|
25
|
+
}> | _sapphire_shapeshift0.UndefinedToOptional<{
|
|
26
26
|
type: any;
|
|
27
27
|
name: any;
|
|
28
28
|
}>;
|
|
29
29
|
cooldown: number | undefined;
|
|
30
|
-
preconditions:
|
|
30
|
+
preconditions: _sapphire_shapeshift0.UndefinedToOptional<{
|
|
31
31
|
id: any;
|
|
32
32
|
scope: any;
|
|
33
33
|
execute: any;
|
|
34
34
|
}>[] | undefined;
|
|
35
|
-
postconditions:
|
|
35
|
+
postconditions: _sapphire_shapeshift0.UndefinedToOptional<{
|
|
36
36
|
id: any;
|
|
37
37
|
scope: any;
|
|
38
38
|
execute: any;
|
|
@@ -40,7 +40,7 @@ declare class CommandModuleValidator extends Validator {
|
|
|
40
40
|
disabledPreconditions: string[] | undefined;
|
|
41
41
|
disabledPostconditions: string[] | undefined;
|
|
42
42
|
execute: Function;
|
|
43
|
-
},
|
|
43
|
+
}, _sapphire_shapeshift0.UndefinedToOptional<{
|
|
44
44
|
id: string | undefined;
|
|
45
45
|
moduleType: ModuleType | undefined;
|
|
46
46
|
onEnable: Function | undefined;
|
|
@@ -49,23 +49,23 @@ declare class CommandModuleValidator extends Validator {
|
|
|
49
49
|
} & {
|
|
50
50
|
id: string;
|
|
51
51
|
type: _reciple_core0.CommandType;
|
|
52
|
-
data:
|
|
52
|
+
data: _sapphire_shapeshift0.UndefinedToOptional<{
|
|
53
53
|
name: any;
|
|
54
54
|
description: any;
|
|
55
55
|
aliases: any;
|
|
56
56
|
options: any;
|
|
57
57
|
flags: any;
|
|
58
|
-
}> |
|
|
58
|
+
}> | _sapphire_shapeshift0.UndefinedToOptional<{
|
|
59
59
|
type: any;
|
|
60
60
|
name: any;
|
|
61
61
|
}>;
|
|
62
62
|
cooldown: number | undefined;
|
|
63
|
-
preconditions:
|
|
63
|
+
preconditions: _sapphire_shapeshift0.UndefinedToOptional<{
|
|
64
64
|
id: any;
|
|
65
65
|
scope: any;
|
|
66
66
|
execute: any;
|
|
67
67
|
}>[] | undefined;
|
|
68
|
-
postconditions:
|
|
68
|
+
postconditions: _sapphire_shapeshift0.UndefinedToOptional<{
|
|
69
69
|
id: any;
|
|
70
70
|
scope: any;
|
|
71
71
|
execute: any;
|
|
@@ -74,9 +74,7 @@ declare class CommandModuleValidator extends Validator {
|
|
|
74
74
|
disabledPostconditions: string[] | undefined;
|
|
75
75
|
execute: Function;
|
|
76
76
|
}>>;
|
|
77
|
-
static resolvable:
|
|
78
|
-
toJSON: Function;
|
|
79
|
-
}> | _sapphire_shapeshift7.UndefinedToOptional<{
|
|
77
|
+
static resolvable: _sapphire_shapeshift0.UnionValidator<_sapphire_shapeshift0.UndefinedToOptional<{
|
|
80
78
|
id: string | undefined;
|
|
81
79
|
moduleType: ModuleType | undefined;
|
|
82
80
|
onEnable: Function | undefined;
|
|
@@ -85,23 +83,23 @@ declare class CommandModuleValidator extends Validator {
|
|
|
85
83
|
} & {
|
|
86
84
|
id: string;
|
|
87
85
|
type: _reciple_core0.CommandType;
|
|
88
|
-
data:
|
|
86
|
+
data: _sapphire_shapeshift0.UndefinedToOptional<{
|
|
89
87
|
name: any;
|
|
90
88
|
description: any;
|
|
91
89
|
aliases: any;
|
|
92
90
|
options: any;
|
|
93
91
|
flags: any;
|
|
94
|
-
}> |
|
|
92
|
+
}> | _sapphire_shapeshift0.UndefinedToOptional<{
|
|
95
93
|
type: any;
|
|
96
94
|
name: any;
|
|
97
95
|
}>;
|
|
98
96
|
cooldown: number | undefined;
|
|
99
|
-
preconditions:
|
|
97
|
+
preconditions: _sapphire_shapeshift0.UndefinedToOptional<{
|
|
100
98
|
id: any;
|
|
101
99
|
scope: any;
|
|
102
100
|
execute: any;
|
|
103
101
|
}>[] | undefined;
|
|
104
|
-
postconditions:
|
|
102
|
+
postconditions: _sapphire_shapeshift0.UndefinedToOptional<{
|
|
105
103
|
id: any;
|
|
106
104
|
scope: any;
|
|
107
105
|
execute: any;
|
|
@@ -109,6 +107,8 @@ declare class CommandModuleValidator extends Validator {
|
|
|
109
107
|
disabledPreconditions: string[] | undefined;
|
|
110
108
|
disabledPostconditions: string[] | undefined;
|
|
111
109
|
execute: Function;
|
|
110
|
+
}> | _sapphire_shapeshift0.UndefinedToOptional<{
|
|
111
|
+
toJSON: Function;
|
|
112
112
|
}>>;
|
|
113
113
|
static isValid(value: unknown): asserts value is AnyCommandModuleData;
|
|
114
114
|
}
|
|
@@ -3,15 +3,15 @@ import { EventModule } from "../modules/events/EventModule.mjs";
|
|
|
3
3
|
import "../../index.mjs";
|
|
4
4
|
import { Validator } from "@reciple/core";
|
|
5
5
|
import { EventEmitter } from "node:events";
|
|
6
|
-
import * as
|
|
6
|
+
import * as _sapphire_shapeshift16 from "@sapphire/shapeshift";
|
|
7
7
|
|
|
8
8
|
//#region src/classes/validation/EventModuleValidator.d.ts
|
|
9
9
|
declare class EventModuleValidator extends Validator {
|
|
10
|
-
static emitter:
|
|
11
|
-
static event:
|
|
12
|
-
static once:
|
|
13
|
-
static onEvent:
|
|
14
|
-
static object:
|
|
10
|
+
static emitter: _sapphire_shapeshift16.InstanceValidator<EventEmitter<[never] | Record<string | number | symbol, any[]>>>;
|
|
11
|
+
static event: _sapphire_shapeshift16.StringValidator<string>;
|
|
12
|
+
static once: _sapphire_shapeshift16.UnionValidator<boolean | undefined>;
|
|
13
|
+
static onEvent: _sapphire_shapeshift16.InstanceValidator<Function>;
|
|
14
|
+
static object: _sapphire_shapeshift16.ObjectValidator<{
|
|
15
15
|
id: string | undefined;
|
|
16
16
|
moduleType: ModuleType | undefined;
|
|
17
17
|
onEnable: Function | undefined;
|
|
@@ -22,7 +22,7 @@ declare class EventModuleValidator extends Validator {
|
|
|
22
22
|
event: string;
|
|
23
23
|
once: boolean | undefined;
|
|
24
24
|
onEvent: Function;
|
|
25
|
-
},
|
|
25
|
+
}, _sapphire_shapeshift16.UndefinedToOptional<{
|
|
26
26
|
id: string | undefined;
|
|
27
27
|
moduleType: ModuleType | undefined;
|
|
28
28
|
onEnable: Function | undefined;
|
|
@@ -34,9 +34,9 @@ declare class EventModuleValidator extends Validator {
|
|
|
34
34
|
once: boolean | undefined;
|
|
35
35
|
onEvent: Function;
|
|
36
36
|
}>>;
|
|
37
|
-
static resolvable:
|
|
37
|
+
static resolvable: _sapphire_shapeshift16.UnionValidator<_sapphire_shapeshift16.UndefinedToOptional<{
|
|
38
38
|
toJSON: Function;
|
|
39
|
-
}> |
|
|
39
|
+
}> | _sapphire_shapeshift16.UndefinedToOptional<{
|
|
40
40
|
id: string | undefined;
|
|
41
41
|
moduleType: ModuleType | undefined;
|
|
42
42
|
onEnable: Function | undefined;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { PostconditionModule } from "../modules/PostconditionModule.mjs";
|
|
2
2
|
import { CommandPostconditionReason, CommandType, Validator } from "@reciple/core";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _sapphire_shapeshift25 from "@sapphire/shapeshift";
|
|
4
4
|
|
|
5
5
|
//#region src/classes/validation/PostconditionModule.d.ts
|
|
6
6
|
declare class PostconditionModuleValidator extends Validator {
|
|
7
|
-
static scope:
|
|
8
|
-
static accepts:
|
|
9
|
-
static execute:
|
|
10
|
-
static object:
|
|
7
|
+
static scope: _sapphire_shapeshift25.UnionValidator<CommandType[] | undefined>;
|
|
8
|
+
static accepts: _sapphire_shapeshift25.UnionValidator<CommandPostconditionReason[] | undefined>;
|
|
9
|
+
static execute: _sapphire_shapeshift25.InstanceValidator<Function>;
|
|
10
|
+
static object: _sapphire_shapeshift25.ObjectValidator<{
|
|
11
11
|
scope: CommandType[] | undefined;
|
|
12
12
|
execute: Function;
|
|
13
|
-
},
|
|
13
|
+
}, _sapphire_shapeshift25.UndefinedToOptional<{
|
|
14
14
|
scope: CommandType[] | undefined;
|
|
15
15
|
execute: Function;
|
|
16
16
|
}>>;
|
|
17
|
-
static resolvable:
|
|
17
|
+
static resolvable: _sapphire_shapeshift25.UnionValidator<_sapphire_shapeshift25.UndefinedToOptional<{
|
|
18
|
+
toJSON: Function;
|
|
19
|
+
}> | _sapphire_shapeshift25.UndefinedToOptional<{
|
|
18
20
|
scope: CommandType[] | undefined;
|
|
19
21
|
execute: Function;
|
|
20
|
-
}> | _sapphire_shapeshift0.UndefinedToOptional<{
|
|
21
|
-
toJSON: Function;
|
|
22
22
|
}>>;
|
|
23
23
|
static isValidScope(scope: unknown): asserts scope is CommandType[];
|
|
24
24
|
static isValidAccepts(accepts: unknown): asserts accepts is CommandPostconditionReason[];
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { PreconditionModule } from "../modules/PreconditionModule.mjs";
|
|
2
2
|
import { CommandType, Validator } from "@reciple/core";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _sapphire_shapeshift43 from "@sapphire/shapeshift";
|
|
4
4
|
|
|
5
5
|
//#region src/classes/validation/PreconditionModule.d.ts
|
|
6
6
|
declare class PreconditionModuleValidator extends Validator {
|
|
7
|
-
static scope:
|
|
8
|
-
static execute:
|
|
9
|
-
static object:
|
|
7
|
+
static scope: _sapphire_shapeshift43.UnionValidator<CommandType[] | undefined>;
|
|
8
|
+
static execute: _sapphire_shapeshift43.InstanceValidator<Function>;
|
|
9
|
+
static object: _sapphire_shapeshift43.ObjectValidator<{
|
|
10
10
|
scope: CommandType[] | undefined;
|
|
11
11
|
execute: Function;
|
|
12
|
-
},
|
|
12
|
+
}, _sapphire_shapeshift43.UndefinedToOptional<{
|
|
13
13
|
scope: CommandType[] | undefined;
|
|
14
14
|
execute: Function;
|
|
15
15
|
}>>;
|
|
16
|
-
static resolvable:
|
|
16
|
+
static resolvable: _sapphire_shapeshift43.UnionValidator<_sapphire_shapeshift43.UndefinedToOptional<{
|
|
17
17
|
toJSON: Function;
|
|
18
|
-
}> |
|
|
18
|
+
}> | _sapphire_shapeshift43.UndefinedToOptional<{
|
|
19
19
|
scope: CommandType[] | undefined;
|
|
20
20
|
execute: Function;
|
|
21
21
|
}>>;
|
package/dist/package.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "reciple",
|
|
4
|
-
version: "10.0.1-dev.
|
|
4
|
+
version: "10.0.1-dev.7",
|
|
5
5
|
license: "LGPL-3.0-only",
|
|
6
6
|
description: "The CLI for reciple",
|
|
7
7
|
module: "./dist/index.mjs",
|
|
@@ -37,7 +37,7 @@ var package_default = {
|
|
|
37
37
|
dependencies: {
|
|
38
38
|
"@clack/prompts": "^0.11.0",
|
|
39
39
|
"@dotenvx/dotenvx": "^1.51.1",
|
|
40
|
-
"@reciple/utils": "^10.0.1-dev.
|
|
40
|
+
"@reciple/utils": "^10.0.1-dev.2",
|
|
41
41
|
"@sapphire/shapeshift": "^4.0.0",
|
|
42
42
|
"@sapphire/snowflake": "^3.5.5",
|
|
43
43
|
"commander": "^14.0.2",
|
|
@@ -68,7 +68,7 @@ var package_default = {
|
|
|
68
68
|
"discord.js": { "optional": false }
|
|
69
69
|
},
|
|
70
70
|
publishConfig: { "access": "public" },
|
|
71
|
-
gitHead: "
|
|
71
|
+
gitHead: "ec14faf9ce5f2a54e48b6720a8a558dae7e3233a"
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
//#endregion
|
package/dist/package.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.mjs","names":[],"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"reciple\",\n \"version\": \"10.0.1-dev.
|
|
1
|
+
{"version":3,"file":"package.mjs","names":[],"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"reciple\",\n \"version\": \"10.0.1-dev.7\",\n \"license\": \"LGPL-3.0-only\",\n \"description\": \"The CLI for reciple\",\n \"module\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.mts\",\n \"bin\": \"./dist/bin/reciple.mjs\",\n \"type\": \"module\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.mts\"\n },\n \"./jsx-runtime\": {\n \"import\": \"./dist/helpers/jsx-runtime.mjs\",\n \"types\": \"./dist/helpers/jsx-runtime.d.mts\"\n }\n },\n \"files\": [\n \"dist\",\n \"assets\",\n \"README.md\"\n ],\n \"scripts\": {\n \"clean\": \"rimraf ./dist\",\n \"build\": \"tsdown --config-loader unrun\",\n \"check\": \"tsc --noEmit\",\n \"prepack\": \"npm run build\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/thenorthsolution/reciple\",\n \"directory\": \"packages/reciple\"\n },\n \"dependencies\": {\n \"@clack/prompts\": \"^0.11.0\",\n \"@dotenvx/dotenvx\": \"^1.51.1\",\n \"@reciple/utils\": \"^10.0.1-dev.2\",\n \"@sapphire/shapeshift\": \"^4.0.0\",\n \"@sapphire/snowflake\": \"^3.5.5\",\n \"commander\": \"^14.0.2\",\n \"github-slugger\": \"^2.0.0\",\n \"globby\": \"^16.0.0\",\n \"micromatch\": \"^4.0.8\",\n \"pkg-types\": \"^2.3.0\",\n \"prtyprnt\": \"^2.0.2\",\n \"semver\": \"^7.7.3\",\n \"ts-mixer\": \"^6.0.4\",\n \"tsdown\": \"^0.17.0-beta.4\",\n \"unrun\": \"^0.2.15\"\n },\n \"devDependencies\": {\n \"@reciple/jsx\": \"^10.0.1-dev.0\",\n \"@types/micromatch\": \"^4.0.10\",\n \"@types/node\": \"^24.10.1\",\n \"@types/semver\": \"^7.7.1\",\n \"nodemon\": \"^3.1.11\",\n \"rolldown\": \"^1.0.0-beta.52\"\n },\n \"peerDependencies\": {\n \"@reciple/core\": \"^10.0.0 || >=10.0.1-dev.0\",\n \"discord.js\": \"^14.25.1\"\n },\n \"peerDependenciesMeta\": {\n \"@reciple/core\": {\n \"optional\": false\n },\n \"discord.js\": {\n \"optional\": false\n }\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"gitHead\": \"ec14faf9ce5f2a54e48b6720a8a558dae7e3233a\"\n}\n"],"mappings":";sBAAA;OACU;UACG;UACA;cACI;SACL;QACD;MACF;OACC;UACG;EACT,KAAK;GACH,UAAU;GACV,SAAS;GACV;EACD,iBAAiB;GACf,UAAU;GACV,SAAS;GACV;EACF;QACQ;EACP;EACA;EACA;EACD;UACU;EACT,SAAS;EACT,SAAS;EACT,SAAS;EACT,WAAW;EACZ;aACa;EACZ,QAAQ;EACR,OAAO;EACP,aAAa;EACd;eACe;EACd,kBAAkB;EAClB,oBAAoB;EACpB,kBAAkB;EAClB,wBAAwB;EACxB,uBAAuB;EACvB,aAAa;EACb,kBAAkB;EAClB,UAAU;EACV,cAAc;EACd,aAAa;EACb,YAAY;EACZ,UAAU;EACV,YAAY;EACZ,UAAU;EACV,SAAS;EACV;kBACkB;EACjB,gBAAgB;EAChB,qBAAqB;EACrB,eAAe;EACf,iBAAiB;EACjB,WAAW;EACX,YAAY;EACb;mBACmB;EAClB,iBAAiB;EACjB,cAAc;EACf;uBACuB;EACtB,iBAAiB,EACf,YAAY,OACb;EACD,cAAc,EACZ,YAAY,OACb;EACF;gBACgB,EACf,UAAU,UACX;UACU;CACZ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reciple",
|
|
3
|
-
"version": "10.0.1-dev.
|
|
3
|
+
"version": "10.0.1-dev.7",
|
|
4
4
|
"license": "LGPL-3.0-only",
|
|
5
5
|
"description": "The CLI for reciple",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@clack/prompts": "^0.11.0",
|
|
38
38
|
"@dotenvx/dotenvx": "^1.51.1",
|
|
39
|
-
"@reciple/utils": "^10.0.1-dev.
|
|
39
|
+
"@reciple/utils": "^10.0.1-dev.2",
|
|
40
40
|
"@sapphire/shapeshift": "^4.0.0",
|
|
41
41
|
"@sapphire/snowflake": "^3.5.5",
|
|
42
42
|
"commander": "^14.0.2",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "ec14faf9ce5f2a54e48b6720a8a558dae7e3233a"
|
|
77
77
|
}
|