npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

redux-remigrate

v6.0.6

Published

The official TypeScript-first migration layer for Redux Remember

Downloads

667

Readme

Redux Remigrate is a TypeScript-first migration layer for Redux Remember

NPM Version Build Status Coverage Status NPM Downloads

Documentation | GitHub


Features

  • TypeScript first - Migrator only works with TypeScript and uses auto-generated version types
  • CLI tooling - Generate migrations, validate types, and clean up unused files
  • Automatic version tracking - Tracks store schema versions and runs migrations sequentially
  • Prettier integration - Generated files respect your project's Prettier config (if available)
  • Circular migration detection - Prevents infinite loops with built-in safeguards

Installation

npm install redux-remigrate
# or
pnpm/yarn/bun add redux-remigrate

Quick Start

1. Create a config file

Create remigrate.config.ts in your project root:

import { defineRemigrateConfig } from 'redux-remigrate';

export default defineRemigrateConfig({
  storagePath: './src/remigrate',
  stateFilePath: './src/store.ts',
  stateTypeExpression: 'PersistedState',
  // prettierrcPath: './.prettierrc',
  // tsconfigPath: './tsconfig.json',
});

This creates the migrations directory structure and generates the initial version file based on your current store type.

2. Add to Redux Remember

Import the generated migrate function and pass it to Redux Remember:

import { configureStore } from '@reduxjs/toolkit';
import { rememberReducer, rememberEnhancer } from 'redux-remember';
import { _remigrateVersion } from 'redux-remigrate';
import { myStateIsRemembered, myStateIsForgotten } from './reducers.ts';
import { migrate } from './remigrate/index.ts';

const reducers = {
  // 3.1. Add the _remigrateVersion reducer to track your state version:
  _remigrateVersion,
  myStateIsRemembered: myStateIsRemembered.reducer,
  myStateIsForgotten: myStateIsForgotten.reducer,
};

const rememberedKeys = [
  // 3.2. Make sure _remigrateVersion gets persisted with the state:
  '_remigrateVersion',
  'myStateIsRemembered',
] satisfies (keyof typeof reducers)[];

const reducer = rememberReducer(reducers);
const store = configureStore({
  reducer,
  enhancers: (getDefaultEnhancers) => getDefaultEnhancers().concat(
    // 3.3. Pass the migrate function to the rememberEnhancer:
    rememberEnhancer(window.localStorage, rememberedKeys, {
      migrate
    })
  )
});

export type RootState = ReturnType<typeof store['getState']>;
// 3.4. Set your "stateTypeExpression" to the type name you specify here:
export type PersistedState = Pick<RootState, typeof rememberedKeys[number]>;

3. Initialize migrations directory

npx remigrate init

4. Create a migration when your persisted state changes

When your persisted state type changes, run:

npx remigrate create

This will:

  • Detect changes to your store type
  • Generate a new version file with the updated type
  • Create a migration file with type-safe function signatures

5. Implement state migration logic in your newly created migrations file

Edit the generated migration file to transform data from the old version to the new:

import type { StoreVersion_20240101_120000 } from '../versions/20240101_120000.ts';
import type { StoreVersion_20240115_140000 } from '../versions/20240115_140000.ts';

export const from_20240101_120000 = (
  { myStateIsRemembered, ...store }: StoreVersion_20240101_120000
): StoreVersion_20240115_140000 => ({
  ...store,
  myStateIsRemembered: {
    ...myStateIsRemembered,
    newFieldAdded: 'yay!'
  },
  _remigrateVersion: '20240115_140000',
});

6. Validate migration types

Run the validate command to check your migrations for TypeScript errors:

npx remigrate validate

This ensures all migration functions correspond to their type signatures.

CLI Commands

Usage: remigrate <command> [options]

Commands:
  init [suffix]        Initialize migrations directory
  create [suffix]      Create a new migration file if store type changed
  cleanup              Remove unreferenced version type files
  validate             Validate migrations for TypeScript errors

Options:
  -c, --config <file>  Override config file path

Configuration Options

| Option | Type | Required | Description | |-------------------------|----------|-----|------------------------------------------ | | storagePath | string | Yes | Directory where migrations will be stored | | stateFilePath | string | Yes | Path to the file containing your persisted state type | | stateTypeExpression | string | Yes | The TypeScript type expression for your persisted state | | prettierrcPath | string | No | Path to your Prettier config file | | tsconfigPath | string | No | Path to your TypeScript config file | | headers.versionFile | string | No | Custom header for generated version files | | headers.migrationFile | string | No | Custom header for generated migration files | | headers.indexFile | string | No | Custom header for the generated index file |

For more examples and detailed API documentation, visit the full documentation.

License

MIT