Skip to content
This repository has been archived by the owner on Mar 4, 2022. It is now read-only.

Bug: Recursive dependencies. #74

Open
4 tasks
ryan-roemer opened this issue Jan 14, 2016 · 2 comments
Open
4 tasks

Bug: Recursive dependencies. #74

ryan-roemer opened this issue Jan 14, 2016 · 2 comments
Labels

Comments

@ryan-roemer
Copy link
Member

An easy footgun with the existing https://github.com/FormidableLabs/builder-react-component/blob/master/package.json is if in:

// ROOT
  "scripts": {
    "test": "builder run check"
  },

// ARCHETYPE
  "scripts": {
    "check": "builder run lint && builder run test"
  },

and then run:

$ npm test

and watch an infinite loop of the same task...

The lint command works just fine, but builder run test in the archetype hits the ROOT test task recursively firing up everything again, and again, and again, ...

TASK: Research a way to detect and deal with:

  • Maybe keep builder task spawn state in environment?
  • Refactor our archetypes to make npm:test really be something worth of npm test in ROOT and remove archetype test commands.
  • Detect and error in archetypes on npm lifecycle commands (?) (Orthogonal, but related -- can have recursive blow up with completely custom commands too.)
  • Update the README to not have test be an example of overriding commands.

/cc @coopy @chaseadamsio

@exogen
Copy link
Contributor

exogen commented Aug 27, 2016

This is easy to do with plain old npm as well:

  "scripts": {
    "check": "npm run lint && npm run test",
    "lint": "echo OK",
    "test": "npm run check"
  }

...but perhaps a little easier with Builder since you're not looking at the full list of tasks when you edit package.json. I'm inclined to just add a word of caution to the docs instead of figuring out a technical solution.

@curiouslychase
Copy link

I'm inclined to just add a word of caution to the docs instead of figuring out a technical solution.

It might be interesting to come up with a tool that checks for these kinds of infinite loops in scripts that'd work for builder or npm.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants