Skip to content

Commit 2c818d5

Browse files
committed
prevent author being set to myself
1 parent 1a67d1a commit 2c818d5

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

remix.init/index.mjs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export default async function main({ isTypeScript, rootDirectory }) {
1919
// not throwing an error because the stack trace doesn't do anything to help the user
2020
throw `Sorry, this template only supports TypeScript. Please run the command again and select "TypeScript". Learn more about why in https://github.com/epicweb-dev/epic-stack/blob/main/docs/decisions/001-typescript-only.md`
2121
}
22-
const README_PATH = path.join(rootDirectory, 'README.md')
2322
const FLY_TOML_PATH = path.join(rootDirectory, 'fly.toml')
2423
const EXAMPLE_ENV_PATH = path.join(rootDirectory, '.env.example')
2524
const ENV_PATH = path.join(rootDirectory, '.env')
@@ -34,9 +33,8 @@ export default async function main({ isTypeScript, rootDirectory }) {
3433
// get rid of anything that's not allowed in an app name
3534
.replace(/[^a-zA-Z0-9-_]/g, '-')
3635

37-
const [flyTomlContent, readme, env, packageJson] = await Promise.all([
36+
const [flyTomlContent, env, packageJsonString] = await Promise.all([
3837
fs.readFile(FLY_TOML_PATH, 'utf-8'),
39-
fs.readFile(README_PATH, 'utf-8'),
4038
fs.readFile(EXAMPLE_ENV_PATH, 'utf-8'),
4139
fs.readFile(PKG_PATH, 'utf-8'),
4240
])
@@ -53,18 +51,16 @@ export default async function main({ isTypeScript, rootDirectory }) {
5351
APP_NAME,
5452
)
5553

56-
const newReadme = readme.replace(new RegExp(appNameRegex, 'g'), APP_NAME)
54+
const packageJson = JSON.parse(packageJsonString)
5755

58-
const newPackageJson = packageJson.replace(
59-
new RegExp(appNameRegex, 'g'),
60-
APP_NAME,
61-
)
56+
packageJson.name = APP_NAME
57+
delete packageJson.author
58+
delete packageJson.license
6259

6360
const fileOperationPromises = [
6461
fs.writeFile(FLY_TOML_PATH, newFlyTomlContent),
65-
fs.writeFile(README_PATH, newReadme),
6662
fs.writeFile(ENV_PATH, newEnv),
67-
fs.writeFile(PKG_PATH, newPackageJson),
63+
fs.writeFile(PKG_PATH, JSON.stringify(packageJson)),
6864
fs.copyFile(
6965
path.join(rootDirectory, 'remix.init', 'gitignore'),
7066
path.join(rootDirectory, '.gitignore'),

0 commit comments

Comments
 (0)