Commit Graph

55 Commits

Author SHA1 Message Date
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
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
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
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
62b0942be6 Change default test environment to jsdom (#5074) 2018-09-24 11:30:04 -04:00
Joe Haddad
9bbc1775bb Remove mjs support (#5027)
* Revert Lerna dependency, there's too many bugs in v3

* Remove `mjs` support
2018-09-18 17:09:27 -04:00
Joe Haddad
50b4857ff8 Revert "Add support for yarn and lerna monorepos. (#3741)"
This reverts commit b43ad04b88.
2018-09-18 14:31:19 -04:00
Craig Mulligan
0e0f260e35 .mjs should not resolve before .js files (#4085) (#4318)
Support for .mjs files added in #3239 did not account for npm libraries which ship native mjs files alongside js files. This accounts for this by ensuring .js files resolve before their accompanying .mjs file. Note that this is not an ideal end state since selecting a .mjs over a .js extension should be the result of whether `import` was used instead of `require()` in a node environment with native ESM support (currently via `--experimental-modules`). Instead, this change just *always* selects a .js extension before the .mjs extension if it exists.

This unbreaks support for using GraphQL (relay, apollo, etc) within create-react-app projects.
2018-05-20 20:27:31 +01:00
Mike Kusold
493a379c21 Map (css|sass|scss) modules to identity-obj-proxy in jest (#4419) 2018-05-15 21:03:22 -04:00
Pete Nykänen
779dad5546 Add loader for .graphql files (#3909)
* Add graphql loader to webpack config

Signed-off-by: petetnt <pete.a.nykanen@gmail.com>

* Update README.md

Signed-off-by: petetnt <pete.a.nykanen@gmail.com>

* Update react-scripts README.md

Signed-off-by: petetnt <pete.a.nykanen@gmail.com>

* Add graphql jest transform

Signed-off-by: petetnt <pete.a.nykanen@gmail.com>

* Add integration tests, pin versions in package.json

Signed-off-by: petetnt <pete.a.nykanen@gmail.com>

* Tests expect regexp matchers

Signed-off-by: petetnt <pete.a.nykanen@gmail.com>

* Use strict equal test instead

Signed-off-by: petetnt <pete.a.nykanen@gmail.com>

* Escaping is hard

Signed-off-by: petetnt <pete.a.nykanen@gmail.com>

* Add comment for signifying a different file

* Update docs

* Fix jest config

* Remove node_modules exclusion

* Update README.md

* Inline graphql jest transform

Signed-off-by: petetnt <pete.a.nykanen@gmail.com>

* Update copyright header

Signed-off-by: petetnt <pete.a.nykanen@gmail.com>

* Use .graphql extension only

Signed-off-by: petetnt <pete.a.nykanen@gmail.com>
2018-02-03 15:51:55 +00:00
bradfordlemley
b43ad04b88 Add support for yarn and lerna monorepos. (#3741)
* Support for multiple source paths via package.json srcPaths entry.

Initial support for yarn workspace.

Support lerna workspace, fix for when to use template files.

Remove support for specifying srcPaths in package.json.

Re-enable transpilation caching.

* Clean up, use file matching (similar to original) in webpack configs instead of matching function.

* Remove package lock files.

* Fix for eject.
Note: monorepos won't work after eject.
Can be fixed easily with JEST 22.0.?+ which has file pattern matches against realpaths.

* Filter tests to run only tests in monorepo components included by the app.
(Not sure this is desireable, might be cool to be able to easily run all tests in monorepo from one app.)

* Fix conditions for when to use template.

* Fix eject.

* Remove code that is not needed w/ Jest 22.

* Include all cra-comp tests in monorepo instead of trying to include only tests that are dependencies of app.
(tests can be easily filtered via jest cli if desired, e.g. 'npm test -- myapp comp1')

* Pin find-pkg version.

* Hopefully fix jest test file matching on windows by removing first slash.

* E2E tests for monorepo.

* Run monorepo tests in CI.

* Fix and test post-eject build.

* Fix e2e test.

* Fix test suite names in appveyor.

* Include individual package dirs as srcPaths instead of top-level monorepo root.
Fixes build/start after eject.

* Fix running tests after eject.

* Clean up test workspace, add some verifcations.

* Cleanup.

* Try to fix hang when running test on appveyor.

* Don't write babel or lint config to package.json when ejecting.

* Incorporate review comments.
* Simply monorepo pkg finder
* Only include monorepo pkgs if app itself is included in monorepo
* Check for specific tests in e2e

* Fixes for windows.

* Fix for kitchensink mocha tests compiling.

* Add lerna monorepo test.

* Fix lerna bootstrap on windows.

* Incorporate more review comments:
* remove support for lerna w/o yarn workspace
* add react and react-dom as devDeps to comp1 and comp2

* Add monorepo info to user guide.
2018-02-01 20:58:18 +00:00
Michaël De Boey
25184c4e91 Fix links to package (#3898) 2018-01-22 22:16:22 +00:00
Ro Savage
fc7c9915b0 Add support for CSS Modules with explicit filename (#2285)
* Add css modules with [name].modules.css file convention

* Add e2e for CSS Modules

* Updated based on feedback

* Change css modules class name to be deterministic and fix licences

* Update css modules class naming convention
2018-01-17 10:20:57 -05:00
Jack Franklin
7969b48cd0 Enhance Jest config error for setupTestFrameworkScriptFile (#3512)
* Enhance Jest config error for `setupTestFrameworkScriptFile`

I wasn't aware of the fact that users of c-r-a could just define
`src/setupTests.js` and it would be configured with Jest - I nearly
ejected before I found a GitHub issue that confirmed this functionality.

I thought it might be a nice idea to add it to the error about Jest
config overrides to stop others ejecting when they don't need to.

* Change the order of Jest config errors.

* Show different error for `setupTestFrameworkScriptFile`

* Tweak the message
2018-01-17 13:26:22 +00:00
Gary Meehan
f5708c67cd Add feature #3116 extended Jest config (#3802) 2018-01-15 17:03:14 +00:00
Dan Abramov
11db9af4df Add preflight check to guard against wrong versions of webpack/eslint/jest higher up the tree (#3771)
* Run real scripts in local development

* Add preflight check warning

* I know what I am doing

* Move preflight check into individual scripts

This ensures we don't try to filter NODE_PATH twice, accidentally removing the now-absolute path.

* Slightly tweak the wording

* Fix lint
2018-01-15 00:08:14 -05:00
aisensiy
776d2d6036 Update jest to 22 and support watchPathIgnorePatterns configuration (#3124)
* update jest to 21.0.2 to support watchPathIgnorePatterns configuration

* update jest to 21.1.0

* Try bumping Jest

* Bump babel-jest

* Try to debug weird CI failure

* Remove debug code

* Bump other Jest packages

* ffs

* temp

* Revert "temp"

This reverts commit 62aec9ac1ae70a995a89548feb7ac7870e5324c0.
2018-01-15 00:06:24 -05:00
Joe Haddad
5c8000f300 Add .mjs support (#3239) 2017-10-28 21:48:42 +01:00
Sophie Alpert
2e82ebb337 BSD+Patents -> MIT (#3189)
* File headers BSD+Patents -> MIT

* BSD+Patents -> MIT
2017-09-26 10:30:05 +01:00
Mostafa Hajizadeh
16f0d4a56c Add "node" to Jest's moduleFileExtensions (#2738)
Jest's default value for this option is ["js", "json", "jsx", "node"].
CRA's current value is ["web.js", "js", "json", "web.jsx", "jsx"], which
is missing one of default ones: "node". This change fixes that.

This "node" extension is used in packages that use native code.
2017-07-07 11:37:32 +01:00
Evan Jones
6ab0ec0075 Better React Native Web support (#2511)
* Better React Native Web support

* Adding better react-native-web support for jest testing
2017-06-28 15:29:58 +01:00
Dan Abramov
8dc9217b61 Move more logic from react-scripts to react-dev-utils (#2209)
* Show warnings for builds

* Move WebpackDevServer helpers into react-dev-utils
2017-05-18 12:26:18 +01:00
Dan Abramov
46eeabca7e Tweak colors for better contrast on Windows (#2180) 2017-05-16 16:45:12 +01:00
Ryan Sullivan
10a180be9b Make coverage and snapshot Jest options overridable in package.json (#1830)
* Override Jest config collectCoverageFrom with package.json

* Protect against overriding other options

* Better error message

* Create Jest config early on eject

* Tweak wording

* Dry it up
2017-05-16 05:13:19 +01:00
Tom Dunlap
c5e5eb5e33 Only run tests in <rootDir>/src (#544) (#1808)
* Only run tests in <rootDir>/src (#544)

* updates Jest to 19.0.2

* removes testPathIgnorePatterns from jest config

* adds testMatch to jest config to only match files in src

* Bump babel-jest to 19.0.0 to match jest 19.0.2
2017-05-15 19:46:18 -05:00
Rogelio Guzman
71e0960476 Update to Jest 19 (#1614)
* Upgrade to Jest 19

* Use testMatch

* Correct version
2017-05-15 14:35:18 -04:00
Dan Abramov
f87e61337a Make error/warning output more useful (#2161) 2017-05-15 18:09:05 +01:00
James Blight
71a27c0f8b Allow custom proxies in development (#1790)
* Change proxy handling to allow multiple proxies to be specified in package.json.

* Up webpack-dev-server to 2.4.2

Webpack Dev Server version 2.4.2 handles the external websocket upgrade
for all proxies

* Fix the listen() call

* Switch to correct default host

* Remove promises and extract to react-dev-utils

* oops
2017-05-14 21:12:54 -04:00
Dan Abramov
21349c542b Tweak error and warning output (#2152)
* Tweak error and warning output

* Add a colon
2017-05-15 01:07:59 +01:00
Siddharth Doshi
f17448e9e5 Add custom eslint formatter (#2138)
* Add custom eslint formatter

* Add formatter docs

* Update formatter docs

* Slightly tweak it

* Update README.md
2017-05-15 00:42:13 +01:00
Dan Abramov
4434467a43 Click to view source from error overlay (#2141)
* Click to view source

* Update package.json

* Update package.json

* Fix lint
2017-05-14 12:17:05 +01:00
Jeremy Morrell
94149c77a8 Ignore the yarn cache directory (#2063) 2017-05-08 15:05:49 +01:00
Buns Shar
c0fd569654 Resolve localhost when offline on Windows (#1839)
* Change proxy localhost to I27.0.0.1 for windows

* Update comment

* resolve localhost IP with DNS lookup on windows

* Fix CI errors

* Promisify addWebpackMiddleware

* Remove Node 6 syntax

* Update addWebpackMiddleware.js

* Actually use the resolved proxy
2017-04-21 16:23:08 -04:00
Buns Shar
f61cba104e Ensure proxy url starts with http:// or https:// (#1890) 2017-04-14 22:51:29 -04:00
Valerii Sorokobatko
fe7b5c212b update to modern code style (#1738)
* mv create-react-app/index.js -> create-react-app/creteReactApp.js

* update to modern code style

* var -> cosnt

* set trailing-coma to es5 for prettier
2017-03-07 19:46:10 +00:00
Dan Abramov
1bfd5dafdf Fix internal linting setup and add missing headers (#1741) 2017-03-06 14:20:29 +00:00