Skip to content

Commit

Permalink
feat(yarn): Support yarn hoisted packages in a workspace context
Browse files Browse the repository at this point in the history
  • Loading branch information
easadev committed Jun 6, 2019
1 parent bb75dbb commit 019a051
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/services/plugins-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class PluginsService implements IPluginsService {
}

const name = (await this.$packageManager.install(plugin, projectData.projectDir, this.npmInstallOptions)).name;
const pathToRealNpmPackageJson = path.join(projectData.projectDir, "node_modules", name, "package.json");
const pathToRealNpmPackageJson = this.getPackageJsonFilePathForModule(name, projectData.projectDir);
const realNpmPackageJson = this.$fs.readJson(pathToRealNpmPackageJson);

if (realNpmPackageJson.nativescript) {
Expand Down Expand Up @@ -228,7 +228,10 @@ export class PluginsService implements IPluginsService {
}

private getPackageJsonFilePathForModule(moduleName: string, projectDir: string): string {
return path.join(this.getNodeModulesPath(projectDir), moduleName, "package.json");
const pathToJsonFile = require.resolve(`${moduleName}/package.json`, {
paths: [projectDir]
});
return pathToJsonFile;
}

private getDependencies(projectDir: string): string[] {
Expand Down

0 comments on commit 019a051

Please sign in to comment.