Skip to content

Commit

Permalink
feat: Add dev branches for testing component documentation (#158)
Browse files Browse the repository at this point in the history
Co-authored-by: Maksim Sitnikov <[email protected]>
  • Loading branch information
imsitnikov and Maksim Sitnikov authored Dec 25, 2023
1 parent 016ee2f commit 2960c4d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ npm run start
# .env file

GITHUB_PROFILE="your profile" # default gravity-ui, target profile for pulling documentation from components

# Dev branches for testing component documentation
DEV_BRANCH_UIKIT="dev-branch-name"
DEV_BRANCH_COMPONENTS="dev-branch-name"
DEV_BRANCH_DATE_COMPONENTS="dev-branch-name"
```
9 changes: 5 additions & 4 deletions src/content/components/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import {Repos} from '../../types/common';
const githubTargetProfile = process.env.GITHUB_PROFILE || TARGET_PROFILE;

const TARGET_REPOS_VERSIONS = {
[Repos.Uikit]: packagesVersions[Repos.Uikit],
[Repos.Components]: packagesVersions[Repos.Components],
// [Repos.DateComponents]: packagesVersions['@gravity-ui/date-components'],
[Repos.Uikit]: process.env.DEV_BRANCH_UIKIT || `v${packagesVersions[Repos.Uikit]}`,
[Repos.Components]:
process.env.DEV_BRANCH_COMPONENTS || `v${packagesVersions[Repos.Components]}`,
// [Repos.DateComponents]: process.env.DEV_BRANCH_DATE_COMPONENTS || `v${packagesVersions['@gravity-ui/date-components']}`,
};

export type GetterProps = {componentName: string; repoName: Repos};
Expand All @@ -21,7 +22,7 @@ export const mappingOptions = (arr: string[]) =>
}));

export const getReadmeUrl: RepoInfoGetterFunc = ({componentName, repoName}) =>
`https://raw.githubusercontent.com/${githubTargetProfile}/${repoName}/v${TARGET_REPOS_VERSIONS[repoName]}/src/components/${componentName}/README.md`;
`https://raw.githubusercontent.com/${githubTargetProfile}/${repoName}/${TARGET_REPOS_VERSIONS[repoName]}/src/components/${componentName}/README.md`;

export const getGithubUrl: RepoInfoGetterFunc = ({componentName, repoName}) =>
`https://github.com/${githubTargetProfile}/${repoName}/tree/main/src/components/${componentName}`;

0 comments on commit 2960c4d

Please sign in to comment.