How to update each dependency in package.json to the latest version?

前端 未结 30 2903
清歌不尽
清歌不尽 2020-11-22 08:01

I copied package.json from another project and now want to bump all of the dependencies to their latest versions since this is a fresh project and I don\'t mind

30条回答
  •  逝去的感伤
    2020-11-22 08:22

    Here is a basic regex to match semantic version numbers so you can quickly replace them all with an asterisk.

    Semantic Version Regex

    ([>|<|=|~|^|\s])*?(\d+\.)?(\d+\.)?(\*|\d+)
    

    How to use

    Select the package versions you want to replace in the JSON file.

    Input the regex above and verify it's matching the correct text.

    Replace all matches with an asterisk.

    Run npm update --save

提交回复
热议问题