Not compatible with latest NX
Hi @mirco.bartels,
I hope this message finds you well. I have recently joined the team at ENN (Ottobock) and we are working to migrate to the latest version of NX (16.7.4). Doing that I found this project to be used while linting. For which our thanks.
However, the current implementation is relying on a workspace.json-file to exist which has been deprecated for a while now and apparently is now fully unsupported. During the migrations (as provided by the nx migrate-tool) the workspace file was removed and as such can no longer be relied on. To resolve this I've adjusted the implementation using patch-package for the time being, but we would greatly appreciate it if a new release could be made with the necessary adjustments.
Unfortunately I could not open a Merge request on this project for your scrutiny (for good reason, I'm sure), so I'll leave a snippet here:
const nx = require('@nx/devkit');
const projects = nx.readCachedProjectGraph().nodes;
/**
* @returns {string} The output path of the code quality artifact.
*/
function getOutputPath() {
if (!NX_TASK_TARGET_PROJECT) {
throw new Error("Expected 'NX_TASK_TARGET_PROJECT' to be defined");
}
const project = projects?.[NX_TASK_TARGET_PROJECT];
if (!projects || Object.keys(projects).length < 1 || !project) {
throw new Error("Expected 'projects' to be defined");
}
const relateFilePath = project.data.root;
return resolve(
process.cwd(),
'tmp',
relateFilePath,
ESLINT_CODE_QUALITY_REPORT || 'gl-codequality.json',
);
}
I believe this is going to work, but have not had a chance to test it in our Pipelines just yet. Locally I tested it by adding a console.log that called getOutputPath. If you feel a different implementation would be more appropriate please don't hesitate to make any changes.
Any and all help would be much appreciated. Thank you in advance.