| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks! If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact cla@fb.com if you have any questions. |
Sorry, something went wrong.
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Sorry, something went wrong.
|
Hmm, ignore for now? I can't get this build failure to repro locally :( EDIT: Fixed build issues. Apologies for the spam. |
Sorry, something went wrong.
add support for installing react-scripts via npm link
nit: grammar fix in comment
|
with this change, are the scoped package steps still needed if you're not making a long running fork? I want to be able to take my existing app, pull someone's branch for an open PR, run npm link react-scripts, and see how those changes work in my app. And then npm unlink react-scripts once I've gotten to test. This simple flow works with most other dependencies... can it work with react-scripts? |
Sorry, something went wrong.
|
Yep, should work. Running npm link <react-script-module-name> from your app should change the path under node_modules to pick up the local dependency. The original issue (and my particular set up) were based on longer term forks. |
Sorry, something went wrong.
| // `publish`) or running the smoke test. | ||
| var isRunningFromOwn = __dirname.indexOf(path.join('packages', 'react-scripts', 'config')) !== -1; | ||
| var isSmokeTest = process.argv.some(arg => arg.indexOf('--smoke-test') > -1); | ||
| var isRunningFromAppUsingLink = (process.env.npm_lifecycle_event === 'start') && isRunningFromOwn && !isSmokeTest |
There was a problem hiding this comment.
What is special about start? I don't understand this.
Sorry, something went wrong.
There was a problem hiding this comment.
Without including the check for start, (i.e. only checking isRunningFromOwn && !isSmokeTest), the tests fail because those conditions are both true for other events like build. At first glance, it may be assuming too much, as it's entirely possible that someone will write an app that has other start-like events, but are named something else. But they should be able to handle their own custom cases since they'll be forking react-scripts in the first place.
Sorry, something went wrong.
|
Could you write up another explanation about why this works and solves that use case? |
Sorry, something went wrong.
|
When you try to use npm link to reference a forked version of react-scripts, the original logic of paths.js uses the template from the react-scripts module (i.e. packages/react-scripts/template) instead of the app itself (e.g. src). You can see this by following the repro steps in the initial comment. After a ton of trial and error, I came up with a set of conditions for when to use the template, and when to use local source files of the app referencing react-scripts. There are effectively three cases to look for, so I'll walk through each one.
With the special logic to track isRunningFromAppUsingLink, I refactored the existing usages of resolveApp and resolveOwn to handle this special case. |
Sorry, something went wrong.
|
Tagging as 0.9.1 as I'd like us to understand what's the problem here, and maybe merge this in some form. |
Sorry, something went wrong.
|
I believe that this is trying to accomplish what #1356 does, but in a much more convoluted way. I appreciate all your hard work and explanations @tabrezm, but I'm going to close this in favor of #1356 since it is a more straightforward modification. Please do not hesitate to reach out to us if this does not resolve your use case. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
When using npm link to depend on a forked version of react-scripts, the paths are set up incorrectly such that the source files in the react-scripts template get used instead of the actual source files from the app.
Repro steps:
to this:
"devDependencies": { "react-scripts": "0.7.0" },to this
"devDependencies": { "@tabrezm/react-scripts": "0.0.0" },Expected: see new content
Actual: see content from template in react-scripts instead
Full discussion: #682 (comment)