-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathpre_build.js
44 lines (37 loc) · 1.47 KB
/
pre_build.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
37
38
39
40
41
42
43
44
// https://github.com/Chia-Mine/clvm-js/blob/main/pre_build.js
const path = require("path");
const fs = require("fs");
// clean and create output dir
const distDir = path.join(__dirname, "dist");
if(fs.existsSync(distDir)){
fs.rmdirSync(distDir, {recursive: true});
}
fs.mkdirSync(distDir);
// Copy wasm file
// const browserDir = path.join(distNpmDir, "browser");
// if(fs.existsSync(browserDir)){
// fs.rmdirSync(browserDir, {recursive: true});
// }
// fs.mkdirSync(browserDir);
// const blsWasmSrcPath = path.join(__dirname, "node_modules", "@chiamine", "bls-signatures", "blsjs.wasm");
// const blsWasmDestPath = path.join(browserDir, "blsjs.wasm");
// if(!fs.existsSync(blsWasmSrcPath)){
// console.error("blsjs.wasm not found at:");
// console.error(blsWasmSrcPath);
// console.error("Probably you haven't execute npm install yet");
// return;
// }
// fs.copyFileSync(blsWasmSrcPath, blsWasmDestPath);
// const browserDtsPath = path.join(browserDir, "index.d.ts");
// fs.writeFileSync(browserDtsPath, 'export * from "..";\n');
// const packageJson = require("./package.json");
// fs.writeFileSync(path.join(distNpmDir, "package.json"), JSON.stringify(packageJson, null, 2));
// function copyFileToPublish(fileName){
// const srcPath = path.join(__dirname, fileName);
// const distPath = path.join(distDir, fileName);
// if(fs.existsSync(srcPath)){
// fs.copyFileSync(srcPath, distPath);
// }
// }
// copyFileToPublish("LICENSE");
// copyFileToPublish("README.md");