-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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(core): allow for non-js libs to be moved without errors or the creation of any unneeded tsconfig files #28350
base: master
Are you sure you want to change the base?
fix(core): allow for non-js libs to be moved without errors or the creation of any unneeded tsconfig files #28350
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 756614e. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution
✅ Successfully ran 5 targets
Sent with 💌 from NxCloud. |
Don't create a new scope. Use |
Oh! That's my bad. I'll undo the commitizen changes and amend my commit messages. |
1458b0b
to
a10cf17
Compare
@jaysoo can you take a look at this PR? |
@@ -148,8 +149,8 @@ export function updateImports( | |||
to: schema.relativeToRootDestination, | |||
}; | |||
|
|||
if (tsConfig) { | |||
const path = tsConfig.compilerOptions.paths[projectRef.from] as string[]; | |||
if (tsConfig && paths.length > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think moving writeJson(...)
into the if (tsConfig)
is enough to fix the issue.
Updating getRootTsConfigPathInTree
is fine since it's only used here and in the remove generator. But we should also change the check to tree.exists(tsConfigPath)
to account for null
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That thought did cross my mind, but I was worried about false positives. I'll remove the second clause all the same, though. I'll also go ahead and take a look at tree.exists(tsConfigPath)
so that it'll account for null
.
I also believe I can greatly clean up the code quite a bit, too, so that it scales far better. I just wanted to hold off on it in favor of getting these essential changes merged quickly first before with as few changes as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked into updating tree.exists(filePath)
to change its argument typing to string | null
directly without just adding on another if-operator clause.
From what I can tell, it would require touching 3 additional files (with starting line numbers):
packages/devkit/src/utils/invoke-nx-generator.ts:L131
packages/nx/src/generators/tree.ts:L62
e2e/utils/file-utils.ts:L111
The changes seem fairly straight forward, but since this effects a critical Nx component, I figured we could save it for a second PR that I can submit right after this one gets approved. If anything else, just to keep the PRs better focused.
With that said, I applied the necessary changes locally on my machine.
…eation of any unneeded tsconfig files closed nrwl#28349
756614e
to
30903de
Compare
Your CI Pipeline Execution ↗ for commit f094547 is in progress ⏳
☁️ Nx Cloud last updated this comment at |
Current Behavior
I have a project that is utilizing the
@nx-go/nx-go
extension that's used for supporting Go applications.When I attempt to use the
@nx/workspace:move
generator to move a Go library, it'll produce an error. (Please refer to the Failure Logs section for said error.)Sadly, there isn't a consistent means to get the bun to start showing up, but once it does, the issue will persist throughout the workspace's life cycle.
I was able to trace this to the compiled Javascript files within Nx's installed project files under the
node_modules
directory, which is where I found a workaround. That being to have thesecondaryEntryPointImportPaths
variable (located within theupdateImports
function) set with an empty array on the same line it's declared.However, this will produce a
tsconfig.base.json
file at the root of the workspace with the textundefined
contained within it and with no actual JSON to speak of.Expected Behavior
I have a project that is utilizing the
@nx-go/nx-go
extension that's used for supporting Go applications.The
@nx/workspace:move
schematic generator should be able to move libraries based in Go and other programming languages without any errors popping up.It should also do it without generating an empty
tsconfig.base.json
file if one didn't exist previously. This tends to be the case when there is no Typescript to speak of within the Nx workspace. For example, an Nx workspace initiated with the@nx-go/nx-go
preset.Related Issue(s)