Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 7 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
2 changes: 2 additions & 0 deletions extensions/packageManager/src/node/feeds/npm/npmFeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ export class NpmFeed implements IFeed {
url = `${url}&from=${query.skip}`;
}

url = `${url}&popularity=1.0`;

return url;
}
}
2 changes: 2 additions & 0 deletions extensions/packageManager/src/node/feeds/nuget/nugetFeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ export class NuGetFeed implements IFeed {
}

const searchResult = httpResponse.data as INuGetSearchResult;
// sort these results by total downloads
searchResult.data = searchResult.data.sort((a, b) => b.totalDownloads - a.totalDownloads);
if (searchResult.data) {
return this.asPackageDefinition(searchResult);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface INuGetPackage {
versions: INuGetVersion[];
tags?: string | string[];
projectUrl?: string;
totalDownloads: number;
}

/**
Expand Down
41 changes: 6 additions & 35 deletions extensions/packageManager/src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,8 @@ import { FeedFactory } from './feeds/feedFactory';

const API_ROOT = '/api';

const hasSchema = (c) => {
// NOTE: A special case for orchestrator is included here because it does not directly include the schema
// the schema for orchestrator is in a dependent package
// additionally, our schemamerge command only returns the top level components found, even though
// it does properly discover and include the schema from this dependent package.
// without this special case, composer does not see orchestrator as being installed even though it is.
// in the future this should be resolved in the schemamerger library by causing the includesSchema property to be passed up to all parent libraries
return c.includesSchema || c.name.toLowerCase() === 'microsoft.bot.components.orchestrator';
};

const isAdaptiveComponent = (c) => {
return hasSchema(c) || c.includesExports;
return c.includesSchema || c.keywords?.indexOf('msbot-component') >= 0 || c.includesExports;
Comment thread
benbrown marked this conversation as resolved.
Outdated
};

const readFileAsync = async (path, encoding) => {
Expand Down Expand Up @@ -110,18 +100,6 @@ export default async (composer: IExtensionRegistration): Promise<void> => {
text: formatMessage('nuget'),
url: 'https://api.nuget.org/v3/index.json',
readonly: true,
defaultQuery: {
prerelease: true,
semVerLevel: '2.0.0',
query: `microsoft.bot.components+tags:${botComponentTag}`,
},
type: PackageSourceType.NuGet,
},
{
key: 'nuget-community',
text: formatMessage('community packages'),
url: 'https://api.nuget.org/v3/index.json',
readonly: true,
defaultQuery: {
prerelease: true,
semVerLevel: '2.0.0',
Expand All @@ -134,17 +112,6 @@ export default async (composer: IExtensionRegistration): Promise<void> => {
text: formatMessage('npm'),
url: `https://registry.npmjs.org/-/v1/search`,
readonly: true,
defaultQuery: {
prerelease: true,
query: `keywords:${botComponentTag}+scope:microsoft`,
},
type: PackageSourceType.NPM,
},
{
key: 'npm-community',
text: formatMessage('JS community packages'),
url: `https://registry.npmjs.org/-/v1/search`,
readonly: true,
defaultQuery: {
prerelease: true,
query: `keywords:${botComponentTag}`,
Expand Down Expand Up @@ -227,6 +194,8 @@ export default async (composer: IExtensionRegistration): Promise<void> => {

composer.log('GETTING FEED', packageSource, packageSource.defaultQuery);

// set default page size to 100
packageSource.defaultQuery.take = 100;
const packages = await feed.getPackages(packageSource.defaultQuery);

if (Array.isArray(packages)) {
Expand Down Expand Up @@ -399,7 +368,9 @@ export default async (composer: IExtensionRegistration): Promise<void> => {
}

// update the settings.components array
const newlyInstalledPlugin = installedComponents.find((c) => hasSchema(c) && c.name == packageName);
const newlyInstalledPlugin = installedComponents.find(
(c) => isAdaptiveComponent(c) && c.name == packageName
);
if (
newlyInstalledPlugin &&
!currentProject.settings.runtimeSettings?.components?.find((p) => p.name === newlyInstalledPlugin.name)
Expand Down
16 changes: 9 additions & 7 deletions extensions/packageManager/src/pages/Library.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,6 @@ const Library: React.FC = () => {

updateInstalledComponents(results.data.components);
} else {
telemetryClient.track('PackageUninstallFailed', { package: selectedItem.name });

throw new Error(results.data.message);
}

Expand All @@ -526,11 +524,15 @@ const Library: React.FC = () => {
} catch (err) {
telemetryClient.track('PackageUninstallFailed', { package: selectedItem.name });

setApplicationLevelError({
status: err.response.status,
message: err.response && err.response.data.message ? err.response.data.message : err,
summary: strings.importError,
});
if (err.response) {
setApplicationLevelError({
status: err.response.status,
message: err.response && err.response.data.message ? err.response.data.message : err,
summary: strings.importError,
});
} else {
setApplicationLevelError(err);
}
}
setWorking('');
}
Expand Down