jashkenas / jashkenas/coffeescript
CLI `npm` `scripts` and input `.coffee` file/s as last argument conflicting with `--watch`
- Dominant language
- CoffeeScript
- Stars
- 16.6k
- Forks
- 2k
- PR merge metrics
- No merged PRs in 30d
Description
The CLI doesn’t currently play nice with [`p`]`npm` `scripts`, when calling one from another…
### Expected Behavior
In this contrived, simplified example:
~~~ js
// package.json
"scripts": {
"compile": "coffee --compile *.coffee",
"watch": "npm run compile -- --watch"
}
~~~
~~~ sh
npm run watch
~~~
should run `coffee` in watch mode, but this seems to be impossible because of the design of the command line API.
### Current Behavior
The above throws a `File not found: .../my-project/--watch` error.
### Possible Solution
Allow the positional `*.coffee` parameter/s to be anywhere, rather than forcing it to be the last argument, or add some kind of `-`[`-i`]`nput` option.
### Context
* CoffeeScript version: 2.7.0
* Node.js version: 20.6.1
Contributor guide
Research direction
Start by reproducing the package.json scripts with CoffeeScript 2.7.0 and Node.js 20.6.1, using `npm run watch`. Then inspect the CLI argument handling for `coffee --compile *.coffee --watch`; done means the command runs in watch mode without treating `--watch` as an input file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- coffeescript, node.js
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100