-
Notifications
You must be signed in to change notification settings - Fork 214
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
feat: Nested projects #1338
feat: Nested projects #1338
Conversation
… in the repository
# Conflicts: # libs/vscode/nx-project-view/src/lib/nx-project-tree-provider.ts
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 18bb367. 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 3 targetsSent with 💌 from NxCloud. |
Thanks for the PR @rickvandermey! I've been testing it, and it appears that there's some weird artifacts that show up in the Nx Examples repo Notice the |
That was the note i added, the workspace project key isnt the same as the folder name but because upcoming week i do not have a lot of spare time, I wanted to give you something to review, and maybe co-develop this feature |
Ok, I'll reveiw it again once you add that fix in. We shouldn't have to make users change their config to show things in Nx Console. I'm fine with just hiding the project/child nodes if it doesnt match the path. |
@Cammisuli I've updated the PR with working folder structure with tasks |
|
||
export class NxProjectTreeHelper { | ||
|
||
static async getProjectsInFolders(projects: [string, ProjectConfiguration][]): Promise<Record<string,any>> { |
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.
Can we add a proper return type rather than any
?
splittedProject.reduce((r: {[key: string]: string;} & any, e: string, i: number) => { | ||
if (splittedProject.length -1 > i) { | ||
return r[e] || (r[e] = {}); | ||
} | ||
return r[e] || (r[e] = project) | ||
}, projectsObject) |
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.
This was a bit too confusing because of the variable names, and the modifying nested properties of the projectObject property. I feel like this (or something close to it) would make this a little more readable:
splittedProject.reduce((r: {[key: string]: string;} & any, e: string, i: number) => { | |
if (splittedProject.length -1 > i) { | |
return r[e] || (r[e] = {}); | |
} | |
return r[e] || (r[e] = project) | |
}, projectsObject) | |
for (const [index, pathNode] of splittedProject.entries()) { | |
if (splittedProject.length - 1 > index) { | |
projectsObject[pathNode] ??= {}; | |
continue; | |
} | |
projectsObject[pathNode] ??= project; | |
} |
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.
This was a bit too confusing because of the variable names, and the modifying nested properties of the projectObject property. I feel like this (or something close to it) would make this a little more readable:
I've tried implementing your code snippet, but it doesn't compile, so i've added functional naming for the parameters.
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.
the variable names were one part of the confusion, but it's still modifying a nested object. There's a bunch of redirection happening with the nested object
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.
… functional naming in helper
return projectsObject; | ||
} | ||
|
||
static async findNestedObject(fields: any, key: string): Promise<any> { |
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 was hoping that with the change of the type in the previous function, that you would remove the any
types from here as well 😅
Please make sure all new code are properly typed please 🙂
linked to #1181
at the moment its only possible when the folder has the same name as the lib/app. maybe should go deeper into that to fix that as well