Skip to content

Commit db204fb

Browse files
build: migrate to Angular workspace (#557)
1 parent d4d4567 commit db204fb

File tree

18 files changed

+297
-389
lines changed

18 files changed

+297
-389
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
# misc
2929
/.angular/cache
3030
.angular
31-
.nx
32-
migrations.json
3331
.cache
3432
/.sass-cache
3533
/connect.lock

angular.json

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"cli": {
5+
"analytics": false,
6+
"cache": {
7+
"enabled": true,
8+
"path": "./.cache/angular",
9+
"environment": "all"
10+
}
11+
},
12+
"newProjectRoot": "projects",
13+
"projects": {
14+
"testing-library": {
15+
"projectType": "library",
16+
"root": "projects/testing-library",
17+
"sourceRoot": "projects/testing-library/src",
18+
"prefix": "lib",
19+
"architect": {
20+
"build": {
21+
"builder": "@angular-devkit/build-angular:ng-packagr",
22+
"options": {
23+
"project": "projects/testing-library/ng-package.json"
24+
},
25+
"configurations": {
26+
"production": {
27+
"tsConfig": "projects/testing-library/tsconfig.lib.prod.json"
28+
},
29+
"development": {
30+
"tsConfig": "projects/testing-library/tsconfig.lib.json"
31+
}
32+
},
33+
"defaultConfiguration": "production"
34+
},
35+
"test": {
36+
"builder": "@angular-builders/jest:run",
37+
"options": {
38+
"configPath": "projects/testing-library/jest.config.ts"
39+
}
40+
},
41+
"lint": {
42+
"builder": "@angular-eslint/builder:lint",
43+
"options": {
44+
"lintFilePatterns": ["projects/testing-library/**/*.ts", "projects/testing-library/**/*.html"]
45+
}
46+
}
47+
}
48+
},
49+
"example-app": {
50+
"projectType": "application",
51+
"root": "apps/example-app",
52+
"sourceRoot": "apps/example-app/src",
53+
"prefix": "app",
54+
"architect": {
55+
"build": {
56+
"builder": "@angular-devkit/build-angular:browser",
57+
"options": {
58+
"outputPath": "dist/apps/example-app",
59+
"index": "apps/example-app/src/index.html",
60+
"main": "apps/example-app/src/main.ts",
61+
"polyfills": "apps/example-app/src/polyfills.ts",
62+
"tsConfig": "apps/example-app/tsconfig.app.json",
63+
"assets": ["apps/example-app/src/favicon.ico", "apps/example-app/src/assets"],
64+
"styles": ["apps/example-app/src/styles.css"],
65+
"scripts": []
66+
},
67+
"configurations": {
68+
"production": {
69+
"budgets": [
70+
{
71+
"type": "anyComponentStyle",
72+
"maximumWarning": "6kb"
73+
}
74+
],
75+
"outputHashing": "all"
76+
},
77+
"development": {
78+
"buildOptimizer": false,
79+
"optimization": false,
80+
"vendorChunk": true,
81+
"extractLicenses": false,
82+
"sourceMap": true,
83+
"namedChunks": true
84+
}
85+
},
86+
"defaultConfiguration": "production"
87+
},
88+
"serve": {
89+
"builder": "@angular-devkit/build-angular:dev-server",
90+
"configurations": {
91+
"production": {
92+
"buildTarget": "example-app:build:production"
93+
},
94+
"development": {
95+
"buildTarget": "example-app:build:development"
96+
}
97+
},
98+
"defaultConfiguration": "development"
99+
},
100+
"extract-i18n": {
101+
"builder": "@angular-devkit/build-angular:extract-i18n",
102+
"options": {
103+
"buildTarget": "example-app:build"
104+
}
105+
},
106+
"test": {
107+
"builder": "@angular-builders/jest:run",
108+
"options": {
109+
"configPath": "apps/example-app/jest.config.ts"
110+
}
111+
},
112+
"lint": {
113+
"builder": "@angular-eslint/builder:lint",
114+
"options": {
115+
"lintFilePatterns": ["apps/example-app/**/*.ts", "apps/example-app/**/*.html"]
116+
}
117+
}
118+
}
119+
},
120+
"example-app-karma": {
121+
"projectType": "application",
122+
"root": "apps/example-app-karma",
123+
"sourceRoot": "apps/example-app-karma/src",
124+
"prefix": "app",
125+
"architect": {
126+
"build": {
127+
"builder": "@angular-devkit/build-angular:browser",
128+
"options": {
129+
"outputPath": "dist/apps/example-app-karma",
130+
"index": "apps/example-app-karma/src/index.html",
131+
"main": "apps/example-app-karma/src/main.ts",
132+
"tsConfig": "apps/example-app-karma/tsconfig.app.json",
133+
"assets": ["apps/example-app-karma/src/favicon.ico", "apps/example-app-karma/src/assets"],
134+
"styles": [],
135+
"scripts": []
136+
},
137+
"configurations": {
138+
"production": {
139+
"budgets": [
140+
{
141+
"type": "anyComponentStyle",
142+
"maximumWarning": "6kb"
143+
}
144+
],
145+
"outputHashing": "all"
146+
},
147+
"development": {
148+
"buildOptimizer": false,
149+
"optimization": false,
150+
"vendorChunk": true,
151+
"extractLicenses": false,
152+
"sourceMap": true,
153+
"namedChunks": true
154+
}
155+
},
156+
"defaultConfiguration": "production"
157+
},
158+
"serve": {
159+
"builder": "@angular-devkit/build-angular:dev-server",
160+
"configurations": {
161+
"production": {
162+
"buildTarget": "example-app-karma:build:production"
163+
},
164+
"development": {
165+
"buildTarget": "example-app-karma:build:development"
166+
}
167+
},
168+
"defaultConfiguration": "development"
169+
},
170+
"test": {
171+
"builder": "@angular-devkit/build-angular:karma",
172+
"options": {
173+
"main": "apps/example-app-karma/src/test.ts",
174+
"tsConfig": "apps/example-app-karma/tsconfig.spec.json",
175+
"karmaConfig": "apps/example-app-karma/karma.conf.js"
176+
}
177+
},
178+
"lint": {
179+
"builder": "@angular-eslint/builder:lint",
180+
"options": {
181+
"lintFilePatterns": ["apps/example-app-karma/**/*.ts", "apps/example-app-karma/**/*.html"]
182+
}
183+
}
184+
}
185+
}
186+
},
187+
"schematics": {
188+
"@schematics/angular:component": {
189+
"style": "scss",
190+
"displayBlock": true,
191+
"changeDetection": "OnPush"
192+
}
193+
}
194+
}

apps/example-app-karma/project.json

Lines changed: 0 additions & 68 deletions
This file was deleted.

apps/example-app/jest.config.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,29 @@
1-
export default {
1+
import type { Config } from 'jest';
2+
3+
const config: Config = {
24
displayName: {
35
name: 'Example App',
46
color: 'blue',
57
},
6-
preset: '../../jest.preset.js',
7-
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
8+
preset: 'jest-preset-angular',
9+
setupFilesAfterEnv: ['<rootDir>/apps/example-app/src/test-setup.ts'],
10+
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
11+
coverageDirectory: '<rootDir>/coverage/apps/example-app',
12+
transform: {
13+
'^.+\\.(ts|js|html)$': [
14+
'jest-preset-angular',
15+
{
16+
tsconfig: '<rootDir>/apps/example-app/tsconfig.spec.json',
17+
stringifyContentPathRegex: '\\.(html|svg)$',
18+
},
19+
],
20+
},
21+
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
22+
snapshotSerializers: [
23+
'jest-preset-angular/build/serializers/no-ng-attributes',
24+
'jest-preset-angular/build/serializers/ng-snapshot',
25+
'jest-preset-angular/build/serializers/html-comment',
26+
],
827
};
28+
29+
export default config;

apps/example-app/project.json

Lines changed: 0 additions & 75 deletions
This file was deleted.

apps/example-app/src/test-setup.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';
21
import '@testing-library/jest-dom';
3-
4-
setupZoneTestEnv();

jest.config.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
const { getJestProjectsAsync } = require('@nx/jest');
2-
3-
export default async () => ({
4-
projects: await getJestProjectsAsync(),
5-
});
1+
// Root jest configuration - not used directly, projects have their own configs
2+
export default {};

0 commit comments

Comments
 (0)