refactoring

This commit is contained in:
Emily
2025-01-25 15:31:37 +01:00
parent e4bdf7e4c3
commit 3960eaa8ad
11 changed files with 833 additions and 2221 deletions

40
scripts/shared-helper.js Normal file
View File

@@ -0,0 +1,40 @@
const path = require('path');
const fs = require('fs');
class SharedHelper {
static getSharedPath() {
return path.join(__dirname, '../shared_global');
}
constructor(localSharedPath) {
this.localSharedPath = localSharedPath;
}
clear() {
if (fs.existsSync(this.localSharedPath)) {
fs.rmSync(this.localSharedPath, { force: true, recursive: true });
fs.mkdirSync(this.localSharedPath);
}
}
create(name) {
const localFolder = path.join(this.localSharedPath, name);
fs.mkdirSync(localFolder);
}
copy(name) {
const localSharedFile = path.join(this.localSharedPath, name);
fs.cpSync(SharedHelper.getSharedPath(), localSharedFile);
}
}
module.exports = {
SharedHelper
}