Skip to content

Commit

Permalink
fix(plugins): parse name issue with invalid plugins (#5770)
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanWalker committed Feb 2, 2024
1 parent e3ef37d commit f826248
Showing 1 changed file with 24 additions and 17 deletions.
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

0 comments on commit f826248

Please sign in to comment.