1
mirror of https://github.com/thepeacockproject/Peacock synced 2025-03-01 14:43:02 +01:00

Added dynamic external package detection for plugin compilation

This commit is contained in:
Lennard Fonteijn 2023-04-17 00:15:52 +02:00 committed by Lennard Fonteijn
parent 4551059a53
commit 606b84b0cc
3 changed files with 6 additions and 18 deletions

@ -18,7 +18,6 @@
import { existsSync, readdirSync, readFileSync } from "fs"
import { readdir, readFile, writeFile } from "fs/promises"
import * as atomically from "atomically"
import { join } from "path"
import {
generateUserCentric,
@ -53,8 +52,6 @@ import {
} from "./configSwizzleManager"
import { log, LogLevel } from "./loggingInterop"
import * as axios from "axios"
import * as ini from "js-ini"
import * as statemachineParser from "@peacockproject/statemachine-parser"
import {
addDashesToPublicId,
fastClone,
@ -185,13 +182,6 @@ export const featuredContractGroups: string[][] = [
],
]
const peacockRequireTable = {
"@peacockproject/statemachine-parser": statemachineParser,
axios,
ini,
atomically,
}
/**
* A binding of the virtual require function that displays the problematic plugin's name.
*
@ -204,12 +194,6 @@ function createPeacockRequire(pluginName: string): NodeRequire {
* @param specifier The requested module.
*/
const peacockRequire: NodeRequire = (specifier: string) => {
if (
Object.prototype.hasOwnProperty.call(peacockRequireTable, specifier)
) {
return peacockRequireTable[specifier]
}
if (
Object.prototype.hasOwnProperty.call(
generatedPeacockRequireTable,

@ -10,7 +10,7 @@
"prettier": "pprettier --write \"**/*.{js,json,ts,md,tsx,css,mjs,html}\"",
"prettier:check": "pprettier --check \"**/*.{js,json,ts,md,tsx,css,mjs,html}\"",
"build": "yarn webui:build && node packaging/build.mjs",
"build-plugins": "node packaging/buildPlugins.mjs",
"build-plugins": "node --no-warnings packaging/buildPlugins.mjs",
"typecheck-ws": "tsc",
"typecheck": "yarn workspaces foreach -A run typecheck-ws",
"lint": "eslint --format=pretty .",

@ -18,6 +18,7 @@
import * as e from "esbuild"
import glob from "glob"
import packageJson from "../package.json" assert { type: "json" }
const plugins = glob.sync("plugins/*.plugin.ts", {
cwd: ".",
@ -29,5 +30,8 @@ await e.build({
outdir: "plugins",
platform: "node",
target: "es2021",
external: ["@peacockproject/core"],
external: [
"@peacockproject/core",
...Object.keys(packageJson.dependencies),
],
})