Skip to content

Commit

Permalink
Handle Windows when checking relative paths (elastic#16380) (elastic#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kimjoar authored Jan 30, 2018
1 parent 4903ab4 commit 3416f43
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 7 additions & 2 deletions packages/kbn-build/dist/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand Down Expand Up @@ -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 */
Expand Down
7 changes: 6 additions & 1 deletion packages/kbn-build/src/utils/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand Down Expand Up @@ -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, '/');
}

0 comments on commit 3416f43

Please sign in to comment.