cdk8s-cli
Version:
This is the command line tool for Cloud Development Kit (CDK) for Kubernetes (cdk8s).
44 lines • 4.41 kB
JavaScript
/**
*
* github:crossplane/crossplane@0.14.0
* |--^- | ^ ^ ^ ^ ^
* | | | | | |
* - provider ----+ | | | | |
* - account -----------+ | | | |
* - repo ------------------------+ | | |
* - major ---------------------------------+ | |
* - minor -----------------------------------+ |
* - patch --------------------------------------+
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.matchCrdsDevUrl = void 0;
/**
* Matches a https://doc.crds.dev repo
*
* - url if found
* - undefined if not
*
* @param source
*/
function matchCrdsDevUrl(source) {
var _a;
const match = /^github:([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)(?:\@([0-9]+)\.([0-9]+)(?:\.([0-9]+))?)?$/.exec(source);
if (match) {
const account = match[1];
const repo = match[2];
const major = match[3];
//default to master if no version specified
//TODO: get latest released version from available versions
let url = `https://doc.crds.dev/raw/github.com/${account}/${repo}`;
if (major) {
const minor = match[4];
const patch = (_a = match[5]) !== null && _a !== void 0 ? _a : '0';
url = `https://doc.crds.dev/raw/github.com/${account}/${repo}@v${major}.${minor}.${patch}`;
}
return url;
}
return undefined;
}
exports.matchCrdsDevUrl = matchCrdsDevUrl;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3Jkcy1kZXYuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW1wb3J0L2NyZHMtZGV2LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7Ozs7R0FXRzs7O0FBRUg7Ozs7Ozs7R0FPRztBQUNILFNBQWdCLGVBQWUsQ0FBQyxNQUFjOztJQUM1QyxNQUFNLEtBQUssR0FBRyx1RkFBdUYsQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDbkgsSUFBSSxLQUFLLEVBQUU7UUFDVCxNQUFNLE9BQU8sR0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