Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add dev branches for testing component documentation #158

Merged
merged 1 commit into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}`;
Loading