docs(core): remove @nrwl/ rescope message from codeblocks (#22184)
This commit is contained in:
parent
9d5bdbe884
commit
8030bd7291
@ -1,10 +1,9 @@
|
|||||||
import {
|
import {
|
||||||
ClipboardDocumentCheckIcon,
|
ClipboardDocumentCheckIcon,
|
||||||
ClipboardDocumentIcon,
|
ClipboardDocumentIcon,
|
||||||
InformationCircleIcon,
|
|
||||||
SparklesIcon,
|
SparklesIcon,
|
||||||
} from '@heroicons/react/24/outline';
|
} from '@heroicons/react/24/outline';
|
||||||
import { ReactNode, JSX, useEffect, useState } from 'react';
|
import { JSX, ReactNode, useEffect, useState } from 'react';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { CopyToClipboard } from 'react-copy-to-clipboard';
|
import { CopyToClipboard } from 'react-copy-to-clipboard';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@ -29,31 +28,20 @@ function CodeWrapper(options: {
|
|||||||
fileName: string;
|
fileName: string;
|
||||||
command: string;
|
command: string;
|
||||||
path: string;
|
path: string;
|
||||||
isMessageBelow: boolean;
|
|
||||||
language: string;
|
language: string;
|
||||||
children: string; // intentionally typed as such
|
children: string; // intentionally typed as such
|
||||||
}): ({ children }: { children: ReactNode }) => JSX.Element {
|
}): ({ children }: { children: ReactNode }) => JSX.Element {
|
||||||
return ({ children }: { children: ReactNode }) =>
|
return ({ children }: { children: ReactNode }) =>
|
||||||
options.language === 'shell' ? (
|
options.language === 'shell' ? (
|
||||||
<TerminalOutput
|
<TerminalOutput command={options.children} path="" content={null} />
|
||||||
command={options.children}
|
|
||||||
path=""
|
|
||||||
content={null}
|
|
||||||
isMessageBelow={options.isMessageBelow}
|
|
||||||
/>
|
|
||||||
) : options.command ? (
|
) : options.command ? (
|
||||||
<TerminalOutput
|
<TerminalOutput
|
||||||
content={children}
|
content={children}
|
||||||
command={options.command}
|
command={options.command}
|
||||||
path={options.path}
|
path={options.path}
|
||||||
isMessageBelow={options.isMessageBelow}
|
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<CodeOutput
|
<CodeOutput content={children} fileName={options.fileName} />
|
||||||
content={children}
|
|
||||||
fileName={options.fileName}
|
|
||||||
isMessageBelow={options.isMessageBelow}
|
|
||||||
/>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,6 +126,7 @@ export function Fence({
|
|||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const highlightOptions = Object.keys(lineGroups).map((lineNumberKey) => ({
|
const highlightOptions = Object.keys(lineGroups).map((lineNumberKey) => ({
|
||||||
label: lineNumberKey,
|
label: lineNumberKey,
|
||||||
value: lineNumberKey,
|
value: lineNumberKey,
|
||||||
@ -163,11 +152,11 @@ export function Fence({
|
|||||||
t && clearTimeout(t);
|
t && clearTimeout(t);
|
||||||
};
|
};
|
||||||
}, [copied]);
|
}, [copied]);
|
||||||
const showRescopeMessage =
|
|
||||||
(!skipRescope && children.includes('@nx/')) || command.includes('@nx/');
|
|
||||||
function highlightChange(item: { label: string; value: string }) {
|
function highlightChange(item: { label: string; value: string }) {
|
||||||
onLineGroupSelectionChange?.(item.value);
|
onLineGroupSelectionChange?.(item.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="code-block group relative w-full">
|
<div className="code-block group relative w-full">
|
||||||
<div>
|
<div>
|
||||||
@ -217,24 +206,10 @@ export function Fence({
|
|||||||
fileName,
|
fileName,
|
||||||
command,
|
command,
|
||||||
path,
|
path,
|
||||||
isMessageBelow: showRescopeMessage,
|
|
||||||
language,
|
language,
|
||||||
children,
|
children,
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
{showRescopeMessage && (
|
|
||||||
<a
|
|
||||||
className="relative block rounded-b-md border border-slate-200 bg-slate-50 px-4 py-2 text-xs font-medium no-underline hover:underline dark:border-slate-700 dark:bg-slate-800"
|
|
||||||
href="/recipes/other/rescope"
|
|
||||||
title="Nx 16 package name changes"
|
|
||||||
>
|
|
||||||
<InformationCircleIcon
|
|
||||||
className="mr-2 inline-block h-5 w-5"
|
|
||||||
aria-hidden="true"
|
|
||||||
/>
|
|
||||||
Nx 15 and lower use @nrwl/ instead of @nx/
|
|
||||||
</a>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,22 +1,14 @@
|
|||||||
import { cx } from '@nx/nx-dev/ui-primitives';
|
|
||||||
import { JSX, ReactNode } from 'react';
|
import { JSX, ReactNode } from 'react';
|
||||||
|
|
||||||
export function CodeOutput({
|
export function CodeOutput({
|
||||||
content,
|
content,
|
||||||
fileName,
|
fileName,
|
||||||
isMessageBelow,
|
|
||||||
}: {
|
}: {
|
||||||
content: ReactNode;
|
content: ReactNode;
|
||||||
fileName: string;
|
fileName: string;
|
||||||
isMessageBelow: boolean;
|
|
||||||
}): JSX.Element {
|
}): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div
|
<div className="hljs not-prose w-full overflow-x-auto border border-slate-200 bg-slate-50/50 font-mono text-sm dark:border-slate-700 dark:bg-slate-800/60 rounded-lg">
|
||||||
className={cx(
|
|
||||||
'hljs not-prose w-full overflow-x-auto border border-slate-200 bg-slate-50/50 font-mono text-sm dark:border-slate-700 dark:bg-slate-800/60',
|
|
||||||
isMessageBelow ? 'rounded-t-lg border-b-0' : 'rounded-lg'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{!!fileName && (
|
{!!fileName && (
|
||||||
<div className="flex border-b border-slate-200 bg-slate-50 px-4 py-2 italic text-slate-400 dark:border-slate-700 dark:bg-slate-800/80 dark:text-slate-500">
|
<div className="flex border-b border-slate-200 bg-slate-50 px-4 py-2 italic text-slate-400 dark:border-slate-700 dark:bg-slate-800/80 dark:text-slate-500">
|
||||||
{fileName}
|
{fileName}
|
||||||
|
|||||||
@ -4,17 +4,15 @@ import { TerminalShellWrapper } from './terminal-shell';
|
|||||||
export function TerminalOutput({
|
export function TerminalOutput({
|
||||||
content,
|
content,
|
||||||
command,
|
command,
|
||||||
isMessageBelow,
|
|
||||||
path,
|
path,
|
||||||
}: {
|
}: {
|
||||||
content: ReactNode | null;
|
content: ReactNode | null;
|
||||||
command: string;
|
command: string;
|
||||||
isMessageBelow: boolean;
|
|
||||||
path: string;
|
path: string;
|
||||||
}): JSX.Element {
|
}): JSX.Element {
|
||||||
const commandLines = command.split('\n').filter(Boolean);
|
const commandLines = command.split('\n').filter(Boolean);
|
||||||
return (
|
return (
|
||||||
<TerminalShellWrapper isMessageBelow={isMessageBelow}>
|
<TerminalShellWrapper>
|
||||||
<div className="p-4 pt-2 overflow-x-auto">
|
<div className="p-4 pt-2 overflow-x-auto">
|
||||||
<div className="flex flex-col items-left">
|
<div className="flex flex-col items-left">
|
||||||
{commandLines.map((line, index) => {
|
{commandLines.map((line, index) => {
|
||||||
|
|||||||
@ -1,20 +1,12 @@
|
|||||||
import { cx } from '@nx/nx-dev/ui-primitives';
|
|
||||||
import { JSX, ReactNode } from 'react';
|
import { JSX, ReactNode } from 'react';
|
||||||
|
|
||||||
export function TerminalShellWrapper({
|
export function TerminalShellWrapper({
|
||||||
isMessageBelow,
|
|
||||||
children,
|
children,
|
||||||
}: {
|
}: {
|
||||||
isMessageBelow: boolean;
|
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
}): JSX.Element {
|
}): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div
|
<div className="hljs not-prose w-full overflow-x-auto border border-slate-200 bg-slate-50/50 font-mono text-sm dark:border-slate-700 dark:bg-slate-800/60 rounded-lg">
|
||||||
className={cx(
|
|
||||||
'hljs not-prose w-full overflow-x-auto border border-slate-200 bg-slate-50/50 font-mono text-sm dark:border-slate-700 dark:bg-slate-800/60',
|
|
||||||
isMessageBelow ? 'rounded-t-lg border-b-0' : 'rounded-lg'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<div className="relative flex justify-center p-2 border-b border-slate-200 bg-slate-100/50 text-slate-400 dark:border-slate-700 dark:bg-slate-700/50 dark:text-slate-500">
|
<div className="relative flex justify-center p-2 border-b border-slate-200 bg-slate-100/50 text-slate-400 dark:border-slate-700 dark:bg-slate-700/50 dark:text-slate-500">
|
||||||
<div className="absolute flex items-center gap-2 left-2 top-3">
|
<div className="absolute flex items-center gap-2 left-2 top-3">
|
||||||
<span className="w-2 h-2 bg-red-400 rounded-full dark:bg-red-600" />
|
<span className="w-2 h-2 bg-red-400 rounded-full dark:bg-red-600" />
|
||||||
|
|||||||
@ -24,7 +24,7 @@ export function TerminalVideo({
|
|||||||
alt: string;
|
alt: string;
|
||||||
}): JSX.Element {
|
}): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<TerminalShellWrapper isMessageBelow={false}>
|
<TerminalShellWrapper>
|
||||||
<div className="overflow-x-auto">
|
<div className="overflow-x-auto">
|
||||||
<VideoLoop src={src} alt={alt}></VideoLoop>
|
<VideoLoop src={src} alt={alt}></VideoLoop>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user