You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
648 B
JavaScript
17 lines
648 B
JavaScript
11 months ago
|
import * as fs from 'fs';
|
||
|
import path from 'path';
|
||
|
|
||
|
const SRC_DIR = path.resolve('./src');
|
||
|
const DST_DIR = path.resolve('./dist');
|
||
|
|
||
|
const pluginDir = path.resolve(SRC_DIR, 'plugins');
|
||
|
// 遍历plugin文件夹
|
||
|
const pluginPaths = fs.readdirSync(pluginDir);
|
||
|
for (let pluginPath of pluginPaths) {
|
||
|
let pluginIndexFile = path.resolve(pluginDir, pluginPath, 'plugin.yaml');
|
||
|
if (fs.existsSync(pluginIndexFile)) {
|
||
|
// 将plugin.yaml复制到dist/plugin/pluginName/plugin.yaml
|
||
|
let pluginIndexFileDist = path.resolve(DST_DIR, 'plugins', pluginPath, 'plugin.yaml');
|
||
|
fs.copyFileSync(pluginIndexFile, pluginIndexFileDist);
|
||
|
}
|
||
|
}
|