alfred-link icon indicating copy to clipboard operation
alfred-link copied to clipboard

Maintain script through package.json

Open SamVerschueren opened this issue 9 years ago • 3 comments

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.

SamVerschueren avatar Aug 22 '16 06:08 SamVerschueren

👍 bin

sindresorhus avatar Aug 25 '16 21:08 sindresorhus

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.

SamVerschueren avatar Aug 26 '16 10:08 SamVerschueren

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.

sindresorhus avatar Aug 26 '16 10:08 sindresorhus