@azu azu released this May 10, 2017 · 268 commits to master since this release

Assets 2

Breaking Changes

💟 Migration Guide

You can migrate almin 0.11.x to 0.12.x by using migration-tools

# Installation
npm install -g jscodeshift @almin/migration-tools 
# Migrate *Store.js
## Target file path should be change
jscodeshift --run-in-band -t `npm root -g`/@almin/migration-tools/scripts/store-get-state-return-object-to-flat.js src/store/*/**/*Store.js
# Migrate old StoreGroup to new StoreGroup
## Target file path should be change
jscodeshift --run-in-band -t `npm root -g`/@almin/migration-tools/scripts/store-group-arguments.js src/store/AppStore.js

Actual examples:

If you want to use legacy implemenration of StoreGroup and Store, please see almin/legacy-store-group.

Features

  • Replace old StoreGroup as new StoreGroup#154 #159
    • It contains a breaking change. #159
  • Add receivePayload(payload) to Store for StoreGroup #160
  • Add shouldStateUpdate(prevState, nextState) to Store for StoreGroup
    • Update StoreLike interface

New usage of StoreGroup and Store

Before:

class AStore extends Store {
    getState() {
        return {a : "a value"};
    }
}
class BStore extends Store {
    getState() {
        return {b : "b value"};
    }
}
const aStore = new AStore();
const bStore = new BStore();
const storeGroup = new StoreGroup(
    aStore,
    bStore
]);
console.log(storeGroup.getState());
// { a: "a value", b: "b value" }

After:

Almin 0.12 require following syntax.
(Store#getState and StoreGroup constructor is changed.)

class AStore extends Store {
    getState() {
        return "a value";
    }
}
class BStore extends Store {
    getState() {
        return "b value";
    }
}
const aStore = new AStore();
const bStore = new BStore();
const storeGroup = new StoreGroup({
    // stateName: store
    a: aStore,
    b: bStore
});
console.log(storeGroup.getState());
// { a: "a value", b: "b value" }

Please see documentation.

TypeScript

  • Core: Upgrade to TypeScript 2.3 #178
  • Store: Make clear the relation Store and State #165
  • Context: Make Context#getState explicit #166
  • Context: Make store arguments of constructor simple

Internal

  • Move to monorepo #182

Not in 0.12

  • Transaction UseCase