I am trying to create a task for the npm script configured in package.json. So, here are the files:
package.json
....
scripts : {
"migrate": "node_modules/.bin/migrate-mongo",
"migrate:create": "npm run migrate create" // --> this command needs input (file name)
}
....
Now when I have to run the migrate:create command I have to go to shell and run like this:
$> npm run migrate:craete filename
And it works fine.
Now I want to create a task for the same. For that I did some research and taking the idea from: https://stackoverflow.com/a/53846572/1227940 created the tasks.json as:
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "Create a db migration script.",
"command": "npm run migrate create ${input:migrationName}",
}
],
"inputs": [
{
"type": "promptString",
"id": "migrationName",
"description": "Name your migration script?",
"default": "create"
}
]
}
But somehow it is not giving me a text box to input anything and directly going inside and firing a command: npm run migrate:create which is failing since filename is missed.
Can anyone please shed some light, what I lacked and what I missed, please let me know?
Thanks in advance, happy coding :)