From 95f4c11d4485109bfb5f157080365c7d4d891be0 Mon Sep 17 00:00:00 2001 From: Matt Brophy Date: Thu, 5 Oct 2023 16:19:19 -0400 Subject: [PATCH] Add back remix init logic for format repo --- remix.init/index.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/remix.init/index.js b/remix.init/index.js index c41da34e..9b8ea999 100644 --- a/remix.init/index.js +++ b/remix.init/index.js @@ -56,6 +56,21 @@ const getPackageManagerVersion = (packageManager) => const getRandomString = (length) => crypto.randomBytes(length).toString("hex"); +const updatePackageJson = ({ APP_NAME, packageJson }) => { + const { + scripts: { + // eslint-disable-next-line no-unused-vars + "format:repo": _repoFormatScript, + ...scripts + }, + } = packageJson.content; + + packageJson.update({ + name: APP_NAME, + scripts, + }); +}; + const main = async ({ packageManager, rootDirectory }) => { const pm = getPackageManagerCommand(packageManager); @@ -134,6 +149,8 @@ const main = async ({ packageManager, rootDirectory }) => { ) : dockerfile; + updatePackageJson({ APP_NAME, packageJson }); + await Promise.all([ fs.writeFile(FLY_TOML_PATH, toml.stringify(prodToml)), fs.writeFile(README_PATH, newReadme), @@ -163,7 +180,7 @@ const main = async ({ packageManager, rootDirectory }) => { fs.rm(path.join(rootDirectory, "LICENSE.md")), ]); - execSync(pm.run("format", "--loglevel warn"), { + execSync(pm.run("format", "--log-level warn"), { cwd: rootDirectory, stdio: "inherit", });