| import {execEachPlugin} from "./utils.mjs"; | |||||
| import {execEachPlugin} from './utils.mjs'; | |||||
| // Each plugin should have "prepare" that will also build the plugin | // Each plugin should have "prepare" that will also build the plugin | ||||
| execEachPlugin('npm ci') // install dependencies | execEachPlugin('npm ci') // install dependencies |
| import {execEachPlugin} from "./utils.mjs"; | |||||
| import {execEachPlugin} from './utils.mjs'; | |||||
| const command = process.argv.slice(2).join(' ') | const command = process.argv.slice(2).join(' ') | ||||
| if(!command) throw new Error('Command is required') | if(!command) throw new Error('Command is required') | ||||
| // Each plugin should have "prepare" that will also build the plugin | // Each plugin should have "prepare" that will also build the plugin | ||||
| execEachPlugin(`npm ${command}`) // install dependencies | execEachPlugin(`npm ${command}`) // install dependencies | ||||
| // in nodejs | // in nodejs | ||||
| import {writeFileSync} from "node:fs" | |||||
| import {writeFileSync} from 'node:fs' | |||||
| writeFileSync('src/viewer/version.ts', `export const VERSION = '${process.env.npm_package_version}'\n`) | |||||
| writeFileSync("src/viewer/version.ts", `export const VERSION = '${process.env.npm_package_version}'\n`) |
| import path from "node:path"; | |||||
| import fs from "node:fs"; | |||||
| import {execSync} from "node:child_process"; | |||||
| import path from 'node:path'; | |||||
| import fs from 'node:fs'; | |||||
| import {execSync} from 'node:child_process'; | |||||
| export function loopPluginDirs(callback){ | |||||
| export function loopPluginDirs (callback) { | |||||
| const pathname = new URL(import.meta.url).pathname.replace(/^\/([A-Za-z]:\/)/, '$1') | const pathname = new URL(import.meta.url).pathname.replace(/^\/([A-Za-z]:\/)/, '$1') | ||||
| const __dirname = path.dirname(pathname); | const __dirname = path.dirname(pathname); | ||||
| const pluginsDir = path.resolve(__dirname, '../plugins') | const pluginsDir = path.resolve(__dirname, '../plugins') | ||||
| } | } | ||||
| export function execEachPlugin(command, templates = false){ | |||||
| export function execEachPlugin (command, templates = false) { | |||||
| loopPluginDirs((pluginDir, pluginFolder) => { | loopPluginDirs((pluginDir, pluginFolder) => { | ||||
| if(!templates && pluginFolder.startsWith('plugin-template-')) return; | if(!templates && pluginFolder.startsWith('plugin-template-')) return; | ||||
| console.log(`Executing ${command} in ${pluginDir}`) | console.log(`Executing ${command} in ${pluginDir}`) |