more api cleanup

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2022-08-18 14:11:45 +02:00
parent e195112c5c
commit 3f739be9d9
88 changed files with 358 additions and 594 deletions
@@ -17,7 +17,6 @@
import React from 'react';
import { makeStyles } from '@material-ui/core';
import { TEST_IDS } from '../test-helpers/test-ids';
import { InfoCard } from '@backstage/core-components';
const useStyles = makeStyles(() => ({
@@ -26,7 +25,8 @@ const useStyles = makeStyles(() => ({
},
}));
export const InfoCardPlus = ({ children }: { children?: React.ReactNode }) => {
/** @public */
export const InfoCardPlus = (props: { children?: React.ReactNode }) => {
const classes = useStyles();
return (
@@ -34,7 +34,7 @@ export const InfoCardPlus = ({ children }: { children?: React.ReactNode }) => {
style={{ position: 'relative' }}
data-testid={TEST_IDS.info.infoFeaturePlus}
>
<InfoCard className={classes.feature}>{children}</InfoCard>
<InfoCard className={classes.feature}>{props.children}</InfoCard>
</div>
);
};
@@ -28,16 +28,15 @@ import { SemverTagParts } from './tagParts/getSemverTagParts';
*
* For semantic versioning this means either a minor or a patch bump
* depending on the value of `bumpLevel`
*
* @public
*/
export function getBumpedTag({
project,
tag,
bumpLevel,
}: {
export function getBumpedTag(options: {
project: Project;
tag: string;
bumpLevel: keyof typeof SEMVER_PARTS;
}) {
const { project, tag, bumpLevel } = options;
const tagParts = getTagParts({ project, tag });
if (tagParts.error !== undefined) {
@@ -53,6 +52,7 @@ export function getBumpedTag({
return getBumpedSemverTag(tagParts.tagParts, bumpLevel);
}
/** @public */
function getPatchedCalverTag(tagParts: CalverTagParts) {
const bumpedTagParts: CalverTagParts = {
...tagParts,
@@ -67,6 +67,7 @@ function getPatchedCalverTag(tagParts: CalverTagParts) {
};
}
/** @public */
function getBumpedSemverTag(
tagParts: SemverTagParts,
semverBumpLevel: keyof typeof SEMVER_PARTS,
@@ -85,6 +86,8 @@ function getBumpedSemverTag(
/**
* Calculates the next semantic version, taking into account
* whether or not it's a minor or patch
*
* @public
*/
export function getBumpedSemverTagParts(
tagParts: SemverTagParts,
@@ -21,17 +21,13 @@ import { Project } from '../../contexts/ProjectContext';
/**
* Tag parts are the individual parts of a version, e.g. <major>.<minor>.<patch>
* are the parts of a semantic version
*
* @public
*/
export function getTagParts({
project,
tag,
}: {
project: Project;
tag: string;
}) {
if (project.versioningStrategy === 'calver') {
return getCalverTagParts(tag);
export function getTagParts(options: { project: Project; tag: string }) {
if (options.project.versioningStrategy === 'calver') {
return getCalverTagParts(options.tag);
}
return getSemverTagParts(tag);
return getSemverTagParts(options.tag);
}
@@ -18,13 +18,13 @@ import { getCalverTagParts } from './getCalverTagParts';
import { getSemverTagParts } from './getSemverTagParts';
import { Project } from '../../contexts/ProjectContext';
export const validateTagName = ({
project,
tagName,
}: {
/** @public */
export const validateTagName = (options: {
project: Project;
tagName?: string;
}) => {
const { project, tagName } = options;
if (!tagName) {
return {
tagNameError: null,
@@ -33,7 +33,6 @@ export const validateTagName = ({
if (project.versioningStrategy === 'calver') {
const { error } = getCalverTagParts(tagName);
return {
tagNameError: error,
};