Skip to content

Commit 11105d0

Browse files
authored
chore: improve dependencies and lint (#277)
1 parent 20ae40d commit 11105d0

22 files changed

+136
-400
lines changed

.husky/_/husky.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/bin/sh
22
if [ -z "$husky_skip_init" ]; then
33
debug () {
4-
[ "$HUSKY_DEBUG" = "1" ] && echo "husky (debug) - $1"
4+
if [ "$HUSKY_DEBUG" = "1" ]; then
5+
echo "husky (debug) - $1"
6+
fi
57
}
68

79
readonly hook_name="$(basename "$0")"
@@ -23,8 +25,7 @@ if [ -z "$husky_skip_init" ]; then
2325

2426
if [ $exitCode != 0 ]; then
2527
echo "husky - $hook_name hook exited with code $exitCode (error)"
26-
exit $exitCode
2728
fi
2829

29-
exit 0
30+
exit $exitCode
3031
fi

angular.json

Lines changed: 5 additions & 292 deletions
Original file line numberDiff line numberDiff line change
@@ -1,296 +1,9 @@
11
{
2-
"version": 1,
3-
"cli": {
4-
"analytics": false
5-
},
6-
"defaultProject": "example-app",
2+
"version": 2,
73
"projects": {
8-
"example-app": {
9-
"projectType": "application",
10-
"root": "apps/example-app",
11-
"sourceRoot": "apps/example-app/src",
12-
"prefix": "app",
13-
"schematics": {},
14-
"architect": {
15-
"build": {
16-
"builder": "@angular-devkit/build-angular:browser",
17-
"options": {
18-
"outputPath": "dist/apps/example-app",
19-
"index": "apps/example-app/src/index.html",
20-
"main": "apps/example-app/src/main.ts",
21-
"polyfills": "apps/example-app/src/polyfills.ts",
22-
"tsConfig": "apps/example-app/tsconfig.app.json",
23-
"assets": ["apps/example-app/src/favicon.ico", "apps/example-app/src/assets"],
24-
"styles": ["apps/example-app/src/styles.css"],
25-
"scripts": [],
26-
"vendorChunk": true,
27-
"extractLicenses": false,
28-
"buildOptimizer": false,
29-
"sourceMap": true,
30-
"optimization": false,
31-
"namedChunks": true
32-
},
33-
"configurations": {
34-
"production": {
35-
"budgets": [
36-
{
37-
"type": "anyComponentStyle",
38-
"maximumWarning": "6kb"
39-
}
40-
],
41-
"fileReplacements": [
42-
{
43-
"replace": "apps/example-app/src/environments/environment.ts",
44-
"with": "apps/example-app/src/environments/environment.prod.ts"
45-
}
46-
],
47-
"optimization": true,
48-
"outputHashing": "all",
49-
"sourceMap": false,
50-
"namedChunks": false,
51-
"extractLicenses": true,
52-
"vendorChunk": false,
53-
"buildOptimizer": true
54-
}
55-
},
56-
"outputs": ["{options.outputPath}"]
57-
},
58-
"serve": {
59-
"builder": "@angular-devkit/build-angular:dev-server",
60-
"options": {
61-
"browserTarget": "example-app:build"
62-
},
63-
"configurations": {
64-
"production": {
65-
"browserTarget": "example-app:build:production"
66-
}
67-
}
68-
},
69-
"extract-i18n": {
70-
"builder": "@angular-devkit/build-angular:extract-i18n",
71-
"options": {
72-
"browserTarget": "example-app:build"
73-
}
74-
},
75-
"lint": {
76-
"builder": "@nrwl/linter:eslint",
77-
"options": {
78-
"lintFilePatterns": [
79-
"apps/example-app/**/*.ts",
80-
"apps/example-app/**/*.html",
81-
"apps/example-app/src/**/*.html",
82-
"apps/example-app/src/**/*.html",
83-
"apps/example-app/src/**/*.html"
84-
]
85-
},
86-
"outputs": ["{options.outputFile}"]
87-
},
88-
"test": {
89-
"builder": "@nrwl/jest:jest",
90-
"options": {
91-
"jestConfig": "apps/example-app/jest.config.js"
92-
},
93-
"outputs": ["coverage/"]
94-
}
95-
}
96-
},
97-
"example-app-karma": {
98-
"projectType": "application",
99-
"root": "apps/example-app-karma",
100-
"sourceRoot": "apps/example-app-karma/src",
101-
"prefix": "app",
102-
"schematics": {},
103-
"architect": {
104-
"build": {
105-
"builder": "@angular-devkit/build-angular:browser",
106-
"options": {
107-
"outputPath": "dist/apps/example-app-karma",
108-
"index": "apps/example-app-karma/src/index.html",
109-
"main": "apps/example-app-karma/src/main.ts",
110-
"polyfills": "apps/example-app-karma/src/polyfills.ts",
111-
"tsConfig": "apps/example-app-karma/tsconfig.app.json",
112-
"assets": ["apps/example-app-karma/src/favicon.ico", "apps/example-app-karma/src/assets"],
113-
"styles": [],
114-
"scripts": [],
115-
"vendorChunk": true,
116-
"extractLicenses": false,
117-
"buildOptimizer": false,
118-
"sourceMap": true,
119-
"optimization": false,
120-
"namedChunks": true
121-
},
122-
"configurations": {
123-
"production": {
124-
"budgets": [
125-
{
126-
"type": "anyComponentStyle",
127-
"maximumWarning": "6kb"
128-
}
129-
],
130-
"fileReplacements": [
131-
{
132-
"replace": "apps/example-app-karma/src/environments/environment.ts",
133-
"with": "apps/example-app-karma/src/environments/environment.prod.ts"
134-
}
135-
],
136-
"optimization": true,
137-
"outputHashing": "all",
138-
"sourceMap": false,
139-
"namedChunks": false,
140-
"extractLicenses": true,
141-
"vendorChunk": false,
142-
"buildOptimizer": true
143-
}
144-
},
145-
"outputs": ["{options.outputPath}"]
146-
},
147-
"serve": {
148-
"builder": "@angular-devkit/build-angular:dev-server",
149-
"options": {
150-
"browserTarget": "example-app-karma:build"
151-
},
152-
"configurations": {
153-
"production": {
154-
"browserTarget": "example-app-karma:build:production"
155-
}
156-
}
157-
},
158-
"lint": {
159-
"builder": "@nrwl/linter:eslint",
160-
"options": {
161-
"lintFilePatterns": [
162-
"apps/example-app-karma/**/*.ts",
163-
"apps/example-app-karma/**/*.html",
164-
"apps/example-app-karma/src/**/*.html",
165-
"apps/example-app-karma/src/**/*.html",
166-
"apps/example-app-karma/src/**/*.html"
167-
]
168-
},
169-
"outputs": ["{options.outputFile}"]
170-
},
171-
"test": {
172-
"builder": "@angular-devkit/build-angular:karma",
173-
"options": {
174-
"main": "apps/example-app-karma/src/test.ts",
175-
"tsConfig": "apps/example-app-karma/tsconfig.spec.json",
176-
"polyfills": "apps/example-app-karma/src/polyfills.ts",
177-
"karmaConfig": "apps/example-app-karma/karma.conf.js",
178-
"styles": [],
179-
"scripts": [],
180-
"assets": []
181-
}
182-
}
183-
}
184-
},
185-
"jest-utils": {
186-
"root": "projects/jest-utils",
187-
"sourceRoot": "projects/jest-utils/src",
188-
"projectType": "library",
189-
"prefix": "lib",
190-
"architect": {
191-
"build-package": {
192-
"builder": "@angular-devkit/build-angular:ng-packagr",
193-
"options": {
194-
"tsConfig": "projects/jest-utils/tsconfig.lib.json",
195-
"project": "projects/jest-utils/ng-package.json"
196-
},
197-
"configurations": {
198-
"production": {
199-
"project": "projects/jest-utils/ng-package.json",
200-
"tsConfig": "projects/jest-utils/tsconfig.lib.json"
201-
}
202-
}
203-
},
204-
"lint": {
205-
"builder": "@nrwl/linter:eslint",
206-
"options": {
207-
"lintFilePatterns": [
208-
"projects/jest-utils/**/*.ts",
209-
"projects/jest-utils/**/*.html",
210-
"projects/jest-utils/src/**/*.html",
211-
"projects/jest-utils/src/**/*.html",
212-
"projects/jest-utils/src/**/*.html"
213-
]
214-
},
215-
"outputs": ["{options.outputFile}"]
216-
},
217-
"build": {
218-
"builder": "@nrwl/workspace:run-commands",
219-
"options": {
220-
"parallel": false,
221-
"commands": [
222-
{
223-
"command": "ng run jest-utils:build-package"
224-
}
225-
]
226-
}
227-
},
228-
"test": {
229-
"builder": "@nrwl/jest:jest",
230-
"options": {
231-
"jestConfig": "projects/jest-utils/jest.config.js"
232-
},
233-
"outputs": ["coverage/projects/jest-utils"]
234-
}
235-
}
236-
},
237-
"testing-library": {
238-
"root": "projects/testing-library",
239-
"sourceRoot": "projects/testing-library/src",
240-
"projectType": "library",
241-
"prefix": "lib",
242-
"architect": {
243-
"build-package": {
244-
"builder": "@angular-devkit/build-angular:ng-packagr",
245-
"options": {
246-
"tsConfig": "projects/testing-library/tsconfig.lib.json",
247-
"project": "projects/testing-library/ng-package.json"
248-
},
249-
"configurations": {
250-
"production": {
251-
"project": "projects/testing-library/ng-package.json",
252-
"tsConfig": "projects/testing-library/tsconfig.lib.json"
253-
}
254-
}
255-
},
256-
"lint": {
257-
"builder": "@nrwl/linter:eslint",
258-
"options": {
259-
"lintFilePatterns": [
260-
"projects/testing-library/**/*.ts",
261-
"projects/testing-library/**/*.html",
262-
"projects/testing-library/src/**/*.html",
263-
"projects/testing-library/src/**/*.html",
264-
"projects/testing-library/src/**/*.html"
265-
]
266-
},
267-
"outputs": ["{options.outputFile}"]
268-
},
269-
"build": {
270-
"builder": "@nrwl/workspace:run-commands",
271-
"options": {
272-
"parallel": false,
273-
"commands": [
274-
{
275-
"command": "ng run testing-library:build-package"
276-
},
277-
{
278-
"command": "npm run build:schematics"
279-
},
280-
{
281-
"command": "cpy ./README.md ./dist/@testing-library/angular"
282-
}
283-
]
284-
}
285-
},
286-
"test": {
287-
"builder": "@nrwl/jest:jest",
288-
"options": {
289-
"jestConfig": "projects/testing-library/jest.config.js"
290-
},
291-
"outputs": ["coverage/projects/testing-library"]
292-
}
293-
}
294-
}
4+
"example-app": "apps/example-app",
5+
"example-app-karma": "apps/example-app-karma",
6+
"jest-utils": "projects/jest-utils",
7+
"testing-library": "projects/testing-library"
2958
}
2969
}

apps/example-app/src/app/examples/03-forms.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ test('is possible to fill in a form and verify error messages (with the help of
2323
userEvent.selectOptions(colorControl, 'G');
2424

2525
expect(screen.queryByText('name is required')).not.toBeInTheDocument();
26-
expect(screen.queryByText('score must be lesser than 10')).toBeInTheDocument();
26+
expect(screen.getByText('score must be lesser than 10')).toBeInTheDocument();
2727
expect(screen.queryByText('color is required')).not.toBeInTheDocument();
2828

2929
expect(scoreControl).toBeInvalid();

apps/example-app/src/app/examples/04-forms-with-material.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import userEvent from '@testing-library/user-event';
44
import { MaterialModule } from '../material.module';
55
import { MaterialFormsComponent } from './04-forms-with-material';
66

7-
87
test('is possible to fill in a form and verify error messages (with the help of jest-dom https://testing-library.com/docs/ecosystem-jest-dom)', async () => {
98
const { fixture } = await render(MaterialFormsComponent, {
109
imports: [MaterialModule],
@@ -26,7 +25,7 @@ test('is possible to fill in a form and verify error messages (with the help of
2625
userEvent.click(screen.getByText(/green/i));
2726

2827
expect(screen.queryByText('name is required')).not.toBeInTheDocument();
29-
expect(screen.queryByText('score must be lesser than 10')).toBeInTheDocument();
28+
expect(screen.getByText('score must be lesser than 10')).toBeInTheDocument();
3029
expect(screen.queryByText('color is required')).not.toBeInTheDocument();
3130

3231
expect(scoreControl).toBeInvalid();
@@ -56,8 +55,8 @@ test('set and show pre-set form values', async () => {
5655
fixture.componentInstance.form.setValue({
5756
name: 'Max',
5857
score: 4,
59-
color: 'B'
60-
})
58+
color: 'B',
59+
});
6160
detectChanges();
6261

6362
const nameControl = screen.getByLabelText(/name/i);

0 commit comments

Comments
 (0)