Palash Bansal 1年前
コミット
2585c0fb57
コミッターのメールアドレスに関連付けられたアカウントが存在しません
4個のファイルの変更11行の追加9行の削除
  1. 1
    1
      scripts/build-plugins.mjs
  2. 2
    1
      scripts/each-plugin.mjs
  3. 3
    2
      scripts/update-version.mjs
  4. 5
    5
      scripts/utils.mjs

+ 1
- 1
scripts/build-plugins.mjs ファイルの表示

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

+ 2
- 1
scripts/each-plugin.mjs ファイルの表示

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


+ 3
- 2
scripts/update-version.mjs ファイルの表示



// 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`)

+ 5
- 5
scripts/utils.mjs ファイルの表示

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}`)

読み込み中…
キャンセル
保存