Almin

Almin

  • Docs
  • API
  • Blog
  • Help
  • GitHub

โ€บRecent Posts

Recent Posts

  • Almin v0.18 โ€“ React Native compatible
  • Almin v0.17 โ€“ Support `context.useCase#execute` typing and new React Context
  • New Website

Almin v0.18 โ€“ React Native compatible

August 27, 2018

azu

almin@0.18.0 is released ๐ŸŽ‰

Summary

  • Deprecate context.useCase#executor
    • Use context.useCase#execute instead of it
    • almin/migration-tools help to migrate it
  • Work almin in React Native without installing events module
    • Drop to use events of Node.js Core API

๐Ÿฅ‡ Migration

almin-migration-tools support migration from 0.17.x to 0.18.x.

npx @almin/migration-tools

This(0.17.x โ†’ 0.18.x) migration also supports TypeScript.

npx @almin/migration-tools "src/**/*.{ts,tsx}"
  • almin/migration-tools: Migration scripts for Almin.

๐Ÿ”ฅ Breaking Change

TypeScript user:

If you use Almin with TypeScript, please upgrade to TypeScript 3.0. Almin 0.18 require TypeScript 3.0.

If you seen following compile error, you should upgrade to TypeScript 3.0.

Type '{}' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<{ state: StateMap<{ subscriptionList: any; subscri...'.
  Type '{}' is not assignable to type 'Readonly<Pick<StateMap<{ subscriptionList: any; subscriptionContents: any; appHeader: any; appPre...'.

JavaScript user:

No breaking change.

โญ Features

Make execute type complete #355 #107

For TypeScript user

UseCaseExecutor#executor has been introduced as a workaround for TypeScript #107.

In Almin 0.18+, UseCaseExecutor#execute work with TypeScript #355

๐Ÿ“ Require TypeScript 3.0+

So, you should use UseCaseExecutor#execute instead of UseCaseExecutor#executor.

Before: executor()

import { UseCase, Context } from "almin";
class MyUseCaseA extends UseCase {
    execute(_a: string) {}
}
const context = new Context({
    store: createStore({ name: "test" })
});

// executor
context.useCase(new MyUseCaseA()).executor(useCase => useCase.execute("A")); 

After: execute()

import { UseCase, Context } from "almin";
class MyUseCaseA extends UseCase {
    execute(_a: string) {}
}
const context = new Context({
    store: createStore({ name: "test" })
});

//execute
context.useCase(new MyUseCaseA()).execute("A");

These are same meaning without syntax.

Deprecate executor() #356

You can migrate from executor to execute by migration tools

npx @almin/migration-tools "src/**/*.{js,ts,tsx}" --script "executor-to-execute"
  • almin/migration-tools: Migration scripts for Almin.

โ™ป๏ธ Refactoring

Drop to use events module #352

Almin 0.18 drop to use Node.js's events module.

Previously, Almin use events module of Node.js Core API. The events module is polyfill-ed by bundler like webpack or browserify. But, React Native's bundler does not bundle it.

As a result, almin 0.18 improves to

  • support React Native compatible
  • reduce file size

We will work on Almin 1.0.0 within a few month. I(@azu) think that last blocker of 1.0.0 is Store design.

  • Almin: Store#receivePayload design ยท Issue #312 ยท almin/almin

Also, We welcome to your contribution. If you want to contribute to almin, please check good first issue.

Recent Posts
Almin
Docs
Getting StartedTutorialAPI Reference
Community
User ShowcaseStack OverflowTwitter
GitHub
GitHubReleasesIssuesStar
Copyright ยฉ 2021 azu