Skip to content

feat(yarn): yarn support for workspaces #4668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: this code will work with Node.js 8.9 or later.

});
return pathToJsonFile;
}

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