Git Product home page Git Product logo

redux-boot's People

Contributors

arojunior avatar jardix22 avatar lucasconstantino avatar recidive avatar sebas5384 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

redux-boot's Issues

Example test failing

Example with a simple reducer and an async middleware (Spotify API)

{ error: { status: 401, message: 'No token provided' } } 'Unauthorized'

✖ A side-effect of BOOT action modified the state using a middleware and reducer handler.

operator: equal
expected: 'Led Zeppelin'
actual: ''
at: Test.assert [as _assert] (/Users/arojunior/Dropbox/compartilhado/Github/redux-boot/build/test.js:1199:18)

Add better async test

Need to improve this test case:

test('Use redux-actions with redux-promise to fire async and sync side-effect actions in middlewares', (assert) => {

  const AFTER_BOOT = 'choko/core/test/AFTER_BOOT'
  const AFTER_AFTER_BOOT = 'choko/core/test/AFTER_AFTER_BOOT'

  let data = {
    1: 'bar',
    2: 'baz',
    3: 'rock'
  }

  const someApi = {
    get(id) {
      return Promise.resolve({
        name: data[id]
      })
    }
  }

  const afterBootAction = createAction(AFTER_BOOT, async (id) => {
    const result = await someApi.get(id)
    return result
  })

  const afterAfterBootAction = createAction(AFTER_AFTER_BOOT, async (id) => {
    const result = await someApi.get(id)
    return result
  })

  const initialState = {foo: 'bar'}

  const reducer = (state = initialState, action) => {
    switch (action.type) {
      case AFTER_BOOT:
        return {
          ...state,
          foo: action.payload.name
        }

      case AFTER_AFTER_BOOT:
        return {
          ...state,
          foo: action.payload.name
        }
      default:
        return state;
        break;
    }
  }

  const middleware = [
    function middle9({getState, dispatch}) {
      // Note the async keyword.
      return next => (action) => {

        console.log(action.type, 'ACTION')

        const result = next(action)

        if (action.type == AFTER_AFTER_BOOT) {
          console.log(getState(), 'STATEEEE AFTER AFTER BOOT 9');
        }

        return result
      }
    },
    function middleA({getState, dispatch}) {
      // Note the async keyword.
      return next => async (action) => {

        const result = next(action)

        if (action.type == AFTER_BOOT) {
          // console.log(getState(), 'STATEEEE before A');
          // const sideffectB = await dispatch(afterAfterBootAction(3))
          console.log(getState(), 'STATEEEE AFTER BOOT');
        }

        return result
      }
    },
    function middleB({getState, dispatch}) {
      // Note the async keyword.
      return next => async (action) => {

        const result = next(action)

        if (action.type == BOOT) {
          const sideffectA = await dispatch(afterBootAction(2))
          console.log(getState(), 'STATEEEE A');
          const sideffectB = await dispatch(afterAfterBootAction(3))
          console.log(getState(), 'STATEEEE AFTER AFTER BOOT B');
        }

        return result
      }
    },
    function middleC({getState, dispatch}) {
      // Note the async keyword.
      return next => (action) => {

        const result = next(action)

        if (action.type == AFTER_AFTER_BOOT) {
          console.log(getState(), 'STATEEEE AFTER AFTER BOOT C');
        }

        return result
      }
    }
  ]

  const testModule = {
    reducer,
    middleware
  }

  const modules = [
    testModule
  ]

  const app = Choko(initialState, modules)

  app.then(({action, store}) => {

    assert.equal(
      store.getState().foo,
      'rock',
      'Chainable async and sync side-effects were handled'
    )

    assert.end()
  })

})

Create basic documentation

  • Example using handlers at README.md

  • Introduction
  • -- Motivation
  • -- Principles
  • Basics
  • -- Modules
  • -- Actions
  • -- Reducers
  • ---- pure reducer
  • ---- Action handlers
  • -- Middlewares
  • ---- pure middleware
  • ---- Middleware handlers
  • -- Side-effects
  • ---- Sync
  • ---- Async

Redux, Redux Actions and Redux Promise should be peer dependencies?

If we look at projects like react-redux, redux-actions or redux-promise we can notice that their are using peerDependencies for the redux-* dependencies.

I think we should follow this pattern because redux it self for example must be a direct dependency of the project which is using or implementing these libs. It's more easy to know what dependencies the project has, but at the same time removes some kind of abstractions which could help legibility.

Should we move redux, redux-actions and redux-promise to peerDependencies?

Decide on project name

Decide on naming, maybe we should refactor a little and rename this redux-boot, redux-bricks?

GPL is an inappropriate license

The GPL is an inappropriate license for a library, especially a JavaScript library. Anyone who uses redux-boot is required to release their code under a GPL-compatible license. This all but guarantees that pretty much nobody will adopt your library.

This requirement is explained clearly in the GPL FAQ:

if the two programs are combined so that they become effectively two parts of one program, then you can't treat them as two separate programs. So the GPL has to cover the whole thing.

Given that Redux uses the MIT license, you should stick with that. It's more permissive than the GPL and will encourage other developers to actually use your library.

Why we prefer GPL 3 for license

We opted for GPL 3 because we understand that:

  1. Allows distribution of this code with non free software.
  2. This license ensure the freedom of this code for ever (non whatever license).
  3. We want to promote free software (not as free beer), not just open source.

Conversation in pt_BR (sorry) between @recidive and @sebas5384 (me):

henrique [8:37 PM]
okk dei uma lida lá

[8:37]
eu só tenho um problema qto a GPL 3, que é a de restringir o uso, só isso

[8:37]
uns podem optar por não usá-lo apenas por conta disso

sebas5384 [8:38 PM]
pois é, mas hoje não vejo pessoas ligando para nada do MIT

[8:38]
tem uma Netflix usando reactjs

henrique [8:39 PM]
95% ou mais de projetos js são MIT

[8:39]
os relevantes

sebas5384 [8:39 PM]
porque é default

[8:39]
hehe

[8:39]
tipo

[8:39]
o cara da npm init

[8:39]
e vai que vai

henrique [8:39 PM]
não é default não

sebas5384 [8:39 PM]
hmm achei que era

[8:40]
mesmo assim, é default na comunidade js

[8:40]
e isso porque se conhece pouco da lisença

henrique [8:40 PM]

MBP-de-Henrique:~ henrique$ mkdir whatever
MBP-de-Henrique:~ henrique$ npm init -y
Wrote to /Users/henrique/package.json:
{
  "name": "henrique",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

sebas5384 [8:40 PM]
saquei

henrique [8:41 PM]
MIT só garante copyright, acho que não é o ideal para projetos que tem muitos contribuidores

sebas5384 [8:41 PM]
Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

[8:41]
ISC

[8:41]
mesmo coisa

[8:41]
a MERDA de tudo isso

[8:41]
é que fomenta o OpenSource

[8:41]
e não o software livre

henrique [8:42 PM]
burocracia da porra

sebas5384 [8:42 PM]
liverdade e libertinagem é diferente

henrique [8:42 PM]
por isso os caras colocam MIT e um comentário de commit “whatever” assim como no redux

sebas5384 [8:42 PM]
liverdade precisa ter um cuidado, em quanto libertinagem é whatever you like

[8:42]
haha

[8:42]
então

[8:42]
por isso

[8:42]
porque não entende o custo disso

[8:43]
a GPL foi criada

[8:43]
para manter o software livre

[8:43]
não só para fomentar o open source

[8:43]
codigo aberto não implica que é livre

[8:43]
e sempre vai ser

[8:44]
por exemplo

[8:44]
se vc pegar um codigo com licença MIT vc pode trocar para o que vc quiser

[8:44]
até fechar a porra do codigo

[8:45]
tudo baseado na licença do BSD

[8:45]
ISC, MIT, Apache, etc...

[8:45]
GPL é a única que garante que o código SEMPRE seja livre

[8:45]
conhecimento é de propriedade pública

henrique [8:45 PM]
e isso é restringir acesso que disse mais cedo

sebas5384 [8:45 PM]
e eu gosto de garantir que isso seja sempre assim

henrique [8:45 PM]
MIT garante que vc pode inclusive fechar o código

[8:45]
😛

sebas5384 [8:46 PM]
que tipo de acesso?

[8:46]
mas isso não é restringir acesso

henrique [8:46 PM]
acesso a quem quer fazer código fechado

sebas5384 [8:46 PM]
perfeito

[8:46]
é isso mesmo que não gosto

[8:46]
por isso gosto do SL

[8:46]
rsrs

[8:47]
se licenças como GPL não existirem hoje o opensource não seria nem conhecido

[8:47]
eu sou contra a movimentos de libertinagem

[8:48]
porque criam liverdade sem regras, que permitem que outro indivíduo tenha sua liberdade tambem

[8:48]
essas regras são de dominio público

[8:48]
não criadas com o termo “whatever"

[8:49]
whatever não tem opinião

henrique [8:49 PM]
sim, é meio anárquico e desapegado

sebas5384 [8:49 PM]
:simple_smile:

[8:50]
até a anarquia tem suas opniões

[8:50]
auto-organização , etc...

[8:50]
hehe

[8:50]
GPL 3, ela deixa vc colocar o choko-redux por exemplo

[8:50]
junto com software proprietário

[8:50]
:simple_smile:

[8:51]
digo, deixa ser distribuido

[8:51]
e que o codigo seja GPL, não significa que vc é “obrigado” a abrir o código

[8:51]
significa que se vc distribuir, ele precisa ser livre

[8:51]
para sempre

[8:51]
por exemplo

[8:51]
no caso do google

[8:52]
eles usam sl

[8:52]
mas não ficam distribuindo o codigo

[8:52]
mesma coisa se vc usase MIT

[8:52]
a questão é a distribuição

[8:52]
é a diferença de vc poder baixar o código fonte do sistema operacional que vc usa

[8:53]
hehe

[8:53]
eae?

[8:53]
vamos GPL 3 ?

[8:53]
hehe

[8:53]
senão vou ter que convidar mad dog

[8:53]
para tomar uma breja e te convencer

[8:53]
hehehe

henrique [8:53 PM]
eu entendo a questão, pra mim tantôfas, quero mesmo é ver o negócio fluir sem barreiras

sebas5384 [8:55 PM]
hehee

[8:55]
então tem que ser GPL para isso ocorrer

[8:55]
senão alguem pode chegar e botar barreiras 😉

[8:55]
é uma garantia

henrique [8:55 PM]
to tomando uma homebrewed aqui

sebas5384 [8:55 PM]
GPL é garantia de que barreiras não serão colocadas

[8:55]
opa

[8:55]
😄

[8:56]
eu acabei de abrir uma

[8:56]
industrial

[8:56]
rsrs

[8:56]
mas é boa

[8:56]
uma IPA

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.