create-reciple 9.2.0 → 9.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -46
- package/dist/classes/Addon.d.ts +25 -0
- package/dist/classes/Addon.js +25 -0
- package/dist/classes/Addon.js.map +1 -1
- package/dist/classes/Config.d.ts +29 -0
- package/dist/classes/Config.js +54 -0
- package/dist/classes/Config.js.map +1 -0
- package/dist/classes/Setup.d.ts +17 -0
- package/dist/classes/Setup.js +17 -0
- package/dist/classes/Setup.js.map +1 -1
- package/dist/classes/TemplateBuilder.d.ts +66 -0
- package/dist/classes/TemplateBuilder.js +82 -3
- package/dist/classes/TemplateBuilder.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.js +1 -0
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/helpers.d.ts +27 -0
- package/dist/utils/helpers.js +27 -0
- package/dist/utils/helpers.js.map +1 -1
- package/package.json +5 -5
- package/templates/javascript/modules/commands/PingCommand.js +68 -0
- package/templates/javascript/modules/events/WelcomeEvent.js +54 -0
- package/templates/javascript/modules/halts/CommandErrorHalt.js +59 -0
- package/templates/javascript/modules/preconditions/ExamplePrecondition.js +27 -0
- package/templates/typescript/src/commands/PingCommand.ts +57 -0
- package/templates/typescript/src/events/WelcomeEvent.ts +42 -0
- package/templates/typescript/src/halts/CommandErrorHalt.ts +44 -0
- package/templates/typescript/src/preconditions/ExamplePrecondition.ts +18 -0
- package/templates/typescript/tsconfig.json +16 -13
- package/templates/javascript/modules/example.js +0 -48
- package/templates/typescript/src/example.ts +0 -44
package/README.md
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
<h1 align="center">
|
|
2
|
-
<img src="https://i.imgur.com/h0ljJR5.png" width="50%">
|
|
3
|
-
<br>
|
|
4
|
-
</h1>
|
|
5
|
-
|
|
6
|
-
<h3 align="center">
|
|
7
|
-
<a href="https://discord.gg/
|
|
8
|
-
<img src="https://img.shields.io/discord/1032785824686817291?color=5865F2&logo=discord&logoColor=white">
|
|
9
|
-
</a>
|
|
10
|
-
<a href="https://npmjs.org/package/create-reciple">
|
|
11
|
-
<img src="https://img.shields.io/npm/v/create-reciple?label=npm">
|
|
12
|
-
</a>
|
|
13
|
-
<a href="https://github.com/thenorthsolution/Reciple/tree/main/packages/create-reciple">
|
|
14
|
-
<img src="https://img.shields.io/npm/dt/create-reciple?maxAge=3600">
|
|
15
|
-
</a>
|
|
16
|
-
<a href="https://www.codefactor.io/repository/github/thenorthsolution/reciple">
|
|
17
|
-
<img src="https://www.codefactor.io/repository/github/thenorthsolution/reciple/badge">
|
|
18
|
-
</a>
|
|
19
|
-
<br>
|
|
20
|
-
<div style="padding-top: 1rem">
|
|
21
|
-
<a href="https://discord.gg/
|
|
22
|
-
<img src="http://invidget.switchblade.xyz/
|
|
23
|
-
</a>
|
|
24
|
-
</div>
|
|
25
|
-
</h3>
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## About
|
|
30
|
-
|
|
31
|
-
`create-reciple` is a tool used to easily create Reciple projects.
|
|
32
|
-
|
|
33
|
-
## Installation
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
npm create reciple@latest
|
|
37
|
-
yarn create reciple@latest
|
|
38
|
-
pnpm create reciple@latest
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Templates
|
|
42
|
-
- Javascript (CommonJS)
|
|
43
|
-
- Javascript (ES Modules)
|
|
44
|
-
- Typescript (CommonJS)
|
|
45
|
-
- Typescript (ES Modules)
|
|
46
|
-
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<img src="https://i.imgur.com/h0ljJR5.png" width="50%">
|
|
3
|
+
<br>
|
|
4
|
+
</h1>
|
|
5
|
+
|
|
6
|
+
<h3 align="center">
|
|
7
|
+
<a href="https://discord.gg/2gyckrwK7b">
|
|
8
|
+
<img src="https://img.shields.io/discord/1032785824686817291?color=5865F2&logo=discord&logoColor=white">
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://npmjs.org/package/create-reciple">
|
|
11
|
+
<img src="https://img.shields.io/npm/v/create-reciple?label=npm">
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://github.com/thenorthsolution/Reciple/tree/main/packages/create-reciple">
|
|
14
|
+
<img src="https://img.shields.io/npm/dt/create-reciple?maxAge=3600">
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://www.codefactor.io/repository/github/thenorthsolution/reciple">
|
|
17
|
+
<img src="https://www.codefactor.io/repository/github/thenorthsolution/reciple/badge">
|
|
18
|
+
</a>
|
|
19
|
+
<br>
|
|
20
|
+
<div style="padding-top: 1rem">
|
|
21
|
+
<a href="https://discord.gg/2gyckrwK7b">
|
|
22
|
+
<img src="http://invidget.switchblade.xyz/2gyckrwK7b">
|
|
23
|
+
</a>
|
|
24
|
+
</div>
|
|
25
|
+
</h3>
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## About
|
|
30
|
+
|
|
31
|
+
`create-reciple` is a tool used to easily create Reciple projects.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm create reciple@latest
|
|
37
|
+
yarn create reciple@latest
|
|
38
|
+
pnpm create reciple@latest
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Templates
|
|
42
|
+
- Javascript (CommonJS)
|
|
43
|
+
- Javascript (ES Modules)
|
|
44
|
+
- Typescript (CommonJS)
|
|
45
|
+
- Typescript (ES Modules)
|
|
46
|
+
|
package/dist/classes/Addon.d.ts
CHANGED
|
@@ -37,8 +37,33 @@ export declare class Addon implements AddonOptions {
|
|
|
37
37
|
get tarballShasum(): string | null;
|
|
38
38
|
get tmpDir(): string | null;
|
|
39
39
|
constructor(options: AddonOptions);
|
|
40
|
+
/**
|
|
41
|
+
* Asynchronously fetches package metadata and downloads the tarball for the specified module.
|
|
42
|
+
* If the metadata is already available, it will be used instead of fetching it again.
|
|
43
|
+
*
|
|
44
|
+
* @return {Promise<AbbreviatedVersion>} The fetched package metadata.
|
|
45
|
+
*/
|
|
40
46
|
fetch(): Promise<AbbreviatedVersion>;
|
|
47
|
+
/**
|
|
48
|
+
* Reads the tarball and extracts the necessary data from it.
|
|
49
|
+
*
|
|
50
|
+
* @return {Promise<AddonReadTarballData>} The data extracted from the tarball.
|
|
51
|
+
* @throws {Error} If the tarball is not downloaded or if the temporary directory does not exist.
|
|
52
|
+
*/
|
|
41
53
|
readTarball(): Promise<AddonReadTarballData>;
|
|
54
|
+
/**
|
|
55
|
+
* Downloads the tarball from the specified tarballURL if it hasn't been downloaded already.
|
|
56
|
+
* Verifies the tarball's shasum against the stored tarballShasum.
|
|
57
|
+
*
|
|
58
|
+
* @return {Promise<Buffer|undefined>} The downloaded tarball as a Buffer, or undefined if the tarballURL is falsy or the tarball already exists.
|
|
59
|
+
* @throws {Error} If the tarball cannot be downloaded or if the shasum does not match.
|
|
60
|
+
*/
|
|
42
61
|
protected downloadTarball(): Promise<Buffer | undefined>;
|
|
62
|
+
/**
|
|
63
|
+
* Verifies the tarball's shasum against the stored tarballShasum.
|
|
64
|
+
*
|
|
65
|
+
* @param {Buffer} buffer - The tarball buffer to be verified.
|
|
66
|
+
* @return {Promise<boolean>} A promise that resolves to a boolean indicating whether the shasum matches or not.
|
|
67
|
+
*/
|
|
43
68
|
protected verifyTarball(buffer: Buffer): Promise<boolean>;
|
|
44
69
|
}
|
package/dist/classes/Addon.js
CHANGED
|
@@ -29,12 +29,24 @@ export class Addon {
|
|
|
29
29
|
this.module = options?.module;
|
|
30
30
|
this.registry = options?.registry ?? Addon.NPM_REGISTRY;
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Asynchronously fetches package metadata and downloads the tarball for the specified module.
|
|
34
|
+
* If the metadata is already available, it will be used instead of fetching it again.
|
|
35
|
+
*
|
|
36
|
+
* @return {Promise<AbbreviatedVersion>} The fetched package metadata.
|
|
37
|
+
*/
|
|
32
38
|
async fetch() {
|
|
33
39
|
this.metadata ??= await fetchPackage(this.module, { version: this.version, registry: this.registry });
|
|
34
40
|
await this.downloadTarball();
|
|
35
41
|
this.version = this.metadata.version;
|
|
36
42
|
return this.metadata;
|
|
37
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Reads the tarball and extracts the necessary data from it.
|
|
46
|
+
*
|
|
47
|
+
* @return {Promise<AddonReadTarballData>} The data extracted from the tarball.
|
|
48
|
+
* @throws {Error} If the tarball is not downloaded or if the temporary directory does not exist.
|
|
49
|
+
*/
|
|
38
50
|
async readTarball() {
|
|
39
51
|
if (!this.tarball || !this.tmpDir)
|
|
40
52
|
throw new Error('Tarball not downloaded');
|
|
@@ -62,6 +74,13 @@ export class Addon {
|
|
|
62
74
|
initialModuleContent
|
|
63
75
|
};
|
|
64
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Downloads the tarball from the specified tarballURL if it hasn't been downloaded already.
|
|
79
|
+
* Verifies the tarball's shasum against the stored tarballShasum.
|
|
80
|
+
*
|
|
81
|
+
* @return {Promise<Buffer|undefined>} The downloaded tarball as a Buffer, or undefined if the tarballURL is falsy or the tarball already exists.
|
|
82
|
+
* @throws {Error} If the tarball cannot be downloaded or if the shasum does not match.
|
|
83
|
+
*/
|
|
65
84
|
async downloadTarball() {
|
|
66
85
|
if (!this.tarballURL)
|
|
67
86
|
return;
|
|
@@ -76,6 +95,12 @@ export class Addon {
|
|
|
76
95
|
throw new Error('Tarball shasum does not match');
|
|
77
96
|
return this.tarball = buffer;
|
|
78
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Verifies the tarball's shasum against the stored tarballShasum.
|
|
100
|
+
*
|
|
101
|
+
* @param {Buffer} buffer - The tarball buffer to be verified.
|
|
102
|
+
* @return {Promise<boolean>} A promise that resolves to a boolean indicating whether the shasum matches or not.
|
|
103
|
+
*/
|
|
79
104
|
async verifyTarball(buffer) {
|
|
80
105
|
const i = createHash('sha1');
|
|
81
106
|
i.update(buffer);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Addon.js","sourceRoot":"","sources":["../../src/classes/Addon.ts"],"names":[],"mappings":"AAAA,OAAO,YAAoC,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAmB7C,MAAM,OAAO,KAAK;IACd,MAAM,CAAU,YAAY,GAAG,4BAA4B,CAAC;IAC5D,MAAM,CAAU,aAAa,GAAG,8BAA8B,CAAC;IAC/D,MAAM,CAAU,aAAa,GAAG,KAAK,CAAC,YAAY,CAAC;IACnD,MAAM,CAAU,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;IAClD,MAAM,CAAU,sBAAsB,GAAG;QACrC,4BAA4B,EAAE,IAAI;QAClC,mBAAmB,EAAE,IAAI;QACzB,sBAAsB,EAAE,IAAI;QAC5B,wBAAwB,EAAE,IAAI;KACjC,CAAC;IAEK,MAAM,CAAS;IACf,OAAO,CAAU;IACjB,QAAQ,CAAU;IAClB,QAAQ,CAAsB;IAC9B,OAAO,CAAU;IACjB,WAAW,CAAwB;IAE1C,IAAI,UAAU,KAAK,OAAO,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC;IAChE,IAAI,aAAa,KAAK,OAAO,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC;IAClE,IAAI,MAAM,KAAK,OAAO,IAAI,CAAC,aAAa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B;SACvB,CAAC;IACN,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,eAAe;QAC3B,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,OAAO;QAC7B,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO,IAAI,CAAC,OAAO,CAAC;QAEtC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC9C,IAAI,CAAC,QAAQ,CAAC,EAAE;YAAE,OAAO;QAEzB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC;QAC1C,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEjC,IAAI,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAExF,OAAO,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACO,KAAK,CAAC,aAAa,CAAC,MAAc;QACxC,MAAM,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;QAC7B,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAEjB,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAE/B,OAAO,MAAM,KAAK,IAAI,CAAC,aAAa,CAAC;IACzC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface ConfigOptions {
|
|
2
|
+
dir?: string;
|
|
3
|
+
}
|
|
4
|
+
export declare class Config {
|
|
5
|
+
dir: string;
|
|
6
|
+
content: string;
|
|
7
|
+
get filePath(): string;
|
|
8
|
+
get indent(): string;
|
|
9
|
+
constructor(options: ConfigOptions);
|
|
10
|
+
setup(options?: Partial<Record<'halts' | 'preconditions', {
|
|
11
|
+
class: string;
|
|
12
|
+
notDefault?: boolean;
|
|
13
|
+
from: string;
|
|
14
|
+
}[]>>): Promise<this>;
|
|
15
|
+
addPreconditions(preconditions: {
|
|
16
|
+
class: string;
|
|
17
|
+
notDefault?: boolean;
|
|
18
|
+
from: string;
|
|
19
|
+
}[]): void;
|
|
20
|
+
addHalts(halts: {
|
|
21
|
+
class: string;
|
|
22
|
+
notDefault?: boolean;
|
|
23
|
+
from: string;
|
|
24
|
+
}[]): void;
|
|
25
|
+
addImport(imports: string | string[], from: string): void;
|
|
26
|
+
readContent(): Promise<string>;
|
|
27
|
+
writeContent(): Promise<string>;
|
|
28
|
+
saveContent(): Promise<string>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { existsAsync } from '@reciple/utils';
|
|
2
|
+
import { readFile, writeFile } from 'fs/promises';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { ConfigReader } from 'reciple';
|
|
5
|
+
import detectIndentSize from 'detect-indent';
|
|
6
|
+
export class Config {
|
|
7
|
+
dir;
|
|
8
|
+
content = '';
|
|
9
|
+
get filePath() {
|
|
10
|
+
return path.join(this.dir, 'reciple.mjs');
|
|
11
|
+
}
|
|
12
|
+
get indent() {
|
|
13
|
+
return detectIndentSize(this.content).indent ?? ' ';
|
|
14
|
+
}
|
|
15
|
+
constructor(options) {
|
|
16
|
+
this.dir = options.dir ?? process.cwd();
|
|
17
|
+
}
|
|
18
|
+
async setup(options) {
|
|
19
|
+
await this.readContent();
|
|
20
|
+
if (options?.preconditions?.length)
|
|
21
|
+
this.addPreconditions(options.preconditions);
|
|
22
|
+
if (options?.halts?.length)
|
|
23
|
+
this.addHalts(options.halts);
|
|
24
|
+
await this.saveContent();
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
addPreconditions(preconditions) {
|
|
28
|
+
this.content = this.content.replaceAll(`new CommandPermissionsPrecondition()`, `new CommandPermissionsPrecondition(),\n${this.indent.repeat(2)}${preconditions.map(precondition => `new ${precondition.class}(),`).join('\n' + this.indent.repeat(2))}`);
|
|
29
|
+
for (const precondition of preconditions) {
|
|
30
|
+
this.addImport(precondition.notDefault !== true ? [precondition.class] : precondition.class, precondition.from);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
addHalts(halts) {
|
|
34
|
+
this.content = this.content.replaceAll(`commandHalts: []`, `commandHalts: [\n${this.indent.repeat(2)}${halts.map(halt => `new ${halt.class}(),`).join('\n' + this.indent.repeat(2))}\n${this.indent}]`);
|
|
35
|
+
for (const halt of halts) {
|
|
36
|
+
this.addImport(halt.notDefault !== true ? [halt.class] : halt.class, halt.from);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
addImport(imports, from) {
|
|
40
|
+
this.content = this.content.replace(`import { IntentsBitField } from 'discord.js';`, `import { IntentsBitField } from 'discord.js';\nimport ${typeof imports === 'string' ? imports : ('{ ' + imports.join(', ') + ' }')} from '${from}';`);
|
|
41
|
+
}
|
|
42
|
+
async readContent() {
|
|
43
|
+
return this.content = await existsAsync(this.filePath) ? await readFile(this.filePath, 'utf-8') : await this.writeContent();
|
|
44
|
+
}
|
|
45
|
+
async writeContent() {
|
|
46
|
+
await ConfigReader.createConfigJS(this.filePath);
|
|
47
|
+
return this.readContent();
|
|
48
|
+
}
|
|
49
|
+
async saveContent() {
|
|
50
|
+
await writeFile(this.filePath, this.content, 'utf-8');
|
|
51
|
+
return this.content;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=Config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/classes/Config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,gBAAgB,MAAM,eAAe,CAAC;AAM7C,MAAM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CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;IAChI,CAAC;IAEM,KAAK,CAAC,YAAY;QACrB,MAAM,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjD,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;IAC9B,CAAC;IAEM,KAAK,CAAC,WAAW;QACpB,MAAM,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;CACJ"}
|
package/dist/classes/Setup.d.ts
CHANGED
|
@@ -15,12 +15,29 @@ export declare class Setup implements SetupOptions {
|
|
|
15
15
|
get isDone(): boolean;
|
|
16
16
|
introShown: boolean;
|
|
17
17
|
constructor(options?: SetupOptions);
|
|
18
|
+
/**
|
|
19
|
+
* Prompts the user for input to set up the necessary parameters for creating a reciple.
|
|
20
|
+
*
|
|
21
|
+
* @param {boolean} force - Whether to force override existing files in the directory.
|
|
22
|
+
* @return {Promise<this>} A promise that resolves to the current instance of the Setup class.
|
|
23
|
+
*/
|
|
18
24
|
prompt(force?: boolean): Promise<this>;
|
|
19
25
|
promptDir(dir?: string): Promise<string>;
|
|
20
26
|
promptIsTypescript(isTypescript?: boolean): Promise<boolean>;
|
|
21
27
|
promptAddons(addons?: string[]): Promise<string[]>;
|
|
22
28
|
promptPackageManager(packageManager?: PackageManager | null): Promise<PackageManager | null>;
|
|
23
29
|
promptToken(token?: string): Promise<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Cancels the prompts and exits the process with the given reason.
|
|
32
|
+
*
|
|
33
|
+
* @param {string} [reason] - The reason for cancelling the prompts.
|
|
34
|
+
* @return {Promise<never>} - A promise that never resolves.
|
|
35
|
+
*/
|
|
24
36
|
cancelPrompts(reason?: string): Promise<never>;
|
|
37
|
+
/**
|
|
38
|
+
* Returns a SetupOptions object with the current setup details.
|
|
39
|
+
*
|
|
40
|
+
* @return {SetupOptions} The setup options object.
|
|
41
|
+
*/
|
|
25
42
|
toJSON(): SetupOptions;
|
|
26
43
|
}
|
package/dist/classes/Setup.js
CHANGED
|
@@ -23,6 +23,12 @@ export class Setup {
|
|
|
23
23
|
this.addons = options?.addons;
|
|
24
24
|
this.token = options?.token;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Prompts the user for input to set up the necessary parameters for creating a reciple.
|
|
28
|
+
*
|
|
29
|
+
* @param {boolean} force - Whether to force override existing files in the directory.
|
|
30
|
+
* @return {Promise<this>} A promise that resolves to the current instance of the Setup class.
|
|
31
|
+
*/
|
|
26
32
|
async prompt(force = false) {
|
|
27
33
|
if (this.isDone)
|
|
28
34
|
return this;
|
|
@@ -115,10 +121,21 @@ export class Setup {
|
|
|
115
121
|
});
|
|
116
122
|
return isCancel(newToken) ? this.cancelPrompts() : this.token = newToken;
|
|
117
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Cancels the prompts and exits the process with the given reason.
|
|
126
|
+
*
|
|
127
|
+
* @param {string} [reason] - The reason for cancelling the prompts.
|
|
128
|
+
* @return {Promise<never>} - A promise that never resolves.
|
|
129
|
+
*/
|
|
118
130
|
async cancelPrompts(reason) {
|
|
119
131
|
cancel(reason ?? 'Operation cancelled');
|
|
120
132
|
process.exit(0);
|
|
121
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Returns a SetupOptions object with the current setup details.
|
|
136
|
+
*
|
|
137
|
+
* @return {SetupOptions} The setup options object.
|
|
138
|
+
*/
|
|
122
139
|
toJSON() {
|
|
123
140
|
return {
|
|
124
141
|
dir: this.dir,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Setup.js","sourceRoot":"","sources":["../../src/classes/Setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE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AC,cAAc,GAAG,iBAAiB,KAAK,MAAM,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC;IACzF,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,KAAc;QACnC,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEzD,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC;YAC5B,OAAO,EAAE,qDAAqD;YAC9D,IAAI,EAAE,GAAG;SACZ,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;IAC7E,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,aAAa,CAAC,MAAe;QACtC,MAAM,CAAC,MAAM,IAAI,qBAAqB,CAAC,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACI,MAAM;QACT,OAAO;YACH,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;SACtB,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -15,13 +15,79 @@ export declare class TemplateBuilder implements TemplateBuilderOptions {
|
|
|
15
15
|
get packageJsonPath(): string;
|
|
16
16
|
get packageManagerPlaceholders(): Record<"SCRIPT_RUN" | "BIN_EXEC" | "INSTALL_ALL" | "INSTALL_PKG" | "UNINSTALL_PKG", string>;
|
|
17
17
|
constructor(options: TemplateBuilderOptions);
|
|
18
|
+
/**
|
|
19
|
+
* Builds the template by performing the following steps:
|
|
20
|
+
* 1. Initializes the spinner.
|
|
21
|
+
* 2. Creates the directory if it does not exist.
|
|
22
|
+
* 3. Copies the template files.
|
|
23
|
+
* 4. Copies the assets.
|
|
24
|
+
* 5. Sets up the package.json file.
|
|
25
|
+
* 6. Sets up the configuration.
|
|
26
|
+
* 7. Sets up the addons.
|
|
27
|
+
* 8. Sets up the environment.
|
|
28
|
+
* 9. Succeeds the spinner.
|
|
29
|
+
* 10. Installs dependencies if the package manager is specified.
|
|
30
|
+
* 11. Logs the project readiness message.
|
|
31
|
+
* 12. Logs the start developing message.
|
|
32
|
+
* 13. Logs the command to navigate to the project directory if the current working directory is not the project directory.
|
|
33
|
+
* 14. Logs the command to install all dependencies if the package manager is not specified.
|
|
34
|
+
* 15. Logs the command to run the dev script.
|
|
35
|
+
*
|
|
36
|
+
* @return {Promise<void>} A Promise that resolves when the build is complete.
|
|
37
|
+
*/
|
|
18
38
|
build(): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Copies the template files to the specified directory.
|
|
41
|
+
*
|
|
42
|
+
* @return {Promise<void>} A Promise that resolves when the template files are copied.
|
|
43
|
+
*/
|
|
19
44
|
copyTemplateFiles(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Copies the asset files from the root directory to the current directory.
|
|
47
|
+
*
|
|
48
|
+
* @return {Promise<void>} A Promise that resolves when the asset files are copied.
|
|
49
|
+
*/
|
|
20
50
|
copyAssets(): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Configures the package versions and scripts in the package.json file.
|
|
53
|
+
*
|
|
54
|
+
* @return {Promise<void>} A Promise that resolves when the package.json file is configured.
|
|
55
|
+
*/
|
|
21
56
|
setupPackageJson(): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Sets up the configuration for the `reciple.mjs` file by creating a new
|
|
59
|
+
* configuration file in the specified directory. This function does not take
|
|
60
|
+
* any parameters and returns a Promise that resolves when the configuration
|
|
61
|
+
* file is successfully created.
|
|
62
|
+
*
|
|
63
|
+
* @return {Promise<void>} A Promise that resolves when the configuration
|
|
64
|
+
* file is successfully created.
|
|
65
|
+
*/
|
|
22
66
|
setupConfig(): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Sets up the addons for the template by installing the specified addons
|
|
69
|
+
* and updating the package.json file with their dependencies. This function
|
|
70
|
+
* takes no parameters and returns a Promise that resolves when the addons
|
|
71
|
+
* are successfully installed.
|
|
72
|
+
*
|
|
73
|
+
* @return {Promise<void>} A Promise that resolves when the addons are
|
|
74
|
+
* installed.
|
|
75
|
+
*/
|
|
23
76
|
setupAddons(): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Sets up the environment by updating the .env file with the Discord bot token.
|
|
79
|
+
* If the file already exists, it reads the content and appends the token.
|
|
80
|
+
* If the token is not already present in the file, it adds a comment and the token.
|
|
81
|
+
* The function does not return anything.
|
|
82
|
+
*
|
|
83
|
+
* @return {Promise<void>} A Promise that resolves when the environment setup is complete.
|
|
84
|
+
*/
|
|
24
85
|
setupEnv(): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Installs dependencies by running a script with the package manager placeholders.
|
|
88
|
+
*
|
|
89
|
+
* @return {Promise<void>} A Promise that resolves when the dependencies are installed.
|
|
90
|
+
*/
|
|
25
91
|
installDependencies(): Promise<void>;
|
|
26
92
|
setSpinnerText(text: string): void;
|
|
27
93
|
persistSpinner(options: PersistOptions): void;
|
|
@@ -6,8 +6,8 @@ import { packageManagerPlaceholders, packages, root } from '../utils/constants.j
|
|
|
6
6
|
import { Addon } from './Addon.js';
|
|
7
7
|
import detectIndent from 'detect-indent';
|
|
8
8
|
import { kleur } from 'fallout-utility';
|
|
9
|
-
import { ConfigReader } from 'reciple';
|
|
10
9
|
import ora from 'ora';
|
|
10
|
+
import { Config } from './Config.js';
|
|
11
11
|
export class TemplateBuilder {
|
|
12
12
|
setup;
|
|
13
13
|
template;
|
|
@@ -26,6 +26,26 @@ export class TemplateBuilder {
|
|
|
26
26
|
this.setup = options.setup;
|
|
27
27
|
this.template = options.template;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Builds the template by performing the following steps:
|
|
31
|
+
* 1. Initializes the spinner.
|
|
32
|
+
* 2. Creates the directory if it does not exist.
|
|
33
|
+
* 3. Copies the template files.
|
|
34
|
+
* 4. Copies the assets.
|
|
35
|
+
* 5. Sets up the package.json file.
|
|
36
|
+
* 6. Sets up the configuration.
|
|
37
|
+
* 7. Sets up the addons.
|
|
38
|
+
* 8. Sets up the environment.
|
|
39
|
+
* 9. Succeeds the spinner.
|
|
40
|
+
* 10. Installs dependencies if the package manager is specified.
|
|
41
|
+
* 11. Logs the project readiness message.
|
|
42
|
+
* 12. Logs the start developing message.
|
|
43
|
+
* 13. Logs the command to navigate to the project directory if the current working directory is not the project directory.
|
|
44
|
+
* 14. Logs the command to install all dependencies if the package manager is not specified.
|
|
45
|
+
* 15. Logs the command to run the dev script.
|
|
46
|
+
*
|
|
47
|
+
* @return {Promise<void>} A Promise that resolves when the build is complete.
|
|
48
|
+
*/
|
|
29
49
|
async build() {
|
|
30
50
|
this.spinner = ora({
|
|
31
51
|
text: '',
|
|
@@ -52,11 +72,21 @@ export class TemplateBuilder {
|
|
|
52
72
|
console.log(` • ${kleur.cyan().bold(this.packageManagerPlaceholders.INSTALL_ALL)} (or ${packageManagerPlaceholders.pnpm.INSTALL_ALL}, etc)`);
|
|
53
73
|
console.log(` • ${kleur.cyan().bold(`${this.packageManagerPlaceholders.SCRIPT_RUN} dev`)}`);
|
|
54
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Copies the template files to the specified directory.
|
|
77
|
+
*
|
|
78
|
+
* @return {Promise<void>} A Promise that resolves when the template files are copied.
|
|
79
|
+
*/
|
|
55
80
|
async copyTemplateFiles() {
|
|
56
81
|
this.setSpinnerText('Copying template files...');
|
|
57
82
|
await recursiveCopyFiles(this.template.path, this.dir, f => f.replace('dot.', '.'));
|
|
58
83
|
this.persistSpinner({ symbol: kleur.bold().green('✔'), text: 'Template files copied.' });
|
|
59
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Copies the asset files from the root directory to the current directory.
|
|
87
|
+
*
|
|
88
|
+
* @return {Promise<void>} A Promise that resolves when the asset files are copied.
|
|
89
|
+
*/
|
|
60
90
|
async copyAssets() {
|
|
61
91
|
this.setSpinnerText('Copying asset files...');
|
|
62
92
|
if (await existsAsync(path.join(root, 'assets'))) {
|
|
@@ -64,6 +94,11 @@ export class TemplateBuilder {
|
|
|
64
94
|
}
|
|
65
95
|
this.persistSpinner({ symbol: kleur.bold().green('✔'), text: 'Copied all assets.' });
|
|
66
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Configures the package versions and scripts in the package.json file.
|
|
99
|
+
*
|
|
100
|
+
* @return {Promise<void>} A Promise that resolves when the package.json file is configured.
|
|
101
|
+
*/
|
|
67
102
|
async setupPackageJson() {
|
|
68
103
|
this.setSpinnerText(`Configuring ${kleur.green('package.json')} package versions...`);
|
|
69
104
|
let packageJson = await readFile(this.packageJsonPath, 'utf-8');
|
|
@@ -77,11 +112,42 @@ export class TemplateBuilder {
|
|
|
77
112
|
await writeFile(this.packageJsonPath, packageJson, 'utf-8');
|
|
78
113
|
this.persistSpinner({ symbol: kleur.bold().green('✔'), text: `${kleur.green('package.json')} configured.` });
|
|
79
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Sets up the configuration for the `reciple.mjs` file by creating a new
|
|
117
|
+
* configuration file in the specified directory. This function does not take
|
|
118
|
+
* any parameters and returns a Promise that resolves when the configuration
|
|
119
|
+
* file is successfully created.
|
|
120
|
+
*
|
|
121
|
+
* @return {Promise<void>} A Promise that resolves when the configuration
|
|
122
|
+
* file is successfully created.
|
|
123
|
+
*/
|
|
80
124
|
async setupConfig() {
|
|
81
125
|
this.setSpinnerText(`Configuring ${kleur.green('reciple.mjs')}...`);
|
|
82
|
-
await
|
|
126
|
+
await (new Config({ dir: this.dir })).setup({
|
|
127
|
+
halts: [
|
|
128
|
+
{
|
|
129
|
+
class: 'CommandErrorHalt',
|
|
130
|
+
from: './modules/halts/CommandErrorHalt.js',
|
|
131
|
+
}
|
|
132
|
+
],
|
|
133
|
+
preconditions: [
|
|
134
|
+
{
|
|
135
|
+
class: 'ExamplePrecondition',
|
|
136
|
+
from: './modules/preconditions/ExamplePrecondition.js',
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
});
|
|
83
140
|
this.persistSpinner({ symbol: kleur.bold().green('✔'), text: `${kleur.green('reciple.mjs')} configured.` });
|
|
84
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Sets up the addons for the template by installing the specified addons
|
|
144
|
+
* and updating the package.json file with their dependencies. This function
|
|
145
|
+
* takes no parameters and returns a Promise that resolves when the addons
|
|
146
|
+
* are successfully installed.
|
|
147
|
+
*
|
|
148
|
+
* @return {Promise<void>} A Promise that resolves when the addons are
|
|
149
|
+
* installed.
|
|
150
|
+
*/
|
|
85
151
|
async setupAddons() {
|
|
86
152
|
const addons = (this.setup.addons ?? []).map(a => new Addon({ module: a, version: Addon.DEFAULT_ADDON_VERSIONS[a] || undefined }));
|
|
87
153
|
if (!addons.length)
|
|
@@ -97,7 +163,7 @@ export class TemplateBuilder {
|
|
|
97
163
|
const moduleContent = this.setup.isTypescript ? addon.tarballData?.initialModuleContent.ts : addon.tarballData?.initialModuleContent.js;
|
|
98
164
|
if (!moduleContent)
|
|
99
165
|
continue;
|
|
100
|
-
const modulesFolder = path.join(this.dir, this.setup.isTypescript ? 'src' : 'modules');
|
|
166
|
+
const modulesFolder = path.join(this.dir, this.setup.isTypescript ? 'src' : 'modules', 'addons');
|
|
101
167
|
await mkdir(modulesFolder, { recursive: true });
|
|
102
168
|
const modulePath = path.join(modulesFolder, `${addon.module}.${this.setup.isTypescript ? 'ts' : 'js'}`);
|
|
103
169
|
await writeFile(modulePath, moduleContent);
|
|
@@ -112,6 +178,14 @@ export class TemplateBuilder {
|
|
|
112
178
|
await writeFile(this.packageJsonPath, JSON.stringify(packageJson, null, packageJsonIndentSize), 'utf-8');
|
|
113
179
|
this.persistSpinner({ symbol: kleur.bold().green('✔'), text: `${kleur.green('Addons installed.')}` });
|
|
114
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Sets up the environment by updating the .env file with the Discord bot token.
|
|
183
|
+
* If the file already exists, it reads the content and appends the token.
|
|
184
|
+
* If the token is not already present in the file, it adds a comment and the token.
|
|
185
|
+
* The function does not return anything.
|
|
186
|
+
*
|
|
187
|
+
* @return {Promise<void>} A Promise that resolves when the environment setup is complete.
|
|
188
|
+
*/
|
|
115
189
|
async setupEnv() {
|
|
116
190
|
const file = path.resolve(path.join(this.dir, '.env'));
|
|
117
191
|
let content = '';
|
|
@@ -123,6 +197,11 @@ export class TemplateBuilder {
|
|
|
123
197
|
}
|
|
124
198
|
await writeFile(file, content);
|
|
125
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Installs dependencies by running a script with the package manager placeholders.
|
|
202
|
+
*
|
|
203
|
+
* @return {Promise<void>} A Promise that resolves when the dependencies are installed.
|
|
204
|
+
*/
|
|
126
205
|
async installDependencies() {
|
|
127
206
|
await runScript(this.packageManagerPlaceholders.INSTALL_ALL, this.dir);
|
|
128
207
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateBuilder.js","sourceRoot":"","sources":["../../src/classes/TemplateBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,0BAA0B,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,KAAK,EAAe,M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