diff --git a/packages/ui/certd-server/export-plugin-yaml.js b/packages/ui/certd-server/export-plugin-yaml.js index b5cf0b2f1..ea71e802b 100644 --- a/packages/ui/certd-server/export-plugin-yaml.js +++ b/packages/ui/certd-server/export-plugin-yaml.js @@ -229,8 +229,16 @@ table th:nth-of-type(2) { // setTimeout(() => why(), 100); // 延迟打印原因 async function main(){ await genMetadata() - await genPluginMd() + console.log("genMetadata success") + // 获取args genmd + const args = process.argv.slice(2) + if(!args.includes("docoff")){ + await genPluginMd() + console.log("genPluginMd success") + } process.exit() } + + main() diff --git a/packages/ui/certd-server/package.json b/packages/ui/certd-server/package.json index 1c6e38c1d..732cded83 100644 --- a/packages/ui/certd-server/package.json +++ b/packages/ui/certd-server/package.json @@ -23,11 +23,12 @@ "lint": "mwts check", "lint:fix": "mwts fix", "ci": "npm run cov", - "build_only": "cross-env NODE_ENV=production mwtsc --cleanOutDir --skipLibCheck", + "build-only": "cross-env NODE_ENV=production mwtsc --cleanOutDir --skipLibCheck", "build": "npm run build_only && npm run export-metadata", "export-metadata": "node export-plugin-yaml.js", + "export-metadata-only": "node export-plugin-yaml.js docoff", "dev-build": "echo 1", - "build-on-docker": "node ./before-build.js && npm run build_only", + "build-on-docker": "node ./before-build.js && npm run build-only && npm run export-metadata-only", "up-mw-deps": "npx midway-version -u -w", "heap": "cross-env NODE_ENV=production clinic heapprofiler -- node --optimize-for-size --inspect ./bootstrap.js", "flame": "clinic flame -- node ./bootstrap.js", diff --git a/packages/ui/certd-server/plugin-doc-gen.mjs b/packages/ui/certd-server/plugin-doc-gen.mjs deleted file mode 100644 index f9b885abd..000000000 --- a/packages/ui/certd-server/plugin-doc-gen.mjs +++ /dev/null @@ -1,53 +0,0 @@ -// 扫描目录,列出文件,然后加载为模块 - -import { join } from 'path'; -import fs from 'fs' -import { pathToFileURL } from "node:url"; -import path from 'path' -function scanDir(dir) { - const files = fs.readdirSync(dir); - const result = []; - // 扫描目录及子目录 - for (const file of files) { - if (file.includes("index.js")) { - continue; - } - - const filePath = join(dir, file); - const stat = fs.statSync(filePath); - if (stat.isDirectory()) { - result.push(...scanDir(filePath)); - } else { - if (!file.endsWith(".js")) { - continue; - } - result.push(filePath); - } - } - return result -} - -export default async function loadModules(dir) { - const files = scanDir(dir); - const modules = {} - for (const file of files) { - - try { - // 转换为 file:// URL(Windows 必需) - const moduleUrl = pathToFileURL(file).href - const module = await import(moduleUrl) - - // 如果模块有默认导出,优先使用 - modules[file] = module.default || module - } catch (err) { - console.error(`加载模块 ${file} 失败:`, err) - } - } - return modules; -} - -const modules = await loadModules('./dist/plugins'); - -for (const key in modules) { - console.log(key) -}