summaryrefslogtreecommitdiffhomepage
path: root/js/src/global/index.ts
blob: 1e097f38c2139f469f7b4ea09ce63cf8e1bc4643 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import envpaths from "env-paths";
import fs from "fs/promises";
const paths = envpaths("opencode", {
  suffix: "",
});

await Promise.all([
  fs.mkdir(paths.config, { recursive: true }),
  fs.mkdir(paths.cache, { recursive: true }),
]);

export namespace Global {
  export function config() {
    return paths.config;
  }

  export function cache() {
    return paths.cache;
  }
}