@salesforce/plugin-release-management
Version:
A plugin for preparing and publishing npm packages
28 lines • 1.46 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
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.retrieveKnownRepositories = void 0;
const got_1 = require("got");
const packAndSign_1 = require("./codeSigning/packAndSign");
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.
*/
const retrieveKnownRepositories = async () => {
const agent = packAndSign_1.api.getAgentForUri(KNOWN_REPOSITORIES_URL);
const response = await got_1.default.get(KNOWN_REPOSITORIES_URL, { 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);
});
};
exports.retrieveKnownRepositories = retrieveKnownRepositories;
//# sourceMappingURL=repositories.js.map