-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from m1-dev/master
feat: create-commandkit typescript template
- Loading branch information
Showing
18 changed files
with
264 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export type Language = 'js'; | ||
export type Language = 'js' | 'ts'; | ||
export type PackageManager = 'npm' | 'pnpm' | 'yarn'; | ||
export type ModuleType = 'esm' | 'cjs'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/create-commandkit/templates/TypeScript/cjs/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# dependencies | ||
node_modules | ||
|
||
# build output | ||
build | ||
out | ||
dist | ||
|
||
# commandkit | ||
.commandkit | ||
|
||
# env | ||
**/*.env* | ||
!**/*.env.example* | ||
|
||
# logging | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
.pnpm-debug.log* | ||
|
||
# yarn v2+ | ||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
|
||
# other | ||
**/*.DS_Store |
10 changes: 10 additions & 0 deletions
10
packages/create-commandkit/templates/TypeScript/cjs/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Welcome to CommandKit | ||
|
||
> This project was generated by [create-commandkit](https://npmjs.com/package/create-commandkit). | ||
Thanks for choosing CommandKit to build your Discord bot! | ||
|
||
## Useful links | ||
|
||
- [Documentation](https://commandkit.js.org) | ||
- [Discord](https://ctrl.lol/discord) |
6 changes: 6 additions & 0 deletions
6
packages/create-commandkit/templates/TypeScript/cjs/commandkit.cjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const { defineConfig } = require('commandkit'); | ||
|
||
module.exports = defineConfig({ | ||
src: 'src', | ||
main: 'index.js', | ||
}); |
14 changes: 14 additions & 0 deletions
14
packages/create-commandkit/templates/TypeScript/cjs/src/commands/General/ping.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { CommandData, SlashCommandProps, CommandOptions } from 'commandkit'; | ||
|
||
export const data: CommandData = { | ||
name: 'ping', | ||
description: 'Replies with Pong', | ||
}; | ||
|
||
export const run = ({ interaction }: SlashCommandProps) => { | ||
interaction.reply('Pong!'); | ||
}; | ||
|
||
export const options: CommandOptions = { | ||
// https://commandkit.js.org/typedef/CommandOptions | ||
}; |
5 changes: 5 additions & 0 deletions
5
packages/create-commandkit/templates/TypeScript/cjs/src/events/ready/ready.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type { Client } from 'discord.js'; | ||
|
||
export default (client: Client<true>) => { | ||
console.log(`${client.user.tag} is online!`); | ||
}; |
22 changes: 22 additions & 0 deletions
22
packages/create-commandkit/templates/TypeScript/cjs/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import 'dotenv/config'; | ||
|
||
import { Client, IntentsBitField } from 'discord.js'; | ||
import { CommandKit } from 'commandkit'; | ||
import { join } from 'node:path'; | ||
|
||
const client = new Client({ | ||
intents: [ | ||
IntentsBitField.Flags.Guilds, | ||
IntentsBitField.Flags.GuildMembers, | ||
IntentsBitField.Flags.GuildMessages, | ||
IntentsBitField.Flags.MessageContent, | ||
], | ||
}); | ||
|
||
new CommandKit({ | ||
client, | ||
eventsPath: join(__dirname, 'events'), | ||
commandsPath: join(__dirname, 'commands'), | ||
}); | ||
|
||
client.login(process.env.TOKEN); |
20 changes: 20 additions & 0 deletions
20
packages/create-commandkit/templates/TypeScript/cjs/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/tsconfig", | ||
"compilerOptions": { | ||
"lib": ["ES2022"], | ||
"target": "ES2022", | ||
"moduleResolution": "Bundler", | ||
"module": "ES2022", | ||
"esModuleInterop": true, | ||
"resolveJsonModule": true, | ||
"skipLibCheck": true, | ||
"noUncheckedIndexedAccess": true, | ||
"removeComments": true, | ||
"allowJs": true, | ||
"strict": true, | ||
"noEmit": true, | ||
"declaration": false | ||
}, | ||
"include": ["src"], | ||
"exclude": ["dist", "node_modules", ".commandkit"] | ||
} |
33 changes: 33 additions & 0 deletions
33
packages/create-commandkit/templates/TypeScript/esm/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# dependencies | ||
node_modules | ||
|
||
# build output | ||
build | ||
out | ||
dist | ||
|
||
# commandkit | ||
.commandkit | ||
|
||
# env | ||
**/*.env* | ||
!**/*.env.example* | ||
|
||
# logging | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
.pnpm-debug.log* | ||
|
||
# yarn v2+ | ||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
|
||
# other | ||
**/*.DS_Store |
10 changes: 10 additions & 0 deletions
10
packages/create-commandkit/templates/TypeScript/esm/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Welcome to CommandKit | ||
|
||
> This project was generated by [create-commandkit](https://npmjs.com/package/create-commandkit). | ||
Thanks for choosing CommandKit to build your Discord bot! | ||
|
||
## Useful links | ||
|
||
- [Documentation](https://commandkit.js.org) | ||
- [Discord](https://ctrl.lol/discord) |
6 changes: 6 additions & 0 deletions
6
packages/create-commandkit/templates/TypeScript/esm/commandkit.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { defineConfig } from 'commandkit'; | ||
|
||
export default defineConfig({ | ||
src: 'src', | ||
main: 'index.js', | ||
}); |
14 changes: 14 additions & 0 deletions
14
packages/create-commandkit/templates/TypeScript/esm/src/commands/General/ping.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { CommandData, SlashCommandProps, CommandOptions } from 'commandkit'; | ||
|
||
export const data: CommandData = { | ||
name: 'ping', | ||
description: 'Replies with Pong', | ||
}; | ||
|
||
export const run = ({ interaction }: SlashCommandProps) => { | ||
interaction.reply('Pong!'); | ||
}; | ||
|
||
export const options: CommandOptions = { | ||
// https://commandkit.js.org/typedef/CommandOptions | ||
}; |
5 changes: 5 additions & 0 deletions
5
packages/create-commandkit/templates/TypeScript/esm/src/events/ready/ready.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type { Client } from 'discord.js'; | ||
|
||
export default (client: Client<true>) => { | ||
console.log(`${client.user.tag} is online!`); | ||
}; |
26 changes: 26 additions & 0 deletions
26
packages/create-commandkit/templates/TypeScript/esm/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import 'dotenv/config'; | ||
|
||
import { Client, IntentsBitField } from 'discord.js'; | ||
import { CommandKit } from 'commandkit'; | ||
|
||
import { join, dirname } from 'node:path'; | ||
import { fileURLToPath } from 'node:url'; | ||
|
||
const __dirname = dirname(fileURLToPath(import.meta.url)); | ||
|
||
const client = new Client({ | ||
intents: [ | ||
IntentsBitField.Flags.Guilds, | ||
IntentsBitField.Flags.GuildMembers, | ||
IntentsBitField.Flags.GuildMessages, | ||
IntentsBitField.Flags.MessageContent, | ||
], | ||
}); | ||
|
||
new CommandKit({ | ||
client, | ||
eventsPath: join(__dirname, 'events'), | ||
commandsPath: join(__dirname, 'commands'), | ||
}); | ||
|
||
client.login(process.env.TOKEN); |
20 changes: 20 additions & 0 deletions
20
packages/create-commandkit/templates/TypeScript/esm/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/tsconfig", | ||
"compilerOptions": { | ||
"lib": ["ES2022"], | ||
"target": "ES2022", | ||
"moduleResolution": "Bundler", | ||
"module": "ES2022", | ||
"esModuleInterop": true, | ||
"resolveJsonModule": true, | ||
"skipLibCheck": true, | ||
"noUncheckedIndexedAccess": true, | ||
"removeComments": true, | ||
"allowJs": true, | ||
"strict": true, | ||
"noEmit": true, | ||
"declaration": false | ||
}, | ||
"include": ["src"], | ||
"exclude": ["dist", "node_modules", ".commandkit"] | ||
} |