Skip to content

Commit

Permalink
Merge pull request #66 from rootstrap/fix/cli_set_project_name_in_rea…
Browse files Browse the repository at this point in the history
…dme_and_expo_config

fix(cli): set project name in README and Expo config
  • Loading branch information
asdolo authored Sep 11, 2024
2 parents 013545c + 5f0eda4 commit ee73269
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions cli/setup-project.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ const updateProjectConfig = async (projectName) => {
},
],
},
{
fileName: 'app.config.ts',
replacements: [
{
searchValue: "slug: 'reactnativetemplate'",
replaceValue: `slug: '${projectName.toLowerCase()}'`,
},
],
},
]);
};

Expand Down Expand Up @@ -138,13 +147,25 @@ const updateGitHubWorkflows = (projectName) => {
]);
};

const updateProjectReadme = () => {
const updateProjectReadme = (projectName) => {
projectFilesManager.renameFiles([
{
oldFileName: 'README-project.md',
newFileName: 'README.md',
},
]);

projectFilesManager.replaceFilesContent([
{
fileName: 'README.md',
replacements: [
{
searchValue: 'Mobile App',
replaceValue: projectName,
},
],
},
]);
};

const setupProject = async (projectName) => {
Expand All @@ -158,7 +179,7 @@ const setupProject = async (projectName) => {
updatePackageJson(projectName);
updateProjectConfig(projectName);
updateGitHubWorkflows(projectName);
updateProjectReadme();
updateProjectReadme(projectName);
consola.success(`Clean up and setup your project 🧹`);
} catch (error) {
consola.error(`Failed to clean up project folder`, error);
Expand Down

0 comments on commit ee73269

Please sign in to comment.