@sapphire/cli 1.3.0 → 1.3.1-next.85ea98b.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -9
- package/templates/.sapphirerc.json.sapphire +12 -12
- package/templates/components/argument.js.sapphire +17 -10
- package/templates/components/argument.ts.sapphire +7 -7
- package/templates/components/contextmenucommand.js.sapphire +26 -13
- package/templates/components/contextmenucommand.ts.sapphire +7 -5
- package/templates/components/listener.js.sapphire +12 -7
- package/templates/components/listener.ts.sapphire +1 -1
- package/templates/components/messagecommand.js.sapphire +19 -11
- package/templates/components/messagecommand.ts.sapphire +3 -3
- package/templates/components/precondition.js.sapphire +21 -2
- package/templates/components/precondition.ts.sapphire +15 -7
- package/templates/components/slashcommand.js.sapphire +25 -12
- package/templates/components/slashcommand.ts.sapphire +7 -6
- package/templates/schemas/.sapphirerc.scheme.json +48 -61
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sapphire/cli",
|
|
3
|
-
"version": "1.3.0",
|
|
3
|
+
"version": "1.3.1-next.85ea98b.0",
|
|
4
4
|
"description": "CLI for Sapphire Framework",
|
|
5
5
|
"author": "@sapphire",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@favware/colorette-spinner": "^1.0.1",
|
|
42
|
-
"@sapphire/result": "^2.4.
|
|
42
|
+
"@sapphire/result": "^2.4.1",
|
|
43
43
|
"colorette": "^2.0.19",
|
|
44
44
|
"commander": "^9.4.0",
|
|
45
45
|
"execa": "^6.1.0",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"tslib": "^2.4.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@commitlint/cli": "^17.
|
|
53
|
-
"@commitlint/config-conventional": "^17.0
|
|
52
|
+
"@commitlint/cli": "^17.1.2",
|
|
53
|
+
"@commitlint/config-conventional": "^17.1.0",
|
|
54
54
|
"@favware/cliff-jumper": "^1.8.7",
|
|
55
55
|
"@favware/npm-deprecate": "^1.0.5",
|
|
56
56
|
"@sapphire/eslint-config": "^4.3.8",
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"@types/js-yaml": "^4.0.5",
|
|
60
60
|
"@types/node": "^18.7.8",
|
|
61
61
|
"@types/prompts": "^2.0.14",
|
|
62
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
63
|
-
"@typescript-eslint/parser": "^5.
|
|
62
|
+
"@typescript-eslint/eslint-plugin": "^5.36.1",
|
|
63
|
+
"@typescript-eslint/parser": "^5.36.1",
|
|
64
64
|
"cz-conventional-changelog": "^3.3.0",
|
|
65
|
-
"eslint": "^8.
|
|
65
|
+
"eslint": "^8.23.0",
|
|
66
66
|
"eslint-config-prettier": "^8.5.0",
|
|
67
67
|
"eslint-plugin-prettier": "^4.2.1",
|
|
68
68
|
"globby": "^13.1.2",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"prettier": "^2.7.1",
|
|
73
73
|
"pretty-quick": "^3.1.3",
|
|
74
74
|
"ts-node": "^10.9.1",
|
|
75
|
-
"typescript": "^4.
|
|
75
|
+
"typescript": "^4.8.2"
|
|
76
76
|
},
|
|
77
77
|
"resolutions": {
|
|
78
78
|
"ansi-regex": "^5.0.1",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"access": "public"
|
|
118
118
|
},
|
|
119
119
|
"prettier": "@sapphire/prettier-config",
|
|
120
|
-
"packageManager": "yarn@3.2.
|
|
120
|
+
"packageManager": "yarn@3.2.3"
|
|
121
121
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
"projectLanguage": "{{language}}",
|
|
3
|
+
"locations": {
|
|
4
|
+
"base": "src",
|
|
5
|
+
"arguments": "arguments",
|
|
6
|
+
"commands": "commands",
|
|
7
|
+
"listeners": "listeners",
|
|
8
|
+
"preconditions": "preconditions"
|
|
9
|
+
},
|
|
10
|
+
"customFileTemplates": {
|
|
11
|
+
"enabled": false,
|
|
12
|
+
"location": ""
|
|
13
|
+
}
|
|
14
14
|
}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
{ "category": "arguments" }
|
|
2
2
|
---
|
|
3
|
-
|
|
3
|
+
const { Argument } = require('@sapphire/framework');
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
class UserArgument extends Argument {
|
|
6
|
+
/**
|
|
7
|
+
* @param {Argument.Context} context
|
|
8
|
+
*/
|
|
9
|
+
constructor(context) {
|
|
10
|
+
super(context, {
|
|
11
|
+
// Any Argument options you want here
|
|
12
|
+
});
|
|
13
|
+
}
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
async run(parameter) {
|
|
16
|
+
return this.ok(parameter);
|
|
17
|
+
}
|
|
15
18
|
}
|
|
19
|
+
|
|
20
|
+
module.exports = {
|
|
21
|
+
UserArgument
|
|
22
|
+
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{ "category": "arguments" }
|
|
2
2
|
---
|
|
3
3
|
import { ApplyOptions } from '@sapphire/decorators';
|
|
4
|
-
import { Argument, ArgumentOptions } from
|
|
4
|
+
import { Argument, ArgumentOptions } from '@sapphire/framework';
|
|
5
5
|
|
|
6
6
|
@ApplyOptions<ArgumentOptions>({})
|
|
7
7
|
export class UserArgument extends Argument<string> {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
async run(parameter: string) {
|
|
9
|
+
return this.ok(parameter);
|
|
10
|
+
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
declare module '@sapphire/framework' {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
interface ArgType {
|
|
15
|
+
{{name}}: string;
|
|
16
|
+
}
|
|
17
17
|
}
|
|
@@ -1,25 +1,38 @@
|
|
|
1
1
|
{ "category": "commands" }
|
|
2
2
|
---
|
|
3
|
-
const { Command } = require('@sapphire/framework')
|
|
3
|
+
const { Command } = require('@sapphire/framework');
|
|
4
|
+
const { ApplicationCommandType } = require('discord-api-types/v10');
|
|
4
5
|
|
|
5
6
|
class UserCommand extends Command {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* @param {Command.Context} context
|
|
9
|
+
*/
|
|
10
|
+
constructor(context) {
|
|
11
|
+
super(context, {
|
|
12
|
+
// Any Command options you want here
|
|
9
13
|
name: 'command'
|
|
10
|
-
|
|
11
|
-
|
|
14
|
+
});
|
|
15
|
+
}
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* @param {Command.Registry} registry
|
|
19
|
+
*/
|
|
20
|
+
registerApplicationCommands(registry) {
|
|
21
|
+
registry.registerContextMenuCommand((builder) =>
|
|
22
|
+
builder //
|
|
23
|
+
.setName(this.name)
|
|
24
|
+
.setType(ApplicationCommandType.Message)
|
|
25
|
+
);
|
|
18
26
|
}
|
|
19
27
|
|
|
28
|
+
/**
|
|
29
|
+
* @param {Command.ContextMenuInteraction} interaction
|
|
30
|
+
*/
|
|
20
31
|
async contextMenuRun(interaction) {
|
|
21
|
-
return await interaction.reply({content:
|
|
32
|
+
return await interaction.reply({ content: 'Hello world!' });
|
|
22
33
|
}
|
|
23
34
|
}
|
|
24
35
|
|
|
25
|
-
exports
|
|
36
|
+
module.exports = {
|
|
37
|
+
UserCommand
|
|
38
|
+
};
|
|
@@ -2,19 +2,21 @@
|
|
|
2
2
|
---
|
|
3
3
|
import { ApplyOptions } from '@sapphire/decorators';
|
|
4
4
|
import { Command } from '@sapphire/framework';
|
|
5
|
+
import { ApplicationCommandType } from 'discord-api-types/v10';
|
|
5
6
|
|
|
6
7
|
@ApplyOptions<Command.Options>({
|
|
7
8
|
description: 'A basic contextMenu command'
|
|
8
9
|
})
|
|
9
10
|
export class UserCommand extends Command {
|
|
10
11
|
public override registerApplicationCommands(registry: Command.Registry) {
|
|
11
|
-
registry.registerContextMenuCommand(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
registry.registerContextMenuCommand((builder) =>
|
|
13
|
+
builder //
|
|
14
|
+
.setName(this.name)
|
|
15
|
+
.setType(ApplicationCommandType.Message)
|
|
16
|
+
);
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
public async contextMenuRun(interaction: Command.ContextMenuInteraction) {
|
|
18
|
-
return await interaction.reply({content:
|
|
20
|
+
return await interaction.reply({ content: 'Hello world!' });
|
|
19
21
|
}
|
|
20
22
|
}
|
|
@@ -3,13 +3,18 @@
|
|
|
3
3
|
const { Listener } = require('@sapphire/framework');
|
|
4
4
|
|
|
5
5
|
class UserEvent extends Listener {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @param {Listener.Context} context
|
|
8
|
+
*/
|
|
9
|
+
constructor(context) {
|
|
10
|
+
super(context, {
|
|
11
|
+
// Any Listener options you want here
|
|
12
|
+
});
|
|
13
|
+
}
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
run() {}
|
|
13
16
|
}
|
|
14
17
|
|
|
15
|
-
exports
|
|
18
|
+
module.exports = {
|
|
19
|
+
UserEvent
|
|
20
|
+
}
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
{ "category": "commands" }
|
|
2
2
|
---
|
|
3
|
-
const {
|
|
3
|
+
const { Command } = require('@sapphire/framework');
|
|
4
4
|
|
|
5
|
-
class UserCommand extends
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
class UserCommand extends Command {
|
|
6
|
+
/**
|
|
7
|
+
* @param {Command.Context} context
|
|
8
|
+
*/
|
|
9
|
+
constructor(context) {
|
|
10
|
+
super(context, {
|
|
11
|
+
// Any Command options you want here
|
|
12
|
+
});
|
|
13
|
+
}
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
/**
|
|
16
|
+
* @param {import('discord.js').Message} message
|
|
17
|
+
*/
|
|
18
|
+
async messageRun(message) {
|
|
19
|
+
return message.channel.send('Hello world!');
|
|
20
|
+
}
|
|
15
21
|
}
|
|
16
22
|
|
|
17
|
-
exports
|
|
23
|
+
module.exports = {
|
|
24
|
+
UserCommand
|
|
25
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{ "category": "commands" }
|
|
2
2
|
---
|
|
3
3
|
import { ApplyOptions } from '@sapphire/decorators';
|
|
4
|
-
import {
|
|
4
|
+
import { Command } from '@sapphire/framework';
|
|
5
5
|
import type { Message } from 'discord.js';
|
|
6
6
|
|
|
7
|
-
@ApplyOptions<
|
|
7
|
+
@ApplyOptions<Command.Options>({
|
|
8
8
|
description: 'A basic command'
|
|
9
9
|
})
|
|
10
|
-
export class UserCommand extends
|
|
10
|
+
export class UserCommand extends Command {
|
|
11
11
|
public async messageRun(message: Message) {
|
|
12
12
|
return message.channel.send('Hello world!');
|
|
13
13
|
}
|
|
@@ -3,9 +3,28 @@
|
|
|
3
3
|
const { Precondition } = require('@sapphire/framework');
|
|
4
4
|
|
|
5
5
|
class UserPrecondition extends Precondition {
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @param {import('discord.js').Message} message
|
|
8
|
+
*/
|
|
9
|
+
messageRun(message) {
|
|
10
|
+
return this.ok();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @param {import('discord.js').CommandInteraction} interaction
|
|
15
|
+
*/
|
|
16
|
+
chatInputRun(interaction) {
|
|
17
|
+
return this.ok();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @param {import('discord.js').ContextMenuInteraction} interaction
|
|
22
|
+
*/
|
|
23
|
+
contextMenuRun(interaction) {
|
|
7
24
|
return this.ok();
|
|
8
25
|
}
|
|
9
26
|
}
|
|
10
27
|
|
|
11
|
-
module.exports
|
|
28
|
+
module.exports = {
|
|
29
|
+
UserPrecondition
|
|
30
|
+
};
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
{ "category": "preconditions" }
|
|
2
2
|
---
|
|
3
3
|
import { Precondition } from '@sapphire/framework';
|
|
4
|
-
import type { Message } from 'discord.js';
|
|
4
|
+
import type { CommandInteraction, ContextMenuInteraction, Message } from 'discord.js';
|
|
5
5
|
|
|
6
6
|
export class UserPrecondition extends Precondition {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
public override messageRun(message: Message) {
|
|
8
|
+
return this.ok();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public override chatInputRun(interaction: CommandInteraction) {
|
|
12
|
+
return this.ok();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public override contextMenuRun(interaction: ContextMenuInteraction) {
|
|
16
|
+
return this.ok();
|
|
17
|
+
}
|
|
10
18
|
}
|
|
11
19
|
|
|
12
20
|
declare module '@sapphire/framework' {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
21
|
+
interface Preconditions {
|
|
22
|
+
{{name}}: never;
|
|
23
|
+
}
|
|
16
24
|
}
|
|
@@ -3,24 +3,37 @@
|
|
|
3
3
|
const { Command } = require('@sapphire/framework')
|
|
4
4
|
|
|
5
5
|
class UserCommand extends Command {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @param {Command.Context} context
|
|
8
|
+
*/
|
|
9
|
+
constructor(context) {
|
|
10
|
+
super(context, {
|
|
11
|
+
// Any Command options you want here
|
|
9
12
|
name: 'command',
|
|
10
13
|
description: 'A basic slash command'
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
});
|
|
15
|
+
}
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
/**
|
|
18
|
+
* @param {Command.Registry} registry
|
|
19
|
+
*/
|
|
20
|
+
registerApplicationCommands(registry) {
|
|
21
|
+
registry.registerChatInputCommand(
|
|
22
|
+
(builder) =>
|
|
23
|
+
builder //
|
|
24
|
+
.setName(this.name)
|
|
25
|
+
.setDescription(this.description)
|
|
26
|
+
);
|
|
19
27
|
}
|
|
20
28
|
|
|
29
|
+
/**
|
|
30
|
+
* @param {Command.ChatInputInteraction} interaction
|
|
31
|
+
*/
|
|
21
32
|
async chatInputRun(interaction) {
|
|
22
|
-
return await interaction.reply({content:
|
|
33
|
+
return await interaction.reply({ content: 'Hello world!' });
|
|
23
34
|
}
|
|
24
35
|
}
|
|
25
36
|
|
|
26
|
-
exports
|
|
37
|
+
module.exports = {
|
|
38
|
+
UserCommand
|
|
39
|
+
}
|
|
@@ -8,13 +8,14 @@ import { Command } from '@sapphire/framework';
|
|
|
8
8
|
})
|
|
9
9
|
export class UserCommand extends Command {
|
|
10
10
|
public override registerApplicationCommands(registry: Command.Registry) {
|
|
11
|
-
registry.registerChatInputCommand(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
registry.registerChatInputCommand((builder) =>
|
|
12
|
+
builder //
|
|
13
|
+
.setName(this.name)
|
|
14
|
+
.setDescription(this.description)
|
|
15
|
+
);
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
public async chatInputRun(interaction: Command.ChatInputInteraction) {
|
|
18
|
-
return await interaction.reply({content:
|
|
18
|
+
public override async chatInputRun(interaction: Command.ChatInputInteraction) {
|
|
19
|
+
return await interaction.reply({ content: 'Hello world!' });
|
|
19
20
|
}
|
|
20
21
|
}
|
|
@@ -1,63 +1,50 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"required": [
|
|
53
|
-
"enabled",
|
|
54
|
-
"location"
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
"required": [
|
|
59
|
-
"projectLanguage",
|
|
60
|
-
"locations",
|
|
61
|
-
"customFileTemplates"
|
|
62
|
-
]
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Sapphire CLI Config",
|
|
4
|
+
"description": "Scheme for Sapphire CLI Config (@sapphire/cli)",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"projectLanguage": {
|
|
8
|
+
"description": "Project language (ts | js)",
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"locations": {
|
|
12
|
+
"description": "Categories and their locations",
|
|
13
|
+
"type": "object",
|
|
14
|
+
"properties": {
|
|
15
|
+
"base": {
|
|
16
|
+
"type": "string"
|
|
17
|
+
},
|
|
18
|
+
"arguments": {
|
|
19
|
+
"type": "string"
|
|
20
|
+
},
|
|
21
|
+
"commands": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"listeners": {
|
|
25
|
+
"type": "string"
|
|
26
|
+
},
|
|
27
|
+
"preconditions": {
|
|
28
|
+
"type": "string"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"required": ["base", "arguments", "commands", "listeners", "preconditions"]
|
|
32
|
+
},
|
|
33
|
+
"customFileTemplates": {
|
|
34
|
+
"description": "Settings about custom component (piece) templates",
|
|
35
|
+
"type": "object",
|
|
36
|
+
"properties": {
|
|
37
|
+
"enabled": {
|
|
38
|
+
"description": "Enable custom file templates",
|
|
39
|
+
"type": "boolean"
|
|
40
|
+
},
|
|
41
|
+
"location": {
|
|
42
|
+
"description": "Location of your custom file templates",
|
|
43
|
+
"type": "string"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"required": ["enabled", "location"]
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"required": ["projectLanguage", "locations", "customFileTemplates"]
|
|
63
50
|
}
|