sezna / nps

NPM Package Scripts -- All the benefits of npm scripts without the cost of a bloated package.json and limits of json
MIT License
1.43k stars 93 forks source link

Is there an options for --prefix? #228

Closed stoplion closed 3 years ago

stoplion commented 3 years ago

Scripts file (or at least the relevant bits):

Sits in /server

scripts:
  server:
    start: node ./build/index.js
    build: tsc
    watch: tsc -w
    debug: node --inspect-brk ./build/index.js

Sits in root

scripts:
  server:
    start: nps "server:start  --prefix server/"
    debug: nps "server:debug --prefix server/"
    watch: nps "server:watch --prefix server/"
    build: nps "server:build --prefix server/"

The main package.json (the one sitting in root) was able to run scripts in subfolders using the --prefix option. I'm trying to reproduce the same setup with nps. Is this possible?

When running the nps server.start from the the root dir in CLI, I'm attempting to trigger this: nps "server:start --prefix server/" which server:start from the package scripts in child folder.


Second Try

Trying with the config option to target a child package-scripts.json: start: nps -c server/package-scripts.yml "server:start"

Also..

start: "nps -c server/package-scripts.yml server:start"

Results in Scripts must resolve to strings. There is no script that can be resolved from "server:start"