Skip to content

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

feat: add npmCopyButton functionality in vite astro and remix (#387)

Anshuman Singh Rathoreb084791e8113
diff --git a/lib/rehype-npm-command.ts b/lib/rehype-npm-command.ts
index 46a85b00..e3b7525c 100644
--- a/lib/rehype-npm-command.ts
+++ b/lib/rehype-npm-command.ts
@@ -61,6 +61,23 @@ export function rehypeNpmCommand() {
"bunx --bun",
);
}
+ // 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",
+ );
+ }
});
};
}