Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/commandkit/spec/cache.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
import {
cache,
Expand Down
2 changes: 1 addition & 1 deletion packages/commandkit/src/analytics/analytics-engine.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CommandKit } from '../CommandKit';
import { CommandKit } from '../commandkit';
import { Logger } from '../logger/Logger';
import { warnUnstable } from '../utils/warn-unstable';
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/commandkit/src/app/commands/Context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
Guild,
TextBasedChannel,
} from 'discord.js';
import { CommandKit } from '../../CommandKit';
import { CommandKit } from '../../commandkit';
import {
MessageCommandOptions,
MessageCommandParser,
Expand Down
2 changes: 1 addition & 1 deletion packages/commandkit/src/app/events/EventWorkerContext.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AsyncLocalStorage } from 'node:async_hooks';
import { ParsedEvent } from '../router';
import { CommandKit } from '../../CommandKit';
import { CommandKit } from '../../commandkit';

/**
* Context object containing information about the currently executing event.
Expand Down
2 changes: 1 addition & 1 deletion packages/commandkit/src/app/handlers/AppCommandHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Message,
SlashCommandBuilder,
} from 'discord.js';
import type { CommandKit } from '../../CommandKit';
import type { CommandKit } from '../../commandkit';
import { AsyncFunction, GenericFunction } from '../../context/async-context';
import { Logger } from '../../logger/Logger';
import type { CommandData } from '../../types';
Expand Down
2 changes: 1 addition & 1 deletion packages/commandkit/src/app/handlers/AppEventsHandler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Collection } from 'discord.js';
import { CommandKit } from '../../CommandKit';
import { CommandKit } from '../../commandkit';
import { ListenerFunction } from '../../events/CommandKitEventsChannel';
import { Logger } from '../../logger/Logger';
import { toFileURL } from '../../utils/resolve-file-url';
Expand Down
2 changes: 1 addition & 1 deletion packages/commandkit/src/app/register/CommandRegistrar.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ApplicationCommandType, REST, Routes } from 'discord.js';
import { CommandKit } from '../../CommandKit';
import { CommandKit } from '../../commandkit';
import { CommandData } from '../../types';
import { Logger } from '../../logger/Logger';

Expand Down
17 changes: 15 additions & 2 deletions packages/commandkit/src/cli/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface ApplicationBuildOptions {
* @private
* @internal
*/
function mergeDefinitionsIfNeeded(env: Record<string, string>) {
function mergeDefinitionsIfNeeded(env: Record<string, string>, isDev: boolean) {
const values = Object.fromEntries(
Object.entries(process.env).filter(
([k]) => !(k in env) && k.startsWith('COMMANDKIT_PUBLIC_'),
Expand All @@ -36,6 +36,19 @@ function mergeDefinitionsIfNeeded(env: Record<string, string>) {
return {
...env,
...values,
...(isDev
? {
NODE_ENV: 'development',
COMMANDKIT_BOOTSTRAP_MODE: 'development',
COMMANDKIT_IS_DEV: 'true',
COMMANDKIT_IS_TEST: 'false',
}
: {
NODE_ENV: 'production',
COMMANDKIT_BOOTSTRAP_MODE: 'production',
COMMANDKIT_IS_DEV: 'false',
COMMANDKIT_IS_TEST: 'false',
}),
};
}

Expand Down Expand Up @@ -110,7 +123,7 @@ export async function buildApplication({
sourcemap: true,
target: 'node16',
outDir: dest,
env: mergeDefinitionsIfNeeded(config.env || {}),
env: mergeDefinitionsIfNeeded(config.env || {}, !!isDev),
entry: [
'src',
`!${config.distDir}`,
Expand Down
2 changes: 1 addition & 1 deletion packages/commandkit/src/context/async-context.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AsyncLocalStorage } from 'node:async_hooks';
import { CommandKitEnvironment } from './environment';
import { CommandKit } from '../CommandKit';
import { CommandKit } from '../commandkit';
import { isCommandKitError } from '../utils/error-codes';

const kCommandWorker = Symbol('commandkitCommandWorker');
Expand Down
2 changes: 1 addition & 1 deletion packages/commandkit/src/context/environment.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { randomUUID } from 'node:crypto';
import { CommandKit } from '../CommandKit';
import { CommandKit } from '../commandkit';
import { GenericFunction, getContext } from './async-context';
import type { Context } from '../app';

Expand Down
2 changes: 1 addition & 1 deletion packages/commandkit/src/events/CommandKitEventsChannel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import EventEmitter from 'node:events';
import type { CommandKit } from '../CommandKit';
import type { CommandKit } from '../commandkit';
import type { AsyncFunction, GenericFunction } from '../context/async-context';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/commandkit/src/flags/feature-flags.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getCommandKit, getContext } from '../context/async-context';
import { eventWorkerContext } from '../app/events/EventWorkerContext';
import { ParsedEvent } from '../app/router';
import { CommandKit } from '../CommandKit';
import { CommandKit } from '../commandkit';
import {
AutocompleteInteraction,
ChatInputCommandInteraction,
Expand Down
4 changes: 2 additions & 2 deletions packages/commandkit/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CommandKit } from './CommandKit';
import { CommandKit } from './commandkit';

export default CommandKit;

export * from './CommandKit';
export * from './commandkit';
export * from './components';
export * from './config/config';
export * from './context/async-context';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Collection, Constructable } from 'discord.js';
import { CommandKit } from '../../CommandKit';
import { CommandKit } from '../../commandkit';
import { RuntimePlugin } from '../RuntimePlugin';
import {
CommandKitErrorCodes,
Expand Down
2 changes: 1 addition & 1 deletion packages/commandkit/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
Interaction,
RESTPostAPIApplicationCommandsJSONBody,
} from 'discord.js';
import type { CommandKit } from './CommandKit';
import type { CommandKit } from './commandkit';

type Prettify<T> = {
[K in keyof T]: T[K];
Expand Down
2 changes: 1 addition & 1 deletion packages/commandkit/src/utils/dev-hooks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CommandKit } from '../CommandKit';
import type { CommandKit } from '../commandkit';
import { Logger } from '../logger/Logger';
import { COMMANDKIT_IS_DEV, HMREventType } from './constants';

Expand Down