How to rename an Angular project?

前端 未结 5 707
北荒
北荒 2021-01-03 19:51

I renamed my Angular 4 project folder from auction-life to auction-05-life and replaced 3 occurrences of the old project name in:

5条回答
  •  旧巷少年郎
    2021-01-03 20:19

    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

提交回复
热议问题