From c6f876158a752f22e242de7c80529d836cb1ee4c Mon Sep 17 00:00:00 2001 From: Logan McAnsh Date: Tue, 7 Feb 2023 13:17:27 -0500 Subject: [PATCH] fix: make remixRoot the second arg Signed-off-by: Logan McAnsh --- packages/remix-dev/cli/commands.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/remix-dev/cli/commands.ts b/packages/remix-dev/cli/commands.ts index 0650edee686..cd373082a68 100644 --- a/packages/remix-dev/cli/commands.ts +++ b/packages/remix-dev/cli/commands.ts @@ -265,6 +265,8 @@ export async function generateEntry(remixRoot: string, entry: string) { type: "conjunction", }); +export async function generateEntry(entry: string, remixRoot: string) { + let config = await readConfig(remixRoot); let entriesArray = Array.from(entries); let list = listFormat.format(entriesArray); @@ -274,7 +276,7 @@ export async function generateEntry(remixRoot: string, entry: string) { return; } - let pkgJson = await NPMCliPackageJson.load(remixRoot); + let pkgJson = await NPMCliPackageJson.load(config.rootDirectory); let deps = pkgJson.content.dependencies ?? {}; let runtime = deps["@remix-run/deno"] @@ -310,7 +312,7 @@ export async function generateEntry(remixRoot: string, entry: string) { // otherwise, copy the entry file from the defaults if (/\.jsx?$/.test(entry)) { let javascript = convertFileToJS(contents, { - cwd: remixRoot, + cwd: config.rootDirectory, filename: isServerEntry ? defaultEntryServer : defaultEntryClient, }); await fse.writeFile(outputFile, javascript, "utf-8"); @@ -320,7 +322,10 @@ export async function generateEntry(remixRoot: string, entry: string) { console.log( colors.blue( - `Entry file ${entry} created at ${path.relative(remixRoot, outputFile)}.` + `Entry file ${entry} created at ${path.relative( + config.rootDirectory, + outputFile + )}.` ) ); }