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(misc): fix moving projects with standalone configuration #6521
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import { | ||
addProjectConfiguration, | ||
isStandaloneProject, | ||
NxJsonProjectConfiguration, | ||
ProjectConfiguration, | ||
removeProjectConfiguration, | ||
|
@@ -12,6 +13,7 @@ export function moveProjectConfiguration( | |
schema: NormalizedSchema, | ||
projectConfig: ProjectConfiguration & NxJsonProjectConfiguration | ||
) { | ||
const isStandalone = isStandaloneProject(tree, schema.projectName); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use It should work in this case because the current move logic already moves the From what I saw, this could also be solved somewhat hackily by moving There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That wouldn't be right for a couple of reasons:
The need here is to know if the project being moved is configured as standalone or not, that doesn't match what There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah okay, I see |
||
const projectString = JSON.stringify(projectConfig); | ||
const newProjectString = projectString.replace( | ||
new RegExp(projectConfig.root, 'g'), | ||
|
@@ -25,5 +27,10 @@ export function moveProjectConfiguration( | |
removeProjectConfiguration(tree, schema.projectName); | ||
|
||
// Create a new project with the root replaced | ||
addProjectConfiguration(tree, schema.newProjectName, newProject); | ||
addProjectConfiguration( | ||
tree, | ||
schema.newProjectName, | ||
newProject, | ||
isStandalone | ||
); | ||
} |
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 remove this and use
getWorkspaceLayout(host).standaloneAsDefault
instead?