fix(misc): cli - case in drive letters - windows (#15643)

This commit is contained in:
tko39 2023-03-14 21:08:41 +02:00 committed by GitHub
parent 8e838b5aac
commit 87a6b3054e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -163,6 +163,14 @@ export function calculateDefaultProjectName(
projectsConfigurations: ProjectsConfigurations,
nxJsonConfiguration: NxJsonConfiguration
) {
if (cwd && /^[A-Z]:/.test(cwd)) {
cwd = cwd.charAt(0).toLowerCase() + cwd.slice(1);
}
if (root && /^[A-Z]:/.test(root)) {
root = root.charAt(0).toLowerCase() + root.slice(1);
}
let relativeCwd = cwd.replace(/\\/g, '/').split(root.replace(/\\/g, '/'))[1];
relativeCwd = relativeCwd.startsWith('/')