-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild-post.ts
More file actions
28 lines (23 loc) · 757 Bytes
/
build-post.ts
File metadata and controls
28 lines (23 loc) · 757 Bytes
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
import { exists, copyFile, mkdir, rename, readdir } from "fs";
import { promisify } from "util";
function logErr(e: Error | string) {
console.error(e);
}
async function postBuild() {
try {
const pathExists = await promisify(exists)("dist/types");
if (!pathExists) {
await promisify(mkdir)("dist/types");
}
const files = await promisify(readdir)("dist");
files.forEach(async (fileName) => {
if (fileName.endsWith(".d.ts")) {
await promisify(rename)(`dist/${fileName}`, `dist/types/${fileName}`);
}
});
await promisify(copyFile)("src/typings.d.ts", "dist/typings.d.ts");
} catch (e) {
logErr(e as Error);
}
}
postBuild();