Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e/nx-plugin-e2e/tests/plugin-create-nodes.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ describe('nx-plugin', () => {
});

it('should consider plugin option projectPrefix in executor target', async () => {
const cwd = path.join(testFileDir, 'configuration-option-bin');
const cwd = path.join(testFileDir, 'configuration-option-projectPrefix');
registerPluginInWorkspace(tree, {
plugin: '@code-pushup/nx-plugin',
options: {
Expand Down
3 changes: 3 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@
"releaseTagPattern": "v{version}"
},
"plugins": [
{
"plugin": "@code-pushup/nx-plugin"
},
{
"plugin": "@push-based/nx-verdaccio",
"options": {
Expand Down
93 changes: 92 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
},
"devDependencies": {
"@beaussan/nx-knip": "^0.0.5-15",
"@code-pushup/cli": "^0.77.0",
"@code-pushup/eslint-config": "^0.14.2",
"@code-pushup/nx-plugin": "^0.77.0",
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@commitlint/config-nx-scopes": "^19.5.0",
Expand Down
19 changes: 8 additions & 11 deletions packages/nx-plugin/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
import type { CreateNodesV2, NxPlugin } from '@nx/devkit';
import { createNodes, createNodesV2 } from './plugin/index.js';

// default export for nx.json#plugins
const plugin = {
name: '@code-pushup/nx-plugin',
createNodesV2,
// Keep for backwards compatibility with Nx < 21
createNodes,
};

export default plugin;

export { createNodes, createNodesV2 } from './plugin/index.js';
export type { AutorunCommandExecutorOptions } from './executors/cli/schema.js';
export { objectToCliArgs } from './executors/internal/cli.js';
export { generateCodePushupConfig } from './generators/configuration/code-pushup-config.js';
Expand All @@ -22,4 +14,9 @@ export {
type ProcessConfig,
} from './internal/execute-process.js';
export * from './internal/versions.js';
export { createNodes, createNodesV2 } from './plugin/index.js';

export default {
name: 'code-pushup',
createNodesV2: createNodesV2 as CreateNodesV2,
createNodes,
} satisfies NxPlugin;
10 changes: 10 additions & 0 deletions packages/nx-plugin/src/plugin/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
import { NxPlugin } from '@nx/devkit';
import { createNodesV2 } from './plugin.js';

export { createNodes, createNodesV2 } from './plugin.js';
export type { CreateNodesOptions } from './types.js';

const plugin = {
createNodesV2,
name: 'code-pushup-nx-plugin',
} satisfies NxPlugin;

export default plugin;
5 changes: 3 additions & 2 deletions packages/nx-plugin/src/plugin/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ export const createNodes: CreateNodes = [
},
];

export const createNodesV2: CreateNodesV2<CreateNodesOptions> = [
export const createNodesV2: CreateNodesV2 = [
`**/${PROJECT_JSON_FILE_NAME}`,
async (
projectConfigurationFiles: readonly string[],
createNodesOptions: unknown,
context: CreateNodesContextV2,
): Promise<CreateNodesResultV2> => {
const parsedCreateNodesOptions = createNodesOptions as CreateNodesOptions;
const parsedCreateNodesOptions =
(createNodesOptions as CreateNodesOptions) ?? {};

return await Promise.all(
projectConfigurationFiles.map(async projectConfigurationFile => {
Expand Down
15 changes: 1 addition & 14 deletions project.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,6 @@
"code-pushup-coverage": {},
"code-pushup-eslint": {},
"code-pushup-jsdocs": {},
"code-pushup-typescript": {},
"code-pushup": {
"dependsOn": ["code-pushup-*"],
"executor": "nx:run-commands",
"options": {
"args": [
"--no-progress",
"--verbose",
"--cache.read",
"--persist.outputDir={projectRoot}/.code-pushup",
"--upload.project={projectName}"
]
}
}
"code-pushup-typescript": {}
}
}
Loading