Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
09ec54b
chore: add plugin to nx.json
BioPhoton Aug 27, 2025
a449ca5
chore: add plugin to nx.json plugins
BioPhoton Aug 27, 2025
a2c3278
refactor: test use latest version
BioPhoton Aug 28, 2025
5ec4034
refactor: test use latest version 2
BioPhoton Aug 28, 2025
57bfc00
Merge branch 'main' into use-cp-nx-plugin
BioPhoton Aug 29, 2025
add0f3a
Merge branch 'main' into use-cp-nx-plugin
BioPhoton Sep 1, 2025
93e20e8
refactor: fix lint
BioPhoton Sep 1, 2025
3cb3a8d
refactor: wip
BioPhoton Sep 1, 2025
00e6fae
refactor: wip 2
BioPhoton Sep 1, 2025
2e8a05c
Merge branch 'main' into use-cp-nx-plugin
BioPhoton Sep 2, 2025
99d988a
refactor: update packages
BioPhoton Sep 2, 2025
0e66ac8
chore: update packages
BioPhoton Sep 3, 2025
f402ecb
refactor: use process.stdout.write
BioPhoton Sep 3, 2025
41bce2b
refactor: test pkg new
BioPhoton Sep 3, 2025
59a3f83
refactor: add output arg handling to nx-plugin args
BioPhoton Sep 3, 2025
06c94d9
docs: add release steps
BioPhoton Sep 4, 2025
e355699
Merge branch 'main' into use-cp-nx-plugin
BioPhoton Sep 4, 2025
e7da7ef
chore: update packages
BioPhoton Sep 4, 2025
8f69a5e
docs: update release section
BioPhoton Sep 4, 2025
8dced0b
docs: update release section
BioPhoton Sep 4, 2025
0049a64
chore: update packags
BioPhoton Sep 4, 2025
39d2357
Merge branch 'main' into use-cp-nx-plugin
BioPhoton Sep 5, 2025
8aa17d1
Merge branch 'main' into use-cp-nx-plugin
Nov 9, 2025
06f0b65
refactor: move plugin default exports
Nov 9, 2025
55c022b
refactor: remove bin option from config
Nov 9, 2025
e419189
refactor: update packages
Nov 9, 2025
3fb6747
refactor: remove bin options for config generator
Nov 9, 2025
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
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,21 @@ Therefore, PRs are merged via one of two strategies:
- rebase - branch cannot contain merge commits ([rebase instead of merge](https://www.atlassian.com/git/tutorials/merging-vs-rebasing)),
- squash - single commit whose message is the PR title (should be in conventional commit format).

## Releases

We use nx release command to create releases for GitHub as well as publish to npm.

**Preconditions:**

- `npm login` - Only users with write access to [code-pushup](https://www.npmjs.com/org/code-pushup) can publish
- (optional) `GITHUB_TOKEN=ghp_...` in `.env` - [Personal access token](https://github.com/settings/personal-access-tokens/new) to create a GitHub release.

**Steps:**

- `git checkout main`, `git pull`
- (recommended optional) `npx nx release --dryRun`
- `npx nx release` and confirm publish prompt

## Project tags

[Nx tags](https://nx.dev/core-features/enforce-module-boundaries) are used to enforce module boundaries in the project graph when linting.
Expand Down
3 changes: 3 additions & 0 deletions code-pushup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const config: CoreConfig = {
server: 'https://api.staging.code-pushup.dev/graphql',
apiKey: process.env['CP_API_KEY'],
},
persist: {
outputDir: '.code-pushup',
},
}),
plugins: [],
};
Expand Down
3 changes: 2 additions & 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 @@ -3,6 +3,7 @@ import path from 'node:path';
import { readProjectConfiguration } from 'nx/src/generators/utils/project-configuration';
import { afterEach, expect } from 'vitest';
import { generateCodePushupConfig } from '@code-pushup/nx-plugin';
import { PACKAGE_NAME } from '@code-pushup/nx-plugin/src/internal/constants.js';
import {
generateWorkspaceAndProject,
materializeTree,
Expand Down Expand Up @@ -120,7 +121,7 @@ describe('nx-plugin', () => {
expect(projectJson.targets).toStrictEqual({
'code-pushup--configuration': expect.objectContaining({
options: {
command: `nx g XYZ:configuration --project="${project}"`,
command: `nx g ${PACKAGE_NAME}:configuration --project="${project}"`,
},
}),
});
Expand Down
10 changes: 10 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,16 @@
"releaseTagPattern": "v{version}"
},
"plugins": [
{
"plugin": "@code-pushup/nx-plugin",
"options": {
"bin": "packages/cli/src/index.ts",
"env": {
"NODE_OPTIONS": "--import tsx",
"TSX_TSCONFIG_PATH": "tsconfig.base.json"
}
}
},
{
"plugin": "@push-based/nx-verdaccio",
"options": {
Expand Down
114 changes: 108 additions & 6 deletions package-lock.json

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

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
},
"private": true,
"dependencies": {
"@code-pushup/portal-client": "^0.16.0",
"@isaacs/cliui": "^8.0.2",
"@nx/devkit": "21.4.1",
"@poppinss/cliui": "6.4.1",
Expand Down Expand Up @@ -47,10 +46,13 @@
"zod": "^4.0.5"
},
"devDependencies": {
"@code-pushup/portal-client": "^0.16.0",
"@actions/core": "^1.11.1",
"@actions/github": "^6.0.1",
"@beaussan/nx-knip": "^0.0.5-15",
"@code-pushup/cli": "^0.85.0",
"@code-pushup/eslint-config": "^0.14.2",
"@code-pushup/nx-plugin": "^0.85.0",
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@commitlint/config-nx-scopes": "^19.5.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/nx-plugin/src/executors/cli/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function parseAutorunExecutorOptions(
options: Partial<AutorunCommandExecutorOptions>,
normalizedContext: NormalizedExecutorContext,
): AutorunCommandExecutorOptions {
const { projectPrefix, persist, upload, command } = options;
const { projectPrefix, persist, upload, command, output } = options;
const needsUploadParams =
command === 'upload' || command === 'autorun' || command === undefined;
const uploadCfg = uploadConfig(
Expand All @@ -46,6 +46,7 @@ export function parseAutorunExecutorOptions(
...parsePrintConfigExecutorOptions(options),
...parseAutorunExecutorOnlyOptions(options),
...globalConfig(options, normalizedContext),
...(output ? { output } : {}),
persist: persistConfig({ projectPrefix, ...persist }, normalizedContext),
// @TODO This is a hack to avoid validation errors of upload config for commands that dont need it.
// Fix: use utils and execute the core logic directly
Expand Down
27 changes: 27 additions & 0 deletions packages/nx-plugin/src/executors/cli/utils.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,33 @@ describe('parseAutorunExecutorOptions', () => {
);
},
);

it.each<Command>(['print-config'])(
'should include output config for command %s',
command => {
const projectName = 'my-app';
const executorOptions = parseAutorunExecutorOptions(
{
command,
output: 'code-pushup.config.json',
},
{
projectName,
workspaceRoot: 'workspaceRoot',
projectConfig: {
name: 'my-app',
root: 'root',
},
},
);

expect(executorOptions).toEqual(
expect.objectContaining({
output: 'code-pushup.config.json',
}),
);
},
);
});

describe('mergeExecutorOptions', () => {
Expand Down
2 changes: 0 additions & 2 deletions packages/nx-plugin/src/executors/internal/cli.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { logger } from '@nx/devkit';

export function createCliCommandString(options?: {
args?: Record<string, unknown>;
command?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
import * as path from 'node:path';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { DEFAULT_TARGET_NAME, PACKAGE_NAME } from '../../internal/constants.js';
import { configurationGenerator } from './generator.js';

describe('configurationGenerator', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { DynamicTargetOptions } from '../../internal/types.js';

export type ConfigurationGeneratorOptions = {
project: string;
bin?: string;
skipTarget?: boolean;
skipConfig?: boolean;
skipFormat?: boolean;
Expand Down
Loading
Loading