mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: branch naming
This commit is contained in:
1 parent
a06fc87009
commit
adf00a0bbd
4 files changed
+26
-14
No files matched your search
@@ -1,11 +1,11 @@
|
|||||||
---
|
---
|
||||||
import { imgur } from '@blitzkit/core';
|
import { imgur } from '@blitzkit/core';
|
||||||
import { Code, Flex, Heading, Text } from '@radix-ui/themes';
|
import { Code, Flex, Heading, Text } from '@radix-ui/themes';
|
||||||
import { BRANCH_NAMES } from '../constants/branches';
|
import { undefined } from 'astro:schema';
|
||||||
|
import { resolveBranchName } from '../core/blitzkit/branches';
|
||||||
|
|
||||||
const isBranchNamed =
|
const branchName = resolveBranchName();
|
||||||
import.meta.env.PUBLIC_ASSET_BRANCH &&
|
const isBranchNamed = branchName !== undefined;
|
||||||
BRANCH_NAMES[import.meta.env.PUBLIC_ASSET_BRANCH];
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -58,7 +58,7 @@ const isBranchNamed =
|
|||||||
{
|
{
|
||||||
isBranchNamed && (
|
isBranchNamed && (
|
||||||
<Code size="8" color="gray" highContrast variant="outline">
|
<Code size="8" color="gray" highContrast variant="outline">
|
||||||
{BRANCH_NAMES[import.meta.env.PUBLIC_ASSET_BRANCH!]}
|
{branchName}
|
||||||
</Code>
|
</Code>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,16 +17,16 @@ import {
|
|||||||
Separator,
|
Separator,
|
||||||
Text,
|
Text,
|
||||||
} from '@radix-ui/themes';
|
} from '@radix-ui/themes';
|
||||||
import { BRANCH_NAMES } from '../constants/branches';
|
import { resolveBranchName } from '../core/blitzkit/branches';
|
||||||
import { homeTool, TOOLS } from '../constants/tools';
|
import { homeTool, TOOLS } from '../constants/tools';
|
||||||
import { PatreonIcon } from './PatreonIcon';
|
import { PatreonIcon } from './PatreonIcon';
|
||||||
import { NavbarAccount } from './NavbarAccount';
|
import { NavbarAccount } from './NavbarAccount';
|
||||||
|
import { undefined } from 'astro:schema';
|
||||||
|
|
||||||
const toolsFiltered = TOOLS.filter((tool) => !('href' in tool));
|
const toolsFiltered = TOOLS.filter((tool) => !('href' in tool));
|
||||||
const tools = [homeTool, ...toolsFiltered];
|
const tools = [homeTool, ...toolsFiltered];
|
||||||
const isBranchNamed =
|
const branchName = resolveBranchName();
|
||||||
import.meta.env.PUBLIC_ASSET_BRANCH &&
|
const isBranchNamed = branchName !== undefined;
|
||||||
BRANCH_NAMES[import.meta.env.PUBLIC_ASSET_BRANCH];
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -124,7 +124,7 @@ const isBranchNamed =
|
|||||||
{
|
{
|
||||||
isBranchNamed && (
|
isBranchNamed && (
|
||||||
<Code color="gray" size="1" highContrast variant="outline">
|
<Code color="gray" size="1" highContrast variant="outline">
|
||||||
{BRANCH_NAMES[import.meta.env.PUBLIC_ASSET_BRANCH!]}
|
{branchName}
|
||||||
</Code>
|
</Code>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
export const BRANCH_NAMES: Record<string, string> = {
|
|
||||||
dev: 'dev',
|
|
||||||
opentest: 'opentest',
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { assertSecret } from '@blitzkit/core';
|
||||||
|
|
||||||
|
const BRANCH_NAMES: Record<string, string> = {
|
||||||
|
dev: 'beta',
|
||||||
|
opentest: 'opentest',
|
||||||
|
};
|
||||||
|
|
||||||
|
export function resolveBranchName() {
|
||||||
|
if (assertSecret(import.meta.env.MODE) === 'development') {
|
||||||
|
return 'dev';
|
||||||
|
} else {
|
||||||
|
return BRANCH_NAMES[assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH)] as
|
||||||
|
| string
|
||||||
|
| undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user