Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch some scripts (e.g. build) but not others (e.g. serve) #265

Closed
bennypowers opened this issue May 30, 2022 · 3 comments
Closed

Watch some scripts (e.g. build) but not others (e.g. serve) #265

bennypowers opened this issue May 30, 2022 · 3 comments

Comments

@bennypowers
Copy link

I've got a use case which I'll bet is quite common:

  • a build process that outputs files, in my case style-dictionary
  • a dev server with it's own file watcher, watching the files output in the previous step, in my case @web/dev-server

It wouldn't make sense to restart the dev server on changes, so using it's built-in filewatcher is smart.
We'd also like to be able to watch the build's input files for changes and restart the build whenever sources change

"scripts": {
  "build": "wireit",
  "serve": "wireit",
  "start": "wireit"
},
"wireit": {
  "build": {
    "command": "style-dictionary build -c config.cjs",
    "files": [
      "tokens/**/*",
      "docs/**/*",
      "config.js"
    ],
    "output": [
      "build/**"
    ]
  },
  "serve": {
    "command": "wds --open --watch --root-dir build",
    "dependencies": [
      "build"
    ]
  },
  "start": {
    "???": "???"
  }
}

I want npm run build to run the build once, and I want npm run start to run the build command, then the dev server, then watch changes to the build command's inputs and rerun the build command when they change. I tried a few combinations of options but was unable to achieve that workflow with wireit.

I'd like to be able to define commands which are just combinations other commands, and I'd like to specify watchers in the config file, i.e. not with the watch command argument, but with some "watch": ["build"] in package.json

@rictic
Copy link
Member

rictic commented May 30, 2022

Related: #33

@aomarks
Copy link
Member

aomarks commented May 30, 2022

Yeah this is #33 plus #237

@aomarks
Copy link
Member

aomarks commented Jun 10, 2022

Closing as I believe service mode (#33) plus a "soft" dependency (#237 but exact naming/config still TBD) will solve this use-case.

@aomarks aomarks closed this as completed Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants