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
3 changes: 3 additions & 0 deletions apps/test-bot/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Client, Partials } from 'discord.js';
import { Logger, commandkit } from 'commandkit';
import { setDriver } from '@commandkit/tasks';
import { SQLiteDriver } from '@commandkit/tasks/sqlite';
import config from './config.json' with { type: 'json' };

const client = new Client({
intents: [
Expand All @@ -28,4 +29,6 @@ commandkit.setPrefixResolver((message) => {
];
});

console.dir({ importedConfig: config }, { depth: null });

export default client;
6 changes: 6 additions & 0 deletions apps/test-bot/src/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"foo": "bar",
"bar": {
"baz": "qux"
}
}
4 changes: 2 additions & 2 deletions packages/commandkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
"picocolors": "^1.1.1",
"rfdc": "^1.3.1",
"rimraf": "^6.0.0",
"tsdown": "^0.14.2",
"tsdown": "^0.15.2",
"use-macro": "^1.1.0"
},
"devDependencies": {
Expand All @@ -190,4 +190,4 @@
"engines": {
"node": ">=24"
}
}
}
7 changes: 4 additions & 3 deletions packages/commandkit/src/cli/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { existsSync } from 'node:fs';
import { writeFile } from 'node:fs/promises';
import { join } from 'node:path';
import { rimraf } from 'rimraf';
import { build, Options } from 'tsdown';
import type { Options } from 'tsdown';

import { MaybeArray } from '../components';
import { loadConfigFile } from '../config/loader';
import { mergeDeep } from '../config/utils';
import { CompilerPlugin, CompilerPluginRuntime } from '../plugins';
import { COMMANDKIT_CWD } from '../utils/constants';
import { copyLocaleFiles } from './common';
import { copyLocaleFiles, loadTsdown } from './common';
import { devEnvFileArgs, prodEnvFileArgs } from './env';
import { performTypeCheck } from './type-checker';

Expand Down Expand Up @@ -65,6 +65,7 @@ export async function buildApplication({
isDev,
configPath,
}: ApplicationBuildOptions) {
const { build } = await loadTsdown();
const config = await loadConfigFile(configPath);

if (!isDev && !config?.typescript?.ignoreBuildErrors) {
Expand Down Expand Up @@ -118,7 +119,7 @@ export async function buildApplication({
return defaultLog(level, log);
},
moduleTypes: {
'.json': 'js',
'.json': 'json',
'.node': 'binary',
},
},
Expand Down
13 changes: 13 additions & 0 deletions packages/commandkit/src/cli/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { execSync } from 'node:child_process';
import { COMMANDKIT_CWD } from '../utils/constants';

let ts: typeof import('typescript') | undefined;
let tsdown: typeof import('tsdown') | undefined;

/**
* @private
Expand Down Expand Up @@ -234,3 +235,15 @@ export async function copyLocaleFiles(_from: string, _to: string) {
});
}
}

/**
* @private
* @internal
*/
export async function loadTsdown(): Promise<typeof import('tsdown')> {
if (tsdown) return tsdown;

tsdown = await import('tsdown');

return tsdown;
}
Loading
Loading