From 013f3c6c7bdcfffd1892086c4f734295bc511cf6 Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Thu, 15 Sep 2022 21:07:22 -0400 Subject: [PATCH] simplify love.js module lookup --- src/targets/web.ts | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/targets/web.ts b/src/targets/web.ts index 6f60695..787fc6f 100644 --- a/src/targets/web.ts +++ b/src/targets/web.ts @@ -2,7 +2,6 @@ import { IPaths, ITarget } from "../conf/targets"; import { exec } from "child_process"; import { join } from "path"; import { zip } from "zip-a-folder"; -import { platform } from "os"; import * as fse from "fs-extra"; export default async function packageLove( @@ -13,19 +12,11 @@ export default async function packageLove( const unpackedDir = join(paths.tmp, "web-unpacked"); fse.emptydirSync(unpackedDir); - const nodeModulesPath = await new Promise((res, rej) => { - exec(`cd ${__dirname} && npm root`, (err, data) => { - if (err) return rej(err); - res(data.replace("\n", "").replace("\r", "")); - }); - }); - - const loveJsName = platform() == "win32" ? "love.js.cmd" : "love.js"; - const loveJsPath = join(nodeModulesPath, ".bin", loveJsName); + const loveJsPath = require.resolve("love.js"); await new Promise((res, rej) => { exec( - `${loveJsPath} ${paths.tmpLove} ${unpackedDir} -t "${config.name}" -c`, + `node ${loveJsPath} ${paths.tmpLove} ${unpackedDir} -t "${config.name}" -c`, (err) => { if (err) return rej(err); res(null);