File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ const isEventSource = (p: string) =>
3636 p . replaceAll ( '\\' , '/' ) . includes ( 'src/app/events' ) ;
3737
3838export async function bootstrapDevelopmentServer ( configPath ?: string ) {
39+ process . env . COMMANDKIT_BOOTSTRAP_MODE = 'development' ;
3940 const start = performance . now ( ) ;
4041 const cwd = configPath || process . cwd ( ) ;
4142 const configPaths = getPossibleConfigPaths ( cwd ) ;
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { isCompilerPlugin } from '../plugins';
88import { createSpinner } from './utils' ;
99
1010export async function bootstrapProductionServer ( configPath ?: string ) {
11+ process . env . COMMANDKIT_BOOTSTRAP_MODE = 'production' ;
1112 const cwd = configPath || process . cwd ( ) ;
1213 const config = await loadConfigFile ( cwd ) ;
1314 const mainFile = join ( config . distDir , 'index.js' ) ;
@@ -22,6 +23,7 @@ export async function bootstrapProductionServer(configPath?: string) {
2223}
2324
2425export async function createProductionBuild ( configPath ?: string ) {
26+ process . env . COMMANDKIT_BOOTSTRAP_MODE = 'production' ;
2527 const cwd = configPath || process . cwd ( ) ;
2628 const config = await loadConfigFile ( cwd ) ;
2729
Original file line number Diff line number Diff line change 11export const COMMANDKIT_CACHE_TAG = Symbol ( 'kCommandKitCacheTag' ) ;
22
3- export const COMMANDKIT_IS_DEV = ! ! process . env . COMMANDKIT_IS_DEV ;
3+ export const COMMANDKIT_IS_DEV = process . env . COMMANDKIT_IS_DEV === 'true' ;
44
55export const COMMANDKIT_IS_TEST = process . env . COMMANDKIT_IS_TEST === 'true' ;
66
7+ export const COMMANDKIT_BOOTSTRAP_MODE = ( process . env
8+ . COMMANDKIT_BOOTSTRAP_MODE || 'development' ) as 'development' | 'production' ;
9+
710/**
811 * Types of Hot Module Replacement events
912 */
Original file line number Diff line number Diff line change 1+ import { Locale } from 'discord.js' ;
2+
3+ export const DISCORD_LOCALES = new Set (
4+ Object . values ( Locale ) . filter ( ( locale ) => ! / ^ \d + / . test ( locale ) ) ,
5+ ) ;
6+
7+ export const COMMAND_METADATA_KEY = '$command' ;
Original file line number Diff line number Diff line change 1+ import type { Locale } from 'discord.js' ;
2+ import type { CommandLocalizationContext } from './i18n' ;
3+ import { useEnvironment } from 'commandkit' ;
4+
5+ /**
6+ * Gets the localization context.
7+ * @param locale The locale to use. Defaults to the detected locale or the default locale.
8+ */
9+ export function locale ( locale ?: Locale ) : CommandLocalizationContext {
10+ const env = useEnvironment ( ) ;
11+ const context = env . context ;
12+
13+ if ( ! context ) {
14+ throw new Error ( 'No localization context found' ) ;
15+ }
16+
17+ return context . locale ( locale ) ;
18+ }
You can’t perform that action at this time.
0 commit comments