@cfpb/ccdb5-ui 2.4.12 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -18
- package/dist/ccdb5.min.js +1 -1
- package/dist/ccdb5.min.js.LICENSE.txt +21 -12
- package/dist/ccdb5.min.js.map +1 -1
- package/package.json +56 -70
package/README.md
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
This application allows consumers to search complaints submitted to the CFPB by other consumers.
|
|
5
5
|
|
|
6
6
|
#### Technology Stack
|
|
7
|
+
|
|
7
8
|
This application is written in JavaScript and [Less](http://lesscss.org) within
|
|
8
9
|
the [React](https://facebook.github.io/react/) + [Redux](http://redux.js.org/)
|
|
9
|
-
framework.
|
|
10
|
+
framework. It uses [Webpack](http://webpack.github.io/docs/) at runtime to
|
|
10
11
|
manage module loading.
|
|
11
12
|
|
|
12
13
|
The code is written with the [ES6](http://es6-features.org/) feature set
|
|
@@ -20,6 +21,7 @@ Unit testing of the application is performed within
|
|
|
20
21
|
[yarn](https://yarnpkg.com/) is used to manage the build/test/deploy cycle.
|
|
21
22
|
|
|
22
23
|
#### Screenshot
|
|
24
|
+
|
|
23
25
|

|
|
24
26
|
|
|
25
27
|
## Dependencies
|
|
@@ -28,7 +30,7 @@ This application depends on the following third-party components:
|
|
|
28
30
|
|
|
29
31
|
1. [Capital Framework](https://cfpb.github.io/capital-framework/) - CFPB standard styling and controls
|
|
30
32
|
1. [History](https://github.com/reacttraining/history) - Integrating the address bar with the application
|
|
31
|
-
1. [
|
|
33
|
+
1. [dayjs](https://day.js.org/) - Better date handling than native JavaScript
|
|
32
34
|
|
|
33
35
|
It also contains portions adapted from:
|
|
34
36
|
|
|
@@ -48,19 +50,20 @@ Please see the subsection Configuring in [INSTALL](INSTALL.md#configuring)
|
|
|
48
50
|
#### Developing code
|
|
49
51
|
|
|
50
52
|
###### Prerequisites
|
|
53
|
+
|
|
51
54
|
This application depends on the [Public Complaints API](https://github.com/cfpb/ccdb5-api)
|
|
52
55
|
to be available.
|
|
53
56
|
|
|
54
57
|
For local development, you will need to the following:
|
|
55
58
|
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
- [Run consumerfinance.gov locally (which includes the API)](https://github.com/cfpb/consumerfinance.gov#quickstart).
|
|
60
|
+
- [Fill the local Elasticsearch with data](https://github.com/cfpb/ccdb-data-pipeline/blob/main/INSTALL.md).
|
|
58
61
|
|
|
59
|
-
|
|
62
|
+
**_Note:_** The Public Complaints API runs as part of consumerfinance.gov, but you can run the API as an independent app:
|
|
60
63
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
- Ensure the consumerfinance.gov python container is stopped with `docker-compose stop python`.
|
|
65
|
+
- [Install the API](https://github.com/cfpb/ccdb5-api#setup--running) and run it with `python manage.py runserver`.
|
|
66
|
+
- Edit [`env.js`](https://github.com/cfpb/ccdb5-ui/blob/main/config/env.js#L104) to point `ccdbApiUrl.dev` to the locally running API (likely at `http://localhost:8000/`).
|
|
64
67
|
|
|
65
68
|
###### Code-Build cycle
|
|
66
69
|
|
|
@@ -80,6 +83,7 @@ Enter `Control-C` to exit development mode
|
|
|
80
83
|
## How to test the software
|
|
81
84
|
|
|
82
85
|
#### Unit testing
|
|
86
|
+
|
|
83
87
|
To launch the JavaScript test runner in interactive watch/test mode:
|
|
84
88
|
|
|
85
89
|
```bash
|
|
@@ -100,9 +104,11 @@ Timeouts and the local `baseUrl` are set in cypress.json
|
|
|
100
104
|
### To run Cypress tests locally
|
|
101
105
|
|
|
102
106
|
- Set your node env to development:
|
|
107
|
+
|
|
103
108
|
```bash
|
|
104
109
|
export NODE_ENV=development
|
|
105
110
|
```
|
|
111
|
+
|
|
106
112
|
You can run the tests in headless mode and just see results, or you can open the Cypress test-runner, which lets you choose tests and watch them run in a Chrome browser. Having the live browser allows you to see page state during tests, and you can open Chrome dev tools to check console errors and network requests.
|
|
107
113
|
|
|
108
114
|
To run local tests and just see results:
|
|
@@ -124,6 +130,7 @@ yarn run cypress open --browser chrome
|
|
|
124
130
|
```
|
|
125
131
|
|
|
126
132
|
### To run against a server
|
|
133
|
+
|
|
127
134
|
You can also run Cypress tests against a server by passing a `baseUrl` config with the path to the server's consumer complaints search page.
|
|
128
135
|
|
|
129
136
|
**Note**: If you run against a server that has Django's `DEBUG=False` setting,
|
|
@@ -134,6 +141,70 @@ Our internal DEV servers can be deployed with `DEBUG=True` for running Cypress t
|
|
|
134
141
|
yarn run cypress run --browser chrome --headless --config baseUrl=https://[DEV SERVER URL]/data-research/consumer-complaints/search/
|
|
135
142
|
```
|
|
136
143
|
|
|
144
|
+
## Release management
|
|
145
|
+
|
|
146
|
+
Ready to publish changes to npm?
|
|
147
|
+
|
|
148
|
+
### Config prep:
|
|
149
|
+
|
|
150
|
+
1. If you don't have a `.env` file,
|
|
151
|
+
copy it from the sample file with `cp .env_SAMPLE .env`.
|
|
152
|
+
2. Add a `GITHUB_TOKEN` in your `.env` file (see
|
|
153
|
+
https://github.com/settings/tokens/new?scopes=repo&description=ccdb-release-it
|
|
154
|
+
to create the token value).
|
|
155
|
+
Set the desired token expiry length and click generate.
|
|
156
|
+
3. You need to be part of the collaborators for
|
|
157
|
+
https://www.npmjs.com/package/@cfpb/ccdb5-ui.
|
|
158
|
+
Ask a member of the [consumerfinance.gov](https://github.com/cfpb/consumerfinance.gov) team if you are not.
|
|
159
|
+
|
|
160
|
+
### Steps:
|
|
161
|
+
|
|
162
|
+
1. Ensure you're on `main` and `git pull` to confirm you're up-to-date.
|
|
163
|
+
2. Run `yarn run build` to ensure you have the latest built artifacts for npm.
|
|
164
|
+
Commit any changes to `/dist/` directory files to `main`.
|
|
165
|
+
3. Source your `.env` with `source ./.env` (if `GITHUB_TOKEN` in unset).
|
|
166
|
+
4. Log into npm with `npm login` (if not already logged in).
|
|
167
|
+
5. Run `yarn run release` to start the release.
|
|
168
|
+
This'll run the build scripts to copy the latest JS into
|
|
169
|
+
the `dist` directory. It then uses
|
|
170
|
+
[release-it](https://github.com/release-it/release-it/) to publish to
|
|
171
|
+
npm and create a GitHub tag.
|
|
172
|
+
6. Manually create an entry in the GitHub releases changelog by visiting
|
|
173
|
+
https://github.com/cfpb/ccdb5-ui/releases and clicking "Draft a new release":
|
|
174
|
+
- Choose the latest tag generated by the release script in the prior step.
|
|
175
|
+
- Title the release the same as the release version.
|
|
176
|
+
- Click "Auto-generate release notes" or manually enter release notes.
|
|
177
|
+
- Click "Publish release"
|
|
178
|
+
|
|
179
|
+
### Post-publish steps in consumerfinance.gov
|
|
180
|
+
|
|
181
|
+
1. Navigate to the root directory of the
|
|
182
|
+
[consumerfinance.gov](https://github.com/cfpb/consumerfinance.gov) repo.
|
|
183
|
+
2. Create a new branch.
|
|
184
|
+
3. Move to CCDB asset app directory with `cd cfgov/unprocessed/apps/ccdb-search/`.
|
|
185
|
+
4. `npx yarn-check -u` and update to the latest ccdb5-ui version.
|
|
186
|
+
5. Commit the changes to the npm package and node cache.
|
|
187
|
+
6. Open a Pull Request from the branch for review.
|
|
188
|
+
|
|
189
|
+
### Troubleshooting
|
|
190
|
+
|
|
191
|
+
- Ensure your npm version is up-to-date.
|
|
192
|
+
- `yarn run release` can't find https://www.npmjs.com/package/@cfpb/ccdb5-ui
|
|
193
|
+
and doesn't succeed.
|
|
194
|
+
- You're probably not an npm maintainer on the ccdb5-ui project.
|
|
195
|
+
Reach out to a core consumerfinance.gov member to get access.
|
|
196
|
+
- When updating the package in the consumerfinance.gov repo you get a message
|
|
197
|
+
similar to "Cannot download package in offline mode."
|
|
198
|
+
- This is likely an outdated cache issue, perform the following:
|
|
199
|
+
- Delete `cfgov/unprocessed/apps/ccdb-search/npm-packages-offline-cache`
|
|
200
|
+
- Delete `cfgov/unprocessed/apps/ccdb-search/node_modules`
|
|
201
|
+
- Delete `cfgov/unprocessed/apps/ccdb-search/yarn.lock`
|
|
202
|
+
- Temporarily edit the root directory `.yarnrc` file
|
|
203
|
+
and remove the last two lines and save.
|
|
204
|
+
- Run `yarn cache clean; yarn install`
|
|
205
|
+
from `cfgov/unprocessed/apps/ccdb-search/`.
|
|
206
|
+
- Re-add the last two lines to the root `.yarnrc` file.
|
|
207
|
+
|
|
137
208
|
## Getting help
|
|
138
209
|
|
|
139
210
|
If you have questions, concerns, bug reports, etc, please file an issue in this
|
|
@@ -143,23 +214,24 @@ repository's [Issue Tracker](https://github.com/cfpb/ccdb5-ui/issues).
|
|
|
143
214
|
|
|
144
215
|
[CONTRIBUTING](CONTRIBUTING.md).
|
|
145
216
|
|
|
146
|
-
|
|
217
|
+
---
|
|
147
218
|
|
|
148
219
|
## Open source licensing info
|
|
220
|
+
|
|
149
221
|
1. [TERMS](TERMS.md)
|
|
150
222
|
2. [LICENSE](LICENSE)
|
|
151
223
|
3. [CFPB Source Code Policy](https://github.com/cfpb/source-code-policy/)
|
|
152
224
|
|
|
153
|
-
|
|
154
|
-
----
|
|
225
|
+
---
|
|
155
226
|
|
|
156
227
|
## Links that were helpful
|
|
157
228
|
|
|
158
229
|
#### React-Redux
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
230
|
+
|
|
231
|
+
- https://egghead.io/lessons/javascript-redux-the-single-immutable-state-tree
|
|
232
|
+
- https://medium.com/lexical-labs-engineering/redux-best-practices-64d59775802e
|
|
233
|
+
- https://medium.com/@kylpo/redux-best-practices-eef55a20cc72
|
|
234
|
+
- https://github.com/markerikson/react-redux-links/blob/main/tips-and-best-practices.md
|
|
235
|
+
- https://getstream.io/blog/react-redux-best-practices-gotchas/
|
|
236
|
+
- https://tech.affirm.com/redux-patterns-and-anti-patterns-7d80ef3d53bc
|
|
237
|
+
- https://github.com/gaearon/redux-devtools
|