-
Notifications
You must be signed in to change notification settings - Fork 295
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
Improved detection logic for projects created by create-react-app
#266
Conversation
I agree, this makes sense 👍 |
How will this be compatible with other custom CRA ? react-scripts-ts isn't the only one existing |
I fear that the following
is not a good idea considering what I said above After all, the recommended way to add custom configs (such as react-hot-loader or sass, or maybe other languages such as dart/reason) is to fork react-scripts. |
I know that, but I thought it is still less lousy and easier to extend than the previous state with four fixed paths to check for three packages. However I just noticed that checking for the presence of the binaries could actually be more useful than parsing package's dependencies since some forks of |
Maybe we should considerer a setting such as
|
I'm not adverse to that |
But do we gain much if the user has to specify which versions of |
So far, And I may make a mistake but : To begin with, if Why not just always use |
ENOENT should be fixed with the next release (#248) Because there exist a lot of other testing frameworks. By defaulting to |
#268 should fix the issue for most forks of react-scripts. Do you know any major custom CRA not covered by it? |
It turns out my comment about defaulting to |
You can also manually activate the extension with |
My thought was not about when to activate the extension but when it should call |
Folks want it to be simple and work out of the box. I've added the other create-react-app derivates to the check when folks opened issues. It's low overhead to check if a file exists.
It's a decent idea to run "npm test" if it's defined in
I read it like "we expect your 'test' script in
|
My thought was to leave the
I would either implement my thought (and refine the docs) or keep the current behavior and update the docs. |
I'm OK with changing the default, but I'd prefer if we make it a smooth migration and notify the user of the change using a message and a quick pick menu as required. |
In my opinion two different behaviors when using the same configuration would be suboptimal, just like adding a new setting, but let's see which direction #271 is taking. In the meantime I will create a PR with a suggestion for updating the docs. |
Improved detection logic for projects created by `create-react-app`
The old logic for detecting
react-scripts
or similar had a flaw (#244): When testing for the presence of for examplereact-scripts-ts
, on Windows it checked the existence of a folder namednode_modules/react-scripts-ts.cmd
. Furthermore that approach is not compatible with Yarn workspaces, which usually places the folder in a parent directory.Instead it is better to check for the existence of the binary within
node_modules/.bin
. Another, in my opinion more stable, approach would be to parsepackage.json
and check its dependencies.