Handle Windows when checking relative paths (#16380)

This commit is contained in:
Kim Joar Bekkelund 2018-01-30 12:44:37 +01:00 committed by GitHub
parent 232b267510
commit 2fd058876c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View file

@ -23514,7 +23514,7 @@ class Project {
}
ensureValidProjectDependency(project) {
const relativePathToProject = _path2.default.relative(this.path, project.path);
const relativePathToProject = normalizePath(_path2.default.relative(this.path, project.path));
const versionInPackageJson = this.allDependencies[project.name];
const expectedVersionInPackageJson = `${PREFIX}${relativePathToProject}`;
@ -23554,7 +23554,12 @@ class Project {
return (0, _scripts.installInDir)(this.path, extraArgs);
}
}
exports.Project = Project;
exports.Project = Project; // We normalize all path separators to `/` in generated files
function normalizePath(path) {
return path.replace(/[\\\/]+/g, '/');
}
/***/ }),
/* 175 */

View file

@ -34,7 +34,7 @@ export class Project {
}
ensureValidProjectDependency(project) {
const relativePathToProject = path.relative(this.path, project.path);
const relativePathToProject = normalizePath(path.relative(this.path, project.path));
const versionInPackageJson = this.allDependencies[project.name];
const expectedVersionInPackageJson = `${PREFIX}${relativePathToProject}`;
@ -88,3 +88,8 @@ export class Project {
return installInDir(this.path, extraArgs);
}
}
// We normalize all path separators to `/` in generated files
function normalizePath(path) {
return path.replace(/[\\\/]+/g, '/');
}