diff --git a/package.json b/package.json index 7f89df8..106f80f 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "eslint": "^9.11.0", "eslint-config-standard": "~17", "eslint-plugin-vue": "^9.28.0", + "glob": "^11.0.0", "typescript": "^5.6.2" }, "dependencies": { diff --git a/toolbox/compiler.mjs b/toolbox/compiler.mjs index 6581ea2..0086093 100644 --- a/toolbox/compiler.mjs +++ b/toolbox/compiler.mjs @@ -5,9 +5,11 @@ compatibility: ShokaX v0.4.x import path from "node:path"; import fs from 'fs/promises' import child_process from 'child_process' +import { buildSync } from 'esbuild' +import { glob } from 'glob' const CONFIG = { - legacyScript: true, + legacyScript: false, } async function deleteFileRecursive(dir) { @@ -54,7 +56,20 @@ if (CONFIG.legacyScript) { }) }) } else { - throw Error('Not implemented yet.') + console.log('RUN THIS SCRIPT IN YOUR SHOKAX THEME ROOT DIRECTORY!') + console.log('Using esbuild compiler...') + const entryPoints = glob.sync('./scripts/**/*.ts'); + buildSync({ + entryPoints: entryPoints, + outdir: 'scripts', + bundle: false, + format: 'cjs', + target: ['esnext'], + platform: 'node', + loader: { '.ts': 'ts' }, + }) + await deleteFileRecursive('./scripts/') + console.log('Finished compiling.') } console.log('Done.')