MCPcopy
hub / github.com/OptimalBits/bull / transpileScripts

Method transpileScripts

generateRawScripts.js:15–37  ·  view source on GitHub ↗

* Transpile lua scripts in one file, specifying an specific directory to be saved * @param pathname - the path to the directory containing the scripts * @param writeDir - the path to the directory where scripts will be saved

(pathname, writeDir)

Source from the content-addressed store, hash-verified

13 * @param writeDir - the path to the directory where scripts will be saved
14 */
15 async transpileScripts(pathname, writeDir) {
16 const writeFilenamePath = path.normalize(writeDir);
17
18 if (!fs.existsSync(writeFilenamePath)) {
19 fs.mkdirSync(writeFilenamePath);
20 }
21
22 const paths = new Set();
23 if (!paths.has(pathname)) {
24 paths.add(pathname);
25 const scripts = await this.loadScripts(pathname);
26 for (const command of scripts) {
27 const {
28 name,
29 options: { numberOfKeys, lua }
30 } = command;
31 await writeFile(
32 path.join(writeFilenamePath, `${name}-${numberOfKeys}.lua`),
33 lua
34 );
35 }
36 }
37 }
38}
39
40const scriptLoader = new RawScriptLoader();

Callers 1

Calls 2

addMethod · 0.80
loadScriptsMethod · 0.80

Tested by

no test coverage detected