Skip to content

Commit cfb8a2f

Browse files
author
John Doe
committed
refactor: register plugins and adjust targets
1 parent 9082328 commit cfb8a2f

File tree

15 files changed

+166
-183
lines changed

15 files changed

+166
-183
lines changed

nx.json

Lines changed: 153 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
"$schema": "./node_modules/nx/schemas/nx-schema.json",
33
"namedInputs": {
44
"default": ["{projectRoot}/**/*", "sharedGlobals"],
5-
"os": [{ "runtime": "node -e \"console.log(require('os').platform())\"" }],
5+
"os": [
6+
{
7+
"runtime": "node -e \"console.log(require('os').platform())\""
8+
}
9+
],
610
"production": [
711
"default",
812
"!{projectRoot}/README.md",
@@ -25,23 +29,42 @@
2529
],
2630
"test-vitest-inputs": [
2731
"os",
28-
{ "env": "NX_VERBOSE_LOGGING" },
29-
{ "externalDependencies": ["vitest"] }
32+
{
33+
"env": "NX_VERBOSE_LOGGING"
34+
},
35+
{
36+
"externalDependencies": ["vitest"]
37+
}
3038
],
3139
"lint-eslint-inputs": [
3240
"{workspaceRoot}/eslint.config.js",
33-
{ "externalDependencies": ["eslint"] }
41+
{
42+
"externalDependencies": ["eslint"]
43+
}
3444
],
3545
"typecheck-typescript-inputs": [
3646
"{workspaceRoot}/tsconfig.base.json",
37-
{ "externalDependencies": ["typescript"] }
47+
{
48+
"externalDependencies": ["typescript"]
49+
}
3850
],
3951
"code-pushup-inputs": [
4052
"{workspaceRoot}/code-pushup.preset.ts",
41-
{ "env": "NODE_OPTIONS" },
42-
{ "env": "TSX_TSCONFIG_PATH" }
53+
{
54+
"env": "NODE_OPTIONS"
55+
},
56+
{
57+
"env": "TSX_TSCONFIG_PATH"
58+
}
4359
],
44-
"sharedGlobals": [{ "runtime": "node -v" }, { "runtime": "npm -v" }]
60+
"sharedGlobals": [
61+
{
62+
"runtime": "node -v"
63+
},
64+
{
65+
"runtime": "npm -v"
66+
}
67+
]
4568
},
4669
"targetDefaults": {
4770
"lint": {
@@ -123,68 +146,51 @@
123146
},
124147
"code-pushup": {
125148
"cache": false,
126-
"executor": "nx:run-commands",
127149
"dependsOn": ["code-pushup-*"],
128150
"options": {
129-
"command": "node packages/cli/src/index.ts",
130-
"args": [
131-
"--config={projectRoot}/code-pushup.config.ts",
132-
"--cache.read",
133-
"--persist.outputDir=.code-pushup/{projectName}"
134-
],
135-
"env": {
136-
"NODE_OPTIONS": "--import tsx",
137-
"TSX_TSCONFIG_PATH": "tsconfig.base.json"
151+
"command": "autorun",
152+
"config": "{projectRoot}/code-pushup.config.ts",
153+
"persist": {
154+
"outputDir": ".code-pushup/{projectName}"
138155
}
139156
}
140157
},
141158
"code-pushup-coverage": {
159+
"executor": "@code-pushup/nx-plugin:cli",
142160
"dependsOn": ["*-test"],
143161
"cache": true,
144162
"inputs": ["default", "code-pushup-inputs"],
145163
"outputs": [
146164
"{workspaceRoot}/.code-pushup/{projectName}/coverage/runner-output.json"
147165
],
148-
"executor": "nx:run-commands",
149166
"options": {
150-
"command": "node packages/cli/src/index.ts collect",
151-
"args": [
152-
"--config={projectRoot}/code-pushup.config.ts",
153-
"--cache.write",
154-
"--onlyPlugins=coverage",
155-
"--persist.skipReports=true",
156-
"--persist.outputDir=.code-pushup/{projectName}"
157-
],
158-
"env": {
159-
"NODE_OPTIONS": "--import tsx",
160-
"TSX_TSCONFIG_PATH": "tsconfig.base.json"
167+
"command": "collect",
168+
"config": "{projectRoot}/code-pushup.config.ts",
169+
"onlyPlugins": ["coverage"],
170+
"persist": {
171+
"outputDir": ".code-pushup/{projectName}"
161172
}
162173
}
163174
},
164175
"code-pushup-eslint": {
176+
"executor": "@code-pushup/nx-plugin:cli",
165177
"dependsOn": ["lint"],
166178
"cache": true,
167179
"inputs": ["default", "code-pushup-inputs"],
168180
"outputs": [
169181
"{workspaceRoot}/.code-pushup/{projectName}/eslint/runner-output.json"
170182
],
171-
"executor": "nx:run-commands",
172183
"options": {
173-
"command": "node packages/cli/src/index.ts collect",
174-
"args": [
175-
"--config={projectRoot}/code-pushup.config.ts",
176-
"--cache.write",
177-
"--onlyPlugins=eslint",
178-
"--persist.skipReports",
179-
"--persist.outputDir=.code-pushup/{projectName}"
180-
],
181-
"env": {
182-
"NODE_OPTIONS": "--import tsx",
183-
"TSX_TSCONFIG_PATH": "tsconfig.base.json"
184+
"command": "collect",
185+
"config": "{projectRoot}/code-pushup.config.ts",
186+
"onlyPlugins": ["eslint"],
187+
"persist": {
188+
"outputDir": ".code-pushup/{projectName}"
184189
}
185190
}
186191
},
187192
"code-pushup-js-packages": {
193+
"executor": "@code-pushup/nx-plugin:cli",
188194
"cache": false,
189195
"inputs": [
190196
{
@@ -194,43 +200,33 @@
194200
"outputs": [
195201
"{workspaceRoot}/.code-pushup/{projectName}/js-packages/runner-output.json"
196202
],
197-
"executor": "nx:run-commands",
198203
"options": {
199-
"command": "node packages/cli/src/index.ts collect",
200-
"args": [
201-
"--config={projectRoot}/code-pushup.config.ts",
202-
"--onlyPlugins=js-packages",
203-
"--persist.outputDir=.code-pushup/{projectName}"
204-
],
205-
"env": {
206-
"NODE_OPTIONS": "--import tsx",
207-
"TSX_TSCONFIG_PATH": "tsconfig.base.json"
204+
"command": "collect",
205+
"config": "{projectRoot}/code-pushup.config.ts",
206+
"onlyPlugins": ["js-packages"],
207+
"persist": {
208+
"outputDir": ".code-pushup/{projectName}"
208209
}
209210
}
210211
},
211212
"code-pushup-lighthouse": {
213+
"executor": "@code-pushup/nx-plugin:cli",
212214
"cache": true,
213215
"inputs": ["production", "^production", "code-pushup-inputs"],
214216
"outputs": [
215217
"{workspaceRoot}/.code-pushup/{projectName}/lighthouse/runner-output.json"
216218
],
217-
"executor": "nx:run-commands",
218219
"options": {
219-
"command": "node packages/cli/src/index.ts collect",
220-
"args": [
221-
"--config={projectRoot}/code-pushup.config.ts",
222-
"--cache.write",
223-
"--onlyPlugins=lighthouse",
224-
"--persist.skipReports",
225-
"--persist.outputDir=.code-pushup/{projectName}"
226-
],
227-
"env": {
228-
"NODE_OPTIONS": "--import tsx",
229-
"TSX_TSCONFIG_PATH": "tsconfig.base.json"
220+
"command": "collect",
221+
"config": "{projectRoot}/code-pushup.config.ts",
222+
"onlyPlugins": ["lighthouse"],
223+
"persist": {
224+
"outputDir": ".code-pushup/{projectName}"
230225
}
231226
}
232227
},
233228
"code-pushup-jsdocs": {
229+
"executor": "@code-pushup/nx-plugin:cli",
234230
"cache": true,
235231
"inputs": [
236232
"default",
@@ -240,23 +236,17 @@
240236
"outputs": [
241237
"{workspaceRoot}/.code-pushup/{projectName}/jsdocs/runner-output.json"
242238
],
243-
"executor": "nx:run-commands",
244239
"options": {
245-
"command": "node packages/cli/src/index.ts collect",
246-
"args": [
247-
"--config={projectRoot}/code-pushup.config.ts",
248-
"--cache.write",
249-
"--onlyPlugins=jsdocs",
250-
"--persist.skipReports",
251-
"--persist.outputDir=.code-pushup/{projectName}"
252-
],
253-
"env": {
254-
"NODE_OPTIONS": "--import tsx",
255-
"TSX_TSCONFIG_PATH": "tsconfig.base.json"
240+
"command": "collect",
241+
"config": "{projectRoot}/code-pushup.config.ts",
242+
"onlyPlugins": ["jsdocs"],
243+
"persist": {
244+
"outputDir": ".code-pushup/{projectName}"
256245
}
257246
}
258247
},
259248
"code-pushup-typescript": {
249+
"executor": "@code-pushup/nx-plugin:cli",
260250
"cache": true,
261251
"inputs": [
262252
"default",
@@ -266,40 +256,28 @@
266256
"outputs": [
267257
"{workspaceRoot}/.code-pushup/{projectName}/typescript/runner-output.json"
268258
],
269-
"executor": "nx:run-commands",
270259
"options": {
271-
"command": "node packages/cli/src/index.ts collect",
272-
"args": [
273-
"--config={projectRoot}/code-pushup.config.ts",
274-
"--cache.write",
275-
"--onlyPlugins=typescript",
276-
"--persist.skipReports",
277-
"--persist.outputDir=.code-pushup/{projectName}"
278-
],
279-
"env": {
280-
"NODE_OPTIONS": "--import tsx",
281-
"TSX_TSCONFIG_PATH": "tsconfig.base.json"
260+
"command": "collect",
261+
"config": "{projectRoot}/code-pushup.config.ts",
262+
"onlyPlugins": ["typescript"],
263+
"persist": {
264+
"outputDir": ".code-pushup/{projectName}"
282265
}
283266
}
284267
},
285268
"code-pushup-axe": {
269+
"executor": "@code-pushup/nx-plugin:cli",
286270
"cache": true,
287271
"inputs": ["default", "code-pushup-inputs"],
288272
"outputs": [
289273
"{workspaceRoot}/.code-pushup/{projectName}/axe/runner-output.json"
290274
],
291-
"executor": "nx:run-commands",
292275
"options": {
293-
"command": "node packages/cli/src/index.ts collect",
294-
"args": [
295-
"--config={projectRoot}/code-pushup.config.ts",
296-
"--cache.write",
297-
"--onlyPlugins=axe",
298-
"--persist.outputDir=.code-pushup/{projectName}"
299-
],
300-
"env": {
301-
"NODE_OPTIONS": "--import tsx",
302-
"TSX_TSCONFIG_PATH": "tsconfig.base.json"
276+
"command": "collect",
277+
"config": "{projectRoot}/code-pushup.config.ts",
278+
"onlyPlugins": ["axe"],
279+
"persist": {
280+
"outputDir": ".code-pushup/{projectName}"
303281
}
304282
}
305283
},
@@ -310,6 +288,13 @@
310288
"packageRoot": "{projectRoot}/dist",
311289
"registry": "https://registry.npmjs.org/"
312290
}
291+
},
292+
"validate-cp-targets": {
293+
"executor": "nx:run-commands",
294+
"cache": false,
295+
"options": {
296+
"command": "node tools/scripts/validate-cp-targets.mjs"
297+
}
313298
}
314299
},
315300
"workspaceLayout": {
@@ -344,7 +329,75 @@
344329
"releaseTagPattern": "v{version}"
345330
},
346331
"plugins": [
347-
"@code-pushup/nx-plugin",
332+
{
333+
"plugin": "@code-pushup/nx-plugin",
334+
"options": {
335+
"targetName": "code-pushup"
336+
},
337+
"exclude": ["tools/**", "testing/**", "examples/**"]
338+
},
339+
{
340+
"plugin": "@code-pushup/nx-plugin",
341+
"options": {
342+
"targetName": "code-pushup-coverage"
343+
},
344+
"exclude": ["tools/**", "testing/**", "examples/**"]
345+
},
346+
{
347+
"plugin": "@code-pushup/nx-plugin",
348+
"options": {
349+
"targetName": "code-pushup-eslint"
350+
},
351+
"exclude": ["testing/**", "examples/**"]
352+
},
353+
{
354+
"plugin": "@code-pushup/nx-plugin",
355+
"options": {
356+
"targetName": "code-pushup-typescript"
357+
},
358+
"exclude": [
359+
"packages/models/**",
360+
"packages/plugin-lighthouse",
361+
"packages/plugin-js-packages",
362+
"tools/**",
363+
"testing/**",
364+
"examples/**"
365+
]
366+
},
367+
{
368+
"plugin": "@code-pushup/nx-plugin",
369+
"options": {
370+
"targetName": "code-pushup-jsdocs"
371+
},
372+
"exclude": [
373+
"packages/models",
374+
"packages/plugin-lighthouse",
375+
"tools/**",
376+
"testing/**",
377+
"examples/**"
378+
]
379+
},
380+
{
381+
"plugin": "@code-pushup/nx-plugin",
382+
"options": {
383+
"targetName": "code-pushup-js-packages"
384+
},
385+
"exclude": ["packages/**", "tools/**", "testing/**", "examples/**"]
386+
},
387+
{
388+
"plugin": "@code-pushup/nx-plugin",
389+
"options": {
390+
"targetName": "code-pushup-lighthouse"
391+
},
392+
"exclude": ["packages/**", "tools/**", "testing/**", "examples/**"]
393+
},
394+
{
395+
"plugin": "@code-pushup/nx-plugin",
396+
"options": {
397+
"targetName": "code-pushup-axe"
398+
},
399+
"exclude": ["packages/**", "tools/**", "testing/**", "examples/**"]
400+
},
348401
{
349402
"plugin": "@push-based/nx-verdaccio",
350403
"options": {

packages/ci/project.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@
77
"build": {},
88
"lint": {},
99
"unit-test": {},
10-
"int-test": {},
11-
"code-pushup": {},
12-
"code-pushup-eslint": {},
13-
"code-pushup-coverage": {},
14-
"code-pushup-typescript": {},
15-
"code-pushup-jsdocs": {}
10+
"int-test": {}
1611
},
1712
"tags": ["scope:tooling", "type:feature", "publishable"]
1813
}

0 commit comments

Comments
 (0)