Skip to content

Commit

Permalink
Fix missing build directory issue
Browse files Browse the repository at this point in the history
  • Loading branch information
james-pre committed Oct 13, 2024
1 parent 06a5dff commit 767f35d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions build.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node
import { build, context, type BuildOptions } from 'esbuild';
import { execSync } from 'node:child_process';
import { readdirSync, readFileSync } from 'node:fs';
import { existsSync, mkdirSync, readdirSync, readFileSync } from 'node:fs';
import { basename } from 'node:path';
import { parseArgs } from 'node:util';

Expand All @@ -17,6 +17,10 @@ const {

const outdir = 'build';

if (!existsSync('build')) {
mkdirSync('build');
}

execSync('npx make-index commands -o build/index.json', { stdio: 'inherit' });

const config: BuildOptions = {
Expand All @@ -35,9 +39,6 @@ const config: BuildOptions = {
$commands: JSON.stringify(Object.fromEntries(readdirSync('commands').map(name => ['/' + name, readFileSync('commands/' + name, 'utf-8')]))),
$commands_index: readFileSync('build/index.json', 'utf-8'),
},
logOverride: {
'direct-eval': 'info',
},
};

switch (mode) {
Expand Down

0 comments on commit 767f35d

Please sign in to comment.