Renaming a module name

Gregor Martynus 2016-03-22 12:20:58 -04:00
parent 8ee272f3fa
commit e83d7133fe

16
Renaming-a-module-name.md Normal file

@ -0,0 +1,16 @@
Lets say you have `mymodule-oldname` with the latest version `1.2.3` released in the npm registry, and you want to rename it to `mymodule-newname`, you need do to three things, **before** you push your changes to master and let semantic-release do its thing.
1. In package.json, where `"name"` should already be `"mymodule-newname"`, add `"version": "1.2.3"` (or what ever the latest released version of `mymodule-oldname` is.
2. run `npm publish`, this will create `+mymodule-newname@1.2.3` in the npm registry
3. `git checkout package.json` to make sure you do not commit the added `"version"`
After a package name change, its recommended to do a major version bump. For that you can do something like this:
```bash
git commit --allow-empty -m 'chore: renamed module to mymodule-newname
BREAKING CHANGE:
The repository has been renamed from `mymodule-oldname` to `mymodule-newname`
```
That way you can make sure that the semantic-release setup works with the new package name, and also avoid send a signal that there might be breaking changes and people should test their code before updating.