@code-pushup/nx-plugin 0.96.0 → 0.97.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/executors/cli/executor.d.ts +2 -2
- package/src/executors/cli/executor.js +21 -10
- package/src/executors/cli/executor.js.map +1 -1
- package/src/executors/cli/schema.d.ts +3 -3
- package/src/executors/cli/schema.json +8 -1
- package/src/executors/cli/utils.d.ts +3 -3
- package/src/executors/cli/utils.js +8 -6
- package/src/executors/cli/utils.js.map +1 -1
- package/src/executors/internal/config.js +5 -8
- package/src/executors/internal/config.js.map +1 -1
- package/src/executors/internal/types.d.ts +2 -1
- package/src/generators/configuration/schema.d.ts +0 -1
- package/src/index.d.ts +1 -1
- package/src/index.js +2 -1
- package/src/index.js.map +1 -1
- package/src/internal/types.d.ts +1 -0
- package/src/plugin/constants.d.ts +1 -0
- package/src/plugin/constants.js +2 -1
- package/src/plugin/constants.js.map +1 -1
- package/src/plugin/plugin.d.ts +3 -0
- package/src/plugin/plugin.js +11 -2
- package/src/plugin/plugin.js.map +1 -1
- package/src/plugin/target/executor-target.d.ts +4 -1
- package/src/plugin/target/executor-target.js +3 -2
- package/src/plugin/target/executor-target.js.map +1 -1
- package/src/plugin/target/targets.d.ts +3 -1
- package/src/plugin/target/targets.js +2 -2
- package/src/plugin/target/targets.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-pushup/nx-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.97.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Nx plugin to integrate the Code PushUp CLI into your workspace 🛠️",
|
|
6
6
|
"publishConfig": {
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"generators": "./generators.json",
|
|
33
33
|
"executors": "./executors.json",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@code-pushup/models": "0.
|
|
36
|
-
"@code-pushup/utils": "0.
|
|
35
|
+
"@code-pushup/models": "0.97.0",
|
|
36
|
+
"@code-pushup/utils": "0.97.0",
|
|
37
37
|
"@nx/devkit": ">=17.0.0",
|
|
38
38
|
"nx": ">=17.0.0"
|
|
39
39
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ExecutorContext } from '@nx/devkit';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CliCommandExecutorOptions } from './schema.js';
|
|
3
3
|
export type ExecutorOutput = {
|
|
4
4
|
success: boolean;
|
|
5
5
|
command?: string;
|
|
6
6
|
error?: Error;
|
|
7
7
|
};
|
|
8
|
-
export default function
|
|
8
|
+
export default function runCliExecutor(terminalAndExecutorOptions: CliCommandExecutorOptions, context: ExecutorContext): Promise<ExecutorOutput>;
|
|
@@ -1,40 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default =
|
|
3
|
+
exports.default = runCliExecutor;
|
|
4
4
|
const execute_process_js_1 = require("../../internal/execute-process.js");
|
|
5
5
|
const context_js_1 = require("../internal/context.js");
|
|
6
6
|
const utils_js_1 = require("./utils.js");
|
|
7
7
|
/* eslint-disable-next-line max-lines-per-function */
|
|
8
|
-
async function
|
|
8
|
+
async function runCliExecutor(terminalAndExecutorOptions, context) {
|
|
9
9
|
const { objectToCliArgs, formatCommandStatus, logger, stringifyError } = await Promise.resolve().then(() => require('@code-pushup/utils'));
|
|
10
10
|
const normalizedContext = (0, context_js_1.normalizeContext)(context);
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const { command: cliCommand, verbose = false, dryRun, env: executorEnv, bin, projectPrefix, // Do not forward to CLI, it is handled plugin logic only
|
|
12
|
+
...restArgs } = (0, utils_js_1.parseCliExecutorOptions)(terminalAndExecutorOptions, normalizedContext);
|
|
13
|
+
// this sets `CP_VERBOSE=true` on process.env
|
|
14
14
|
logger.setVerbose(verbose);
|
|
15
15
|
const command = bin ? `node` : 'npx';
|
|
16
|
-
const
|
|
16
|
+
const args = [
|
|
17
17
|
bin ?? '@code-pushup/cli',
|
|
18
18
|
...(cliCommand ? [cliCommand] : []),
|
|
19
|
+
...objectToCliArgs(restArgs),
|
|
19
20
|
];
|
|
20
|
-
const
|
|
21
|
-
|
|
21
|
+
const loggedEnvVars = {
|
|
22
|
+
...executorEnv,
|
|
22
23
|
...(verbose && { CP_VERBOSE: 'true' }),
|
|
23
24
|
};
|
|
24
25
|
const commandString = formatCommandStatus([command, ...args].join(' '), {
|
|
25
26
|
cwd: context.cwd,
|
|
26
|
-
env:
|
|
27
|
+
env: loggedEnvVars,
|
|
27
28
|
});
|
|
28
29
|
if (dryRun) {
|
|
29
30
|
logger.warn(`DryRun execution of: ${commandString}`);
|
|
30
31
|
}
|
|
31
32
|
else {
|
|
32
33
|
try {
|
|
33
|
-
logger.debug(`
|
|
34
|
+
logger.debug(`Run CLI with env vars: ${JSON.stringify(loggedEnvVars)}`);
|
|
34
35
|
await (0, execute_process_js_1.executeProcess)({
|
|
35
36
|
command,
|
|
36
37
|
args,
|
|
37
38
|
...(context.cwd ? { cwd: context.cwd } : {}),
|
|
39
|
+
...(executorEnv && Object.keys(executorEnv).length > 0
|
|
40
|
+
? {
|
|
41
|
+
env: {
|
|
42
|
+
// if env is undefined, executeProcess extends process.env by default
|
|
43
|
+
...process.env,
|
|
44
|
+
// we don't pass `CP_VERBOSE=true` as it is handled inside logger.setVerbose
|
|
45
|
+
...executorEnv,
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
: {}),
|
|
38
49
|
});
|
|
39
50
|
}
|
|
40
51
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../src/executors/cli/executor.ts"],"names":[],"mappings":";;AAaA,
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../src/executors/cli/executor.ts"],"names":[],"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B,aAAa,EAAE,CAAC,CAAC;IACvD,CAAC;SAAM,CAAC;QACN,IAAI,CAAC;YACH,MAAM,CAAC,KAAK,CAAC,0BAA0B,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;YACxE,MAAM,IAAA,mCAAc,EAAC;gBACnB,OAAO;gBACP,IAAI;gBACJ,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC5C,GAAG,CAAC,WAAW,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC;oBACpD,CAAC,CAAC;wBACE,GAAG,EAAE;4BACH,qEAAqE;4BACrE,GAAG,OAAO,CAAC,GAAG;4BACd,4EAA4E;4BAC5E,GAAG,WAAW;yBACf;qBACF;oBACH,CAAC,CAAC,EAAE,CAAC;aACR,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;YACpC,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE,aAAa;gBACtB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,EAAE,CAAC;aAC9D,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO;QACL,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,aAAa;KACvB,CAAC;AACJ,CAAC"}
|
|
@@ -4,8 +4,8 @@ export type PrintConfigOptions = {
|
|
|
4
4
|
output?: string;
|
|
5
5
|
};
|
|
6
6
|
export type PrintConfigCommandExecutorOptions = PrintConfigOptions;
|
|
7
|
-
export type
|
|
8
|
-
export type
|
|
7
|
+
export type CliCommandExecutorOnlyOptions = ProjectExecutorOnlyOptions & CollectExecutorOnlyOptions & GeneralExecutorOnlyOptions;
|
|
8
|
+
export type CliCommandExecutorOptions = Partial<{
|
|
9
9
|
upload: Partial<UploadConfig>;
|
|
10
10
|
persist: Partial<PersistConfig>;
|
|
11
|
-
} &
|
|
11
|
+
} & CliCommandExecutorOnlyOptions & GlobalExecutorOptions> & PrintConfigOptions;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"$id": "
|
|
3
|
+
"$id": "CliExecutorOptions",
|
|
4
4
|
"title": "CodePushup CLI autorun executor",
|
|
5
5
|
"description": "Executes the @code-pushup/cli autorun command See: https://github.com/code-pushup/cli/blob/main/packages/cli/README.md#autorun-command",
|
|
6
6
|
"type": "object",
|
|
@@ -21,6 +21,13 @@
|
|
|
21
21
|
"type": "string",
|
|
22
22
|
"description": "Path to Code PushUp CLI"
|
|
23
23
|
},
|
|
24
|
+
"env": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"additionalProperties": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
},
|
|
29
|
+
"description": "Environment variables added to Code PushUp CLI process"
|
|
30
|
+
},
|
|
24
31
|
"verbose": {
|
|
25
32
|
"type": "boolean",
|
|
26
33
|
"description": "Print additional logs"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NormalizedExecutorContext } from '../internal/context.js';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function
|
|
2
|
+
import type { CliCommandExecutorOnlyOptions, CliCommandExecutorOptions, PrintConfigCommandExecutorOptions } from './schema.js';
|
|
3
|
+
export declare function parseCliExecutorOnlyOptions(options: Partial<CliCommandExecutorOnlyOptions>): CliCommandExecutorOnlyOptions;
|
|
4
4
|
export declare function parsePrintConfigExecutorOptions(options: Partial<PrintConfigCommandExecutorOptions>): PrintConfigCommandExecutorOptions;
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function parseCliExecutorOptions(options: Partial<CliCommandExecutorOptions>, normalizedContext: NormalizedExecutorContext): CliCommandExecutorOptions;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.parseCliExecutorOnlyOptions = parseCliExecutorOnlyOptions;
|
|
4
4
|
exports.parsePrintConfigExecutorOptions = parsePrintConfigExecutorOptions;
|
|
5
|
-
exports.
|
|
5
|
+
exports.parseCliExecutorOptions = parseCliExecutorOptions;
|
|
6
6
|
const config_js_1 = require("../internal/config.js");
|
|
7
|
-
function
|
|
8
|
-
const { projectPrefix, dryRun, onlyPlugins } = options;
|
|
7
|
+
function parseCliExecutorOnlyOptions(options) {
|
|
8
|
+
const { projectPrefix, dryRun, onlyPlugins, env, bin } = options;
|
|
9
9
|
return {
|
|
10
10
|
...(projectPrefix && { projectPrefix }),
|
|
11
11
|
...(dryRun != null && { dryRun }),
|
|
12
12
|
...(onlyPlugins && { onlyPlugins }),
|
|
13
|
+
...(env && { env }),
|
|
14
|
+
...(bin && { bin }),
|
|
13
15
|
};
|
|
14
16
|
}
|
|
15
17
|
function parsePrintConfigExecutorOptions(options) {
|
|
@@ -18,14 +20,14 @@ function parsePrintConfigExecutorOptions(options) {
|
|
|
18
20
|
...(output && { output }),
|
|
19
21
|
};
|
|
20
22
|
}
|
|
21
|
-
function
|
|
23
|
+
function parseCliExecutorOptions(options, normalizedContext) {
|
|
22
24
|
const { projectPrefix, persist, upload, command, output } = options;
|
|
23
25
|
const needsUploadParams = command === 'upload' || command === 'autorun' || command === undefined;
|
|
24
26
|
const uploadCfg = (0, config_js_1.uploadConfig)({ projectPrefix, ...upload }, normalizedContext);
|
|
25
27
|
const hasApiToken = uploadCfg?.apiKey != null;
|
|
26
28
|
return {
|
|
27
29
|
...parsePrintConfigExecutorOptions(options),
|
|
28
|
-
...
|
|
30
|
+
...parseCliExecutorOnlyOptions(options),
|
|
29
31
|
...(0, config_js_1.globalConfig)(options, normalizedContext),
|
|
30
32
|
...(output ? { output } : {}),
|
|
31
33
|
persist: (0, config_js_1.persistConfig)({ projectPrefix, ...persist }, normalizedContext),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/executors/cli/utils.ts"],"names":[],"mappings":";;AAYA,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/executors/cli/utils.ts"],"names":[],"mappings":";;AAYA,kEAWC;AAED,0EAOC;AAED,0DAuBC;AAzDD,qDAI+B;AAQ/B,SAAgB,2BAA2B,CACzC,OAA+C;IAE/C,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IACjE,OAAO;QACL,GAAG,CAAC,aAAa,IAAI,EAAE,aAAa,EAAE,CAAC;QACvC,GAAG,CAAC,MAAM,IAAI,IAAI,IAAI,EAAE,MAAM,EAAE,CAAC;QACjC,GAAG,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,CAAC;QACnC,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,CAAC;QACnB,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,CAAC;KACpB,CAAC;AACJ,CAAC;AAED,SAAgB,+BAA+B,CAC7C,OAAmD;IAEnD,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC3B,OAAO;QACL,GAAG,CAAC,MAAM,IAAI,EAAE,MAAM,EAAE,CAAC;KAC1B,CAAC;AACJ,CAAC;AAED,SAAgB,uBAAuB,CACrC,OAA2C,EAC3C,iBAA4C;IAE5C,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACpE,MAAM,iBAAiB,GACrB,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS,CAAC;IACzE,MAAM,SAAS,GAAG,IAAA,wBAAY,EAC5B,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,EAC5B,iBAAiB,CAClB,CAAC;IACF,MAAM,WAAW,GAAG,SAAS,EAAE,MAAM,IAAI,IAAI,CAAC;IAC9C,OAAO;QACL,GAAG,+BAA+B,CAAC,OAAO,CAAC;QAC3C,GAAG,2BAA2B,CAAC,OAAO,CAAC;QACvC,GAAG,IAAA,wBAAY,EAAC,OAAO,EAAE,iBAAiB,CAAC;QAC3C,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7B,OAAO,EAAE,IAAA,yBAAa,EAAC,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,EAAE,iBAAiB,CAAC;QACxE,mGAAmG;QACnG,qDAAqD;QACrD,6CAA6C;QAC7C,GAAG,CAAC,iBAAiB,IAAI,WAAW,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACnE,CAAC;AACJ,CAAC"}
|
|
@@ -8,8 +8,9 @@ const env_js_1 = require("./env.js");
|
|
|
8
8
|
function globalConfig(options, context) {
|
|
9
9
|
const { projectConfig } = context;
|
|
10
10
|
const { root: projectRoot = '' } = projectConfig ?? {};
|
|
11
|
-
const { verbose, config } = options;
|
|
11
|
+
const { verbose, config, command } = options;
|
|
12
12
|
return {
|
|
13
|
+
command,
|
|
13
14
|
verbose: !!verbose,
|
|
14
15
|
config: config ?? path.join(projectRoot, 'code-pushup.config.ts'),
|
|
15
16
|
};
|
|
@@ -28,13 +29,9 @@ function persistConfig(options, context) {
|
|
|
28
29
|
function uploadConfig(options, context) {
|
|
29
30
|
const { workspaceRoot, projectName } = context;
|
|
30
31
|
const { projectPrefix, server, apiKey, organization, project, timeout } = options;
|
|
31
|
-
const applyPrefix = workspaceRoot
|
|
32
|
-
const prefix = projectPrefix ? `${projectPrefix}-` : '';
|
|
33
|
-
const derivedProject = projectName && !project
|
|
34
|
-
? applyPrefix
|
|
35
|
-
? `${prefix}${projectName}`
|
|
36
|
-
: projectName
|
|
37
|
-
: project;
|
|
32
|
+
const applyPrefix = workspaceRoot !== '.';
|
|
33
|
+
const prefix = projectPrefix && applyPrefix ? `${projectPrefix}-` : '';
|
|
34
|
+
const derivedProject = projectName && !project ? `${prefix}${projectName}` : project;
|
|
38
35
|
return {
|
|
39
36
|
...(0, env_js_1.parseEnv)(process.env),
|
|
40
37
|
...Object.fromEntries(Object.entries({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/executors/internal/config.ts"],"names":[],"mappings":";;AAUA,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/executors/internal/config.ts"],"names":[],"mappings":";;AAUA,oCAYC;AAED,sCAkBC;AAED,oCA0BC;AAtED,kCAAkC;AAGlC,qCAAoC;AAOpC,SAAgB,YAAY,CAC1B,OAAiE,EACjE,OAAsC;IAEtC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IAClC,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,aAAa,IAAI,EAAE,CAAC;IACvD,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC7C,OAAO;QACL,OAAO;QACP,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,MAAM,EAAE,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,uBAAuB,CAAC;KAClE,CAAC;AACJ,CAAC;AAED,SAAgB,aAAa,CAC3B,OAA4D,EAC5D,OAAsC;IAEtC,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IAEjD,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,aAAa,IAAI,EAAE,CAAC;IACvD,MAAM,EACJ,MAAM,EACN,SA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C,CACvC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -4,6 +4,8 @@ import type { ProjectConfiguration } from 'nx/src/config/workspace-json-project-
|
|
|
4
4
|
*/
|
|
5
5
|
export type GeneralExecutorOnlyOptions = {
|
|
6
6
|
dryRun?: boolean;
|
|
7
|
+
env?: Record<string, string>;
|
|
8
|
+
bin?: string;
|
|
7
9
|
};
|
|
8
10
|
/**
|
|
9
11
|
* executor types that apply for a subset of exector's.
|
|
@@ -19,7 +21,6 @@ export type ProjectExecutorOnlyOptions = {
|
|
|
19
21
|
export type Command = 'collect' | 'upload' | 'autorun' | 'print-config' | 'compare' | 'merge-diffs' | 'history';
|
|
20
22
|
export type GlobalExecutorOptions = {
|
|
21
23
|
command?: Command;
|
|
22
|
-
bin?: string;
|
|
23
24
|
verbose?: boolean;
|
|
24
25
|
config?: string;
|
|
25
26
|
};
|
package/src/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ declare const plugin: {
|
|
|
4
4
|
createNodes: import("@nx/devkit").CreateNodes;
|
|
5
5
|
};
|
|
6
6
|
export default plugin;
|
|
7
|
-
export type {
|
|
7
|
+
export type { CliCommandExecutorOptions } from './executors/cli/schema.js';
|
|
8
8
|
export { generateCodePushupConfig } from './generators/configuration/code-pushup-config.js';
|
|
9
9
|
export { configurationGenerator } from './generators/configuration/generator.js';
|
|
10
10
|
export type { ConfigurationGeneratorOptions } from './generators/configuration/schema.js';
|
package/src/index.js
CHANGED
|
@@ -15,10 +15,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.createNodesV2 = exports.createNodes = exports.initSchematic = exports.initGenerator = exports.configurationGenerator = exports.generateCodePushupConfig = void 0;
|
|
18
|
+
const constants_js_1 = require("./plugin/constants.js");
|
|
18
19
|
const index_js_1 = require("./plugin/index.js");
|
|
19
20
|
// default export for nx.json#plugins
|
|
20
21
|
const plugin = {
|
|
21
|
-
name:
|
|
22
|
+
name: constants_js_1.PLUGIN_NAME,
|
|
22
23
|
createNodesV2: index_js_1.createNodesV2,
|
|
23
24
|
// Keep for backwards compatibility with Nx < 21
|
|
24
25
|
createNodes: index_js_1.createNodes,
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,gDAA+D;AAE/D,qCAAqC;AACrC,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,wDAAoD;AACpD,gDAA+D;AAE/D,qCAAqC;AACrC,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,0BAAW;IACjB,aAAa,EAAb,wBAAa;IACb,gDAAgD;IAChD,WAAW,EAAX,sBAAW;CACZ,CAAC;AAEF,kBAAe,MAAM,CAAC;AAGtB,0FAA4F;AAAnF,iIAAA,wBAAwB,OAAA;AACjC,wEAAiF;AAAxE,sHAAA,sBAAsB,OAAA;AAE/B,+DAA8E;AAArE,6GAAA,aAAa,OAAA;AAAE,6GAAA,aAAa,OAAA;AAErC,yDAAuC;AACvC,8CAA+D;AAAtD,uGAAA,WAAW,OAAA;AAAE,yGAAA,aAAa,OAAA"}
|
package/src/internal/types.d.ts
CHANGED
package/src/plugin/constants.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CP_TARGET_NAME = void 0;
|
|
3
|
+
exports.PLUGIN_NAME = exports.CP_TARGET_NAME = void 0;
|
|
4
4
|
exports.CP_TARGET_NAME = 'code-pushup';
|
|
5
|
+
exports.PLUGIN_NAME = '@code-pushup/nx-plugin';
|
|
5
6
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/plugin/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/plugin/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG,aAAa,CAAC;AAC/B,QAAA,WAAW,GAAG,wBAAwB,CAAC"}
|
package/src/plugin/plugin.d.ts
CHANGED
package/src/plugin/plugin.js
CHANGED
|
@@ -2,14 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createNodesV2 = exports.createNodes = void 0;
|
|
4
4
|
const constants_js_1 = require("../internal/constants.js");
|
|
5
|
+
const constants_js_2 = require("./constants.js");
|
|
5
6
|
const targets_js_1 = require("./target/targets.js");
|
|
6
7
|
const utils_js_1 = require("./utils.js");
|
|
7
8
|
// name has to be "createNodes" to get picked up by Nx <v20
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated
|
|
11
|
+
*/
|
|
8
12
|
exports.createNodes = [
|
|
9
13
|
`**/${constants_js_1.PROJECT_JSON_FILE_NAME}`,
|
|
10
14
|
async (projectConfigurationFile, createNodesOptions, context) => {
|
|
11
15
|
const parsedCreateNodesOptions = createNodesOptions;
|
|
12
|
-
const
|
|
16
|
+
const pluginsConfig = context.nxJsonConfiguration.pluginsConfig?.[constants_js_2.PLUGIN_NAME] ?? {};
|
|
17
|
+
const mergedOptions = { ...pluginsConfig, ...parsedCreateNodesOptions };
|
|
18
|
+
const normalizedContext = await (0, utils_js_1.normalizedCreateNodesContext)(context, projectConfigurationFile, mergedOptions);
|
|
13
19
|
return {
|
|
14
20
|
projects: {
|
|
15
21
|
[normalizedContext.projectRoot]: {
|
|
@@ -23,8 +29,11 @@ exports.createNodesV2 = [
|
|
|
23
29
|
`**/${constants_js_1.PROJECT_JSON_FILE_NAME}`,
|
|
24
30
|
async (projectConfigurationFiles, createNodesOptions, context) => {
|
|
25
31
|
const parsedCreateNodesOptions = createNodesOptions;
|
|
32
|
+
const { pluginsConfig = {} } = context.nxJsonConfiguration;
|
|
33
|
+
const pluginsConfigObj = pluginsConfig[constants_js_2.PLUGIN_NAME] ?? {};
|
|
34
|
+
const mergedOptions = { ...pluginsConfigObj, ...parsedCreateNodesOptions };
|
|
26
35
|
return await Promise.all(projectConfigurationFiles.map(async (projectConfigurationFile) => {
|
|
27
|
-
const normalizedContext = await (0, utils_js_1.normalizedCreateNodesV2Context)(context, projectConfigurationFile,
|
|
36
|
+
const normalizedContext = await (0, utils_js_1.normalizedCreateNodesV2Context)(context, projectConfigurationFile, mergedOptions);
|
|
28
37
|
const result = {
|
|
29
38
|
projects: {
|
|
30
39
|
[normalizedContext.projectRoot]: {
|
package/src/plugin/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/plugin/plugin.ts"],"names":[],"mappings":";;;AAQA,2DAAkE;AAClE,oDAAoD;AAEpD,yCAGoB;AAEpB,2DAA2D;
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/plugin/plugin.ts"],"names":[],"mappings":";;;AAQA,2DAAkE;AAClE,iDAA6C;AAC7C,oDAAoD;AAEpD,yCAGoB;AAEpB,2DAA2D;AAC3D;;GAEG;AACU,QAAA,WAAW,GAAgB;IACtC,MAAM,qCAAsB,EAAE;IAC9B,KAAK,EACH,wBAAgC,EAChC,kBAA2B,EAC3B,OAA2B,EACC,EAAE;QAC9B,MAAM,wBAAwB,GAAG,kBAAwC,CAAC;QAC1E,MAAM,aAAa,GACjB,OAAO,CAAC,mBAAmB,CAAC,aAAa,EAAE,CAAC,0BAAW,CAAC,IAAI,EAAE,CAAC;QACjE,MAAM,aAAa,GAAG,EAAE,GAAG,aAAa,EAAE,GAAG,wBAAwB,EAAE,CAAC;QAExE,MAAM,iBAAi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|
|
5
5
|
projectPrefix?: string;
|
|
6
|
-
|
|
6
|
+
env?: Record<string, string>;
|
|
7
|
+
}): TargetConfiguration<ProjectPrefixOptions & {
|
|
8
|
+
env?: Record<string, string>;
|
|
9
|
+
}>;
|
|
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createExecutorTarget = createExecutorTarget;
|
|
4
4
|
const constants_js_1 = require("../../internal/constants.js");
|
|
5
5
|
function createExecutorTarget(options) {
|
|
6
|
-
const { bin, projectPrefix } = options ?? {};
|
|
6
|
+
const { bin, projectPrefix, env } = options ?? {};
|
|
7
7
|
const executor = `${constants_js_1.PACKAGE_NAME}:cli`;
|
|
8
|
-
const executorOptions = (bin || projectPrefix) && {
|
|
8
|
+
const executorOptions = (bin || projectPrefix || env) && {
|
|
9
9
|
...(bin && { bin }),
|
|
10
10
|
...(projectPrefix && { projectPrefix }),
|
|
11
|
+
...(env && { env }),
|
|
11
12
|
};
|
|
12
13
|
return { executor, ...(executorOptions && { options: executorOptions }) };
|
|
13
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor-target.js","sourceRoot":"","sources":["../../../../src/plugin/target/executor-target.ts"],"names":[],"mappings":";;AAIA,
|
|
1
|
+
{"version":3,"file":"executor-target.js","sourceRoot":"","sources":["../../../../src/plugin/target/executor-target.ts"],"names":[],"mappings":";;AAIA,oDAgBC;AAnBD,8DAA2D;AAG3D,SAAgB,oBAAoB,CAAC,OAIpC;IAGC,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAElD,MAAM,QAAQ,GAAG,GAAG,2BAAY,MAAM,CAAC;IACvC,MAAM,eAAe,GAAG,CAAC,GAAG,IAAI,aAAa,IAAI,GAAG,CAAC,IAAI;QACvD,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,CAAC;QACnB,GAAG,CAAC,aAAa,IAAI,EAAE,aAAa,EAAE,CAAC;QACvC,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,CAAC;KACpB,CAAC;IACF,OAAO,EAAE,QAAQ,EAAE,GAAG,CAAC,eAAe,IAAI,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC,EAAE,CAAC;AAC5E,CAAC"}
|
|
@@ -5,7 +5,9 @@ export type CreateTargetsOptions = {
|
|
|
5
5
|
createOptions: CreateNodesOptions;
|
|
6
6
|
};
|
|
7
7
|
export declare function createTargets(normalizedContext: CreateTargetsOptions): Promise<{
|
|
8
|
-
[x: string]: import("@nx/devkit").TargetConfiguration<import("../types.js").ProjectPrefixOptions
|
|
8
|
+
[x: string]: import("@nx/devkit").TargetConfiguration<import("../types.js").ProjectPrefixOptions & {
|
|
9
|
+
env?: Record<string, string>;
|
|
10
|
+
}>;
|
|
9
11
|
} | {
|
|
10
12
|
[x: string]: import("@nx/devkit").TargetConfiguration<import("nx/src/executors/run-commands/run-commands.impl.js").RunCommandsOptions>;
|
|
11
13
|
}>;
|
|
@@ -7,11 +7,11 @@ const configuration_target_js_1 = require("./configuration-target.js");
|
|
|
7
7
|
const constants_js_2 = require("./constants.js");
|
|
8
8
|
const executor_target_js_1 = require("./executor-target.js");
|
|
9
9
|
async function createTargets(normalizedContext) {
|
|
10
|
-
const { targetName = constants_js_1.CP_TARGET_NAME, bin, projectPrefix, } = normalizedContext.createOptions;
|
|
10
|
+
const { targetName = constants_js_1.CP_TARGET_NAME, bin, projectPrefix, env, } = normalizedContext.createOptions;
|
|
11
11
|
const rootFiles = await (0, promises_1.readdir)(normalizedContext.projectRoot);
|
|
12
12
|
return rootFiles.some(filename => filename.match(constants_js_2.CODE_PUSHUP_CONFIG_REGEX))
|
|
13
13
|
? {
|
|
14
|
-
[targetName]: (0, executor_target_js_1.createExecutorTarget)({ bin, projectPrefix }),
|
|
14
|
+
[targetName]: (0, executor_target_js_1.createExecutorTarget)({ bin, projectPrefix, env }),
|
|
15
15
|
}
|
|
16
16
|
: // if NO code-pushup.config.*.(ts|js|mjs) is present return configuration target
|
|
17
17
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"targets.js","sourceRoot":"","sources":["../../../../src/plugin/target/targets.ts"],"names":[],"mappings":";;AAgBA,
|
|
1
|
+
{"version":3,"file":"targets.js","sourceRoot":"","sources":["../../../../src/plugin/target/targets.ts"],"names":[],"mappings":";;AAgBA,sCAkBC;AAlCD,+CAA2C;AAC3C,kDAAiD;AAKjD,uEAAsE;AACtE,iDAA0D;AAC1D,6DAA4D;AAQrD,KAAK,UAAU,aAAa,CAAC,iBAAuC;IACzE,MAAM,EACJ,UAAU,GAAG,6BAAc,EAC3B,GAAG,EACH,aAAa,EACb,GAAG,GACJ,GAAG,iBAAiB,CAAC,aAAa,CAAC;IACpC,MAAM,SAAS,GAAG,MAAM,IAAA,kBAAO,EAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC/D,OAAO,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,uCAAwB,CAAC,CAAC;QACzE,CAAC,CAAC;YACE,CAAC,UAAU,CAAC,EAAE,IAAA,yCAAoB,EAAC,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC;SAChE;QACH,CAAC,CAAC,gFAAgF;YAChF;gBACE,CAAC,GAAG,UAAU,iBAAiB,CAAC,EAAE,MAAM,IAAA,mDAAyB,EAAC;oBAChE,WAAW,EAAE,iBAAiB,CAAC,WAAW,CAAC,IAAI;iBAChD,CAAC;aACH,CAAC;AACR,CAAC"}
|