Skip to content

Commit

Permalink
Hot fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
greatsquare0 committed Aug 8, 2024
1 parent 6c820df commit f7a4e96
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions build.mjs → build.mts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ await Bun.build({
sourcemap: 'external',
target: 'node',
minify: true,
external: ['smol-toml'],
plugins: [dts()],
external: ['extract-zip', 'node-fetch', 'smol-toml'],
plugins: [dts()],
})


copyFileSync('./config_template.toml', './dist/config_template.toml')
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "module",
"description": "",
"scripts": {
"build": "bun run build.mjs",
"build": "bun run build.mts",
"prepublishOnly": "bun run build"
},
"files": [
Expand Down
7 changes: 6 additions & 1 deletion src/handle_config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { existsSync, copyFileSync, readFileSync } from "node:fs";
import { parse } from "smol-toml";
import { fileURLToPath } from "url";
import { dirname } from "path";

const projectRoot = process.cwd()

Expand All @@ -16,6 +18,9 @@ const handleConfig = () => {

}

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const readConfigFile = () => {
const configRaw = readFileSync(`${projectRoot}/${configFileName}`, 'utf-8')
try {
Expand All @@ -29,7 +34,7 @@ const readConfigFile = () => {

const createConfigFile = () => {
try {
copyFileSync(`${import.meta.dir}/config_template.toml`, `${projectRoot}/${configFileName}`)
copyFileSync(`${__dirname}/config_template.toml`, `${projectRoot}/${configFileName}`)
return
} catch (error) {
throw new Error(`Failed to create the TOML: ${error}`)
Expand Down

0 comments on commit f7a4e96

Please sign in to comment.