Skip to content

Commit

Permalink
fix(scripts): make it easier for tools like vercel to find the .lua s…
Browse files Browse the repository at this point in the history
…cripts
  • Loading branch information
styfle committed Feb 14, 2022
1 parent 6597218 commit 8ab5b1d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/commands/index.js
Expand Up @@ -22,16 +22,16 @@ 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)
);
};
})();

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) {
/**
Expand All @@ -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 {
Expand Down

0 comments on commit 8ab5b1d

Please sign in to comment.