how can i make a default, and how can ijust make it like npm run push “Your commit…
- User
how can i make a default, and how can ijust make it like npm run push “Your commit message”
"scripts": { "push": "git add . && git commit -m FIRSTARG && git push -u origin master" }
- Assistant
To create an NPM script that takes a command-line argument for your commit message, you can pass arguments to your NPM script using
--followed by the arguments. Here's how you can modify yourpackage.jsonto achieve what you want:-
Edit your
package.json: You need to update thescriptssection of yourpackage.jsonfile to read the argument correctly. -
Using
$npm_config_to access passed parameters: NPM allows access to CLI parameters via environment variablesnpm_config_. For your case, you would typically structure it like this:
-