Skip to content

Commit

Permalink
feat(library): refactor the entire code base
Browse files Browse the repository at this point in the history
BREAKING CHANGE: refactor the entire code

I completely rewrote the library from scratch for two reasons:
1. Provide as much support as possible without introducing bugs, breaking strict mode, or creating an inconvenient API.
2. Reduce the library size.

Here are the changes:
- Angular's peer dependency is now `>= 12`.
- FormGroup's generic was removed in favor of the **experimental** `ControlsOf` interface.
- Remove `mergeValidators`.  Use addValidators in v12.
- Remove `validateOn`.
- Remove `getControl` in favor of `get(key)` or `get(['nested', 'key'])`.
- Remove errors typing.
- Validators should now be imported from Angular.
- `FormBuilder` doesn't support generic anymore. Due to the complexity of the builder API, we're currently couldn't create a "good" implementation of `ControlsOf` for the builder.
- Remove the `group.persist()` from the instance to an exported function to make it tree-shakeable.

Fixes #197,#103,#102,#97,#100
  • Loading branch information
NetanelBasal committed Oct 8, 2021
1 parent 8675a4f commit 5cee6fe
Show file tree
Hide file tree
Showing 157 changed files with 44,281 additions and 23,421 deletions.
98 changes: 0 additions & 98 deletions .all-contributorsrc

This file was deleted.

12 changes: 0 additions & 12 deletions .browserslistrc

This file was deleted.

5 changes: 1 addition & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Editor configuration, see https:https://editorconfig.org
# Editor configuration, see http:https://editorconfig.org
root = true

[*]
Expand All @@ -8,9 +8,6 @@ indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

13 changes: 0 additions & 13 deletions .eslintrc

This file was deleted.

35 changes: 35 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nrwl/nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"rules": {}
}
]
}
52 changes: 52 additions & 0 deletions .github/ISSUE_TEMPLATE/1-bug-report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Bug Report
description: Report a bug in the Reactive Forms Library

body:
- type: dropdown
id: is-regression
attributes:
label: Is this a regression?
options:
- 'Yes'
- 'No'
validations:
required: true

- type: textarea
id: description
attributes:
label: Description
validations:
required: true

- type: input
id: reproduction
attributes:
label: Please provide a link to a minimal reproduction of the bug

- type: textarea
id: exception-or-error
attributes:
label: Please provide the exception or error you saw
render: true

- type: textarea
id: environment
attributes:
label: Please provide the environment you discovered this bug in
render: true

- type: textarea
id: other
attributes:
label: Anything else?

- type: dropdown
id: contribute
attributes:
label: Do you want to create a pull request?
options:
- 'Yes'
- 'No'
validations:
required: true
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/2-feature-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 'Feature Request'
description: Suggest a feature for Reactive Forms Library

body:
- type: textarea
id: description
attributes:
label: Description
validations:
required: true

- type: textarea
id: proposed-solution
attributes:
label: Proposed solution
validations:
required: true

- type: textarea
id: alternatives-considered
attributes:
label: Alternatives considered
validations:
required: true

- type: dropdown
id: contribute
attributes:
label: Do you want to create a pull request?
options:
- 'Yes'
- 'No'
validations:
required: true
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/3-support-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: 'Support Request'
about: Questions and requests for support
---

Please do not file questions or support requests on the GitHub issues tracker.

You can get your questions answered using other communication channels. Please see:

https://github.com/ngneat/reactive-forms/discussions

Thank you!
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Please check if your PR fulfills the following requirements:

- [ ] The commit message follows our guidelines: CONTRIBUTING.md#commit
- [ ] The commit message follows our guidelines: https://github.com/ngneat/reactive-forms/blob/master/CONTRIBUTING.md#commit
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)

Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: '@ngneat/reactive-forms'

on:
push:
branches:
- master
pull_request:

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: true

steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- uses: actions/setup-node@v2
with:
node-version: '14'
cache: 'npm'

- name: Install dependencies
run: npm i

- name: Run ESLint
run: npm run lint:all

- name: Run Build
run: npm run build:all

- name: Run unit tests
run: npm run test:all
30 changes: 0 additions & 30 deletions .github/workflows/test.yml

This file was deleted.

9 changes: 0 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,10 @@
/dist
/tmp
/out-tsc
/projects/ngneat/reactive-forms/src/lib/type-tests/out-tsc
# Only exists if Bazel was run
/bazel-out

# dependencies
node_modules

# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json

# IDEs and editors
/.idea
.project
Expand All @@ -30,7 +23,6 @@ speed-measure-plugin*.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# misc
/.sass-cache
Expand All @@ -45,4 +37,3 @@ testem.log
# System Files
.DS_Store
Thumbs.db
.cache
Loading

0 comments on commit 5cee6fe

Please sign in to comment.