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

[rush-migrate-subspace-plugin] Fix remove project from rush.json #28

Merged
merged 2 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "rush-migrate-subspace-plugin",
"comment": "Fixes rush.json removing project",
"type": "patch"
}
],
"packageName": "rush-migrate-subspace-plugin"
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
{
"parameterKind": "flag",
"longName": "--debug",
"longName": "--debug-logs",
"description": "Provide debug logs",
"associatedCommands": ["migrate-subspace"]
},
Expand Down
6 changes: 3 additions & 3 deletions rush-plugins/rush-migrate-subspace-plugin/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ program
.option('--sync', 'to sync the versions in a subspace')
.option('--move', 'to move projects to a new subspace')
.option('--clean', 'to reduce subspace alternative versions')
.option('--debug', 'to provide debug logs')
.description('Example: rush migrate-subspace [--move] [--sync] [--debug] [--clean]')
.action(async ({ sync, debug, move, clean }) => {
.option('--debug-logs', 'to provide debug logs')
.description('Example: rush migrate-subspace [--move] [--sync] [--debug-logs] [--clean]')
.action(async ({ sync, debugLogs: debug, move, clean }) => {
const packageJson: IPackageJson = JsonFile.load(`${path.resolve(__dirname, '../package.json')}`);

Console.enableDebug(debug);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export const addProjectToSubspace = async (
);

let targetProjectFolderPath: string | undefined = `${targetMonorepoPath}/${sourceProject.projectFolder}`;
if (isExternalMonorepo(sourceMonorepoPath, targetMonorepoPath) || (await moveProjectPrompt())) {
const isExternal: boolean = isExternalMonorepo(sourceMonorepoPath, targetMonorepoPath);
if (isExternal || (await moveProjectPrompt())) {
const sourceProjectFolderPath: string = `${sourceMonorepoPath}/${sourceProject.projectFolder}`;
targetProjectFolderPath = await moveProjectToSubspaceFolder(
sourceProjectFolderPath,
Expand All @@ -106,7 +107,10 @@ export const addProjectToSubspace = async (
}

addProjectToRushConfiguration(sourceProject, targetSubspace, targetProjectFolderPath, targetMonorepoPath);
removeProjectFromRushConfiguration(sourceProject, sourceMonorepoPath);
if (isExternal) {
removeProjectFromRushConfiguration(sourceProject, sourceMonorepoPath);
}

if (sourceProject.subspaceName) {
refreshSubspace(sourceProject.subspaceName, sourceMonorepoPath);
}
Expand Down