File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11import { REST } from "@discordjs/rest" ;
22import { readdirSync } from "node:fs" ;
33import path from "node:path" ;
4- import { DeleteOptions , DeployOptions } from "./types.js" ;
4+ import { DeleteOptions , DeployOptions } from ".. /types.js" ;
55
66const Routes = {
77 commands : ( appId : string ) : `/${string } ` => {
@@ -33,6 +33,7 @@ export async function deployCommands(
3333 opts : DeployOptions
3434) : Promise < boolean > {
3535 opts . logs = opts . logs ?? true ;
36+ const FILE_EXTENSION = opts . fileExtension ?? ".js" ;
3637 if ( ! opts . appToken || ! opts . appId ) {
3738 throw new Error ( "Missing 'appToken' or 'appId' in 'opts'!" ) ;
3839 }
@@ -41,7 +42,7 @@ export async function deployCommands(
4142 let privateCommands = [ ] ;
4243
4344 const commandFiles = readdirSync ( folderPath ) . filter ( ( file ) =>
44- file . endsWith ( ".js" )
45+ file . endsWith ( FILE_EXTENSION )
4546 ) ;
4647
4748 if ( opts . logs )
Original file line number Diff line number Diff line change 1111 "skipLibCheck" : true ,
1212 "types" : [ " node" ]
1313 },
14- "include" : [ " ./index .ts" ],
15- "exclude" : [ " node_modules" ]
14+ "include" : [ " ./src/**/* .ts" ],
15+ "exclude" : [ " node_modules" , " dist " ]
1616}
Original file line number Diff line number Diff line change @@ -13,6 +13,14 @@ export interface DeployOptions {
1313 * @default true
1414 */
1515 logs ?: boolean ;
16+ /**
17+ * The file extension of the command files to be deployed.
18+ *
19+ * This can be useful in development environments where you might use `tsx` which allows you to use TypeScript files directly.
20+ *
21+ * @default ".js"
22+ */
23+ fileExtension ?: `.${string } `;
1624}
1725
1826export interface DeleteOptions {
You can’t perform that action at this time.
0 commit comments