Skip to content

fix(plugins): parse name issue with invalid plugins #5770

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
merged 1 commit into from
Feb 2, 2024
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
41 changes: 24 additions & 17 deletions lib/services/plugins-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -623,25 +623,32 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
cacheData: IDependencyData | INodeModuleData,
projectDir: string
): IPluginData {
const pluginData: any = {};
pluginData.name = cacheData.name;
pluginData.version = cacheData.version;
pluginData.fullPath =
(<IDependencyData>cacheData).directory ||
path.dirname(
this.getPackageJsonFilePathForModule(cacheData.name, projectDir)
try {
const pluginData: any = {};
pluginData.name = cacheData.name;
pluginData.version = cacheData.version;
pluginData.fullPath =
(<IDependencyData>cacheData).directory ||
path.dirname(
this.getPackageJsonFilePathForModule(cacheData.name, projectDir)
);
pluginData.isPlugin = !!cacheData.nativescript;
pluginData.pluginPlatformsFolderPath = (platform: string) =>
path.join(pluginData.fullPath, "platforms", platform.toLowerCase());
const data = cacheData.nativescript;

if (pluginData.isPlugin) {
pluginData.platformsData = data.platforms;
pluginData.pluginVariables = data.variables;
}
} catch (err) {
this.$logger.trace(
"NOTE: There appears to be a problem with this dependency:",
cacheData.name
);
pluginData.isPlugin = !!cacheData.nativescript;
pluginData.pluginPlatformsFolderPath = (platform: string) =>
path.join(pluginData.fullPath, "platforms", platform.toLowerCase());
const data = cacheData.nativescript;

if (pluginData.isPlugin) {
pluginData.platformsData = data.platforms;
pluginData.pluginVariables = data.variables;
this.$logger.trace(err);
return null;
}

return pluginData;
}

private removeDependencyFromPackageJsonContent(
Expand Down