Skip to content

Commit

Permalink
chore: some minor code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ovflowd committed Dec 25, 2024
1 parent 9d9a13d commit 5b76dc5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 5 additions & 5 deletions apps/site/components/Downloads/Release/ReleaseCodeBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import type { ReleaseContextType } from '@/types/release';
// of the current official managers versus the community ones
const CURRENT_OFFICIAL_MANAGERS = ['NVM', 'DOCKER'];

const parseSnippet = (s: string, { release, platform }: ReleaseContextType) => {
const parseSnippet = (s: string, releaseContext: ReleaseContextType) => {
// Creates a minimal JavaScript interpreter for parsing the JavaScript code from the snippets
const interpreter = createSval({ props: { release, platform } }, 'script');
const interpreter = createSval({ props: releaseContext }, 'script');

// Evaluates the JavaScript code applying the release context to the code
interpreter.run(`exports.content = \`${s}\``);
Expand Down Expand Up @@ -49,9 +49,9 @@ const ReleaseCodeBox: FC = () => {
// Bundles the Platform and Package Manager snippets
`${platformSnippet?.content ?? ''}${packageManagerSnippet?.content ?? ''}`,
// Passes a partial state of only the things we need to the parser
{ release, platform } as ReleaseContextType
{ release, platform, os } as ReleaseContextType
);
}, [snippets, release, platform, packageManager]);
}, [snippets, release, platform, os, packageManager]);

// Determines the code language based on the OS
const codeLanguage = os === 'WIN' ? 'ps1' : 'bash';
Expand All @@ -60,7 +60,7 @@ const ReleaseCodeBox: FC = () => {
<div className="mb-6 mt-4 flex flex-col gap-2">
{semVer.lt(release.versionWithPrefix, ESP_SUPPORT_THRESHOLD_VERSION) && (
<AlertBox title="Warning" level="warning" size="small">
{t('layouts.download.codeBox.unsupportedVersionWarning')}&nbsp;
{t('layouts.download.codeBox.unsupportedVersionWarning')}
</AlertBox>
)}

Expand Down
4 changes: 3 additions & 1 deletion apps/site/snippets/en/download/pnpm.bash
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

# Enable Corepack:
corepack enable
${props.os === 'WIN' ?
'corepack enable pnpm' :
'curl -fsSL https://get.pnpm.io/install.sh | sh -'}

# Verify pnpm version:
${props.platform === 'DOCKER' ?
Expand Down

0 comments on commit 5b76dc5

Please sign in to comment.