43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
function copyFile(src, dst) {
|
|
fs.mkdirSync(path.dirname(dst), { recursive: true });
|
|
fs.copyFileSync(src, dst);
|
|
}
|
|
|
|
function copyDir(src, dst) {
|
|
if (!fs.existsSync(src)) return;
|
|
fs.mkdirSync(dst, { recursive: true });
|
|
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
for (const entry of entries) {
|
|
const srcPath = path.join(src, entry.name);
|
|
const dstPath = path.join(dst, entry.name);
|
|
if (entry.isDirectory()) {
|
|
copyDir(srcPath, dstPath);
|
|
} else {
|
|
fs.copyFileSync(srcPath, dstPath);
|
|
}
|
|
}
|
|
}
|
|
|
|
function main() {
|
|
const projectRoot = process.cwd();
|
|
const srcParserPath = path.join(projectRoot, 'src', 'parser');
|
|
const outParserPath = path.join(projectRoot, 'out', 'parser');
|
|
|
|
copyFile(
|
|
path.join(srcParserPath, 'tkinter_ast_parser.py'),
|
|
path.join(outParserPath, 'tkinter_ast_parser.py')
|
|
);
|
|
|
|
copyDir(
|
|
path.join(srcParserPath, 'tk_ast'),
|
|
path.join(outParserPath, 'tk_ast')
|
|
);
|
|
|
|
console.log('Copied Python files to out/parser.');
|
|
}
|
|
|
|
main();
|