Skip to content

Commit

Permalink
Merge branch 'main' into impl-nx-create-nodes-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
BioPhoton committed Mar 8, 2025
2 parents 1f97896 + e538f8a commit 4a168e4
Show file tree
Hide file tree
Showing 337 changed files with 9,770 additions and 1,214 deletions.
49 changes: 49 additions & 0 deletions .github/ISSUE_TEMPLATE/plugin-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Plugin request
description: Add a request for a new plugin
title: 'Plugin request'
body:
- type: textarea
id: metric
attributes:
label: Metric
description: Elaborate on the specific metric the plugin will measure.
placeholder: e.g. Code coverage of functions, branches and lines.
validations:
required: true
- type: markdown
attributes:
value: Please provide a concise set of requirements, so that we can process your request as soon as possible.
- type: textarea
id: user-story
attributes:
label: User story
description: Here you can phrase your request in a user story format which highlights the added value of the requested plugin.
placeholder: e.g. As a Code PushUp user, I want to <request>, so that <added value>.
validations:
required: true
- type: textarea
id: dependencies
attributes:
label: Dependencies
description: List all added dependencies needed for the plugin (dev-dependencies excluded)
placeholder: e.g. - [ts-morph npm package](https://www.npmjs.com/package/ts-morph)
validations:
required: false
- type: textarea
id: acceptance-criteria
attributes:
label: Acceptance criteria
description: Please list a set of criteria to help us determine whether the scope of the plugin was fully addressed.
placeholder: |
For example:
- [ ] All packages have a comprehensive documentation in place.
- [ ] All unit, integration and e2e tests for the plugin.
- [ ] Cross references to relevant models or files are added as links.
validations:
required: true
- type: textarea
id: implementation-details
attributes:
label: Implementation details
description: If there are any implementation details you would want to point out, feel free to do so here.
placeholder: e.g. A link to a 3rd-party library, relevant article, expected flow details, wireframes highlighting the change or other.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22.10.0
22.14.0
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nodejs 22.10.0
nodejs 22.14.0
140 changes: 140 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,143 @@
## 0.64.1 (2025-03-04)

### 🩹 Fixes

- **ci:** always show execute process errors and log stdout if verbose ([b41de478](https://github.com/code-pushup/cli/commit/b41de478))
- **utils:** remove partial from mergeConfigs return type ([69c2ef4c](https://github.com/code-pushup/cli/commit/69c2ef4c))

### ❤️ Thank You

- Matěj Chalk
- Vojtech Masek @vmasek

## 0.64.0 (2025-02-27)

### 🚀 Features

- **ci:** allow refs without shas, fetch if needed ([2ee0a8d1](https://github.com/code-pushup/cli/commit/2ee0a8d1))

### ❤️ Thank You

- Matěj Chalk

## 0.63.0 (2025-02-26)

### 🚀 Features

- **ci:** use temporary file for print-config instead of stdout ([aa4d0b38](https://github.com/code-pushup/cli/commit/aa4d0b38))
- **cli:** add --output=<file> option to print-config command ([a1fde20c](https://github.com/code-pushup/cli/commit/a1fde20c))

### ❤️ Thank You

- Matěj Chalk

## 0.62.0 (2025-02-25)

### 🚀 Features

- log process working directory as cwd if undefined ([a0638f8c](https://github.com/code-pushup/cli/commit/a0638f8c))

### 🩹 Fixes

- **utils:** replace misleading commit labels in markdown diff ([21a1f25d](https://github.com/code-pushup/cli/commit/21a1f25d))

### ❤️ Thank You

- Matěj Chalk
- Vojtech Masek @vmasek

## 0.61.0 (2025-02-19)

### 🚀 Features

- **ci:** disable nx/turbo cache for non-autorun code-pushup commands ([29a1bc63](https://github.com/code-pushup/cli/commit/29a1bc63))
- **models:** do not throw if docs url invalid, treat as missing and log warning ([a54295c6](https://github.com/code-pushup/cli/commit/a54295c6))

### ❤️ Thank You

- Matěj Chalk

## 0.60.2 (2025-02-18)

### 🩹 Fixes

- **ci:** prevent unknown pathspec error for custom base ref ([60dfb5b2](https://github.com/code-pushup/cli/commit/60dfb5b2))

### ❤️ Thank You

- Matěj Chalk

## 0.60.1 (2025-02-18)

### 🩹 Fixes

- add toSorted polyfill as hotfix for bug in github actions runner ([55704d18](https://github.com/code-pushup/cli/commit/55704d18))
- **ci:** prevent ambigious ref when checking head ([f5f226e1](https://github.com/code-pushup/cli/commit/f5f226e1))

### ❤️ Thank You

- Matěj Chalk
- Vojtech Masek @vmasek

## 0.60.0 (2025-02-18)

### 🚀 Features

- **ci:** add skipComment option ([9ac2a6ba](https://github.com/code-pushup/cli/commit/9ac2a6ba))
- **plugin-typescript:** add TS core logic ([#932](https://github.com/code-pushup/cli/pull/932))
- **plugin-typescript:** add plugin logic ([#936](https://github.com/code-pushup/cli/pull/936))

### 🩹 Fixes

- **ci:** ensure head ref is checked out ([74db9023](https://github.com/code-pushup/cli/commit/74db9023))

### ❤️ Thank You

- Matěj Chalk
- Michael Hladky @BioPhoton

## 0.59.0 (2025-02-14)

### 🚀 Features

- **plugin-coverage:** do not halt plugin execution on fail ([23f1ce5c](https://github.com/code-pushup/cli/commit/23f1ce5c))
- **utils:** add string helper ([#916](https://github.com/code-pushup/cli/pull/916))

### 🩹 Fixes

- explicitly exit process with successful code to not leave cli hanging ([2cb815bb](https://github.com/code-pushup/cli/commit/2cb815bb))

### ❤️ Thank You

- Michael Hladky @BioPhoton
- Vojtech Masek @vmasek

## 0.58.0 (2025-02-12)

### 🚀 Features

- **models:** auto-generate JSDoc annotations ([29cf02ad](https://github.com/code-pushup/cli/commit/29cf02ad))
- **plugin-coverage:** support lcovonly option for vitest ([b230a3d2](https://github.com/code-pushup/cli/commit/b230a3d2))
- **plugin-eslint:** add support for custom groups ([#925](https://github.com/code-pushup/cli/pull/925))
- **plugin-jsdocs:** add plugin-jsdocs to analyze documentation in ts/js projects ([#896](https://github.com/code-pushup/cli/pull/896))
- **plugin-typescript:** setup plugin project base ([#917](https://github.com/code-pushup/cli/pull/917))

### 🩹 Fixes

- handle skipped audits and groups ([#911](https://github.com/code-pushup/cli/pull/911))
- fix poppinss version ([#921](https://github.com/code-pushup/cli/pull/921))
- nest files with timestamp for plugin runners ([4ecf9772](https://github.com/code-pushup/cli/commit/4ecf9772))
- **models:** add missing exports ([#918](https://github.com/code-pushup/cli/pull/918))
- **nx-plugin:** deep merge executor options ([#927](https://github.com/code-pushup/cli/pull/927))

### ❤️ Thank You

- Alejandro @aramirezj
- Hanna Skryl @hanna-skryl
- hanna-skryl
- Michael Hladky @BioPhoton
- Vojtech Masek @vmasek

## 0.57.0 (2024-12-17)

### 🚀 Features
Expand Down
9 changes: 9 additions & 0 deletions code-pushup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { z } from 'zod';
import {
coverageCoreConfigNx,
eslintCoreConfigNx,
jsDocsCoreConfig,
jsPackagesCoreConfig,
lighthouseCoreConfig,
} from './code-pushup.preset.js';
Expand Down Expand Up @@ -39,4 +40,12 @@ export default mergeConfigs(
'https://github.com/code-pushup/cli?tab=readme-ov-file#code-pushup-cli/',
),
await eslintCoreConfigNx(),
jsDocsCoreConfig([
'packages/**/src/**/*.ts',
'!packages/**/node_modules',
'!packages/**/{mocks,mock}',
'!**/*.{spec,test}.ts',
'!**/implementation/**',
'!**/internal/**',
]),
);
39 changes: 39 additions & 0 deletions code-pushup.preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ import eslintPlugin, {
eslintConfigFromNxProject,
} from './packages/plugin-eslint/src/index.js';
import jsPackagesPlugin from './packages/plugin-js-packages/src/index.js';
import jsDocsPlugin, {
JsDocsPluginConfig,
} from './packages/plugin-jsdocs/src/index.js';
import {
PLUGIN_SLUG,
groups,
} from './packages/plugin-jsdocs/src/lib/constants.js';
import { filterGroupsByOnlyAudits } from './packages/plugin-jsdocs/src/lib/utils.js';
import lighthousePlugin, {
lighthouseGroupRef,
} from './packages/plugin-lighthouse/src/index.js';
Expand Down Expand Up @@ -82,6 +90,24 @@ export const eslintCategories: CategoryConfig[] = [
},
];

export function getJsDocsCategories(
config: JsDocsPluginConfig,
): CategoryConfig[] {
return [
{
slug: 'docs',
title: 'Documentation',
description: 'Measures how much of your code is **documented**.',
refs: filterGroupsByOnlyAudits(groups, config).map(group => ({
weight: 1,
type: 'group',
plugin: PLUGIN_SLUG,
slug: group.slug,
})),
},
];
}

export const coverageCategories: CategoryConfig[] = [
{
slug: 'code-coverage',
Expand Down Expand Up @@ -114,6 +140,19 @@ export const lighthouseCoreConfig = async (
};
};

export const jsDocsCoreConfig = (
config: JsDocsPluginConfig | string[],
): CoreConfig => {
return {
plugins: [
jsDocsPlugin(Array.isArray(config) ? { patterns: config } : config),
],
categories: getJsDocsCategories(
Array.isArray(config) ? { patterns: config } : config,
),
};
};

export const eslintCoreConfigNx = async (
projectName?: string,
): Promise<CoreConfig> => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/ci-e2e/mocks/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { simpleGit } from 'simple-git';
import { nxTargetProject } from '@code-pushup/test-nx-utils';
import { teardownTestFolder } from '@code-pushup/test-setup';
import {
E2E_ENVIRONMENTS_DIR,
TEST_OUTPUT_DIR,
initGitRepo,
simulateGitFetch,
teardownTestFolder,
} from '@code-pushup/test-utils';

export type TestRepo = Awaited<ReturnType<typeof setupTestRepo>>;
Expand Down
2 changes: 1 addition & 1 deletion e2e/ci-e2e/tests/__snapshots__/basic-report-diff.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Code PushUp

🥳 Code PushUp report has **improved** – compared target commit `<commit-sha>` with source commit `<commit-sha>`.
🥳 Code PushUp report has **improved** – compared current commit `<commit-sha>` with previous commit `<commit-sha>`.

<details>
<summary>👍 <strong>1</strong> audit improved</summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Code PushUp

🥳 Code PushUp report has **improved** – compared target commit `<commit-sha>` with source commit `<commit-sha>`.
🥳 Code PushUp report has **improved** – compared current commit `<commit-sha>` with previous commit `<commit-sha>`.

## 💼 Project `@example/core`

Expand Down
2 changes: 1 addition & 1 deletion e2e/ci-e2e/tests/__snapshots__/nx-monorepo-report-diff.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Code PushUp

🤨 Code PushUp report has both **improvements and regressions** – compared target commit `<commit-sha>` with source commit `<commit-sha>`.
🤨 Code PushUp report has both **improvements and regressions** – compared current commit `<commit-sha>` with previous commit `<commit-sha>`.

## 💼 Project `api`

Expand Down
2 changes: 1 addition & 1 deletion e2e/cli-e2e/tests/__snapshots__/compare.report-diff.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Code PushUp

🥳 Code PushUp report has **improved** – compared target commit `<commit-sha>` with source commit `<commit-sha>`.
🥳 Code PushUp report has **improved** – compared current commit `<commit-sha>` with previous commit `<commit-sha>`.

## 🏷️ Categories

Expand Down
9 changes: 5 additions & 4 deletions e2e/cli-e2e/tests/__snapshots__/help.e2e.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ Global Options:
--progress Show progress bar in stdout.
[boolean] [default: true]
--verbose When true creates more verbose output. This is helpful w
hen debugging. [boolean] [default: false]
hen debugging. You may also set CP_VERBOSE env variable
instead. [boolean] [default: false]
--config Path to config file. By default it loads code-pushup.con
fig.(ts|mjs|js). [string]
--tsconfig Path to a TypeScript config, to be used when loading con
Expand Down Expand Up @@ -65,9 +66,9 @@ Examples:
code-pushup collect --onlyPlugins=covera Run collect with only coverage plugi
ge n, other plugins from config file wi
ll be skipped.
code-pushup collect --skipPlugins=covera Run collect skiping the coverage plu
ge gin, other plugins from config file
will be included.
code-pushup collect --skipPlugins=covera Run collect skipping the coverage pl
ge ugin, other plugins from config file
will be included.
code-pushup upload --persist.outputDir=d Upload dist/report.json to portal us
ist --upload.apiKey=$CP_API_KEY ing API key from environment variabl
e
Expand Down
13 changes: 7 additions & 6 deletions e2e/cli-e2e/tests/collect.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ import { cp } from 'node:fs/promises';
import path from 'node:path';
import { afterEach, beforeAll, describe, expect, it } from 'vitest';
import { nxTargetProject } from '@code-pushup/test-nx-utils';
import { teardownTestFolder } from '@code-pushup/test-setup';
import { E2E_ENVIRONMENTS_DIR, TEST_OUTPUT_DIR } from '@code-pushup/test-utils';
import {
E2E_ENVIRONMENTS_DIR,
TEST_OUTPUT_DIR,
teardownTestFolder,
} from '@code-pushup/test-utils';
import { executeProcess, readTextFile } from '@code-pushup/utils';

describe('CLI collect', () => {
Expand Down Expand Up @@ -38,7 +41,7 @@ describe('CLI collect', () => {
});

it('should create report.md', async () => {
const { code, stderr } = await executeProcess({
const { code } = await executeProcess({
command: 'npx',
args: [
'@code-pushup/cli',
Expand All @@ -50,7 +53,6 @@ describe('CLI collect', () => {
});

expect(code).toBe(0);
expect(stderr).toBe('');

const md = await readTextFile(path.join(dummyOutputDir, 'report.md'));

Expand All @@ -60,14 +62,13 @@ describe('CLI collect', () => {
});

it('should print report summary to stdout', async () => {
const { code, stdout, stderr } = await executeProcess({
const { code, stdout } = await executeProcess({
command: 'npx',
args: ['@code-pushup/cli', '--no-progress', 'collect'],
cwd: dummyDir,
});

expect(code).toBe(0);
expect(stderr).toBe('');

expect(stdout).toContain('Code PushUp Report');
expect(stdout).not.toContain('Generated reports');
Expand Down
Loading

0 comments on commit 4a168e4

Please sign in to comment.