diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..5aee446 --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,30 @@ +name: react-floki + +on: + push: + branches: + - master + +jobs: + publish-npm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 14 + registry-url: https://registry.npmjs.org/ + - name: bump version + run: | + git config --global user.email "git@wednesday.is" + git config --global user.name "Git" + npm version patch -m 'Bump up' + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} + - name: Publish + run: yarn publish + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/generators/container/reducer.js.hbs b/generators/container/reducer.js.hbs index e633aa6..cc0a0dd 100644 --- a/generators/container/reducer.js.hbs +++ b/generators/container/reducer.js.hbs @@ -4,10 +4,9 @@ * */ import produce from 'immer' -import { fromJS } from 'immutable' import { createActions } from 'reduxsauce' -export const initialState = fromJS({}) +export const initialState = {} export const { Types: {{ camelCase name }}Types, Creators: {{ camelCase name }}Creators } = createActions({ defaultAction: ['somePayload'] @@ -18,7 +17,7 @@ export const {{ camelCase name }}Reducer = (state = initialState, action) => produce(state, (/* draft */) => { switch (action.type) { case {{ camelCase name}}Types.DEFAULT_ACTION: - return state.set('somePayload', action.somePayload) + return {...state, somePayload: action.somePayload} default: return state } diff --git a/generators/container/reducer.test.js.hbs b/generators/container/reducer.test.js.hbs index fbdb10b..354e20d 100644 --- a/generators/container/reducer.test.js.hbs +++ b/generators/container/reducer.test.js.hbs @@ -1,5 +1,4 @@ // import produce from 'immer' -import { fromJS } from 'immutable'; import { {{ camelCase name }}Reducer, {{ camelCase name }}Types, initialState } from '../reducer' /* eslint-disable default-case, no-param-reassign */ @@ -14,7 +13,7 @@ describe('{{ properCase name }} reducer tests', () => { }) it('should return the update the state when an action of type DEFAULT is dispatched', () => { - const expectedResult = fromJS(state.toJS()).set('somePayload', 'Mohammed Ali Chherawalla') + const expectedResult = {...state, somePayload: 'Mohammed Ali Chherawalla'} expect( {{ camelCase name }}Reducer(state, { type: {{ camelCase name}}Types.DEFAULT_ACTION, diff --git a/generators/container/selectors.js.hbs b/generators/container/selectors.js.hbs index 69dcf73..3a8018f 100644 --- a/generators/container/selectors.js.hbs +++ b/generators/container/selectors.js.hbs @@ -5,7 +5,7 @@ import { initialState } from './reducer' * Direct selector to the {{ camelCase name }} state domain */ -const select{{ properCase name }}Domain = state => (state.{{ camelCase name }} || initialState).toJS() +const select{{ properCase name }}Domain = state => state.{{ camelCase name }} || initialState const makeSelect{{ properCase name }} = () => createSelector(select{{ properCase name }}Domain, substate => substate) diff --git a/generators/container/selectors.test.js.hbs b/generators/container/selectors.test.js.hbs index f690cd1..296672f 100644 --- a/generators/container/selectors.test.js.hbs +++ b/generators/container/selectors.test.js.hbs @@ -1,4 +1,3 @@ -import { fromJS } from 'immutable' import { select{{ properCase name }}Domain } from '../selectors' describe('{{ properCase name }} selector tests', () => { @@ -6,11 +5,11 @@ describe('{{ properCase name }} selector tests', () => { beforeEach(() => { mockedState = { - {{ camelCase name }}: fromJS({}) + {{ camelCase name }}: {} } }) it('should select the user state', () => { - expect(select{{ properCase name }}Domain(mockedState)).toEqual(mockedState.{{ camelCase name }}.toJS()) + expect(select{{ properCase name }}Domain(mockedState)).toEqual(mockedState.{{ camelCase name }}) }) }) \ No newline at end of file diff --git a/package.json b/package.json index c93d911..5ca2664 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-floki", - "version": "1.0.83", + "version": "1.0.84", "description": "A React component, container and test generation library", "repository": { "type": "git",