From ad16789018a3e7ae4123ebdd0a0b1d9402378349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20K=C3=BCgler?= Date: Sun, 1 Sep 2024 20:39:50 +0200 Subject: [PATCH] Fix addon install command The command copied to the clipboard was different from the one displayed. It erroneously used 'npx' instead of 'npm'. Now we use 'npm' consistently. In addition, we add the '-D' flag to add the addon to dev dependencies, which is what people usually want to do. --- apps/addon-catalog/components/addon/addon-hero.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/addon-catalog/components/addon/addon-hero.tsx b/apps/addon-catalog/components/addon/addon-hero.tsx index 0cdfd8c3..2c9ee4a9 100644 --- a/apps/addon-catalog/components/addon/addon-hero.tsx +++ b/apps/addon-catalog/components/addon/addon-hero.tsx @@ -14,10 +14,11 @@ import { StorybookIcon } from '@repo/ui'; import { type Addon } from '../../types'; export function AddonHero({ addon }: { addon: Addon }) { + const installCommand = `npm install -D ${addon.name ?? ''}`; const [state, setState] = useState(false); const onClick = () => { - copy(`npx install ${addon.name ?? ''}`); + copy(installCommand); setState(true); setTimeout(() => { setState(false); @@ -49,7 +50,7 @@ export function AddonHero({ addon }: { addon: Addon }) { onClick={onClick} type="button" > - npm install {addon.name} + {installCommand} {state ? (