Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e2fdc35

Browse files
committed
chore: add nx monorepo tooling
1 parent d4f0774 commit e2fdc35

File tree

8 files changed

+639
-98
lines changed

8 files changed

+639
-98
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ on:
44
push:
55
branches:
66
- master
7-
# TODO - delete this before merging v4 into master
8-
- v4
97
pull_request:
108
branches:
119
- '**'
@@ -43,7 +41,7 @@ jobs:
4341
- name: Install dependencies
4442
run: |
4543
yarn --ignore-engines --frozen-lockfile --ignore-scripts
46-
yarn check:clean-workspace-after-install
44+
yarn check-clean-workspace-after-install
4745
4846
- name: Build
4947
run: |
@@ -85,57 +83,49 @@ jobs:
8583
- name: Install dependencies
8684
run: |
8785
yarn --ignore-engines --frozen-lockfile --ignore-scripts
88-
yarn check:clean-workspace-after-install
86+
yarn check-clean-workspace-after-install
8987
9088
- name: Build
9189
run: |
9290
yarn build
9391
9492
- name: Run unit tests for typescript-estree
95-
run: yarn test
96-
working-directory: packages/typescript-estree
93+
run: npx nx test typescript-estree
9794
env:
9895
CI: true
9996

10097
- name: Run unit tests for visitor-keys
101-
run: yarn test
102-
working-directory: packages/visitor-keys
98+
run: npx nx test visitor-keys
10399
env:
104100
CI: true
105101

106102
- name: Run unit tests for scope-manager
107-
run: yarn test
108-
working-directory: packages/scope-manager
103+
run: npx nx test scope-manager
109104
env:
110105
CI: true
111106

112107
- name: Run unit tests for experimental-utils
113-
run: yarn test
114-
working-directory: packages/experimental-utils
108+
run: npx nx test experimental-utils
115109
env:
116110
CI: true
117111

118112
- name: Run unit tests for parser
119-
run: yarn test
120-
working-directory: packages/parser
113+
run: npx nx test parser
121114
env:
122115
CI: true
123116

124117
- name: Run unit tests for eslint-plugin
125-
run: yarn test
126-
working-directory: packages/eslint-plugin
118+
run: npx nx test eslint-plugin
127119
env:
128120
CI: true
129121

130122
- name: Run unit tests for eslint-plugin-tslint
131-
run: yarn test
132-
working-directory: packages/eslint-plugin-tslint
123+
run: npx nx test eslint-plugin-tslint
133124
env:
134125
CI: true
135126

136127
- name: Run unit tests for eslint-plugin-internal
137-
run: yarn test
138-
working-directory: packages/eslint-plugin-internal
128+
run: npx nx test eslint-plugin-internal
139129
env:
140130
CI: true
141131

@@ -171,23 +161,23 @@ jobs:
171161
- name: Install dependencies
172162
run: |
173163
yarn --ignore-engines --frozen-lockfile --ignore-scripts
174-
yarn check:clean-workspace-after-install
164+
yarn check-clean-workspace-after-install
175165
176166
- name: Build
177167
run: |
178168
yarn build
179169
180170
- name: Check code formatting
181-
run: yarn check:format
171+
run: yarn check-format
182172

183173
- name: Lint code
184174
run: yarn lint
185175

186176
- name: Lint markdown
187-
run: yarn lint:markdown
177+
run: yarn lint-markdown
188178

189179
- name: Check spelling
190-
run: yarn check:spelling
180+
run: yarn check-spelling
191181

192182
integration_tests:
193183
name: Run integration tests on primary Node.js version
@@ -214,14 +204,14 @@ jobs:
214204
- name: Install dependencies
215205
run: |
216206
yarn --ignore-engines --frozen-lockfile --ignore-scripts
217-
yarn check:clean-workspace-after-install
207+
yarn check-clean-workspace-after-install
218208
219209
- name: Build
220210
run: |
221211
yarn build
222212
223213
- name: Run integrations tests
224-
run: yarn test:integration
214+
run: yarn test-integration
225215
env:
226216
CI: true
227217

@@ -253,51 +243,44 @@ jobs:
253243
- name: Install dependencies
254244
run: |
255245
yarn --ignore-engines --frozen-lockfile --ignore-scripts
256-
yarn check:clean-workspace-after-install
246+
yarn check-clean-workspace-after-install
257247
258248
- name: Build
259249
run: |
260250
yarn build
261251
262252
- name: Run unit tests for typescript-estree
263-
run: yarn test
264-
working-directory: packages/typescript-estree
253+
run: npx nx test typescript-estree
265254
env:
266255
CI: true
267256

268257
- name: Run unit tests for visitor-keys
269-
run: yarn test
270-
working-directory: packages/visitor-keys
258+
run: npx nx test visitor-keys
271259
env:
272260
CI: true
273261

274262
- name: Run unit tests for scope-manager
275-
run: yarn test
276-
working-directory: packages/scope-manager
263+
run: npx nx test scope-manager
277264
env:
278265
CI: true
279266

280267
- name: Run unit tests for experimental-utils
281-
run: yarn test
282-
working-directory: packages/experimental-utils
268+
run: npx nx test experimental-utils
283269
env:
284270
CI: true
285271

286272
- name: Run unit tests for parser
287-
run: yarn test
288-
working-directory: packages/parser
273+
run: npx nx test parser
289274
env:
290275
CI: true
291276

292277
- name: Run unit tests for eslint-plugin
293-
run: yarn test
294-
working-directory: packages/eslint-plugin
278+
run: npx nx test eslint-plugin
295279
env:
296280
CI: true
297281

298282
- name: Run unit tests for eslint-plugin-tslint
299-
run: yarn test
300-
working-directory: packages/eslint-plugin-tslint
283+
run: npx nx test eslint-plugin-tslint
301284
env:
302285
CI: true
303286

@@ -335,7 +318,7 @@ jobs:
335318
- name: Install dependencies
336319
run: |
337320
yarn --ignore-engines --frozen-lockfile --ignore-scripts
338-
yarn check:clean-workspace-after-install
321+
yarn check-clean-workspace-after-install
339322
340323
- name: Build
341324
run: |

.github/workflows/generate-contributors.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
yarn --ignore-engines --frozen-lockfile --ignore-scripts
3636
3737
- name: Generate contributors
38-
run: yarn generate:contributors
38+
run: yarn generate-contributors
3939

4040
- name: Create Pull Request
4141
uses: peter-evans/create-pull-request@v3

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ We have a sophisticated CI process setup which gets run on every PR. You must pa
5555
- Coverage reports should automatically be generated locally, and the `codecov` bot should also comment on your PR with the percentage, as well as links to the line-by-line coverage of each file touched by your PR.
5656
- Ensure you have no lint errors.
5757
- You can run `yarn lint` in any package or in the root.
58-
- You can run `yarn lint:markdown` in the root.
58+
- You can run `yarn lint-markdown` in the root.
5959
- If you have made changes to any markdown documentation, ensure there are no spelling errors
60-
- You can run `yarn check:spelling` in the root.
60+
- You can run `yarn check-spelling` in the root.
6161
- Or if you are using vscode, you can use [`Code Spell Checker`](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) plugin.
6262
- If you have made changes within the `eslint-plugin` package, ensure the configs and documentation are valid.
63-
- You can run `yarn check:configs` and `yarn check:docs` in the root, or in the `eslint-plugin` folder.
63+
- You can run `yarn check-configs` and `yarn check-docs` in the root, or in the `eslint-plugin` folder.
6464

6565
### Raising a PR
6666

nx.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"npmScope": "typescript-eslint",
3+
"implicitDependencies": {
4+
"workspace.json": "*",
5+
"package.json": {
6+
"dependencies": "*",
7+
"devDependencies": "*"
8+
},
9+
"nx.json": "*",
10+
".github/workflows/ci.yml": "*"
11+
},
12+
"workspaceLayout": {
13+
"libsDir": "packages"
14+
},
15+
"tasksRunnerOptions": {
16+
"default": {
17+
"runner": "@nrwl/nx-cloud",
18+
"options": {
19+
"cacheableOperations": ["build", "test", "package", "prepare"],
20+
"strictlyOrderedTargets": ["build", "package", "prepare"],
21+
"accessToken": "YjFjNTBhOWUtY2JmNy00ZDhiLWE5N2UtZjliNDAwNmIzOTdjfHJlYWQtd3JpdGU=",
22+
"canTrackAnalytics": false,
23+
"showUsageWarnings": true
24+
}
25+
}
26+
},
27+
"projects": {
28+
"ast-spec": {
29+
"implicitDependencies": []
30+
},
31+
"eslint-plugin": {
32+
"implicitDependencies": []
33+
},
34+
"eslint-plugin-internal": {
35+
"implicitDependencies": []
36+
},
37+
"eslint-plugin-tslint": {
38+
"implicitDependencies": []
39+
},
40+
"experimental-utils": {
41+
"implicitDependencies": []
42+
},
43+
"parser": {
44+
"implicitDependencies": []
45+
},
46+
"scope-manager": {
47+
"implicitDependencies": []
48+
},
49+
"shared-fixtures": {
50+
"implicitDependencies": []
51+
},
52+
"types": {
53+
"implicitDependencies": []
54+
},
55+
"typescript-estree": {
56+
"implicitDependencies": []
57+
},
58+
"visitor-keys": {
59+
"implicitDependencies": []
60+
}
61+
},
62+
"affected": {
63+
"defaultBase": "master"
64+
}
65+
}

package.json

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,27 @@
1717
"url": "https://github.com/typescript-eslint/typescript-eslint/issues"
1818
},
1919
"scripts": {
20-
"build": "lerna run build --ignore ast-spec",
21-
"check:clean-workspace-after-install": "git diff --quiet --exit-code",
22-
"check:configs": "lerna run check:configs",
23-
"check:docs": "lerna run check:docs",
24-
"check:format": "prettier --list-different \"./**/*.{ts,js,json,md}\"",
25-
"check:spelling": "cspell --config=.cspell.json \"**/*.{md,ts,js}\"",
20+
"build": "nx run-many --target=build --all --parallel --exclude ast-spec",
21+
"check-clean-workspace-after-install": "git diff --quiet --exit-code",
22+
"check-configs": "nx run-many --target=check-configs --all --parallel",
23+
"check-docs": "nx run-many --target=check-docs --all --parallel",
24+
"check-format": "prettier --list-different \"./**/*.{ts,js,json,md}\"",
25+
"check-spelling": "cspell --config=.cspell.json \"**/*.{md,ts,js}\"",
2626
"clean": "lerna clean && lerna run clean",
2727
"cz": "git-cz",
2828
"format": "prettier --write \"./**/*.{ts,js,json,md}\"",
29-
"generate:contributors": "yarn ts-node --transpile-only ./tools/generate-contributors.ts && yarn all-contributors generate",
30-
"lint:fix": "eslint . --ext .js,.ts --fix",
31-
"lint:markdown:fix": "yarn lint:markdown --fix",
32-
"lint:markdown": "markdownlint \"**/*.md\" --config=.markdownlint.json --ignore-path=.markdownlintignore",
29+
"generate-contributors": "yarn ts-node --transpile-only ./tools/generate-contributors.ts && yarn all-contributors generate",
30+
"lint-fix": "eslint . --ext .js,.ts --fix",
31+
"lint-markdown-fix": "yarn lint-markdown --fix",
32+
"lint-markdown": "markdownlint \"**/*.md\" --config=.markdownlint.json --ignore-path=.markdownlintignore",
3333
"lint": "eslint . --ext .js,.ts",
3434
"postinstall": "yarn husky install && yarn build",
3535
"pre-commit": "yarn lint-staged",
36-
"pre-push": "yarn check:format",
37-
"test": "lerna run test --concurrency 1",
38-
"test:integration": "./tests/integration/run-all-tests.sh",
39-
"test:kill-integration-containers": "docker-compose -f tests/integration/docker-compose.yml down -v --rmi local",
40-
"typecheck": "lerna run typecheck"
36+
"pre-push": "yarn check-format",
37+
"test": "nx run-many --target=test --all --parallel",
38+
"test-integration": "./tests/integration/run-all-tests.sh",
39+
"test-kill-integration-containers": "docker-compose -f tests/integration/docker-compose.yml down -v --rmi local",
40+
"typecheck": "nx run-many --target=typecheck --all --parallel"
4141
},
4242
"config": {
4343
"commitizen": {
@@ -74,6 +74,10 @@
7474
"@commitlint/cli": "^12.0.1",
7575
"@commitlint/config-conventional": "^12.0.1",
7676
"@commitlint/config-lerna-scopes": "^12.0.1",
77+
"@nrwl/cli": "^12.3.5",
78+
"@nrwl/nx-cloud": "^12.1.3",
79+
"@nrwl/tao": "^12.3.5",
80+
"@nrwl/workspace": "^12.3.5",
7781
"@types/babel__code-frame": "^7.0.2",
7882
"@types/debug": "^4.1.5",
7983
"@types/eslint-visitor-keys": "^1.0.0",

packages/eslint-plugin/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
"types": "index.d.ts",
3333
"scripts": {
3434
"build": "tsc -b tsconfig.build.json",
35-
"check:docs": "jest tests/docs.test.ts --runTestsByPath --silent --runInBand",
36-
"check:configs": "jest tests/configs.test.ts --runTestsByPath --silent --runInBand",
35+
"check-docs": "jest tests/docs.test.ts --runTestsByPath --silent --runInBand",
36+
"check-configs": "jest tests/configs.test.ts --runTestsByPath --silent --runInBand",
3737
"clean": "tsc -b tsconfig.build.json --clean",
3838
"postclean": "rimraf dist && rimraf coverage",
3939
"format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore",

0 commit comments

Comments
 (0)