Skip to content

Commit eabf881

Browse files
author
arjen.althoff
committed
refactor(example-app): move application code to src folder
To be more in line with the NX defaults, the application files are moved to the ./src folder. The tslint-to-eslint migration was failing. Might have been due to being a flattened project.
1 parent 432749d commit eabf881

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+100
-52
lines changed

angular.json

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
{
2-
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
32
"version": 1,
4-
"newProjectRoot": "",
3+
"cli": {
4+
"analytics": false
5+
},
6+
"defaultProject": "example-app",
7+
"schematics": {
8+
"@nrwl/angular": {
9+
"convert-tslint-to-eslint": {
10+
"removeTSLintIfNoMoreTSLintTargets": true
11+
}
12+
}
13+
},
514
"projects": {
615
"example-app": {
7-
"root": "",
8-
"sourceRoot": "apps/example-app",
916
"projectType": "application",
17+
"root": "apps/example-app",
18+
"sourceRoot": "apps/example-app/src",
1019
"prefix": "app",
1120
"schematics": {},
1221
"architect": {
@@ -15,16 +24,16 @@
1524
"options": {
1625
"aot": true,
1726
"outputPath": "dist/apps/example-app",
18-
"index": "apps/example-app/index.html",
19-
"main": "apps/example-app/main.ts",
20-
"polyfills": "apps/example-app/polyfills.ts",
21-
"tsConfig": "apps/example-app/tsconfig.json",
27+
"index": "apps/example-app/src/index.html",
28+
"main": "apps/example-app/src/main.ts",
29+
"polyfills": "apps/example-app/src/polyfills.ts",
30+
"tsConfig": "apps/example-app/tsconfig.app.json",
2231
"assets": [
23-
"apps/example-app/favicon.ico",
24-
"apps/example-app/assets"
32+
"apps/example-app/src/favicon.ico",
33+
"apps/example-app/src/assets"
2534
],
2635
"styles": [
27-
"apps/example-app/styles.css"
36+
"apps/example-app/src/styles.css"
2837
],
2938
"scripts": []
3039
},
@@ -38,8 +47,8 @@
3847
],
3948
"fileReplacements": [
4049
{
41-
"replace": "apps/example-app/environments/environment.ts",
42-
"with": "apps/example-app/environments/environment.prod.ts"
50+
"replace": "apps/example-app/src/environments/environment.ts",
51+
"with": "apps/example-app/src/environments/environment.prod.ts"
4352
}
4453
],
4554
"optimization": true,
@@ -89,7 +98,7 @@
8998
"builder": "@nrwl/jest:jest",
9099
"options": {
91100
"jestConfig": "apps/example-app/jest.config.js",
92-
"setupFile": "apps/example-app/test-setup.ts"
101+
"setupFile": "apps/example-app/src/test-setup.ts"
93102
},
94103
"outputs": [
95104
"coverage/"
@@ -117,14 +126,12 @@
117126
}
118127
},
119128
"lint": {
120-
"builder": "@angular-devkit/build-angular:tslint",
129+
"builder": "@nrwl/linter:eslint",
121130
"options": {
122-
"tsConfig": [
123-
"projects/testing-library/tsconfig.lib.json",
124-
"projects/testing-library/tsconfig.spec.json"
125-
],
126-
"exclude": [
127-
"**/node_modules/**"
131+
"lintFilePatterns": [
132+
"projects/testing-library/src/**/*.ts",
133+
"projects/testing-library/src/**/*.html",
134+
"projects/testing-library/src/**/*.html"
128135
]
129136
}
130137
},
@@ -180,14 +187,12 @@
180187
}
181188
},
182189
"lint": {
183-
"builder": "@angular-devkit/build-angular:tslint",
190+
"builder": "@nrwl/linter:eslint",
184191
"options": {
185-
"tsConfig": [
186-
"projects/jest-utils/tsconfig.lib.json",
187-
"projects/jest-utils/tsconfig.spec.json"
188-
],
189-
"exclude": [
190-
"**/node_modules/**"
192+
"lintFilePatterns": [
193+
"projects/jest-utils/src/**/*.ts",
194+
"projects/jest-utils/src/**/*.html",
195+
"projects/jest-utils/src/**/*.html"
191196
]
192197
}
193198
},
@@ -214,9 +219,5 @@
214219
}
215220
}
216221
}
217-
},
218-
"defaultProject": "example-app",
219-
"cli": {
220-
"analytics": false
221222
}
222-
}
223+
}

apps/example-app/.browserslistrc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2+
# For additional information regarding the format and rule options, please see:
3+
# https://github.com/browserslist/browserslist#queries
4+
5+
# For the full list of supported browsers by the Angular framework, please see:
6+
# https://angular.io/guide/browser-support
7+
8+
# You can see what browsers were selected by your queries by running:
9+
# npx browserslist
10+
11+
last 1 Chrome version
12+
last 1 Firefox version
13+
last 2 Edge major versions
14+
last 2 Safari major versions
15+
last 2 iOS major versions
16+
Firefox ESR
17+
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.

apps/example-app/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ module.exports = {
55
color: 'blue',
66
},
77
preset: '../../jest.preset.js',
8+
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
89
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

apps/example-app/tsconfig.app.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../../dist/out-tsc",
5+
"types": [],
6+
"allowJs": true
7+
},
8+
"files": ["src/main.ts", "src/polyfills.ts"]
9+
}

apps/example-app/tsconfig.editor.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"include": ["**/*.ts"],
4+
"compilerOptions": {
5+
"types": ["jest", "node"]
6+
}
7+
}

apps/example-app/tsconfig.json

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
{
22
"extends": "../../tsconfig.json",
3-
"compilerOptions": {
4-
"outDir": "../out-tsc/app",
5-
"types": [],
6-
"allowJs": true
7-
},
3+
"files": [],
4+
"include": [],
5+
"compilerOptions": {},
86
"angularCompilerOptions": {
97
"strictInjectionParameters": true,
108
"strictInputAccessModifiers": true,
119
"strictTemplates": true
1210
},
13-
"files": ["main.ts", "polyfills.ts"]
11+
"references": [
12+
{
13+
"path": "./tsconfig.app.json"
14+
},
15+
{
16+
"path": "./tsconfig.spec.json"
17+
},
18+
{
19+
"path": "./tsconfig.editor.json"
20+
}
21+
]
1422
}

apps/example-app/tsconfig.spec.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
2-
"extends": "../../tsconfig.json",
2+
"extends": "./tsconfig.json",
33
"compilerOptions": {
4+
"outDir": "../../dist/out-tsc",
45
"module": "commonjs",
5-
"types": ["node", "jest"]
6+
"types": ["jest", "node"]
67
},
7-
"files": ["test-setup.ts"],
8+
"files": ["src/test-setup.ts"],
89
"include": ["**/*.spec.ts", "**/*.d.ts"]
910
}

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
projects: ['<rootDir>/', '<rootDir>/projects/testing-library', '<rootDir>/projects/jest-utils'],
2+
projects: ['<rootDir>/apps/example-app', '<rootDir>/projects/testing-library', '<rootDir>/projects/jest-utils'],
33
};

jest.preset.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ module.exports = {
88
resolver: '@nrwl/jest/plugins/resolver',
99
moduleFileExtensions: ['ts', 'js', 'html'],
1010
coverageReporters: ['html'],
11-
setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
1211
snapshotSerializers: [
1312
'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js',
1413
'jest-preset-angular/build/AngularSnapshotSerializer.js',

nx.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
{
2-
"npmScope": "testing-library",
32
"implicitDependencies": {
43
"angular.json": "*",
54
"package.json": "*",
65
"tsconfig.json": "*",
76
"tslint.json": "*",
87
"nx.json": "*"
98
},
9+
"npmScope": "testing-library",
1010
"tasksRunnerOptions": {
1111
"default": {
1212
"runner": "@nrwl/nx-cloud",
1313
"options": {
1414
"accessToken": "M2Q4YjlkNjMtMzY1NC00ZjkwLTk1ZjgtZjg5Y2VkMzFjM2FifHJlYWQtd3JpdGU=",
15-
"cacheableOperations": [
16-
"build",
17-
"test",
18-
"lint",
19-
"e2e"
20-
],
15+
"cacheableOperations": ["build", "test", "lint", "e2e"],
2116
"canTrackAnalytics": false,
2217
"showUsageWarnings": true
2318
}

package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,29 @@
4545
},
4646
"devDependencies": {
4747
"@angular-devkit/build-angular": "0.1102.8",
48+
"@angular-eslint/eslint-plugin": "~2.0.2",
49+
"@angular-eslint/eslint-plugin-template": "~2.0.2",
50+
"@angular-eslint/template-parser": "~2.0.2",
4851
"@angular/cli": "11.2.8",
4952
"@angular/compiler-cli": "11.2.9",
5053
"@angular/language-service": "11.2.9",
5154
"@nrwl/cli": "12.0.1",
55+
"@nrwl/eslint-plugin-nx": "12.0.1",
5256
"@nrwl/jest": "12.0.1",
57+
"@nrwl/linter": "12.0.1",
5358
"@nrwl/node": "12.0.1",
5459
"@nrwl/nx-plugin": "12.0.1",
5560
"@nrwl/workspace": "12.0.1",
5661
"@testing-library/jest-dom": "^5.11.0",
5762
"@types/jest": "~26.0.3",
5863
"@types/node": "14.14.37",
64+
"@typescript-eslint/eslint-plugin": "4.19.0",
65+
"@typescript-eslint/parser": "4.19.0",
5966
"codelyzer": "6.0.1",
6067
"cpy-cli": "^3.1.1",
68+
"eslint": "7.22.0",
69+
"eslint-config-prettier": "8.1.0",
70+
"eslint-plugin-import": "latest",
6171
"husky": "^4.2.5",
6272
"jest": "^26.1.0",
6373
"jest-preset-angular": "8.3.2",
@@ -70,4 +80,4 @@
7080
"ts-node": "9.1.1",
7181
"typescript": "4.1.4"
7282
}
73-
}
83+
}

0 commit comments

Comments
 (0)