MCPcopy Create free account
hub / github.com/taskforcesh/bullmq / transpileScripts

Method transpileScripts

scripts/generateRawScripts.ts:14–36  ·  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: string, writeDir: string)

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 3

loadScriptsMethod · 0.80
addMethod · 0.65
normalizeMethod · 0.45

Tested by

no test coverage detected