Skip to content

CLI npm scripts and input .coffee file/s as last argument conflicting with --watch #5455

@danielbayley

Description

@danielbayley

The CLI doesn’t currently play nice with [p]npm scripts, when calling one from another…

Expected Behavior

In this contrived, simplified example:

// package.json
"scripts": {
  "compile": "coffee --compile *.coffee",
  "watch": "npm run compile -- --watch"
}
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions