Upgrade to v1
Learn how to upgrade SignalDB in your project to version 1.0.0. This guide provides step-by-step instructions and best practices for a smooth upgrade process.
Switch to new packages
The core, the reactivity adapters & integration packages have been renamed and moved to the @signaldb
scope. If your application is using any of them, you need to install the new packages and update your imports.
First of all, uninstall all old packages by running the following command.
npm uninstall -S signaldb \
signaldb-plugin-angular \
signaldb-plugin-maverickjs \
signaldb-plugin-meteor \
signaldb-plugin-mobx \
signaldb-plugin-oby \
signaldb-plugin-preact \
signaldb-plugin-reactively \
signaldb-plugin-sinuous \
signaldb-plugin-sjs \
signaldb-plugin-solid \
signaldb-plugin-usignal \
signaldb-plugin-vue
Core Packages
The core package has been renamed to @signaldb/core
and the SyncManager
has been moved to @signaldb/sync
. You need to install the new packages and update your imports. @signaldb/sync
is only needed if you're using the sync engine.
npm install @signaldb/core @signaldb/sync
import { Collection, … } from '@signaldb/core'
import { SyncManager } from '@signaldb/sync'
createLocalStorageAdapter
The createLocalStorageAdapter
function has been moved to the @signaldb/localstorage
package. If your application is using it, you need to install the new package and update your imports.
npm install @signaldb/localstorage
import createLocalStorageAdapter from '@signaldb/localstorage'
createOPFSAdapter
The createOPFSAdapter
function has been moved to the @signaldb/opfs
package. If your application is using it, you need to install the new package and update your imports.
npm install @signaldb/opfs
import createOPFSAdapter from '@signaldb/opfs'
createFileSystemAdapter
The createFileSystemAdapter
function has been moved to the @signaldb/fs
package. If your application is using it, you need to install the new package and update your imports.
npm install @signaldb/fs
import createFileSystemAdapter from '@signaldb/fs'
React
The React integration package has been renamed to @signaldb/react
. If you're using it, you need to install the new package and update your imports.
npm install @signaldb/react
import createUseReactivityHook from '@signaldb/react'
Angular
The Angular reactivity adapter has been renamed to @signaldb/angular
. If you're using it, you need to install the new package and update your imports.
npm install @signaldb/angular
import angularReactivityAdapter from '@signaldb/angular'
@maverickjs/signals
The @maverickjs/signals reactivity adapter has been renamed to @signaldb/maverickjs
. If you're using it, you need to install the new package and update your imports.
npm install @signaldb/maverickjs
import maverickjsReactivityAdapter from '@signaldb/maverickjs'
Meteor Tracker
The Meteor Tracker reactivity adapter has been renamed to @signaldb/meteor
. If you're using it, you need to install the new package and update your imports.
npm install @signaldb/meteor
import meteorReactivityAdapter from '@signaldb/meteor'
MobX
The MobX reactivity adapter has been renamed to @signaldb/mobx
. If you're using it, you need to install the new package and update your imports.
npm install @signaldb/mobx
import mobxReactivityAdapter from '@signaldb/mobx'
oby
The oby reactivity adapter has been renamed to @signaldb/oby
. If you're using it, you need to install the new package and update your imports.
npm install @signaldb/oby
import obyReactivityAdapter from '@signaldb/oby'
@preact/signals
The @preact/signals reactivity adapter has been renamed to @signaldb/preact
. If you're using it, you need to install the new package and update your imports.
npm install @signaldb/preact
import preactReactivityAdapter from '@signaldb/preact'
@reactively/core
The @reactively/core reactivity adapter has been renamed to @signaldb/reactively
. If you're using it, you need to install the new package and update your imports.
npm install @signaldb/reactively
import reactivelyReactivityAdapter from '@signaldb/reactively'
sinuous
The sinuous reactivity adapter has been renamed to @signaldb/sinuous
. If you're using it, you need to install the new package and update your imports.
npm install @signaldb/sinuous
import sinuousReactivityAdapter from '@signaldb/sinuous'
S.js
The S.js reactivity adapter has been renamed to @signaldb/sjs
. If you're using it, you need to install the new package and update your imports.
npm install @signaldb/sjs
import sjsReactivityAdapter from '@signaldb/sjs'
solid
The solid reactivity adapter has been renamed to @signaldb/solid
. If you're using it, you need to install the new package and update your imports.
npm install @signaldb/solid
import solidReactivityAdapter from '@signaldb/solid'
usignal
The usignal reactivity adapter has been renamed to @signaldb/usignal
. If you're using it, you need to install the new package and update your imports.
npm install @signaldb/usignal
import usignalReactivityAdapter from '@signaldb/usignal'
vue
The vue reactivity adapter has been renamed to @signaldb/vue
. If you're using it, you need to install the new package and update your imports.
npm install @signaldb/vue
import vueReactivityAdapter from '@signaldb/vue'
Remove usage of PersistentCollection
The PersistentCollection
class has been removed. If your application is using it, you need to switch to the default Collection
and use adapters to persist data.
To adapt the old logic, you can do something like this.
import { Collection } from '@signaldb/core'
import createLocalStorageAdapter from '@signaldb/localstorage'
import createFileSystemAdapter from '@signaldb/fs'
const someCollection = new Collection({
persistence: typeof window === 'undefined'
? createFileSystemAdapter({ path: './persistent-collection-someCollection.json' })
: createLocalStorageAdapter({ key: 'someCollection' }),
})
Switch from ReplicatedCollection
to SyncManager
The ReplicatedCollection
class has been removed. If your application is using it, you need to switch to the SyncManager
class. Since the SyncManager
uses a totally different approach, you need to update your code.
Take a look at the SyncManager documentation to see how to use it.
Remove options parameter from combinePersistenceAdapters
The combinePersistenceAdapters
function no longer accepts an options parameter. If your application is using it, you need to remove it. The options had allowed to switch the sequence of the arguemnts, but this is no longer necessary. The first argument is the primary adapter and the second argument is the secondary adapter.
Switch to new IndexProviders
Support for old custom IndexProviders
has been removed. If your application is using them, you need to switch to the new ones. This is only necessary if you are using custom IndexProviders
. If you are using the createIndex
function, you don't need to do anything.
Further help
If you need further help, please start a discussion on Github, join our Discord server or open an issue.