Files
yaak/scripts/copy-plugins.cjs
Gregory Schier 748d956eb0 Fix directory
2024-07-19 14:01:21 -07:00

19 lines
749 B
JavaScript

const {readdirSync, cpSync} = require("node:fs");
const path = require("node:path");
console.log('-----> Starting copy plugins script');
const PLUGINS_DIR = process.env.YAAK_PLUGINS_DIR;
if (!PLUGINS_DIR) {
console.log("YAAK_PLUGINS_DIR is not set");
process.exit(1);
}
const pluginsRoot = path.join(PLUGINS_DIR, 'plugins');
for (const name of readdirSync(pluginsRoot)) {
const dir = path.join(pluginsRoot, name);
if (name.startsWith('.')) continue;
const destDir = path.join(__dirname, '../src-tauri/vendored/plugins/', name);
console.log(`Copying ${name} to ${destDir}`);
cpSync(path.join(dir, 'package.json'), path.join(destDir, 'package.json'));
cpSync(path.join(dir, 'build/index.js'), path.join(destDir, 'build/index.js'));
}