Skip to content

Commit e72b2f3

Browse files
author
John Doe
committed
refactor: fix project name
1 parent a04d56b commit e72b2f3

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

packages/nx-plugin/src/executors/internal/config.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as path from 'node:path';
22
import type { PersistConfig, UploadConfig } from '@code-pushup/models';
3+
import type { NormalizedExecutorContext } from './context.js';
34
import { parseEnv } from './env.js';
45
import type {
56
BaseNormalizedExecutorContext,
@@ -44,25 +45,32 @@ export function persistConfig(
4445

4546
export function uploadConfig(
4647
options: Partial<UploadConfig & ProjectExecutorOnlyOptions>,
47-
context: BaseNormalizedExecutorContext,
48+
context: NormalizedExecutorContext,
4849
): Partial<UploadConfig> {
4950
const { workspaceRoot, projectName } = context;
5051

5152
const { projectPrefix, server, apiKey, organization, project, timeout } =
5253
options;
5354
const applyPrefix = workspaceRoot === '.';
5455
const prefix = projectPrefix ? `${projectPrefix}-` : '';
56+
57+
const derivedProject =
58+
projectName && !project
59+
? applyPrefix
60+
? `${prefix}${projectName}`
61+
: projectName
62+
: project;
63+
5564
return {
56-
...(projectName
57-
? {
58-
project: applyPrefix ? `${prefix}${projectName}` : projectName,
59-
}
60-
: {}),
6165
...parseEnv(process.env),
6266
...Object.fromEntries(
63-
Object.entries({ server, apiKey, organization, project, timeout }).filter(
64-
([_, v]) => v !== undefined,
65-
),
67+
Object.entries({
68+
server,
69+
apiKey,
70+
organization,
71+
...(derivedProject ? { project: derivedProject } : {}),
72+
timeout,
73+
}).filter(([_, v]) => v !== undefined),
6674
),
6775
};
6876
}

packages/nx-plugin/src/executors/internal/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,4 @@ export type CollectExecutorOnlyOptions = {
4848
*/
4949
export type BaseNormalizedExecutorContext = {
5050
projectConfig?: ProjectConfiguration;
51-
projectName?: string;
5251
} & { workspaceRoot: string };

0 commit comments

Comments
 (0)