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

Q: Do all wireit scripts need to also be npm scripts #122

Closed
justinfagnani opened this issue Apr 23, 2022 · 2 comments
Closed

Q: Do all wireit scripts need to also be npm scripts #122

justinfagnani opened this issue Apr 23, 2022 · 2 comments

Comments

@justinfagnani
Copy link

Let's say I organize one logical script, like build, into several sub-steps, like build:ts and build:graph. Do I need to make the sub-steps into npm script if they're never intended to be called from npm run or as a dependency of another wireit script?

ie, do I need build:ts and build:graphql in scripts?:

  "scripts": {
    "build": "wireit",
    "build:ts": "wireit",
    "build:graphql": "wireit"
  },
  "wireit": {
    "build": {
      "dependencies": [
        "build:ts"
      ]
    },
    "build:ts" {
      "dependencies": [
        "build:graphql"
      ]
    },
    "build:graphql" { ... },
  }
@aomarks
Copy link
Member

aomarks commented Apr 23, 2022

Yes, all Wireit scripts must be declared in scripts. This is intentional. The reason is to avoid a situation like this:

  1. Package A has a build:ts that is declared in scripts.
  2. Package B has a build:ts that is NOT declared in scripts.
  3. From the root of a monorepo, I type npm run build:ts -ws --if-present.
  4. Only Package A's build:ts runs.

I think this could be confusing and error-prone, so instead we require that every Wireit script be an actual npm script. I think this is also consistent with the design goal of augmenting npm scripts rather than replacing them.

@justinfagnani
Copy link
Author

Sounds good!

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

2 participants