Commit Graph

205 Commits

Author SHA1 Message Date
Leigh Halliday
d57fd37d2d Convert all bit.ly links from http to https (#6239) 2019-02-19 09:25:19 -07:00
Ian Schmitz
6a5b3cdaaa Speed up TypeScript v2 (#6406)
* Revert "Revert "Speed up TypeScript projects (#5903)""

This reverts commit 544a5943ce.

* Move fork-ts-checker dep to react-dev-utils

* Convert WebpackDevServerUtils.createCompiler to take in options arg

* Update README.md for react-dev-utils
2019-02-18 16:31:44 -08:00
Aaron Reisman
df3e73f454 Exclude .d.ts files from TypeScript glob 2019-02-17 10:17:49 +02:00
Ian Schmitz
544a5943ce Revert "Speed up TypeScript projects (#5903)"
This reverts commit 5ce09db2b3.
2019-02-11 08:10:33 -08:00
Dan Abramov
782d71b957 Add Jest typeahead plugin (#5213)
* Add Jest typeahead plugin

* Update jest-watch-typeahead to 0.2.1
2019-02-10 08:13:27 -08:00
Tomáš Szabo
5ce09db2b3 Speed up TypeScript projects (#5903)
As a lot of [people](https://hackernoon.com/why-i-no-longer-use-typescript-with-react-and-why-you-shouldnt-either-e744d27452b4) is complaining about TypeScript performance in CRA, I decided to enable `async` mode in TypeScript checker.

These changes basically brings the JS compilation times to TS projects. So, recompilation took less than 1 second instead of 3 seconds in medium size project.

The problem with async mode is that type-errors are reported after Webpack ends up recompilation as TypeScript could be slower than Babel. PR allows to emit files compiled by Babel immediately and then wait for TS and show type errors in terminal later. Also, if there was no compilation errors and any type error occurs, we trigger a hot-reload with new errors to show error overlay in browser.

Also, I wanted to start a discussion about `skipLibCheck: false` option in default `tsconfig.json`. This makes recompilations really slow and we should consider to set it to `true` or at least give users a big warning to let them know that it could be really slow.

The following video is showing the updated workflow with a forced 2.5 second delay for type-check to give you an idea how it works.

![nov-26-2018 15-47-01](https://user-images.githubusercontent.com/5549148/49021284-9446fe80-f192-11e8-952b-8f83d77d5fbc.gif)


I'm pretty sure that PR needs some polishing and improvements but it should works as it is. Especially a "hack" with reloading the browser after type-check looks ugly to me.

cc @brunolemos as he is an initiator of an original TypeScript PR.

Should fix https://github.com/facebook/create-react-app/issues/5820
2019-02-07 19:34:52 -08:00
Rico Kahler
af339ec343 Add '--no-watch' flag for tests (#6285) 2019-02-01 17:49:52 +02:00
Matthew Holloway
fd382772a1 Ignore node_modules in verifyNoTypeScript (#6022) 2019-01-14 13:54:46 +02:00
Otávio Pace
47e9e2c7a0 Move chalk dependency to react-dev-utils (#6150)
Related to #751
2019-01-12 13:55:57 +02:00
Stephen Algeo
433d0be3b1 Improve error messaging in verifyPackageTree.js (#5974) 2018-12-06 13:39:01 +02:00
Joe Haddad
c50a7ea7de Suggest a different default for speed reasons (#5959)
Advanced users can opt into this behavior, but it's generally outside the users' control to fix and comes with performance concerns
2018-12-04 10:58:48 -05:00
Ian Sutherland
88f2b0bcfc Add pre-eject message about new features in v2 (#5954)
* Add pre-eject message about new features in v2

* Make message bold
2018-12-03 21:54:56 -05:00
Ian Schmitz
49e258b4a6 Support setupTests.ts (#5698) 2018-11-22 21:14:25 -08:00
Joe Haddad
30ee52cf3b Merge webpack configuration (#5722)
* Rename production configuration

* Upgrade lint staged

* Merge mode, bail, devtool, and entry

* Merge output settings

* Remove old comment

* Merge some trivial differences

* Disable minimize in development mode

* Only minify html and generate SW in production

* Adjust comment

* Toggle development plugins

* Add missing imports

* Scope settings

* Delete development config

* Use new config file

* Remove unnecessary config import
2018-11-07 22:11:20 -05:00
Ian Schmitz
5cdf360246 Fix tsconfig.json lib suggested value (#5701) 2018-11-03 15:21:10 -04:00
Joe Haddad
aac14ea579 Add permissive TS lib defaults (#5694) 2018-11-02 19:25:56 -04:00
ZHAO Jinxiang
e1321e520c fix: Duplicate string index signature in ProcessEnv (#5621) 2018-10-31 00:42:12 -04:00
Joe Haddad
6364bbf6dc Remove react-scripts type reference on eject (#5611)
* Remove react-scripts type reference on eject

* Check for env file

* Check eject for typescript

* Shuffle appTypeDeclarations

* Append internal types on eject

* Ensure lib is published for types

* Adjust comment

* Don't add a bunch of new lines

* File should exist and not be deleted

* Add debug

* Set file explicitly

* Revert "Set file explicitly"

This reverts commit bcd58a36cbd08a71af50b037d8f1fae6c595fb4e.

* Copy file before destroying ourselves

* Revert "Add debug"

This reverts commit 0068ba81c6d79d99788877c9e1b618acd7412dce.
2018-10-29 23:15:52 -04:00
Joe Haddad
a95822451c Remove unsupported TS options (#5609) 2018-10-28 15:52:09 -04:00
Joe Haddad
9747480f19 Turn on certain TypeScript options (#5607) 2018-10-28 14:47:06 -04:00
Joe Haddad
eca0ec0d52 Refine how TypeScript env types are handled (#5593)
* Specify types in package

* Do not remove types file on eject

* Stop copying types into generated project

* Reference react and react-dom

* Reference node types

* Install node types as well

* Restore copying

* Add Node to the list of installed types

* Reference Jest types

* Remove jest types from install

* Remove jest from CRA install

* Remove Jest reference and let user do this themselves

* Stop copying types file

* Add types key to package.json

* Add appTypeDeclarations and create when missing

* Rename declarations file

* Add Jest back to install instructions

* Minimize diff
2018-10-27 22:11:47 -07:00
Joe Haddad
3aa5c505e8 Enable forceConsistentCasingInFileNames by default 2018-10-24 17:31:19 -04:00
Joe Haddad
021f7e502f Don't auto exclude test files 2018-10-24 17:23:21 -04:00
Joe Haddad
b50590f7f4 Add TypeScript app creation (#5550)
* Add TypeScript app creation

* Actually specify new extension

* Check for ts and tsx

* Fix types in default service worker file

* Mirror changes in JS version of SW

* Separate templates

* Use separate template directory

* Remove unused function

* Add a tsconfig file to the template

* Test install of typescript

* Add e2e for TypeScript

* Check for index.tsx to make sure we're not in the JS template

* Ensure TypeScript doesn't leak into normal installs

* Ignore some files

* Print version of CRA

* Fix script

* Add new template

* Move test to correct location

* Use `verifyTypeScriptSetup` routine to populate files

* Ensure tsconfig is created
2018-10-24 16:28:36 -04:00
Joe Haddad
5ead915b73 Automatically setup TypeScript when detected (#5549)
* Don't resolve TS files if it's not detected in the project

* Automatically create tsconfig.json file for user

* Remove always false check

* Add missing file

* Don't filter paths too early
2018-10-24 00:59:26 -04:00
Ian Schmitz
315ff4b487 Respect tsconfig.json extends when validating config (#5537)
* Use TS to resolve tsconfig extends

* Prevent modifications to original tsconfig

* Print friendly error
2018-10-23 15:52:48 -04:00
Bruno Lemos
c6cdf42036 Use TypeScript parser to read tsconfig.json (#5532) 2018-10-22 14:51:31 -04:00
Bruno Lemos
4c558d7c26 Enable TypeScript json module resolver (#5531)
* Enable TypeScript json module resolver

* Update verifyTypeScriptSetup.js
2018-10-22 14:49:56 -04:00
Joe Haddad
7231285c6a Properly exclude test files from typechecking 2018-10-22 08:47:41 -04:00
Joe Haddad
6b010b09a9 Fix TypeScript file detection 2018-10-22 08:36:41 -04:00
Joe Haddad
b5f156efec Print friendly message on first time use 2018-10-22 08:32:48 -04:00
Joe Haddad
fa535304d1 Hoist compiler options 2018-10-22 08:26:52 -04:00
Joe Haddad
e0939b6262 Automatically create a tsconfig.json when entrypoint is TypeScript 2018-10-22 08:24:48 -04:00
Joe Haddad
680cf9371a Validate tsconfig when using TypeScript (#5524)
* Sanity check TypeScript config

* Check more options

* Set all defaults and suggestions

* Update docs

* Update doc notes

* Automatically copy react app declared types to project on start

* Remove note about loaders.d.ts
2018-10-22 08:15:41 -04:00
Joe Haddad
7ba343c187 Check for TypeScript install in preflight (#5516)
* Check for TypeScript install in preflight

* Remove unused import
2018-10-21 19:25:04 -04:00
Bruno Lemos
88aef1100f TypeScript syntax support (#4837) 2018-10-21 12:03:26 -04:00
Kit Thompson
302daeffff Fix typo
explictly seems like a typo for explicitly
2018-10-18 10:31:43 -04:00
Dan Abramov
56fed47976 Tweak preflight check message 2018-10-02 00:40:46 +01:00
Dan Abramov
bce2bfca6d Support globalSetup and globalTeardown Jest options (#5218) 2018-10-02 00:33:26 +01:00
Joe Haddad
316da53a32 Check for more packages which may cause problems (#5217) 2018-10-01 18:20:42 -04:00
Dan Abramov
45e621748c Fix absolute paths on eject (#5214) 2018-10-01 22:48:01 +01:00
Dan Abramov
b10337697e Don't crash npm test when hg/git are missing (#5212) 2018-10-01 22:08:14 +01:00
Maël Nison
9e074bbf08 Plug'n'Play support (#5136)
* Adds the PnP plugin for Webpack to find dependencies when working under PnP

* Adds configuration for jest

* Adds an e2e test for when using PnP

* Avoids cra from crashing at the engine check

* Avoids cra from crashing when initializing react-scripts

* Makes the ownPath portable

* Fixes linting

* Bumps to pnp-webpack-plugin@1.1.0, removes symlinks: false

* Adds a --use-pnp option

* Pin version
2018-10-01 15:53:07 +01:00
Joe Haddad
7b1a32be6e Polish webpack message output (#5174)
* Only install react-scripts in CI mode

* Link locally

* Re-enable all output tests

* 💄 Polish webpack output

* Test sass support message

* Add more tests, but disabled

* Format missing default export error

* Format aliased import

* Why was node-sass required? Odd

* Format webpack rejection error

* Re-enable unknown package test

* Format file not found error and catch module scope plugin error

* Re-disable case sensitive paths

* Intercept and format case sensitive path errors

* Test out of scope message formatting

* Run behavior on macOS

* Run behavior on Node 8 and 10, only Node 8 for macOS

* Add some debugging

* Update matcher

* Only check stderr

* Remove old snapshot

* More debug

* Remove debug

* Add new debug

* Disable test on linux

* Add comment for future
2018-09-30 17:44:49 -04:00
Joe Haddad
5599eff861 Drop IE 11 support by default (#5090)
* Drop ie 11 support and move polyfills to a new package

* More useful directions for what entry point to use
https://github.com/facebook/create-react-app/pull/5090#discussion_r220313783

* Clear up what file this polyfill goes in
https://github.com/facebook/create-react-app/pull/5090#discussion_r220313980

* Polyfill `window`, not `global`

* Remove proxy polyfill file
2018-09-25 16:08:29 -04:00
Joe Haddad
03a709195f Revert "Add loader for .graphql files (#3909)" (#5076) 2018-09-24 12:48:58 -04:00
Joe Haddad
88a3de96af Set browsers automatically if not an interactive terminal 2018-09-24 11:46:07 -04:00
Joe Haddad
62b0942be6 Change default test environment to jsdom (#5074) 2018-09-24 11:30:04 -04:00
Joe Haddad
b8da58499a Optimize webpack rebuild speed (#5065)
Derived from https://github.com/facebook/create-react-app/issues/4492#issuecomment-421959548
2018-09-22 13:44:58 -04:00
Joe Haddad
7be14b914f Tweak init.js after merge 2018-09-21 08:19:14 -04:00