@code-pushup/nx-plugin 0.51.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/README.md +23 -0
- package/executors.json +9 -0
- package/generators.json +14 -0
- package/package.json +31 -0
- package/src/executors/autorun/README.md +61 -0
- package/src/executors/autorun/constants.d.ts +1 -0
- package/src/executors/autorun/constants.js +5 -0
- package/src/executors/autorun/constants.js.map +1 -0
- package/src/executors/autorun/executor.d.ts +15 -0
- package/src/executors/autorun/executor.js +44 -0
- package/src/executors/autorun/executor.js.map +1 -0
- package/src/executors/autorun/schema.d.ts +7 -0
- package/src/executors/autorun/schema.js +3 -0
- package/src/executors/autorun/schema.js.map +1 -0
- package/src/executors/autorun/schema.json +100 -0
- package/src/executors/autorun/utils.d.ts +4 -0
- package/src/executors/autorun/utils.js +24 -0
- package/src/executors/autorun/utils.js.map +1 -0
- package/src/executors/internal/cli.d.ts +10 -0
- package/src/executors/internal/cli.js +48 -0
- package/src/executors/internal/cli.js.map +1 -0
- package/src/executors/internal/config.d.ts +5 -0
- package/src/executors/internal/config.js +47 -0
- package/src/executors/internal/config.js.map +1 -0
- package/src/executors/internal/context.d.ts +6 -0
- package/src/executors/internal/context.js +13 -0
- package/src/executors/internal/context.js.map +1 -0
- package/src/executors/internal/env.d.ts +2 -0
- package/src/executors/internal/env.js +36 -0
- package/src/executors/internal/env.js.map +1 -0
- package/src/executors/internal/types.d.ts +39 -0
- package/src/executors/internal/types.js +3 -0
- package/src/executors/internal/types.js.map +1 -0
- package/src/generators/configuration/README.md +27 -0
- package/src/generators/configuration/code-pushup-config.d.ts +13 -0
- package/src/generators/configuration/code-pushup-config.js +38 -0
- package/src/generators/configuration/code-pushup-config.js.map +1 -0
- package/src/generators/configuration/files/code-pushup.config.ts.template +9 -0
- package/src/generators/configuration/generator.d.ts +6 -0
- package/src/generators/configuration/generator.js +46 -0
- package/src/generators/configuration/generator.js.map +1 -0
- package/src/generators/configuration/schema.d.ts +9 -0
- package/src/generators/configuration/schema.json +45 -0
- package/src/generators/configuration/types.d.ts +5 -0
- package/src/generators/configuration/types.js +3 -0
- package/src/generators/configuration/types.js.map +1 -0
- package/src/generators/configuration/utils.d.ts +9 -0
- package/src/generators/configuration/utils.js +47 -0
- package/src/generators/configuration/utils.js.map +1 -0
- package/src/generators/init/README.md +24 -0
- package/src/generators/init/generator.d.ts +5 -0
- package/src/generators/init/generator.js +78 -0
- package/src/generators/init/generator.js.map +1 -0
- package/src/generators/init/schema.d.ts +5 -0
- package/src/generators/init/schema.json +23 -0
- package/src/index.d.ts +11 -0
- package/src/index.js +22 -0
- package/src/index.js.map +1 -0
- package/src/internal/constants.d.ts +3 -0
- package/src/internal/constants.js +8 -0
- package/src/internal/constants.js.map +1 -0
- package/src/internal/execute-process.d.ts +123 -0
- package/src/internal/execute-process.js +104 -0
- package/src/internal/execute-process.js.map +1 -0
- package/src/internal/types.d.ts +4 -0
- package/src/internal/types.js +3 -0
- package/src/internal/types.js.map +1 -0
- package/src/internal/versions.d.ts +4 -0
- package/src/internal/versions.js +15 -0
- package/src/internal/versions.js.map +1 -0
- package/src/plugin/constants.d.ts +1 -0
- package/src/plugin/constants.js +5 -0
- package/src/plugin/constants.js.map +1 -0
- package/src/plugin/index.d.ts +2 -0
- package/src/plugin/index.js +6 -0
- package/src/plugin/index.js.map +1 -0
- package/src/plugin/plugin.d.ts +2 -0
- package/src/plugin/plugin.js +22 -0
- package/src/plugin/plugin.js.map +1 -0
- package/src/plugin/target/configuration-target.d.ts +7 -0
- package/src/plugin/target/configuration-target.js +18 -0
- package/src/plugin/target/configuration-target.js.map +1 -0
- package/src/plugin/target/constants.d.ts +1 -0
- package/src/plugin/target/constants.js +5 -0
- package/src/plugin/target/constants.js.map +1 -0
- package/src/plugin/target/executor-target.d.ts +6 -0
- package/src/plugin/target/executor-target.js +19 -0
- package/src/plugin/target/executor-target.js.map +1 -0
- package/src/plugin/target/targets.d.ts +6 -0
- package/src/plugin/target/targets.js +26 -0
- package/src/plugin/target/targets.js.map +1 -0
- package/src/plugin/types.d.ts +13 -0
- package/src/plugin/types.js +3 -0
- package/src/plugin/types.js.map +1 -0
- package/src/plugin/utils.d.ts +3 -0
- package/src/plugin/utils.js +27 -0
- package/src/plugin/utils.js.map +1 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeProcess = exports.ProcessError = exports.calcDuration = void 0;
|
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
|
5
|
+
function calcDuration(start, stop) {
|
|
6
|
+
return Math.round((stop ?? performance.now()) - start);
|
|
7
|
+
}
|
|
8
|
+
exports.calcDuration = calcDuration;
|
|
9
|
+
/**
|
|
10
|
+
* Error class for process errors.
|
|
11
|
+
* Contains additional information about the process result.
|
|
12
|
+
* @category Error
|
|
13
|
+
* @public
|
|
14
|
+
* @class
|
|
15
|
+
* @extends Error
|
|
16
|
+
* @example
|
|
17
|
+
* const result = await executeProcess({})
|
|
18
|
+
* .catch((error) => {
|
|
19
|
+
* if (error instanceof ProcessError) {
|
|
20
|
+
* console.error(error.code);
|
|
21
|
+
* console.error(error.stderr);
|
|
22
|
+
* console.error(error.stdout);
|
|
23
|
+
* }
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
class ProcessError extends Error {
|
|
28
|
+
code;
|
|
29
|
+
stderr;
|
|
30
|
+
stdout;
|
|
31
|
+
constructor(result) {
|
|
32
|
+
super(result.stderr);
|
|
33
|
+
this.code = result.code;
|
|
34
|
+
this.stderr = result.stderr;
|
|
35
|
+
this.stdout = result.stdout;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.ProcessError = ProcessError;
|
|
39
|
+
/**
|
|
40
|
+
* Executes a process and returns a promise with the result as `ProcessResult`.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
*
|
|
44
|
+
* // sync process execution
|
|
45
|
+
* const result = await executeProcess({
|
|
46
|
+
* command: 'node',
|
|
47
|
+
* args: ['--version']
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* console.info(result);
|
|
51
|
+
*
|
|
52
|
+
* // async process execution
|
|
53
|
+
* const result = await executeProcess({
|
|
54
|
+
* command: 'node',
|
|
55
|
+
* args: ['download-data.js'],
|
|
56
|
+
* observer: {
|
|
57
|
+
* onStdout: updateProgress,
|
|
58
|
+
* error: handleError,
|
|
59
|
+
* complete: cleanLogs,
|
|
60
|
+
* }
|
|
61
|
+
* });
|
|
62
|
+
*
|
|
63
|
+
* console.info(result);
|
|
64
|
+
*
|
|
65
|
+
* @param cfg - see {@link ProcessConfig}
|
|
66
|
+
*/
|
|
67
|
+
function executeProcess(cfg) {
|
|
68
|
+
const { observer, cwd, command, args, ignoreExitCode = false } = cfg;
|
|
69
|
+
const { onStdout, onError, onComplete } = observer ?? {};
|
|
70
|
+
const date = new Date().toISOString();
|
|
71
|
+
const start = performance.now();
|
|
72
|
+
return new Promise((resolve, reject) => {
|
|
73
|
+
// shell:true tells Windows to use shell command for spawning a child process
|
|
74
|
+
const process = (0, node_child_process_1.spawn)(command, args, { cwd, shell: true });
|
|
75
|
+
// eslint-disable-next-line functional/no-let
|
|
76
|
+
let stdout = '';
|
|
77
|
+
// eslint-disable-next-line functional/no-let
|
|
78
|
+
let stderr = '';
|
|
79
|
+
process.stdout.on('data', data => {
|
|
80
|
+
stdout += String(data);
|
|
81
|
+
onStdout?.(String(data));
|
|
82
|
+
});
|
|
83
|
+
process.stderr.on('data', data => {
|
|
84
|
+
stderr += String(data);
|
|
85
|
+
});
|
|
86
|
+
process.on('error', err => {
|
|
87
|
+
stderr += err.toString();
|
|
88
|
+
});
|
|
89
|
+
process.on('close', code => {
|
|
90
|
+
const timings = { date, duration: calcDuration(start) };
|
|
91
|
+
if (code === 0 || ignoreExitCode) {
|
|
92
|
+
onComplete?.();
|
|
93
|
+
resolve({ code, stdout, stderr, ...timings });
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
const errorMsg = new ProcessError({ code, stdout, stderr, ...timings });
|
|
97
|
+
onError?.(errorMsg);
|
|
98
|
+
reject(errorMsg);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
exports.executeProcess = executeProcess;
|
|
104
|
+
//# sourceMappingURL=execute-process.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute-process.js","sourceRoot":"","sources":["../../../../../packages/nx-plugin/src/internal/execute-process.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../packages/nx-plugin/src/internal/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cpCliVersion = exports.cpUtilsVersion = exports.cpModelVersion = exports.cpNxPluginVersion = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const workspaceRoot = (0, node_path_1.join)(__dirname, '../../');
|
|
7
|
+
const projectsFolder = (0, node_path_1.join)(__dirname, '../../../');
|
|
8
|
+
exports.cpNxPluginVersion = loadPackageJson(workspaceRoot).version;
|
|
9
|
+
exports.cpModelVersion = loadPackageJson((0, node_path_1.join)(projectsFolder, 'cli')).version;
|
|
10
|
+
exports.cpUtilsVersion = loadPackageJson((0, node_path_1.join)(projectsFolder, 'utils')).version;
|
|
11
|
+
exports.cpCliVersion = loadPackageJson((0, node_path_1.join)(projectsFolder, 'models')).version;
|
|
12
|
+
function loadPackageJson(folderPath) {
|
|
13
|
+
return (0, devkit_1.readJsonFile)((0, node_path_1.join)(folderPath, 'package.json'));
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=versions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../packages/nx-plugin/src/internal/versions.ts"],"names":[],"mappings":";;;AAAA,uCAA0C;AAC1C,yCAAiC;AAGjC,MAAM,aAAa,GAAG,IAAA,gBAAI,EAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAChD,MAAM,cAAc,GAAG,IAAA,gBAAI,EAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAEvC,QAAA,iBAAiB,GAAG,eAAe,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC;AAC3D,QAAA,cAAc,GAAG,eAAe,CAC3C,IAAA,gBAAI,EAAC,cAAc,EAAE,KAAK,CAAC,CAC5B,CAAC,OAAO,CAAC;AACG,QAAA,cAAc,GAAG,eAAe,CAC3C,IAAA,gBAAI,EAAC,cAAc,EAAE,OAAO,CAAC,CAC9B,CAAC,OAAO,CAAC;AACG,QAAA,YAAY,GAAG,eAAe,CACzC,IAAA,gBAAI,EAAC,cAAc,EAAE,QAAQ,CAAC,CAC/B,CAAC,OAAO,CAAC;AAEV,SAAS,eAAe,CAAC,UAAkB;IACzC,OAAO,IAAA,qBAAY,EAAc,IAAA,gBAAI,EAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CP_TARGET_NAME = "code-pushup";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../packages/nx-plugin/src/plugin/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG,aAAa,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createNodes = void 0;
|
|
4
|
+
var plugin_1 = require("./plugin");
|
|
5
|
+
Object.defineProperty(exports, "createNodes", { enumerable: true, get: function () { return plugin_1.createNodes; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/nx-plugin/src/plugin/index.ts"],"names":[],"mappings":";;;AAAA,mCAAuC;AAA9B,qGAAA,WAAW,OAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createNodes = void 0;
|
|
4
|
+
const constants_1 = require("../internal/constants");
|
|
5
|
+
const targets_1 = require("./target/targets");
|
|
6
|
+
const utils_1 = require("./utils");
|
|
7
|
+
// name has to be "createNodes" to get picked up by Nx
|
|
8
|
+
exports.createNodes = [
|
|
9
|
+
`**/${constants_1.PROJECT_JSON_FILE_NAME}`,
|
|
10
|
+
async (projectConfigurationFile, createNodesOptions, context) => {
|
|
11
|
+
const parsedCreateNodesOptions = createNodesOptions;
|
|
12
|
+
const normalizedContext = await (0, utils_1.normalizedCreateNodesContext)(context, projectConfigurationFile, parsedCreateNodesOptions);
|
|
13
|
+
return {
|
|
14
|
+
projects: {
|
|
15
|
+
[normalizedContext.projectRoot]: {
|
|
16
|
+
targets: await (0, targets_1.createTargets)(normalizedContext),
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../../../packages/nx-plugin/src/plugin/plugin.ts"],"names":[],"mappings":";;;AAEA,qDAA+D;AAC/D,8CAAiD;AAEjD,mCAAuD;AAEvD,sDAAsD;AACzC,QAAA,WAAW,GAAgB;IACtC,MAAM,kCAAsB,EAAE;IAC9B,KAAK,EACH,wBAAgC,EAChC,kBAA2B,EAC3B,OAA2B,EACC,EAAE;QAC9B,MAAM,wBAAwB,GAAG,kBAAwC,CAAC;QAC1E,MAAM,iBAAiB,GAAG,MAAM,IAAA,oCAA4B,EAC1D,OAAO,EACP,wBAAwB,EACxB,wBAAwB,CACzB,CAAC;QAEF,OAAO;YACL,QAAQ,EAAE;gBACR,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE;oBAC/B,OAAO,EAAE,MAAM,IAAA,uBAAa,EAAC,iBAAiB,CAAC;iBAChD;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TargetConfiguration } from '@nx/devkit';
|
|
2
|
+
import type { RunCommandsOptions } from 'nx/src/executors/run-commands/run-commands.impl';
|
|
3
|
+
export declare function createConfigurationTarget(options?: {
|
|
4
|
+
targetName?: string;
|
|
5
|
+
projectName?: string;
|
|
6
|
+
bin?: string;
|
|
7
|
+
}): TargetConfiguration<RunCommandsOptions>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createConfigurationTarget = void 0;
|
|
4
|
+
const cli_1 = require("../../executors/internal/cli");
|
|
5
|
+
const constants_1 = require("../../internal/constants");
|
|
6
|
+
const constants_2 = require("../constants");
|
|
7
|
+
function createConfigurationTarget(options) {
|
|
8
|
+
const { projectName, bin = constants_1.PACKAGE_NAME, targetName = constants_2.CP_TARGET_NAME, } = options ?? {};
|
|
9
|
+
return {
|
|
10
|
+
command: `nx g ${bin}:configuration ${(0, cli_1.objectToCliArgs)({
|
|
11
|
+
skipTarget: true,
|
|
12
|
+
targetName,
|
|
13
|
+
...(projectName ? { project: projectName } : {}),
|
|
14
|
+
}).join(' ')}`,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
exports.createConfigurationTarget = createConfigurationTarget;
|
|
18
|
+
//# sourceMappingURL=configuration-target.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration-target.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/plugin/target/configuration-target.ts"],"names":[],"mappings":";;;AAEA,sDAA+D;AAC/D,wDAAwD;AACxD,4CAA8C;AAE9C,SAAgB,yBAAyB,CAAC,OAIzC;IACC,MAAM,EACJ,WAAW,EACX,GAAG,GAAG,wBAAY,EAClB,UAAU,GAAG,0BAAc,GAC5B,GAAG,OAAO,IAAI,EAAE,CAAC;IAClB,OAAO;QACL,OAAO,EAAE,QAAQ,GAAG,kBAAkB,IAAA,qBAAe,EAAC;YACpD,UAAU,EAAE,IAAI;YAChB,UAAU;YACV,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACjD,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;KACf,CAAC;AACJ,CAAC;AAjBD,8DAiBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CODE_PUSHUP_CONFIG_REGEX: RegExp;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/plugin/target/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,wBAAwB,GACnC,4CAA4C,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createExecutorTarget = void 0;
|
|
4
|
+
const constants_1 = require("../../internal/constants");
|
|
5
|
+
function createExecutorTarget(options) {
|
|
6
|
+
const { bin = constants_1.PACKAGE_NAME, projectPrefix } = options ?? {};
|
|
7
|
+
return {
|
|
8
|
+
executor: `${bin}:autorun`,
|
|
9
|
+
...(projectPrefix
|
|
10
|
+
? {
|
|
11
|
+
options: {
|
|
12
|
+
projectPrefix,
|
|
13
|
+
},
|
|
14
|
+
}
|
|
15
|
+
: {}),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
exports.createExecutorTarget = createExecutorTarget;
|
|
19
|
+
//# sourceMappingURL=executor-target.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor-target.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/plugin/target/executor-target.ts"],"names":[],"mappings":";;;AACA,wDAAwD;AAGxD,SAAgB,oBAAoB,CAAC,OAGpC;IACC,MAAM,EAAE,GAAG,GAAG,wBAAY,EAAE,aAAa,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAC5D,OAAO;QACL,QAAQ,EAAE,GAAG,GAAG,UAAU;QAC1B,GAAG,CAAC,aAAa;YACf,CAAC,CAAC;gBACE,OAAO,EAAE;oBACP,aAAa;iBACd;aACF;YACH,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC;AAfD,oDAeC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { NormalizedCreateNodesContext } from '../types';
|
|
2
|
+
export declare function createTargets(normalizedContext: NormalizedCreateNodesContext): Promise<{
|
|
3
|
+
[x: string]: import("@nx/devkit").TargetConfiguration<import("../types").ProjectPrefixOptions>;
|
|
4
|
+
} | {
|
|
5
|
+
[x: string]: import("@nx/devkit").TargetConfiguration<import("nx/src/executors/run-commands/run-commands.impl").RunCommandsOptions>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTargets = void 0;
|
|
4
|
+
const promises_1 = require("node:fs/promises");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const configuration_target_1 = require("./configuration-target");
|
|
7
|
+
const constants_2 = require("./constants");
|
|
8
|
+
const executor_target_1 = require("./executor-target");
|
|
9
|
+
async function createTargets(normalizedContext) {
|
|
10
|
+
const { targetName = constants_1.CP_TARGET_NAME, bin, projectPrefix, } = normalizedContext.createOptions;
|
|
11
|
+
const rootFiles = await (0, promises_1.readdir)(normalizedContext.projectRoot);
|
|
12
|
+
return rootFiles.some(filename => filename.match(constants_2.CODE_PUSHUP_CONFIG_REGEX))
|
|
13
|
+
? {
|
|
14
|
+
[targetName]: (0, executor_target_1.createExecutorTarget)({ bin, projectPrefix }),
|
|
15
|
+
}
|
|
16
|
+
: // if NO code-pushup.config.*.(ts|js|mjs) is present return configuration target
|
|
17
|
+
{
|
|
18
|
+
[`${targetName}--configuration`]: (0, configuration_target_1.createConfigurationTarget)({
|
|
19
|
+
targetName,
|
|
20
|
+
projectName: normalizedContext.projectJson.name,
|
|
21
|
+
bin,
|
|
22
|
+
}),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
exports.createTargets = createTargets;
|
|
26
|
+
//# sourceMappingURL=targets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"targets.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/plugin/target/targets.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,4CAA8C;AAE9C,iEAAmE;AACnE,2CAAuD;AACvD,uDAAyD;AAElD,KAAK,UAAU,aAAa,CACjC,iBAA+C;IAE/C,MAAM,EACJ,UAAU,GAAG,0BAAc,EAC3B,GAAG,EACH,aAAa,GACd,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,oCAAwB,CAAC,CAAC;QACzE,CAAC,CAAC;YACE,CAAC,UAAU,CAAC,EAAE,IAAA,sCAAoB,EAAC,EAAE,GAAG,EAAE,aAAa,EAAE,CAAC;SAC3D;QACH,CAAC,CAAC,gFAAgF;YAChF;gBACE,CAAC,GAAG,UAAU,iBAAiB,CAAC,EAAE,IAAA,gDAAyB,EAAC;oBAC1D,UAAU;oBACV,WAAW,EAAE,iBAAiB,CAAC,WAAW,CAAC,IAAI;oBAC/C,GAAG;iBACJ,CAAC;aACH,CAAC;AACR,CAAC;AArBD,sCAqBC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CreateNodesContext, ProjectConfiguration } from '@nx/devkit';
|
|
2
|
+
import type { WithRequired } from '@code-pushup/utils';
|
|
3
|
+
import type { DynamicTargetOptions } from '../internal/types';
|
|
4
|
+
export type ProjectPrefixOptions = {
|
|
5
|
+
projectPrefix?: string;
|
|
6
|
+
};
|
|
7
|
+
export type CreateNodesOptions = DynamicTargetOptions & ProjectPrefixOptions;
|
|
8
|
+
export type ProjectConfigurationWithName = WithRequired<ProjectConfiguration, 'name'>;
|
|
9
|
+
export type NormalizedCreateNodesContext = CreateNodesContext & {
|
|
10
|
+
projectJson: ProjectConfigurationWithName;
|
|
11
|
+
projectRoot: string;
|
|
12
|
+
createOptions: CreateNodesOptions;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../packages/nx-plugin/src/plugin/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CreateNodesContext } from '@nx/devkit';
|
|
2
|
+
import type { CreateNodesOptions, NormalizedCreateNodesContext } from './types';
|
|
3
|
+
export declare function normalizedCreateNodesContext(context: CreateNodesContext, projectConfigurationFile: string, createOptions?: CreateNodesOptions): Promise<NormalizedCreateNodesContext>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizedCreateNodesContext = void 0;
|
|
4
|
+
const promises_1 = require("node:fs/promises");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const constants_1 = require("./constants");
|
|
7
|
+
async function normalizedCreateNodesContext(context, projectConfigurationFile, createOptions = {}) {
|
|
8
|
+
const projectRoot = (0, node_path_1.dirname)(projectConfigurationFile);
|
|
9
|
+
try {
|
|
10
|
+
const projectJson = JSON.parse((await (0, promises_1.readFile)(projectConfigurationFile)).toString());
|
|
11
|
+
const { targetName = constants_1.CP_TARGET_NAME } = createOptions;
|
|
12
|
+
return {
|
|
13
|
+
...context,
|
|
14
|
+
projectJson,
|
|
15
|
+
projectRoot,
|
|
16
|
+
createOptions: {
|
|
17
|
+
...createOptions,
|
|
18
|
+
targetName,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
throw new Error(`Error parsing project.json file ${projectConfigurationFile}.`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.normalizedCreateNodesContext = normalizedCreateNodesContext;
|
|
27
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../packages/nx-plugin/src/plugin/utils.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAC5C,yCAAoC;AACpC,2CAA6C;AAOtC,KAAK,UAAU,4BAA4B,CAChD,OAA2B,EAC3B,wBAAgC,EAChC,gBAAoC,EAAE;IAEtC,MAAM,WAAW,GAAG,IAAA,mBAAO,EAAC,wBAAwB,CAAC,CAAC;IAEtD,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC5B,CAAC,MAAM,IAAA,mBAAQ,EAAC,wBAAwB,CAAC,CAAC,CAAC,QAAQ,EAAE,CACtB,CAAC;QAElC,MAAM,EAAE,UAAU,GAAG,0BAAc,EAAE,GAAG,aAAa,CAAC;QACtD,OAAO;YACL,GAAG,OAAO;YACV,WAAW;YACX,WAAW;YACX,aAAa,EAAE;gBACb,GAAG,aAAa;gBAChB,UAAU;aACX;SACF,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,mCAAmC,wBAAwB,GAAG,CAC/D,CAAC;IACJ,CAAC;AACH,CAAC;AA3BD,oEA2BC"}
|