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:
parent
4551059a53
commit
606b84b0cc
@ -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),
|
||||
],
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user