Skip to content
This repository was archived by the owner on Jul 18, 2022. It is now read-only.
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ trim_trailing_whitespace = true
[*.md]
indent_style = space
insert_final_newline = false
indent_size = 4

[package.json]
[{*.yaml,*.yml,package.json}]
indent_style = space
indent_size = 2
3 changes: 1 addition & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_modules
dist
coverage
example
docs
styleguide
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ updates:
- package-ecosystem: "npm"
directory: "/" # Location of package manifests
schedule:
interval: "daily"
interval: "weekly"
27 changes: 2 additions & 25 deletions .github/workflows/push.yml → .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint and test
name: Coverage

on:
push:
Expand All @@ -8,37 +8,14 @@ on:
- '**.md'
branches:
- main
pull_request:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
- run: npm ci
- run: npm run lint
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@master
with:
node-version: 16
- run: npm ci
- run: npm run test:ci
coverage:
needs: [ test ]
if: github.ref == 'refs/heads/main'
name: Sending test coverage to Code Climate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm ci
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish documentation

on:
workflow_call:
inputs:
targetFolder:
required: true
type: string

jobs:
docs:
name: Build & publish documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm ci
- run: npm run build:docs
- uses: JamesIves/github-pages-deploy-action@4.1.5
with:
branch: docs
folder: styleguide
target-folder: ${{ inputs.targetFolder }}
git-config-name: github-pages-deploy-action
21 changes: 16 additions & 5 deletions .github/workflows/release.yml → .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,50 @@
name: Lint, test, build and publish
name: Publish

on:
release:
types: [ published ]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm ci
- run: npm run lint

test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm ci
- run: npm run test:ci

publish:
needs: [ lint, test ]
name: Build & publish
name: Build & publish package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm ci
- run: npm run build
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}

docs:
needs: [ publish ]
steps:
- uses: ./.github/workflows/docs.yml
with:
targetFolder: docs
34 changes: 34 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Verify

on:
push:
tags-ignore:
- '*'
paths-ignore:
- '**.md'
branches:
- main
pull_request:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm ci
- run: npm run lint

test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm ci
- run: npm run test:ci
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ node_modules/
.npm

dist/

styleguide/
*.code-workspace
8 changes: 8 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*
.*
!CHANGELOG
!dist/*/*
!src/**/*
**/*.test.ts
**/*.spec.ts
**/.*
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.12
16
28 changes: 28 additions & 0 deletions .styleguidist/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module.exports = function ({color}) {
return {
Blockquote: {
blockquote: {
borderLeft: `5px solid ${color.border}`,
margin: '16px 32px 16px 0',
paddingLeft: 20,
},
},
Playground: {
preview: {
color: color.base,
// '& input': {
// fontSize: 'inherit',
// background: 'none',
// outline: 'none',
// border: `1px solid ${color.base}`,
// borderRadius: 4,
// padding: 8,
// // height: '1.4375em',
// '&:hover': {
// border: `1px solid ${color.light}`,
// }
// },
},
},
}
}
35 changes: 35 additions & 0 deletions .styleguidist/theme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module.exports = {
fontFamily: {
base: '"IBM Plex Sans", sans-serif',
monospace: '"IBM Plex Mono", monospace',
},
color: {
base: '#aab4be',
light: '#eaeef2',

link: '#9e9eff',
linkHover: '#d0adf0',

border: '#132f4c',

baseBackground: '#0b1929',
sidebarBackground: '#0b1929',
codeBackground: '#011e3c',

ribbonBackground: '#0f80d7',
ribbonText: '#eaeef2',

codeBase: '#aab4be',
codeFunction: '#77abff',
codeComment: '#5c647f',
codeString: '#b9e981',
codeNumber: '#ff8563',
codeConstant: '#ff6774',
codeProperty: '#ff6774',
codePunctuation: '#d18ff0',
codeOperator: '#d18ff0',
codeKeyword: '#d18ff0',
codeParameter: '#68ddff',
},
sidebarWidth: 280,
};
9 changes: 8 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"recommendations": [
"dbaeumer.vscode-eslint"
"tyriar.sort-lines",
"moppitz.vscode-extension-auto-import",
"dbaeumer.vscode-eslint",
"davidanson.vscode-markdownlint",
"gruntfuggly.todo-tree",
"editorconfig.editorconfig",
"streetsidesoftware.code-spell-checker",
"andys8.jest-snippets",
]
}
46 changes: 46 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# What's changed

## [2.1.0] - 2021-12-23

### Added

- [styleguidist](https://react-styleguidist.js.org/) based documentation
- `castType` function as an argument added to `min` & `max`

This is done to be able to check number passed from form directly. Html forms pass values as strings. So, to cast type of these values to numbers we can use castType function.

### Changed

- All dependencies are up to date
- `jest.mocked` instead of `ts-jest/mocked` due to https://github.com/facebook/jest/pull/12089
- Package contains src directory since now
- pattern validator accepts falthy values

### Removed

- `postalCodeCA` & `sinCA` validators

I don't want to keep special logic within this library.
If you need something like that you may integrate it with any other projects
e.g. [validator.js](https://github.com/validatorjs/validator.js) trough the `func` validator.

- sources of example application removed

**Full Changelog**: [2.0.0...2.1.0](https://github.com/boonya/react-hook-form-validation/compare/2.0.0...2.1.0)

## [2.0.0] - 2021-10-23

- Asynchronous interface v2.0 [#34]
- Update dependencies [#65]

**Full Changelog**: [1.0.0-beta.4...2.0.0](https://github.com/boonya/react-hook-form-validation/compare/1.0.0-beta.4...2.0.0)

## [1.0.0-beta.4] - 2021-09-11

**Full Changelog**: [1.0.0-beta.3...1.0.0-beta.4](https://github.com/boonya/react-hook-form-validation/compare/1.0.0-beta.3...1.0.0-beta.4)

## [1.0.0-beta.3] - 2021-08-07

**Full Changelog**: [1.0.0-beta.2...1.0.0-beta.3](https://github.com/boonya/react-hook-form-validation/compare/1.0.0-beta.2...1.0.0-beta.3)

## [1.0.0-beta.2] - 2021-08-07
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MIT License
# MIT License

Copyright (c) 2019 Serhii [boonya] Buinytskyi

Expand Down
Loading