Skip to content

Commit

Permalink
Packages/utils (#2863)
Browse files Browse the repository at this point in the history
* Implemented the utils package
- Refactored the `packages/core/src/utils.js` file into separate typescript files in the new `packages/utils/src`

* - More changes

* - Added all of the non-validation-based utilities and many of the tests

* - removed schema related files temporarily

* - Added missing tests to get test coverage up to 100% for all but `getWidget()`
- Also did some cleanup in the `src` files, moving types into `types.ts`, and exporting all the types

* - Fixed getWidget tests

* - Update README.md

* - update the target to  for typescript in

* - revert `package-lock.json` for antd, core and playground

* - fix build issues

* - Added the `rjsf-v5` branch to the `ci.yml`
- Added a new `RJSFSchema` as a redefine of `JSONSchema7` to make changing schemas everywhere else easier
- Updated all the utils and tests to change `JSONSchema7` to `RJSFSchema`
- Fixed test breaks by casting e to Error

* - changed tabs to spaces in package.json, fixed bug in deepEquals

* - Add `tsdx` to `package.json` to enable running `npm run test` inside of the `packages/utils` directory
  - Bumped `@types/jest` to match the version in use by `tsdx`
- Fixed the `utcToLocal()` test by mocking the `getDate()` and `getHours()` functions to be UTC + 2 hours to avoid server vs local timezone issues

* - Began adding documentation to the utility functions
- Reordered the logic in `asNumber` to avoid converting to number until we have to
- Updated `findSchemaDefinition()` to handle the case where a `$ref` in a schema also contains additional props
- Updated `getSubmitButtonOptions()` to export its `DEFAULT_OPTIONS` for testing purposes
- Updated `getUiOptions()` to no longer support `ui:widget` objects as it has been deprecated for years
- Made some other test fixes

* - Finished adding documentation to all of the remaining utils methods

* - Minor documentation changes, and allow `findSchemaDefinition()` to support undefined ref name

* - Responded to self-review comments
  • Loading branch information
heath-freenome authored May 31, 2022
1 parent 8863080 commit 78688c0
Show file tree
Hide file tree
Showing 75 changed files with 17,573 additions and 21,328 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [ master ]
branches: [ master, rjsf-v5 ]
pull_request:
branches: [ master ]
branches: [ master, rjsf-v5 ]

jobs:
build:
Expand All @@ -22,7 +22,7 @@ jobs:
- run: npm ci
- run: npm run lint
- run: npm run cs-check

- name: Build with Netlify badge
if: github.ref != 'refs/heads/master'
run: npm run build
Expand All @@ -31,14 +31,14 @@ jobs:
- name: Build
if: github.ref == 'refs/heads/master'
run: npm run build

- if: matrix.node-version == '14.x'
uses: actions/upload-artifact@v2
with:
name: dist
path: packages/playground/build
- run: npm test

deploy_preview:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/master'
Expand All @@ -58,7 +58,7 @@ jobs:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}

deploy_playground:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
Expand All @@ -78,7 +78,7 @@ jobs:
build_dir: dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# deploy_canary:
# runs-on: ubuntu-latest
# if: github.ref == 'refs/heads/master'
Expand Down
Loading

0 comments on commit 78688c0

Please sign in to comment.