Skip to content

Commit

Permalink
feat: add npmCopyButton functionality in vite astro and remix (#387)
Browse files Browse the repository at this point in the history
* feat: add npmcopybutton functionality in vite astro and remix

* fix: lint

---------

Co-authored-by: anshumanRathore-coder <anshumantathore328@gmail.com>
Co-authored-by: Dillion Verma <hello@dillion.io>
  • Loading branch information
3 people authored Dec 18, 2024
1 parent 4aff5c4 commit b084791
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/rehype-npm-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
);
}
});
};
}

0 comments on commit b084791

Please sign in to comment.