android: do not put js file directly
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const crypto = require("crypto");
|
||||
|
||||
async function work() {
|
||||
const imageDts = await fs.promises.readFile("src/image.d.ts", "utf-8");
|
||||
@@ -13,6 +15,24 @@ ${indexDts
|
||||
${imageDts}
|
||||
`;
|
||||
await fs.promises.writeFile("index.d.ts", content);
|
||||
const files = [
|
||||
"bundle/doric-lib.js",
|
||||
"bundle/doric-sandbox.js",
|
||||
"bundle/doric-web.js",
|
||||
"bundle/doric-web.html",
|
||||
];
|
||||
const androidAssets = "../doric-android/doric/src/main/assets";
|
||||
for (let file of files) {
|
||||
const md5 = crypto.createHash("md5");
|
||||
md5.update(path.basename(file));
|
||||
const name = md5.digest("hex").toLowerCase();
|
||||
const data = await fs.promises.readFile(file);
|
||||
const temp = new Uint8Array(data.buffer);
|
||||
for (let i = 0; i < temp.length; i++) {
|
||||
temp[i] = 0xff - temp[i];
|
||||
}
|
||||
await fs.promises.writeFile(path.resolve(androidAssets, name), data);
|
||||
}
|
||||
}
|
||||
|
||||
work();
|
||||
|
Reference in New Issue
Block a user