Commit Graph

218 Commits

Author SHA1 Message Date
Ian Schmitz
76fea02277 Cleanup Jest config (#6654)
General cleanup after the [Jest 24 PR](#6278). 

This also includes `jsdom@14` via https://www.npmjs.com/package/jest-environment-jsdom-fourteen. Since we have a node >= 8.10 requirement, we are able to use the latest version of `jsdom` which includes additional implementations of browser APIs such as `MutationObserver` (which we had an issue filed for over at #6617).

/cc @SimenB. Is there more you recommend we do to cleanup our [Jest config](b0cbf2caa1/packages/react-scripts/scripts/utils/createJestConfig.js) for TypeScript?

Co-authored-by: Ian Sutherland <ian@iansutherland.ca>
2019-04-04 11:00:00 -06:00
Cody Olsen
9514cb88ab Remove --coverage + --watch workaround (#4176) 2019-04-02 10:49:36 -07:00
Jack Zhao
4734d4ef21 Merge branch 'master' into master 2019-03-18 17:50:52 -07:00
Lorenzo Rapetti
3be3576304 Update to Jest 24 (#6278)
* Update to jest 24

* Add notice about pnpResolver.js

* Formatting

* Fix linting

* Update to jest 24.1.0

* Update jest-pnp-resolver

* Swap create-react-app params in e2e scripts

* Add extraGlobals to supportedKeys

* Bump jest to 24.3.1

* Bump jest to 24.4.0

* Bumb jest to 24.5.0

* Update template dependencies jest to 24.5.0

* Debug failing test

* Remove jest-pnp-resolver

* Remove console.log

* Revert yarn.lock.cached
2019-03-15 12:02:59 -06:00
Salvador Hernandez
dc133a351f Stage files for commit after ejecting (#5960)
* add command to add files to staging after eject

* update console.log message

* wrap git add in a try/catch block

* return true & update log message

* add test to check if files were staged

* Fix check for staged files
2019-03-11 22:06:37 -06:00
Ian Schmitz
3c9c21a285 Upgrade dependencies (#6614)
* Upgrade dependencies

* Upgrade a couple missed deps

* Run Prettier over codebase
2019-03-11 20:45:14 -06:00
Jannis Hell
5b77280dad Make compiler variable const instead of let (#6621)
compiler is not being reassigned, so we can use a const here
2019-03-11 12:42:20 -07:00
Mike Beaton
ed86da9ed3 Convert JSON.stringify \n to os.EOL when writing tsconfig.json (#6610) 2019-03-11 08:47:16 -07:00
Ian Sutherland
1548a0a92e Reapply "Speed up TypeScript v2 (#6406)" (#6586)
This reverts commit b2cf28b7f1 and reapplies #6406.
2019-03-06 17:46:38 -07:00
Ian Sutherland
b2cf28b7f1 Revert "Speed up TypeScript v2 (#6406)" (#6585)
This reverts commit 6a5b3cdaaa.
2019-03-06 17:33:17 -07:00
Jack Zhao
4a4d2eff4e remove argv 2019-02-21 14:39:01 -08:00
Jack Zhao
140e182e7d remove stats json 2019-02-21 14:35:34 -08:00
Jack Zhao
e7a427ad16 remove webpack-bundle-analyzer 2019-02-20 23:21:35 -08:00
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