@sapphire/cli 1.6.0 → 1.6.1-next.0f82665.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/README.md +1 -1
- package/dist/commands/generate.js +10 -7
- package/dist/lib/aliases.js +10 -0
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@ import { load } from 'js-yaml';
|
|
|
9
9
|
import { readFile } from 'node:fs/promises';
|
|
10
10
|
import { basename, join } from 'node:path';
|
|
11
11
|
import { setTimeout as sleep } from 'node:timers/promises';
|
|
12
|
+
import { commandNames, componentCommandNames, componentInteractionHandlerNames, interactionHandlerNames } from 'src/lib/aliases';
|
|
12
13
|
async function createComponent(component, name, config, configLoc) {
|
|
13
14
|
const { projectLanguage } = config;
|
|
14
15
|
if (!projectLanguage) {
|
|
@@ -34,6 +35,10 @@ async function fetchConfig() {
|
|
|
34
35
|
}
|
|
35
36
|
return Promise.race([findUp('.sapphirerc.yml', { cwd: '.' }), sleep(5000)]);
|
|
36
37
|
}
|
|
38
|
+
function joinComponentNames(components) {
|
|
39
|
+
const lastComponent = components.pop();
|
|
40
|
+
return `"${components.join('", "')}" or "${lastComponent}"`;
|
|
41
|
+
}
|
|
37
42
|
/**
|
|
38
43
|
* Parses common hints for the user
|
|
39
44
|
* @param component Component name
|
|
@@ -42,14 +47,12 @@ async function fetchConfig() {
|
|
|
42
47
|
function parseCommonHints(component) {
|
|
43
48
|
const newLine = '\n';
|
|
44
49
|
const lowerCaseComponent = component.toLowerCase();
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
const commonHints = `${newLine}Hint: You wrote "${component}", instead of `;
|
|
51
|
+
if (commandNames.includes(lowerCaseComponent)) {
|
|
52
|
+
return `${commonHints}"${joinComponentNames(componentCommandNames)}".`;
|
|
47
53
|
}
|
|
48
|
-
if (lowerCaseComponent
|
|
49
|
-
|
|
50
|
-
lowerCaseComponent === 'interactionhandler' ||
|
|
51
|
-
lowerCaseComponent === 'interactionhandlers') {
|
|
52
|
-
return `${newLine}Hint: You wrote "${component}", instead of "buttoninteractionhandler", "autocompleteinteractionhandler", "modalinteractionhandler", or "selectmenuinteractionhandler"`;
|
|
54
|
+
if (interactionHandlerNames.includes(lowerCaseComponent)) {
|
|
55
|
+
return `${commonHints} ${joinComponentNames(componentInteractionHandlerNames)}.`;
|
|
53
56
|
}
|
|
54
57
|
return '';
|
|
55
58
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const commandNames = ['command', 'commands'];
|
|
2
|
+
export const componentCommandNames = ['messagecommand', 'slashcommand', 'contextmenucommand'];
|
|
3
|
+
export const interactionHandlerNames = ['interactionhandler', 'interactionhandlers'];
|
|
4
|
+
export const componentInteractionHandlerNames = [
|
|
5
|
+
'buttoninteractionhandler',
|
|
6
|
+
'autocompleteinteractionhandler',
|
|
7
|
+
'modalinteractionhandler',
|
|
8
|
+
'selectmenuinteractionhandler'
|
|
9
|
+
];
|
|
10
|
+
//# sourceMappingURL=aliases.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sapphire/cli",
|
|
3
|
-
"version": "1.6.0",
|
|
3
|
+
"version": "1.6.1-next.0f82665.0",
|
|
4
4
|
"description": "CLI for Sapphire Framework",
|
|
5
5
|
"author": "@sapphire",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@favware/colorette-spinner": "^1.0.1",
|
|
37
|
-
"@sapphire/result": "^2.6.
|
|
38
|
-
"colorette": "^2.0.
|
|
39
|
-
"commander": "^10.0.
|
|
37
|
+
"@sapphire/result": "^2.6.2",
|
|
38
|
+
"colorette": "^2.0.20",
|
|
39
|
+
"commander": "^10.0.1",
|
|
40
40
|
"execa": "^7.1.1",
|
|
41
41
|
"find-up": "^5.0.0",
|
|
42
42
|
"js-yaml": "^4.1.0",
|
|
@@ -44,31 +44,31 @@
|
|
|
44
44
|
"tslib": "^2.5.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@commitlint/cli": "^17.
|
|
48
|
-
"@commitlint/config-conventional": "^17.
|
|
47
|
+
"@commitlint/cli": "^17.6.1",
|
|
48
|
+
"@commitlint/config-conventional": "^17.6.1",
|
|
49
49
|
"@favware/cliff-jumper": "^2.0.0",
|
|
50
50
|
"@favware/npm-deprecate": "^1.0.7",
|
|
51
51
|
"@sapphire/decorators": "*",
|
|
52
|
-
"@sapphire/eslint-config": "^4.4.
|
|
52
|
+
"@sapphire/eslint-config": "^4.4.1",
|
|
53
53
|
"@sapphire/framework": "*",
|
|
54
54
|
"@sapphire/plugin-api": "*",
|
|
55
55
|
"@sapphire/prettier-config": "^1.4.5",
|
|
56
56
|
"@sapphire/ts-config": "^4.0.0",
|
|
57
57
|
"@types/js-yaml": "^4.0.5",
|
|
58
|
-
"@types/node": "^18.
|
|
58
|
+
"@types/node": "^18.16.0",
|
|
59
59
|
"@types/prompts": "^2.4.4",
|
|
60
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
61
|
-
"@typescript-eslint/parser": "^5.
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^5.59.0",
|
|
61
|
+
"@typescript-eslint/parser": "^5.59.0",
|
|
62
62
|
"cz-conventional-changelog": "^3.3.0",
|
|
63
63
|
"discord.js": "*",
|
|
64
|
-
"eslint": "^8.
|
|
64
|
+
"eslint": "^8.39.0",
|
|
65
65
|
"eslint-config-prettier": "^8.8.0",
|
|
66
66
|
"eslint-plugin-prettier": "^4.2.1",
|
|
67
67
|
"globby": "^13.1.4",
|
|
68
68
|
"husky": "^8.0.3",
|
|
69
69
|
"lint-staged": "^13.2.1",
|
|
70
70
|
"pinst": "^3.0.0",
|
|
71
|
-
"prettier": "^2.8.
|
|
71
|
+
"prettier": "^2.8.8",
|
|
72
72
|
"pretty-quick": "^3.1.3",
|
|
73
73
|
"ts-node": "^10.9.1",
|
|
74
74
|
"typescript": "^5.0.4"
|