@salesforce/plugin-release-management
Version:
A plugin for preparing and publishing npm packages
24 lines • 1.26 kB
JavaScript
/*
* Copyright (c) 2020, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import got from 'got';
import { api } from './codeSigning/packAndSign.js';
const KNOWN_REPOSITORIES_URL = 'https://raw.githubusercontent.com/salesforcecli/status/main/repositories.json';
const PACKAGE_REGISTRY_BASE_URL = 'https://www.npmjs.com/package';
/**
* Get a list of known tooling repositories that include Salesforce CLI plugins, libraries, and orbs.
*/
export const retrieveKnownRepositories = async () => {
const agent = api.getAgentForUri(KNOWN_REPOSITORIES_URL);
const response = await got.get(KNOWN_REPOSITORIES_URL, agent ? { agent } : {});
const repositories = JSON.parse(response.body);
return repositories.map((repository) => {
const [, organization, name] = /https:\/\/github.com\/([\w_-]+)\/([\w_-]+)/.exec(repository.url) ?? [];
const packages = repository.packages.map((pkg) => Object.assign(pkg, { url: `${PACKAGE_REGISTRY_BASE_URL}/${pkg.name}` }));
return Object.assign({ organization, name, packages }, repository);
});
};
//# sourceMappingURL=repositories.js.map