support import_libs

This commit is contained in:
SrGooglo 2024-01-25 00:37:42 +01:00
parent 63f247a5ac
commit 48fea3bc18

View File

@ -1,6 +1,20 @@
import path from "node:path" import path from "node:path"
import os from "node:os" import os from "node:os"
import PublicLibs from "../public_libraries"
async function importLib(libs) {
const libraries = {}
for (const lib of libs) {
if (PublicLibs[lib]) {
libraries[lib] = PublicLibs[lib]
}
}
return libraries
}
export default async (manifest = {}) => { export default async (manifest = {}) => {
const packPath = path.resolve(INSTALLERS_PATH, manifest.id) const packPath = path.resolve(INSTALLERS_PATH, manifest.id)
@ -21,6 +35,11 @@ export default async (manifest = {}) => {
delete manifest.init delete manifest.init
} }
if (Array.isArray(manifest.import_libs)) {
manifest.libraries = await importLib(manifest.import_libs)
console.log(`Imported libraries: ${manifest.import_libs.join(", ")}`)
}
return { return {
...manifest, ...manifest,
packPath: packPath, packPath: packPath,