Skip to content

Commit

Permalink
Chore: Package updates (#49)
Browse files Browse the repository at this point in the history
* Initial commit

* Update jest

* Update jest again (just published)

* Update eslint

* Update uuid

* Upgrade size-limit

* Remove unused coverage reporter

* Bump patch

* Upgrade travis node

* Update branch name reference in travis

* Specify dist b/c travis cannot figure it out
  • Loading branch information
chawes13 authored Jul 7, 2023
1 parent 61eae02 commit ff9755b
Show file tree
Hide file tree
Showing 9 changed files with 3,904 additions and 7,456 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
jasmine: true
jest: true
es6: true
parser: babel-eslint
parser: "@babel/eslint-parser"
parserOptions:
sourceType: module
ecmaFeatures:
Expand Down
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: node_js
node_js:
- '8'
- '18'
dist: 'jammy'
notifications:
email: false
before_script: yarn size
Expand All @@ -10,5 +11,5 @@ deploy:
api_key:
secure: Mu68/DGE+RC2TilCle7RXuqeluOCsR2MMSFge2MLNGWDdtv/j5S5gMYFuHKw61ASpBQ1bJsJmuIJ1/MHrAQ5S67N6/8lA2LVVSzWMB30h28anUm+lCSGZMWcy+Z+z1xXLMOAMrDglHGwAmt5NabUKIpHc9YWuPE3T3yp2ilVq81ameFObPZ08ISM8pmF90bp1qIXwk1iUPTcCWa6UkIfhpfAdMVHVWXLWIyaZ3+/p8mYNpc27mW23GrWcejDfgUUI9Oe+5pv/fb3RBO2HXLmIt582s+H3/evY9VSHTKt2e/CbBO2umgE1Bgn5Al7VIX8YRb62effbxUyNMVLk15UQnTVWu7m3/V2+N3pnFrJzMFJMS7JNmIPzCb+xFKvKaqo6qklfc6Wir8IW8mMyB1KznoaqEeOJ9daehmQgCQkCulzl5h6HLQ08OFQ5WUcsSHgAJgUlXsL2u5izQNZhbhT1eMP/YwNZvbI072Yxw468U0oaeGaj1Y0rnmtQR0UT3QcfyEyzzZ/2+FwDRF9AfZwhMDx7BNrlCuQ0Z2lnj54fggXe2q0G6NBrpC6Vw610FTCwBQ3yzQKnQ8IQckYxp/nD7ew2mnaQJnj0V4wn9MqquijOukBKUfEFmRjliKYLdTIUZBPJ9wBua1PrBlO6QIeBJzPlsDA039CB4icBYE2CCw=
on:
branch: master
branch: main
skip_cleanup: true
2 changes: 1 addition & 1 deletion .babelrc → babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
module.exports = {
"presets": [ "@launchpadlab/babel-preset/react" ]
}
19 changes: 9 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redux-flash",
"version": "2.0.6",
"version": "2.0.7",
"description": "Redux action creators for displaying flash messages",
"main": "lib/index.js",
"scripts": {
Expand All @@ -12,8 +12,7 @@
"prepublish": "yarn run lint && yarn run clean && yarn run build",
"test": "jest",
"size": "yarn build && size-limit",
"test:coverage": "jest --coverage",
"report-coverage": "codeclimate-test-reporter < coverage/lcov.info"
"test:coverage": "jest --coverage"
},
"repository": "launchpadlab/redux-flash",
"keywords": [
Expand All @@ -31,23 +30,23 @@
"lib/"
],
"devDependencies": {
"@babel/eslint-parser": "^7.22.6",
"@launchpadlab/babel-preset": "^2.1.0",
"@size-limit/preset-small-lib": "^2.1.1",
"babel-eslint": "^10.0.2",
"codeclimate-test-reporter": "^0.4.1",
"eslint": "^6.1.0",
"@size-limit/file": "^8.2.6",
"@size-limit/webpack": "^8.2.6",
"eslint": "^8.44.0",
"eslint-plugin-import": "^2.2.0",
"jest": "^24.8.0",
"jest": "^29.5.0",
"redux": "^4.0.4",
"redux-mock-store": "^1.3.0",
"size-limit": "^2.1.1"
"size-limit": "^8.2.6"
},
"dependencies": {
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"prop-types": "^15.6.1",
"redux-actions": "^2.6.5",
"uuid": "^3.1.0"
"uuid": "^9.0.0"
},
"peerDependencies": {
"redux": "^4.0.0 || ^3.0.0"
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export {
clearMessages,
removeMessage,
} from './actions'
export flashMessageType from './flashMessageType'
export middleware from './middleware'
export { default as flashMessageType } from './flashMessageType'
export { default as middleware } from './middleware'
export {
reducer,
getFlashMessages,
Expand Down
4 changes: 2 additions & 2 deletions src/middleware.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import uuid from 'uuid/v4'
import { v4 as uuidv4 } from 'uuid'
import * as actions from './actions'

const DEFAULT_TIMEOUT = 3000
Expand Down Expand Up @@ -26,7 +26,7 @@ function middleware (options={}) {
}
}
} = action
const id = uuid()
const id = uuidv4()
// Dispatch appropriate internal actions
if (push) next(actions.clearMessages())
next(actions._addMessage({ id, message, isError, props: { ...globalProps, ...props }}))
Expand Down
8 changes: 4 additions & 4 deletions test/actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,31 @@ test('flashMessage sets default timeout if none is provided', () => {
const store = createMockStore()
store.dispatch(flashMessage('Hi'))
expect(store.getActionTypes()).toEqual([ADD_MESSAGE_ACTION_TYPE])
jest.runTimersToTime(4000)
jest.advanceTimersByTime(4000)
expect(store.getActionTypes()).toEqual([ADD_MESSAGE_ACTION_TYPE, REMOVE_MESSAGE_ACTION_TYPE])
})

test('flashMessage sets custom timeout if one is provided in action creator', () => {
const store = createMockStore()
store.dispatch(flashMessage('Hi', { timeout: 500 }))
expect(store.getActionTypes()).toEqual([ADD_MESSAGE_ACTION_TYPE])
jest.runTimersToTime(1000)
jest.advanceTimersByTime(1000)
expect(store.getActionTypes()).toEqual([ADD_MESSAGE_ACTION_TYPE, REMOVE_MESSAGE_ACTION_TYPE])
})

test('flashMessage sets custom timeout if one is provided in middleware config', () => {
const store = createMockStore({}, { timeout: 500 })
store.dispatch(flashMessage('Hi'))
expect(store.getActionTypes()).toEqual([ADD_MESSAGE_ACTION_TYPE])
jest.runTimersToTime(1000)
jest.advanceTimersByTime(1000)
expect(store.getActionTypes()).toEqual([ADD_MESSAGE_ACTION_TYPE, REMOVE_MESSAGE_ACTION_TYPE])
})

test('flashMessage sets no timeout if "false" is provided', () => {
const store = createMockStore()
store.dispatch(flashMessage('Hi', { timeout: false }))
expect(store.getActionTypes()).toEqual([ADD_MESSAGE_ACTION_TYPE])
jest.runTimersToTime(4000)
jest.advanceTimersByTime(4000)
expect(store.getActionTypes()).toEqual([ADD_MESSAGE_ACTION_TYPE])
})

Expand Down
2 changes: 2 additions & 0 deletions test/flashMessageType.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import {
} from '../src'
import { createMockStore } from './helpers'

jest.useFakeTimers()

function validatePropType (propType, value) {
// checkPropTypes will log an error if it fails
const spy = jest.spyOn(console, 'error')
Expand Down
Loading

0 comments on commit ff9755b

Please sign in to comment.