-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathindex.js
36 lines (30 loc) · 1 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const { readFile } = require("node:fs/promises");
const path = require("node:path");
const { fromPromise } = require("universalify");
const { compile, compileSync } = require("./tasks/compile");
const distDir = "dist";
const clientDevLibFileName = "oc-client.js";
const clientLibFileName = "oc-client.min.js";
const clientMapFileName = "oc-client.min.map";
const version = require("./package.json").version;
function getLib() {
return readFile(path.join(__dirname, distDir, clientLibFileName), "utf-8");
}
async function getLibs() {
const [dev, prod] = await Promise.all([
readFile(path.join(__dirname, distDir, clientDevLibFileName), "utf-8"),
readFile(path.join(__dirname, distDir, clientLibFileName), "utf-8"),
]);
return { dev, prod };
}
function getMap() {
return readFile(path.join(__dirname, distDir, clientMapFileName), "utf8");
}
module.exports = {
compile: fromPromise(compile),
compileSync,
getLib: fromPromise(getLib),
getLibs: fromPromise(getLibs),
getMap: fromPromise(getMap),
version,
};