Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

fix: update rehype command replace

Dillion Verma67cfb30be12e
diff --git a/lib/rehype-npm-command.ts b/lib/rehype-npm-command.ts
index e3b7525c..974d0c52 100644
--- a/lib/rehype-npm-command.ts
+++ b/lib/rehype-npm-command.ts
@@ -26,7 +26,7 @@ export function rehypeNpmCommand() {
);
}
- // npx create.
+ // npx create-.
if (node.properties?.["__rawString__"]?.startsWith("npx create-")) {
const npmCommand = node.properties?.["__rawString__"];
node.properties["__npmCommand__"] = npmCommand;
@@ -44,6 +44,24 @@ export function rehypeNpmCommand() {
);
}
+ // npm create.
+ if (node.properties?.["__rawString__"]?.startsWith("npm create")) {
+ const npmCommand = node.properties?.["__rawString__"];
+ node.properties["__npmCommand__"] = npmCommand;
+ node.properties["__yarnCommand__"] = npmCommand.replace(
+ "npm create",
+ "yarn create",
+ );
+ node.properties["__pnpmCommand__"] = npmCommand.replace(
+ "npm create",
+ "pnpm create",
+ );
+ node.properties["__bunCommand__"] = npmCommand.replace(
+ "npm create",
+ "bun create",
+ );
+ }
+
// npx.
if (
node.properties?.["__rawString__"]?.startsWith("npx") &&
@@ -61,21 +79,22 @@ export function rehypeNpmCommand() {
"bunx --bun",
);
}
- // npm create.
- if (node.properties?.["__rawString__"]?.startsWith("npm create")) {
+
+ // npm run.
+ if (node.properties?.["__rawString__"]?.startsWith("npm run")) {
const npmCommand = node.properties?.["__rawString__"];
node.properties["__npmCommand__"] = npmCommand;
node.properties["__yarnCommand__"] = npmCommand.replace(
- "npm create",
- "yarn create",
+ "npm run",
+ "yarn",
);
node.properties["__pnpmCommand__"] = npmCommand.replace(
- "npm create",
- "pnpm create",
+ "npm run",
+ "pnpm",
);
node.properties["__bunCommand__"] = npmCommand.replace(
- "npm create",
- "bun create",
+ "npm run",
+ "bun",
);
}
});