Skip to content
This repository was archived by the owner on May 3, 2024. It is now read-only.

Commit 5242c70

Browse files
fix: 🐛 provide config defaults
1 parent 82ddc95 commit 5242c70

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,16 @@ markDescendantsAsDirty(formControl);
371371

372372
### Basic Workflow
373373

374+
One time config: `git config --global push.followTags true`
375+
374376
1. Develop
375377
1. Write specs
376378
1. Run `npm run test:lib`
377379
1. Run `npm run commit` and choose fix or feature
378380
1. Run `npm run release`
379381
1. Run `npm run build:lib`
380382
1. Go to the dist directory and run `npm publish`
383+
1. Push changes `git push`
381384

382385
### Scripts
383386

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"test:lib:coverage": "npm run test:lib -- --code-coverage",
2020
"postbuild:lib": "copyfiles README.md logo.png dist/ngx-errors",
2121
"release": "cd projects/ngx-errors && standard-version --infile ../../CHANGELOG.md",
22+
"release:dry": "cd projects/ngx-errors && standard-version --infile ../../CHANGELOG.md --dry-run",
2223
"commitlint": "commitlint",
2324
"prepare": "husky install"
2425
},

projects/ngx-errors/src/lib/errors-configuration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ export interface IErrorsConfiguration {
3535
@Injectable()
3636
export class ErrorsConfiguration implements IErrorsConfiguration {
3737
showErrorsWhenInput = 'touched';
38-
showMaxErrors = undefined;
38+
showMaxErrors: number | undefined = undefined;
3939
}

projects/ngx-errors/src/lib/errors.module.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ const declarationsAndExports = [
2424
SetMatInputErrorStateMatcherDirective,
2525
];
2626

27+
const defaultConfig: ErrorsConfiguration = {
28+
showErrorsWhenInput: 'touched',
29+
showMaxErrors: undefined,
30+
};
31+
32+
function mergeErrorsConfiguration(
33+
config: IErrorsConfiguration
34+
): ErrorsConfiguration {
35+
return { ...defaultConfig, ...config };
36+
}
37+
2738
@NgModule({
2839
imports: [ReactiveFormsModule],
2940
declarations: [...declarationsAndExports],
@@ -37,14 +48,14 @@ const declarationsAndExports = [
3748
})
3849
export class NgxErrorsModule {
3950
static configure(
40-
config?: IErrorsConfiguration
51+
config: IErrorsConfiguration
4152
): ModuleWithProviders<NgxErrorsModule> {
4253
return {
4354
ngModule: NgxErrorsModule,
4455
providers: [
4556
{
4657
provide: ErrorsConfiguration,
47-
useValue: config,
58+
useValue: mergeErrorsConfiguration(config),
4859
},
4960
{
5061
provide: ErrorStateMatcher,

0 commit comments

Comments
 (0)