@sapphire/cli 1.3.2-next.f854841.0 → 1.4.0-next.6944f40.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.
@@ -27,9 +27,16 @@ async function installDeps(location, pm, verbose) {
27
27
  if (value.exitCode !== 0) {
28
28
  throw new Error('An unknown error occurred while installing the dependencies. Try running Sapphire CLI with "--verbose" flag.');
29
29
  }
30
- const oppositeLockfile = `./${location}/${pm === 'npm' ? 'yarn.lock' : 'package-lock.json'}`;
31
- if (await fileExists(oppositeLockfile)) {
32
- await rm(oppositeLockfile);
30
+ const oppositeLockfiles = {
31
+ npm: ['yarn.lock', 'pnpm-lock.yaml'],
32
+ yarn: ['package-lock.json', 'pnpm-lock.yaml'],
33
+ pnpm: ['package-lock.json', 'yarn.lock']
34
+ };
35
+ const lockfiles = pm === 'npm' ? oppositeLockfiles.npm : pm === 'Yarn' ? oppositeLockfiles.yarn : oppositeLockfiles.pnpm;
36
+ for (const lockfile of lockfiles) {
37
+ if (await fileExists(lockfile)) {
38
+ await rm(lockfile);
39
+ }
33
40
  }
34
41
  return true;
35
42
  }
@@ -83,7 +90,7 @@ async function cloneRepo(location, verbose) {
83
90
  return true;
84
91
  }
85
92
  export default async (name, flags) => {
86
- const response = await prompts(PromptNew(name, await CommandExists('yarn')));
93
+ const response = await prompts(PromptNew(name, await CommandExists('yarn'), await CommandExists('pnpm')));
87
94
  if (!response.projectName || !response.projectLang || !response.projectTemplate || !response.packageManager) {
88
95
  process.exit(1);
89
96
  }
@@ -98,6 +105,9 @@ export default async (name, flags) => {
98
105
  language: response.projectLang
99
106
  });
100
107
  await editPackageJson(response.projectName, projectName);
108
+ if (response.packageManager === 'pnpm') {
109
+ await writeFile(`./${response.projectName}/.npmrc`, '# pnpm only\nshamefully-hoist=true\npublic-hoist-pattern[]=@sapphire/*');
110
+ }
101
111
  };
102
112
  const jobs = [
103
113
  [() => cloneRepo(response.projectName, flags.verbose), 'Cloning the repository'],
@@ -8,13 +8,18 @@ const jsTemplates = [
8
8
  { title: 'with ESM (Recommended)', value: 'with-esm' },
9
9
  { title: 'with CommonJS', value: 'with-javascript' }
10
10
  ];
11
- export const PromptNew = (projectName, yarn) => {
11
+ export const PromptNew = (projectName, yarn, pnpm) => {
12
12
  const pmChoices = [
13
13
  {
14
14
  title: `Yarn (Recommended) ${yarn ? '' : '(Not installed)'}`,
15
15
  value: 'Yarn',
16
16
  disabled: !yarn
17
17
  },
18
+ {
19
+ title: `pnpm ${pnpm ? '' : '(Not Installed)'}`,
20
+ value: 'pnpm',
21
+ disabled: !pnpm
22
+ },
18
23
  { title: 'npm', value: 'npm' }
19
24
  ];
20
25
  return [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapphire/cli",
3
- "version": "1.3.2-next.f854841.0",
3
+ "version": "1.4.0-next.6944f40.0",
4
4
  "description": "CLI for Sapphire Framework",
5
5
  "author": "@sapphire",
6
6
  "license": "MIT",
@@ -41,38 +41,38 @@
41
41
  "@favware/colorette-spinner": "^1.0.1",
42
42
  "@sapphire/result": "^2.6.0",
43
43
  "colorette": "^2.0.19",
44
- "commander": "^9.4.1",
44
+ "commander": "^9.5.0",
45
45
  "execa": "^6.1.0",
46
46
  "find-up": "^5.0.0",
47
47
  "js-yaml": "^4.1.0",
48
48
  "prompts": "^2.4.2",
49
- "tslib": "^2.4.0"
49
+ "tslib": "^2.4.1"
50
50
  },
51
51
  "devDependencies": {
52
- "@commitlint/cli": "^17.1.2",
53
- "@commitlint/config-conventional": "^17.1.0",
54
- "@favware/cliff-jumper": "^1.8.8",
55
- "@favware/npm-deprecate": "^1.0.5",
52
+ "@commitlint/cli": "^17.4.0",
53
+ "@commitlint/config-conventional": "^17.4.0",
54
+ "@favware/cliff-jumper": "^1.9.0",
55
+ "@favware/npm-deprecate": "^1.0.7",
56
56
  "@sapphire/eslint-config": "^4.3.8",
57
57
  "@sapphire/prettier-config": "^1.4.4",
58
58
  "@sapphire/ts-config": "^3.3.4",
59
59
  "@types/js-yaml": "^4.0.5",
60
- "@types/node": "^18.7.15",
61
- "@types/prompts": "^2.4.1",
62
- "@typescript-eslint/eslint-plugin": "^5.40.1",
63
- "@typescript-eslint/parser": "^5.40.1",
60
+ "@types/node": "^18.11.18",
61
+ "@types/prompts": "^2.4.2",
62
+ "@typescript-eslint/eslint-plugin": "^5.48.0",
63
+ "@typescript-eslint/parser": "^5.48.0",
64
64
  "cz-conventional-changelog": "^3.3.0",
65
- "eslint": "^8.26.0",
66
- "eslint-config-prettier": "^8.5.0",
65
+ "eslint": "^8.31.0",
66
+ "eslint-config-prettier": "^8.6.0",
67
67
  "eslint-plugin-prettier": "^4.2.1",
68
- "globby": "^13.1.2",
69
- "husky": "^8.0.1",
70
- "lint-staged": "^13.0.3",
68
+ "globby": "^13.1.3",
69
+ "husky": "^8.0.3",
70
+ "lint-staged": "^13.1.0",
71
71
  "pinst": "^3.0.0",
72
- "prettier": "^2.7.1",
72
+ "prettier": "^2.8.2",
73
73
  "pretty-quick": "^3.1.3",
74
74
  "ts-node": "^10.9.1",
75
- "typescript": "^4.8.4"
75
+ "typescript": "^4.9.4"
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.4"
120
+ "packageManager": "yarn@3.3.1"
121
121
  }
@@ -26,10 +26,10 @@ class UserCommand extends Command {
26
26
  }
27
27
 
28
28
  /**
29
- * @param {Command.ContextMenuInteraction} interaction
29
+ * @param {Command.ContextMenuCommandInteraction} interaction
30
30
  */
31
31
  async contextMenuRun(interaction) {
32
- return await interaction.reply({ content: 'Hello world!' });
32
+ return interaction.reply({ content: 'Hello world!' });
33
33
  }
34
34
  }
35
35
 
@@ -16,7 +16,7 @@ export class UserCommand extends Command {
16
16
  );
17
17
  }
18
18
 
19
- public async contextMenuRun(interaction: Command.ContextMenuInteraction) {
20
- return await interaction.reply({ content: 'Hello world!' });
19
+ public async contextMenuRun(interaction: Command.ContextMenuCommandInteraction) {
20
+ return interaction.reply({ content: 'Hello world!' });
21
21
  }
22
22
  }
@@ -11,14 +11,14 @@ class UserPrecondition extends Precondition {
11
11
  }
12
12
 
13
13
  /**
14
- * @param {import('discord.js').CommandInteraction} interaction
14
+ * @param {import('discord.js').ChatInputCommandInteraction} interaction
15
15
  */
16
16
  chatInputRun(interaction) {
17
17
  return this.ok();
18
18
  }
19
19
 
20
20
  /**
21
- * @param {import('discord.js').ContextMenuInteraction} interaction
21
+ * @param {import('discord.js').ContextMenuCommandInteraction} interaction
22
22
  */
23
23
  contextMenuRun(interaction) {
24
24
  return this.ok();
@@ -1,18 +1,18 @@
1
1
  { "category": "preconditions" }
2
2
  ---
3
3
  import { Precondition } from '@sapphire/framework';
4
- import type { CommandInteraction, ContextMenuInteraction, Message } from 'discord.js';
4
+ import type { ChatInputCommandInteraction, ContextMenuCommandInteraction, Message } from 'discord.js';
5
5
 
6
6
  export class UserPrecondition extends Precondition {
7
7
  public override messageRun(message: Message) {
8
8
  return this.ok();
9
9
  }
10
10
 
11
- public override chatInputRun(interaction: CommandInteraction) {
11
+ public override chatInputRun(interaction: ChatInputCommandInteraction) {
12
12
  return this.ok();
13
13
  }
14
14
 
15
- public override contextMenuRun(interaction: ContextMenuInteraction) {
15
+ public override contextMenuRun(interaction: ContextMenuCommandInteraction) {
16
16
  return this.ok();
17
17
  }
18
18
  }
@@ -27,10 +27,10 @@ class UserCommand extends Command {
27
27
  }
28
28
 
29
29
  /**
30
- * @param {Command.ChatInputInteraction} interaction
30
+ * @param {Command.ChatInputCommandInteraction} interaction
31
31
  */
32
32
  async chatInputRun(interaction) {
33
- return await interaction.reply({ content: 'Hello world!' });
33
+ return interaction.reply({ content: 'Hello world!' });
34
34
  }
35
35
  }
36
36
 
@@ -15,7 +15,7 @@ export class UserCommand extends Command {
15
15
  );
16
16
  }
17
17
 
18
- public override async chatInputRun(interaction: Command.ChatInputInteraction) {
19
- return await interaction.reply({ content: 'Hello world!' });
18
+ public override async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
19
+ return interaction.reply({ content: 'Hello world!' });
20
20
  }
21
21
  }