Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 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
4ba05a6
refactor: add env options and correct bin
Nov 10, 2025
d61fa16
Merge branch 'main' into use-cp-nx-plugin
Nov 10, 2025
71779ae
refactor: refactor plugin options
Nov 11, 2025
45e33a3
refactor: packages update
Nov 11, 2025
c8ab27c
refactor: fix text
Nov 11, 2025
4dcbedb
refactor: fix import
Nov 11, 2025
2d12182
refactor: fix logger spacing
Nov 11, 2025
804319b
refactor: add logger helper unit tests
Nov 11, 2025
a54e5dc
refactor: add env and cwd to logger in execProcess
Nov 11, 2025
0a8af75
refactor: fix unit tests
Nov 11, 2025
50d9f2c
refactor: wip
Nov 11, 2025
256ea00
refactor: wip revert
Nov 11, 2025
2b05307
refactor: wip 1
Nov 11, 2025
cbf9d19
refactor: move objToCliArgs parts and reuse
Nov 11, 2025
5559d5f
refactor: fix unit tests
Nov 11, 2025
0a5170f
refactor: wip
Nov 11, 2025
9a1558e
refactor: wip
Nov 11, 2025
b8c4659
refactor: wip
Nov 11, 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
12 changes: 11 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
"watch": false
}
},
"code-pushup": {
"old-code-pushup": {
"cache": false,
"outputs": [
"{projectRoot}/.code-pushup/report.md",
Expand Down 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 @@ -51,6 +50,9 @@
"@actions/github": "^6.0.1",
"@beaussan/nx-knip": "^0.0.5-15",
"@code-pushup/eslint-config": "^0.14.2",
"@code-pushup/cli": "0.86.0",
"@code-pushup/nx-plugin": "0.86.0",
"@code-pushup/portal-client": "^0.16.0",
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@commitlint/config-nx-scopes": "^19.5.0",
Expand Down
31 changes: 15 additions & 16 deletions packages/nx-plugin/src/executors/cli/executor.int.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { afterEach, expect, vi } from 'vitest';
import { executorContext } from '@code-pushup/test-nx-utils';
import { removeColorCodes } from '@code-pushup/test-utils';
import * as executeProcessModule from '../../internal/execute-process.js';
import runAutorunExecutor from './executor.js';
import * as utils from './utils.js';
Expand All @@ -26,27 +27,25 @@ describe('runAutorunExecutor', () => {
executeProcessSpy.mockReset();
});

it('should normalize context, parse CLI options and execute command', async () => {
const output = await runAutorunExecutor(
it('should parse CLI options and execute command', async () => {
const { success, command } = await runAutorunExecutor(
{ verbose: true },
executorContext('utils'),
);
expect(output.success).toBe(true);

expect(parseAutorunExecutorOptionsSpy).toHaveBeenCalledTimes(1);

//is context normalized
expect(parseAutorunExecutorOptionsSpy).toHaveBeenCalledWith(
{ verbose: true },
expect(success).toBe(true);
const cleanCommand = removeColorCodes(command || '');
expect(cleanCommand).toMatch('npx @code-pushup/cli');
expect(cleanCommand).toMatch('CP_VERBOSE="true"');
expect(executeProcessSpy).toHaveBeenCalledTimes(1);
expect(executeProcessSpy).toHaveBeenCalledWith(
expect.objectContaining({
projectConfig: expect.objectContaining({ name: 'utils' }),
command: 'npx',
args: expect.arrayContaining(['@code-pushup/cli']),
cwd: expect.any(String),
env: expect.objectContaining({
CP_VERBOSE: 'true',
}),
}),
);
expect(executeProcessSpy).toHaveBeenCalledTimes(1);
expect(executeProcessSpy).toHaveBeenCalledWith({
command: 'npx',
args: expect.arrayContaining(['@code-pushup/cli']),
cwd: process.cwd(),
});
});
});
Loading
Loading