Created
November 6, 2023 11:09
-
-
Save AshCoolman/ec3da0b1df7a30e38c9d4388cacb0436 to your computer and use it in GitHub Desktop.
Revisions
-
AshCoolman created this gist
Nov 6, 2023 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ #!/bin/bash if [ ! -f "package.json" ]; then echo "No package.json. Run this at your project root." exit 1 fi echo -n "Command not found: " read command if [ ! -d "./node_modules/.bin" ]; then echo "Missing ./node_modules/.bin. Run 'yarn install'." exit 1 fi if [ ! -f "./node_modules/.bin/$command" ]; then echo "Missing command $command. Install with 'yarn add <package>'." exit 1 fi if [[ ":$PATH:" != *":$(yarn global bin):"* ]]; then echo "Yarn's bin not in PATH. Add with 'export PATH=\"$(yarn global bin):\$PATH\"' (probably use \$HOME) in .bashrc or .zshrc." fi if ! grep -q "\"$command\"" "package.json"; then echo "Command $command not in scripts. Add it or run with 'yarn run <command>'." fi echo "Looks correct. Check package documentation or reinstall with 'yarn add <package>'."