I renamed my Angular 4 project folder from auction-life to auction-05-life and replaced 3 occurrences of the old project name in:
If you are not familiar with bash scripting but with your IDE, you always can perform recursive search in your files (usually Ctrl+Shift+F) and replace it everywhere - Ctrl+Alt+Enter on VSCode. Visual Studio Code Example
As of this writing, the Angular-cli commandline doesn't do renaming. So, this is what i did (manually):
1. First, see how really invested the old name is in the project by searching the "old name". On Linux, i used simple grep as.
grep -ir "oldname" .
That showed so many files, most of them under /node_modules. So i removed the /node_modules (and will use npm install after i finish the rename).
2. Next, i did Linux find & replace command against the files in current folder as follows (source sited at bottom):
cd your folder
sed -i 's/oldName/newName/g' *
Finally, don’t forget to do npm install on the current directory to install dependencies listed in your package.json (remember we removed node_modules that had old name)
** Credits:
Find replace "sed" command is from: How to replace a string in multiple files in linux command line
With macOS you go to your angular project folder, and use sed command to replace old name by the new that you want:
LC_CTYPE=C && LANG=C && find * -type f -exec sed -i "" "s/old-angular-project-name/new-name/g" {} +
Modify Project name in angular.json file & also project folder name. Delete 'node_modules' folder from your project directory. Then run npm install command.Finally run ng serve command.