From 8ab5b1d1c3eecf41b20d97f464030377ece01640 Mon Sep 17 00:00:00 2001 From: Steven Date: Sun, 13 Feb 2022 21:37:26 -0500 Subject: [PATCH] fix(scripts): make it easier for tools like vercel to find the .lua scripts --- lib/commands/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/commands/index.js b/lib/commands/index.js index ac5c9e1a8..599216cee 100644 --- a/lib/commands/index.js +++ b/lib/commands/index.js @@ -22,7 +22,7 @@ module.exports = (function() { return async function(client) { await utils.isRedisReady(client); - scripts = await (scripts || loadScripts(__dirname)); + scripts = await (scripts || loadScripts()); return scripts.map(({ name, options }) => client.defineCommand(name, options) @@ -30,8 +30,8 @@ module.exports = (function() { }; })(); -async function loadScripts(dir) { - const scriptsDir = await fsAsync.readdir(dir); +async function loadScripts() { + const scriptsDir = await fsAsync.readdir(__dirname); const luaFiles = scriptsDir.filter(file => path.extname(file) === '.lua'); if (luaFiles.length === 0) { /** @@ -42,7 +42,7 @@ async function loadScripts(dir) { } return Promise.all( luaFiles.map(async file => { - const lua = await fsAsync.readFile(path.join(dir, file)); + const lua = await fsAsync.readFile(path.join(__dirname, file)); const longName = path.basename(file, '.lua'); return {