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: {