Maintain script through package.json
I think it would be nice if we maintained the script that is being executed by Alfred through package.json.
I don't want to specify a new property. That's why my suggestion is that we look at the main or bin property of package.json. If that property is set AND alfy is a dependency, I think we can assume the script should be
run-node {main} $1
If you are doing something differently and don't want that, you can safely remove the main (or bin) property from package.json.
Not sure which property I prefer, main or bin.
👍 bin
We can actually even go further and make it
{
"bin": {
"ng2": "index.js"
}
}
Whereas ng2 in this case is the activation keyword. If not provided, it will use the name of the package and remove the alfred- prefix.
Actually, one problem with using bin is that npm will add it as a global binary when the user install the workflow, so while bin is more correct semantically, main might be a better choice. Or we could just add a custom field.