feat: add build system
Some checks failed
/ deploy_site (push) Has been cancelled

This commit is contained in:
2024-12-30 14:40:09 +09:00
parent 6cbeecea87
commit 32dc5eb667
9 changed files with 845 additions and 24 deletions

View File

@ -22,25 +22,25 @@ export class BPManager {
}
private async loadBPSets() {
const bpSetFiles = await readdir('./dist/bpsets', {
recursive: true,
withFileTypes: true
})
const bpSetFolders = await readdir(path.join(__dirname, 'bpsets'))
for (const bpSetFolder of bpSetFolders) {
const bpSetFiles = await readdir(path.join(__dirname, 'bpsets', bpSetFolder))
for (const bpSetFile of bpSetFiles) {
if (bpSetFile.isDirectory())
continue
const bpSetPath = path.join(bpSetFile.parentPath, bpSetFile.name)
const bpSetClasses = await import('../' + bpSetPath) as Record<string, new () => BPSet>
for (const bpSetClass of Object.keys(bpSetClasses))
this.bpSets[bpSetClass] = new bpSetClasses[bpSetClass]()
for (const bpSetFile of bpSetFiles) {
const bpSetPath = path.join(__dirname, 'bpsets', bpSetFolder, bpSetFile)
const bpSetClasses = await import(bpSetPath) as Record<string, new () => BPSet>
for (const bpSetClass of Object.keys(bpSetClasses)) {
this.bpSets[bpSetClass] = new bpSetClasses[bpSetClass]()
console.log('BPSet implement,', bpSetClass, 'loaded')
}
}
}
}
private async loadBPSetMetadatas() {
const bpSetMetadatasRaw = await readFile('./bpset_metadata.json')
const bpSetMetadatasRaw = await readFile(path.join(__dirname, '../bpset_metadata.json'))
const bpSetMetadatas = JSON.parse(bpSetMetadatasRaw.toString('utf-8')) as BPSetMetadata[]
for (const [idx, bpSetMetadata] of bpSetMetadatas.entries()) {