Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(devkit): make devkit backwards compatible back to nx 14.1 #14854

Merged
merged 1 commit into from
Feb 9, 2023

Conversation

FrozenPandaz
Copy link
Collaborator

@FrozenPandaz FrozenPandaz commented Feb 7, 2023

Current Behavior

@nrwl/devkit is supposed to be backwards compatible back to Nx 14 but currently fails if you have something like.

> npm ls nx @nrwl/devkit
some-nx-plugin > @nrwl/devkit@15.6.3
nx@14.1.0

This makes it harder for plugin owners to maintain backwards compatibility for older versions of Nx while keeping up with the latest @nrwl/devkit

Expected Behavior

The following should always work.

> npm ls nx @nrwl/devkit
some-nx-plugin > @nrwl/devkit@latest
nx@previous

There's a nx/src/devkit-exports and nx/src/devkit-testing-exports file which exports things to devkit.

In v17, @nrwl/devkit will only import from nx using path. This will make the compatibility more robust in the future.

To facilitate this, when importing nx from @nrwl/devkit, we should use requireNx() until v17.

Related Issue(s)

Fixes #

@vercel
Copy link

vercel bot commented Feb 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
nx-dev ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 9, 2023 at 3:41PM (UTC)

@nx-cloud
Copy link

nx-cloud bot commented Feb 7, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 37994ea. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

dependencies: { '@angular/core': '~13.2.0' },
}));
jest.spyOn(nxFileutils, 'readJsonFile').mockImplementation((file) => {
console.log('HELLO?');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be removed?

"patterns": [
{
"group": ["nx/**/*"],
"message": "Use getNx() from packages/devkit/nx.ts OR use a type import instead.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"message": "Use getNx() from packages/devkit/nx.ts OR use a type import instead.",
"message": "Use requireNx() from packages/devkit/nx.ts OR use a type import instead.",

@github-actions
Copy link

github-actions bot commented Mar 3, 2023

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants