github sindresorhus/electron-store v12.0.0

5 hours ago

Breaking

  • Require Electron 35 1aa2096, f78f186
  • Update to conf 16 f78f186
    • Migrations no longer run for a config file that does not exist yet. A new store starts at the current version.
    • Migrations run in version order, whatever order they are defined in.
    • The recorded migration version never moves backwards.
    • .get() throws when given a non-string key.
    • The rootSchema option throws when it contains a properties key.
    • With clearInvalidConfig, the cleared store is now written to the config file.
    • projectVersion must be a full semantic version when using migrations.
    • name must not point outside cwd.
    • An empty encryptionKey is refused.
    • With dot notation, a key that is not a valid path (for example, a[x) throws.

New

  • Add cache option to keep the store in memory
    • Reads do not parse the config file each time. Values returned from the store are frozen, so copy a value before you change it.
  • Add .events to listen for change events directly
  • Allow serialize to return a Uint8Array
  • Allow the projectVersion option in the types 9fbe0a1
  • Make the name option non-readonly in the types 9d62519
  • Improve the TypeScript types. Annotating schema with Schema<T> now gives .get() its types.

Improvements

  • Fail with a clear error when not running in Electron, unless you pass an absolute cwd 44bd512
  • Update dependencies 1aa2096
  • Improve the docs, including the encryption algorithm, rootSchema, ajvOptions, configFileMode, nested defaults, and renderer process requirements 49ab1c3, e7cada4, 36f7106, 17122f8, 5ad6974

Fixes

  • Fix .reset() with dot-notation keys
  • Fix a migration with a semver range making the store impossible to open after a failed migration

Migration guide

Migrations

A new config file no longer runs migrations, so the store starts at the current version. If your migrations must run on first launch, do that work in your app code instead.

If you use migrations, the projectVersion (or your app version) must be a full semantic version, such as 1.0.0.


v11.0.2...v12.0.0

Don't miss a new electron-store release

NewReleases is sending notifications on new releases.