Skip to content

Commit ac7219f

Browse files
committed
feat: Improve initialization and update build config
1 parent e7e9daf commit ac7219f

2 files changed

Lines changed: 5 additions & 18 deletions

File tree

src/lib/initialization.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,13 @@
11
import consola from "consola"
2-
import fs from "node:fs/promises"
32
import { FetchError } from "ofetch"
43

5-
import { PATHS } from "~/lib/paths"
4+
import { ensurePaths } from "~/lib/paths"
65
import { tokenService } from "~/lib/token"
76
import { getGitHubUser } from "~/services/github/get-user/service"
87

98
import { getModels } from "../services/copilot/get-models/service"
109
import { getGitHubToken } from "../services/github/get-token/service"
1110

12-
async function initializeAppDirectory(): Promise<void> {
13-
await fs.mkdir(PATHS.APP_DIR, { recursive: true })
14-
try {
15-
await fs.access(PATHS.GITHUB_TOKEN_PATH, fs.constants.W_OK)
16-
} catch {
17-
await fs.writeFile(PATHS.GITHUB_TOKEN_PATH, "")
18-
await fs.chmod(PATHS.GITHUB_TOKEN_PATH, 0o600)
19-
}
20-
}
21-
2211
async function initializeGithubAuthentication(): Promise<void> {
2312
const githubToken = await tokenService.getGithubToken()
2413

@@ -71,7 +60,7 @@ async function logUser() {
7160
}
7261

7362
export async function initializeApp() {
74-
await initializeAppDirectory()
63+
await ensurePaths()
7564
await initializeGithubAuthentication()
7665
await initializeCopilotToken()
7766
await logModelInformation()

tsup.config.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@ export default defineConfig({
44
entry: ["src/main.ts"],
55

66
format: ["esm"],
7-
target: "esnext",
7+
target: "es2022",
88
platform: "node",
99

10-
dts: true,
11-
removeNodeProtocol: false,
12-
sourcemap: true,
13-
shims: true,
10+
minify: true,
1411
clean: true,
12+
removeNodeProtocol: false,
1513

1614
env: {
1715
NODE_ENV: "production",

0 commit comments

Comments
 (0)