Skip to content

Commit

Permalink
ディレクトリ別コピー
Browse files Browse the repository at this point in the history
  • Loading branch information
elleonard committed Sep 17, 2023
1 parent 3081bf5 commit eedc751
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions scripts/copyToProject/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ const path = require('path');
const cpx = require('cpx');
const YAML = require('yaml');

const srcPluginDirs = fs.readdirSync(path.join(__dirname, '..', '..', '_dist'))
.map(dir => path.join(__dirname, '..', '..', '_dist', dir, 'DarkPlasma_*.js'));
console.log(srcPluginDirs);
const srcPluginDirsRelative = fs.readdirSync(path.join(__dirname, '..', '..', '_dist'));
console.log(srcPluginDirsRelative);
const isWatch = process.argv.some((n) => n === '-w');

function loadConfig(configPath) {
Expand All @@ -24,11 +23,22 @@ config.projectDirs
.map((projectDir) => path.resolve(projectDir))
.forEach((projectDir) => {
try {
const distDir = path.join(projectDir, 'js', 'plugins');
if (isWatch) {
srcPluginDirs.forEach((srcPlugins) => cpx.watch(srcPlugins, distDir));
srcPluginDirsRelative.forEach((dir) => {
const srcPlugins = path.join(__dirname, '..', '..', '_dist', dir, 'DarkPlasma_*.js');
const distDir = dir === 'codes' || dir === 'excludes'
? path.join(projectDir, 'js', 'plugins')
: path.join(projectDir, 'js', 'plugins', dir);
cpx.watch(srcPlugins, distDir);
});
} else {
srcPluginDirs.forEach((srcPlugins) => cpx.copy(srcPlugins, distDir));
srcPluginDirsRelative.forEach((dir) => {
const srcPlugins = path.join(__dirname, '..', '..', '_dist', dir, 'DarkPlasma_*.js');
const distDir = dir === 'codes' || dir === 'excludes'
? path.join(projectDir, 'js', 'plugins')
: path.join(projectDir, 'js', 'plugins', dir);
cpx.copy(srcPlugins, distDir);
});
console.log(`copy plugins to ${projectDir} done.`);
}
} catch (e) {
Expand Down

0 comments on commit eedc751

Please sign in to comment.