From 6e9280ab7dab6d558bc819ab6aa5348de66885a5 Mon Sep 17 00:00:00 2001 From: Dominik Date: Tue, 22 Oct 2024 11:39:00 +0200 Subject: [PATCH] Update build.js --- scripts/build.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/scripts/build.js b/scripts/build.js index 1d2bdcd..eace58d 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -1,13 +1,14 @@ -const { watch } = require("rollup"); -const path = require("path"); +const { execSync } = require("child_process"); const fs = require("fs"); const os = require("os"); -const nodeResolve = require("@rollup/plugin-node-resolve"); +const path = require("path"); +const { watch } = require("rollup"); const commonjs = require("@rollup/plugin-commonjs"); -const cssom = require("cssom"); -const { js: jsBeautify } = require("js-beautify"); const { default: esBuild } = require("rollup-plugin-esbuild"); const { default: json } = require("@rollup/plugin-json"); +const nodeResolve = require("@rollup/plugin-node-resolve"); +const cssom = require("cssom"); +const { js: jsBeautify } = require("js-beautify"); const NO_PLUGIN_FOLDERS = [".github", "scripts", "Themes"]; @@ -114,6 +115,12 @@ const buildPlugin = (pluginFolder, makeFolder) => { process.exit(1); } + const manifest = require(manifestPath); + if (manifest.dependencies || manifest.devDependencies) { + console.log(`Installing dependencies for ${pluginFolder}...`); + execSync('npm install', { cwd: pluginFolder, stdio: 'inherit' }); + } + const watcher = watch({ input: path.resolve(pluginFolder, fs.readdirSync(pluginFolder).find(e => e.indexOf("index") === 0)), watch: {