Skip to content

Commit

Permalink
chore: some fixes (#5)
Browse files Browse the repository at this point in the history
* chore: rename `.cliff.toml` to `cliff.toml`

* chore: Update eslint and prettier configurations, and add sapphire eslint config

* chore: format with prettier

* chore: Fix formatting issue in index.ts

* chore: remove old tsconfig

---------

Co-authored-by: fearandesire <63979371+fearandesire@users.noreply.github.com>
  • Loading branch information
swiizyy and fearandesire authored Jun 28, 2024
1 parent e0811a8 commit e7cd9df
Show file tree
Hide file tree
Showing 7 changed files with 421 additions and 78 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"**/.yarn": true,
"**/dist/": true,
"**/.git/": true
},
}
}
2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ nodeLinker: node-modules
plugins:
- checksum: f8ce3a541a57481f6213647cfe7ac8555d87cb1fc23a73a102e64e12be07f603826d822f4d0285333400f0f15baed92510c33dcce75dde2953b2811e36efa012
path: .yarn/plugins/@yarnpkg/plugin-git-hooks.cjs
spec: "https://raw.githubusercontent.com/trufflehq/yarn-plugin-git-hooks/main/bundles/%40yarnpkg/plugin-git-hooks.js"
spec: 'https://raw.githubusercontent.com/trufflehq/yarn-plugin-git-hooks/main/bundles/%40yarnpkg/plugin-git-hooks.js'

yarnPath: .yarn/releases/yarn-4.3.1.cjs
101 changes: 48 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@

## Table of Contents

- [Table of Contents](#table-of-contents)
- [Description](#description)
- [Features](#features)
- [Usage](#usage)
- [Global Options](#global-options)
- [Commands](#commands)
- [Conversion Exemples](#conversion-exemples)
- [Input](#input)
- [Output](#output)
- [Contributors](#contributors)
- [Table of Contents](#table-of-contents)
- [Description](#description)
- [Features](#features)
- [Usage](#usage)
- [Global Options](#global-options)
- [Commands](#commands)
- [Conversion Exemples](#conversion-exemples)
- [Input](#input)
- [Output](#output)
- [Contributors](#contributors)

## Description

Expand All @@ -34,10 +34,10 @@ This CLI tool is designed to convert Sapphire Framework command files from JavaS

[Back to top][toc]

- Convert a single command file
- Convert all command files within a directory
- Replace original JS command file(s) with converted TypeScript files
- Overwrite existing TS file
- Convert a single command file
- Convert all command files within a directory
- Replace original JS command file(s) with converted TypeScript files
- Overwrite existing TS file

## Usage

Expand All @@ -63,13 +63,13 @@ npx saph-convert cdir <directory> [ouptutDirectory] [options]

### Global Options

- `-o, --overwrite`: Overwrite existing TypeScript file(s) if they exist. Default: Enable.
- `-r, --replace`: Replace original JavaScript file(s) with converted TypeScript file(s). Default: Enable.
- `-o, --overwrite`: Overwrite existing TypeScript file(s) if they exist. Default: Enable.
- `-r, --replace`: Replace original JavaScript file(s) with converted TypeScript file(s). Default: Enable.

### Commands

- `cf <file> [ouptutDirectory] [options]`: Convert a single file.
- `cdir <directory> [ouptutDirectory] [options]`: Convert all files in a directory.
- `cf <file> [ouptutDirectory] [options]`: Convert a single file.
- `cdir <directory> [ouptutDirectory] [options]`: Convert all files in a directory.

## Conversion Exemples

Expand All @@ -89,31 +89,29 @@ npx saph-convert cdir ./commands
const { ApplicationCommandRegistry, Command } = require('@sapphire/framework');

module.exports = class UserCommand extends Command {
/*
* @param {Command.LoaderContext} registry
*/
constructor(context) {
super(context, {
name: 'ping',
description: 'Ping the bot to check if it is alive.',
});
}

/**
* @param {ApplicationCommandRegistry} registry
*/
registerApplicationCommands(registry) {
registry.registerChatInputCommand((builder) =>
builder.setName(this.name).setDescription(this.description)
);
}

/**
* @param {Command.ChatInputCommandInteraction} interaction
*/
async chatInputRun(interaction) {
return interaction.reply('Pong!');
}
/*
* @param {Command.LoaderContext} registry
*/
constructor(context) {
super(context, {
name: 'ping',
description: 'Ping the bot to check if it is alive.'
});
}

/**
* @param {ApplicationCommandRegistry} registry
*/
registerApplicationCommands(registry) {
registry.registerChatInputCommand((builder) => builder.setName(this.name).setDescription(this.description));
}

/**
* @param {Command.ChatInputCommandInteraction} interaction
*/
async chatInputRun(interaction) {
return interaction.reply('Pong!');
}
};
```

Expand All @@ -126,16 +124,13 @@ import { ApplyOptions } from '@sapphire/decorators';

@ApplyOptions<Command.Options>({ description: 'Ping the bot to check if it is alive.' })
export class UserCommand extends Command {

public override registerApplicationCommands(registry: ApplicationCommandRegistry) {
registry.registerChatInputCommand((builder) =>
builder.setName(this.name).setDescription(this.description)
);
}

public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
return interaction.reply('Pong!');
}
public override registerApplicationCommands(registry: ApplicationCommandRegistry) {
registry.registerChatInputCommand((builder) => builder.setName(this.name).setDescription(this.description));
}

public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
return interaction.reply('Pong!');
}
}
```

Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@
"publishConfig": {
"access": "public"
},
"eslintConfig": {
"extends": "@sapphire"
},
"prettier": "@sapphire/prettier-config",
"packageManager": "yarn@4.3.1"
}
Loading

0 comments on commit e7cd9df

Please sign in to comment.