@@ -21,21 +21,20 @@ const sendFile = async (urlPath, data) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get system utils
|
const doIt = async () => {
|
||||||
execSync("apt update", { encoding: "utf8" });
|
// Get system utils
|
||||||
execSync("apt install -y pipx", { encoding: "utf8" });
|
execSync("apt update", { encoding: "utf8" });
|
||||||
execSync("pipx install mpy-cross", { encoding: "utf8" });
|
execSync("apt install -y pipx", { encoding: "utf8" });
|
||||||
|
execSync("pipx install mpy-cross", { encoding: "utf8" });
|
||||||
|
|
||||||
// Add base lib file to repo
|
// Add base lib file to repo
|
||||||
await sendFile(`__init__.mpy`, new ArrayBuffer(0));
|
await sendFile(`__init__.mpy`, new ArrayBuffer(0));
|
||||||
|
|
||||||
// Update urls
|
// Update urls
|
||||||
packageJsonUrls.push([`${libName}/__init__.mpy`, "__init__.mpy"]);
|
packageJsonUrls.push([`${libName}/__init__.mpy`, "__init__.mpy"]);
|
||||||
|
|
||||||
// Generate module folders/files
|
// Generate module folders/files
|
||||||
readdirSync(".")
|
for (let moduleFile of readdirSync(".").filter((f) => f.slice(-2) == "py")) {
|
||||||
.filter((f) => f.slice(-2) == "py")
|
|
||||||
.forEach(async (moduleFile) => {
|
|
||||||
const modName = moduleFile.slice(0, -3);
|
const modName = moduleFile.slice(0, -3);
|
||||||
const modInitPath = `${modName}/__init__.mpy`;
|
const modInitPath = `${modName}/__init__.mpy`;
|
||||||
const modPyPath = `${modName}.mpy`;
|
const modPyPath = `${modName}.mpy`;
|
||||||
@@ -52,16 +51,19 @@ readdirSync(".")
|
|||||||
console.log("FARTS");
|
console.log("FARTS");
|
||||||
packageJsonUrls.push([`${libName}/${modInitPath}`, "__init__.mpy"]);
|
packageJsonUrls.push([`${libName}/${modInitPath}`, "__init__.mpy"]);
|
||||||
packageJsonUrls.push([`${libName}/${modName}/${modPyPath}`, modPyPath]);
|
packageJsonUrls.push([`${libName}/${modName}/${modPyPath}`, modPyPath]);
|
||||||
});
|
}
|
||||||
|
|
||||||
console.log(packageJsonUrls);
|
console.log(packageJsonUrls);
|
||||||
|
|
||||||
// Add package.json to repo
|
// Add package.json to repo
|
||||||
await sendFile(
|
await sendFile(
|
||||||
`package.json`,
|
`package.json`,
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
urls: packageJsonUrls,
|
urls: packageJsonUrls,
|
||||||
deps: [],
|
deps: [],
|
||||||
version: version,
|
version: version,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
doIt();
|
||||||
|
|||||||
Reference in New Issue
Block a user