Skip to content

Commit

Permalink
Add back remix init logic for format repo
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 committed Oct 5, 2023
1 parent ceb1195 commit 95f4c11
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion remix.init/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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",
});
Expand Down

0 comments on commit 95f4c11

Please sign in to comment.