Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish
run-name: ${{ github.actor }} published a new release
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out latest code
uses: actions/checkout@v3
- name: Set up node
uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
scope: '@launchpadlab'
- name: Install dependencies
run: HUSKY=0 yarn --frozen-lockfile
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting HUSKY to 0 will skip the install of precommit hooks (https://typicode.github.io/husky/guide.html#with-env-variables)

- name: Publish package on NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn run lint && yarn run docs && git add docs.md
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10
18
9 changes: 1 addition & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
language: node_js
dist: focal
before_script:
- 'yarn lint'
notifications:
email: false
deploy:
provider: npm
email: dev@launchpadlab.com
api_key:
secure: adaVgZMVHSiReV4NvO9CYkEbt72E2WXyk8H+q5s9hAnBx0/XU467fn9gM3E70BNo7TeI6W081r5wLXzKgnOnBkyLazHtV53o2HmP/eHZOpa8g9Be2qwxU0QQ4sQqnKxXQRg0CqaTo4zpJROWidT/DnvHDfzs+tuQr9apIgCdAT9GUVh2jmjvp4fC5ouA3u2WCih9rlgMbm+pmAHInL0rxyPuagJig1NKonvhAnsa7PZwGm0vEE79nFqCBABnf4ekRad+RDeuJ+ao5SH+9zJIWHtFP4u4GdFeZRUmOX5tPq/YcEBhEQ2PyoSRP+1tYFuMogOT97wSBQC4GSJhUSA47YxpDpWqVgT1fo1zhG/3/BXMwcT5Qv7fqtV7D0S8R9GLP9Z4Xfp6iGJ462Ivgds4nU5t1eWbNFHsuR3j+agAnUptVYroVpPjHE+M0CmgqSRaCz4Qt8JNcxO1JZncdmnHeeSHStckWk44+8FWvn6D8JVrP4fFNtbdqghjgsOOP5PTouVtc/R+j0p0raooLHUjyh26Rn7asPary1h7LPDlQBRgwGHWDDdgTORAhcDRYA/UywFq06WqtrJ2xat3TxBD2Qyh7TTSoEvBIJdHeRuB6F9R4+y+Wy31wabV+TaeG9a2aJrSKSFIKYQ3iv/dzV7dVkkf2NXGgFcp3NyiYRTA/ac=
on:
branch: master
skip_cleanup: true
28 changes: 14 additions & 14 deletions docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

### Table of Contents

- [selectorForSlice][1]
- [Parameters][2]
- [Examples][3]
- [setState][4]
- [Parameters][5]
- [Examples][6]
- [unsetState][7]
- [Parameters][8]
- [Examples][9]
* [selectorForSlice][1]
* [Parameters][2]
* [Examples][3]
* [setState][4]
* [Parameters][5]
* [Examples][6]
* [unsetState][7]
* [Parameters][8]
* [Examples][9]

## selectorForSlice

Given the path of a certain state slice, returns a function that can be used to create state selectors (helpful for `mapStateToProps()`).

### Parameters

- `slicePath` **[String][10]** Path to slice of state.
* `slicePath` **[String][10]** Path to slice of state.

### Examples

Expand Down Expand Up @@ -55,13 +55,13 @@ Returns **[Function][11]** A function that can be used to create state selectors

## setState

A helper function for creating simple "setter" reducers.
A helper function for creating simple "setter" reducers.
Given a path, it sets the state at that path to the payload of an action.

### Parameters

- `path` **[String][10]** Path to the part of the state that will be set
- `transform` **[Function][11]** A function with arguments `(action, state, slice)` that can be used to transform the value that will be set. `slice` is the data, if any, that already exists in the state at `path`. The default transform function simply returns the action's payload. To set the state to a constant value, simply pass the value in place of the transform function.
* `path` **[String][10]** Path to the part of the state that will be set
* `transform` **[Function][11]** A function with arguments `(action, state, slice)` that can be used to transform the value that will be set. `slice` is the data, if any, that already exists in the state at `path`. The default transform function simply returns the action's payload. To set the state to a constant value, simply pass the value in place of the transform function.

### Examples

Expand Down Expand Up @@ -92,7 +92,7 @@ Given a path, it calls lodash [unset ][12] on the state at that path.

### Parameters

- `path` **[String][10]** Path to the part of state to unset
* `path` **[String][10]** Path to the part of state to unset

### Examples

Expand Down
26 changes: 11 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@launchpadlab/lp-redux-utils",
"version": "1.3.2",
"version": "1.3.3",
"description": "redux helpers",
"main": "lib/index.js",
"scripts": {
Expand All @@ -10,8 +10,9 @@
"clean": "rm -rf lib",
"docs": "documentation build src/index.js -f md -o docs.md",
"lint": "eslint src --max-warnings=0",
"prepublish": "yarn run lint && yarn run clean && yarn run build",
"test": "jest --coverage"
"prepublishOnly": "yarn run lint",
"test": "jest --coverage",
"prepare": "husky install && yarn run clean && yarn run build"
},
"repository": "launchpadlab/lp-redux-utils",
"homepage": "https://github.com/launchpadlab/lp-redux-utils",
Expand All @@ -30,25 +31,20 @@
"lib/"
],
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.8.4",
"@babel/cli": "^7.22.9",
"@babel/core": "^7.22.9",
"@launchpadlab/babel-preset": "^2.1.1",
"@launchpadlab/eslint-config": "^2.7.0",
"documentation": "^12.1.4",
"eslint": "^6.8.0",
"husky": "^4.2.3",
"jest": "^25.1.0",
"@launchpadlab/eslint-config": "^3.0.1",
"documentation": "^14.0.0",
"eslint": "^8.0.0",
"husky": "^8.0.0",
"jest": "^29.0.0",
"redux": "^4.0.0"
},
"dependencies": {
"lodash": "^4.17.4"
},
"peerDependencies": {
"redux": ">=2.0.0"
},
"husky": {
"hooks": {
"pre-commit": "yarn run docs && git add docs.md"
}
}
}
Loading