"scripts": { "push": "git add . && git commit -m FIRSTARG && git push -u origin master"…
- User
"scripts": { "push": "git add . && git commit -m FIRSTARG && git push -u origin master" }
how can i make a default, and how can ijust make it like npm run push “Your commit message”
- Assistant
To achieve the behavior you want—where you can run
npm run push "Your commit message"and have that message passed to the script—you'll need to modify your script to use an argument passed via npm's command line interface.By default, npm does not pass command-line arguments to scripts directly. However, you can use the
--syntax to pass the arguments, and then use a utility likejqto handle the arguments or simply reference$npm_config_argsor$*in a shell-compatible way in your script.Here's how you can modify your
package.jsonto achieve this functionality:json