[nx] autocomplete doesn't work properly anymore
overbit opened this issue · comments
Sanity checks
- My issue relates to a specific CLI completion spec (e.g.
git checkout
is missing options ingit
completion spec). If your issue is more general, please create your issue here: withfig/fig - I have searched github.com/withfig/autocomplete/issues and there are no duplicates of my issue
- I would like to work on this.
What CLI tool does this relate to?
nx
Which statement makes the most sense?
This completion spec isn't complete
Issue Details
Since #1915 the nx
autocomplete doesn't prompt commands shown in the documentation anymore (https://fig.io/manual/nx).
The most annoying miss is, of course the nx serve
.
I'm looking into this.
I have reverted the PR so this should be fixed while I understand what is the issue.
@overbit what version of nx are you using?
15.4.5
"@nrwl/cypress": "15.4.5",
"@nrwl/devkit": "^15.4.5",
"@nrwl/eslint-plugin-nx": "15.4.5",
"@nrwl/express": "15.4.5",
"@nrwl/jest": "15.4.5",
"@nrwl/js": "15.4.5",
"@nrwl/linter": "15.4.5",
"@nrwl/nest": "15.4.5",
"@nrwl/node": "15.4.5",
"@nrwl/nx-cloud": "15.0.3",
"@nrwl/react": "15.4.5",
"@nrwl/storybook": "15.4.5",
"@nrwl/web": "15.4.5",
"@nrwl/webpack": "15.4.5",
"@nrwl/workspace": "15.4.5",
You said you reverted it but I can I get the latest version? fig update
returns that I'm running the latest. @fedeci
Sorry to drop in but the CLI documentation of NX is here: https://nx.dev/reference/commands#nx-cli-commands
The https://fig.io/manual/nx is some internal fig documentation that have not been updated.
Can you say what commands are missing? Because I removed all deprecated ones and wonder if I messed something up.
@fedeci it would be great if we had a chat before this was reverted. Because right now there are a few guys that are wonder why the autocomplete for nx is again so poor.
Just saw... the nx serve
you are missing is implemented with the run-derived-subcommands like the nx build
is created the same way that you can see in your screenshot: (
Line 689 in 3b85e1a
For this you must know how the nx run
command works and what that run-derived-subcommands are.
Every time you are using nx serve something
the nx cli is executing nx run something:serve:configuration
.
The only thing I noticed is that you are executing the nx command with npx nx
but this should also work to give you a list with all projects.
@fedeci sorry to speak out this way but the screenshot has exactly zero value, because it is alphabetical and you can scroll into it what you can't see here... also I am sure that if @overbit did put in npx nx s
that the serve command would have been there. So I completely can not understand the decision of reverting.
@fedeci the serve command is only visible when there is at least one project that has this target. Basically every app has this command. If you type nx outside a nx-repo there will be no serve because there is no project.json to check and fill up the projects, targets and configurations.
@ikosta Got it, I was testing it like that. However in my repro I do not have apps
or libs
but I do have packages
and preProcessProjects
is not working correctly.
@fedeci can you provide me a repo to check that
I am correcting it and pushing to main, I am adding you as co-author for the PR @ikosta, so that you get credit for the commits.
@fedeci can you provide me a repo to check that
npx create-nx-workspace@latest myorg --preset=ts
does the work
I am correcting it and pushing to main, I am adding you as co-author for the PR @ikosta, so that you get credit for the commits.
I don't care about getting credit. Just want to have it next level autocomplete 😝
@fedeci can you provide me a repo to check that
npx create-nx-workspace@latest myorg --preset=ts
does the work
ok... that's a new release with nx 16... let ne check what happens there
libs
and apps
dirs are stored in the nx.json
so we can retrieve them easily.
for nx@16 yes... but nx@15 does not have this entries
7d025b3#diff-83d1c6cef9dc94f9a457149936c4e9c181d469a70dc00263c101121da800700dR129-R140
We fallback to apps
and libs
for previous versions. I can assume @overbit was wrong, but we still got a future issue.
7d025b3#diff-83d1c6cef9dc94f9a457149936c4e9c181d469a70dc00263c101121da800700dR129-R140
We fallback to
apps
andlibs
for previous versions. I can assume @overbit was wrong, but we still got a future issue.
Yes... since nx@16. Thanks for fixing that. maybe we should abort the find for project.json's if there is no nx.json
in the execution directory... this would fix an issue when having plenty nx-repos and execute the nx-autocomplete on the ../
directory... would load all project.json's from all repos right now.
I will fix that next week and open a PR... thanks @fedeci
@ikosta is it doing that rn? When nx.json
is missing cat nx.json
is non-zero and executeShellCommand
rejects so the directory lookup should occurr.
Yeah... you fixed that by accident 😉
Hi guys, since amplication is opensource, you can validate yourself the autocomplete here https://github.com/amplication/amplication.
Right now, the autocomplete is much worst than before since only few projects are shown (before all the projects wehere displayed)
screen-recording-2023-05-16-at-104901_4ausLbI8.mp4
@fedeci sorry to speak out this way but the screenshot has exactly zero value, because it is alphabetical and you can scroll into it what you can't see here... also I am sure that if @overbit did put in
npx nx s
that the serve command would have been there. So I completely can not understand the decision of reverting.
As shown in the video, putting npx nx s
won't open the serve suggestion..
@ikosta @fedeci
npx nx affected:apps
& npx nx affected:libs
-> deprecated -> not implemented in the new version. use npx nx print-affected
instead
The repo you provided is in nx@15.4 and has a workspace.json
and alsoproject.json
's in the libs
and packages
directories. Since the workspace.json
is not needed this is a misconfiguration on your end. Also the base directories are libs
and apps
and there is a property workspaceLayout
in the nx.json
where you can change that.
Overall you use deprecated commands and the repo has a misconfiguration.
ok... you have that configured
let me check where the error is
ok... found the error... sorry you have all correct configured
@overbit you can maybe hot fix that till the PR is released by adding the misspelled appDir
in the workspaceLayout
.
Nice finding!