Created
April 17, 2022 05:27
-
-
Save gBasil/adebecf1023e4900ef6fbe8af9a65173 to your computer and use it in GitHub Desktop.
Evangelize yarn! A userscript to swap the npm install snippet with yarn.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Yarnify | |
// @namespace http://gbasil.dev/ | |
// @version 1.0 | |
// @description Evangelize yarn! Replace the npm install with yarn, and affix --dev to type definitions. | |
// @author Basil | |
// @match https://www.npmjs.com/package/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=npmjs.com | |
// @grant none | |
// ==/UserScript== | |
// Install with yarn | |
document.querySelector('[tabindex="0"]').childNodes[0].textContent = 'yarn add '; | |
// Install types as dev dependencies | |
if ( | |
document.querySelector('[tabindex="0"]').childNodes[2].textContent.startsWith('@types/') | |
) document.querySelector('[tabindex="0"]').childNodes[2].textContent += ' --dev'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment