yeoman / configstore

Easily load and persist config without having to think about where and how
BSD 2-Clause "Simplified" License
868 stars 56 forks source link

Versioning the config store #66

Closed EduardoSimon closed 4 years ago

EduardoSimon commented 4 years ago

Hi, I'd like to congratulate you for the amazing work you've done with this package. It's been great. However, I've got a problem when I update the default configuration in the ConfigStore declaration and release it to npm. Users who have an older version of my package don't get their local config-store delete under ~/.config/configstore. Should I do this in the bootstrap of my package and save the version in the config itself? If the version is older do something like config.clear().

Thanks in advance

sindresorhus commented 4 years ago

Yes, it's up to you to handle breaking version changes.

EduardoSimon commented 4 years ago

Okay, any tips on that?

sindresorhus commented 4 years ago

It really depends on how you use it. If the values can be regenerated, .clear() is fine. Otherwise, you need to migrate over the data to the new structure.

I have a similar package that supports migrations: https://github.com/sindresorhus/conf#migrations