marcj/typedoc-plugin-lerna-packages

Package fails to find package on Windows

Closed this issue · 4 comments

const findLernaPackageForChildOriginalName = (path: string): string => {

Logging out the variables reveals the problem.

for (const i in this.lernaPackages) {
  if (!this.lernaPackages.hasOwnProperty(i))
    continue;
  console.log(i);
  const packagePath = path_1.join(cwd, this.lernaPackages[i]) + '/';
  console.log("packagePath:", packagePath);
  console.log("path:", path);
  if (-1 !== (path + '/').indexOf(packagePath)) {
  console.log("fit", fit);
  if (i.length > fit.length) {
    fit = i;
  }
}
@as-pect/cli
packagePath: C:\Users\jtenner\Desktop\projects\as-pect\packages\cli/
path: C:/Users/jtenner/Desktop/projects/as-pect/packages/cli/src/help.ts
@as-pect/core
packagePath: C:\Users\jtenner\Desktop\projects\as-pect\packages\core/
path: C:/Users/jtenner/Desktop/projects/as-pect/packages/cli/src/help.ts

As you can see, the strings aren't normalized for windows users. This can be fixed by simply calling path.normalize() on the packagePath and the path object.

Would you like me to submit a pull request?

marcj commented

Yes, absolutely :)

@marcj It looks like there is already a pull request for this change... but it hasn't been touched in a month. My change updates a few package dependencies too.

marcj commented

Oh I see, hehe. What dependencies would you like to update and why?

I was mistaken on the package updates. Thanks for the quick fix!