* 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.
* 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
* Update paths.js, rename shadow path variable
This file requires the "path" module and sets it to a variable `path`. The function `ensureSlash` also has a variable `path` that then shadows the `path` module.
* Update paths.js
Summary:
The `hasSlash` method uses `path.substr(path, path.length - 1)` to
remove the last character from `path`. Clearly, the first parameter is
suspect; it should be `0`. The code works as written, but only very
accidentally: the first parameter is coerced by `ToNumber` to `NaN`,
which is then coerced by `ToInteger` to `+0`, per [the spec][1].
[1]: https://www.ecma-international.org/ecma-262/6.0/#sec-string.prototype.substr
Test Plan:
Reading the spec should be sufficient. To verify in the Real World:
```js
const path = "has-slash-but-does-not-need-slash/"
const a = path.substr(path, path.length - 1);
const b = path.substr(0, path.length - 1);
console.log(a === b); // true
console.log(a); // has-slash-but-does-not-need-slash
```
wchargin-branch: ensureslash-accidental-coercion
* Run yarn after ejecting.
* On eject, choose to run yarn instead of npm if yarn is available.
* Move monorepo to react-dev-utils.
* Fix lint.
* Rename monorepo to workspaceUtils.
* Add react-dev-utils dep for create-react-app.
* getMonorepo -> findMonorepo
* add default value for globPatterns
without this, the latest alpha broke on start
```
/Users/adeviankakrisnafadlil/Projects/eurecah/node_modules/react-scripts/config/paths.js:130
.reduce(
^
TypeError: Cannot read property 'reduce' of undefined
at findPkgs (/Users/adeviankakrisnafadlil/Projects/eurecah/node_modules/react-scripts/config/paths.js:130:6)
at getMonorepoPkgPaths (/Users/adeviankakrisnafadlil/Projects/eurecah/node_modules/react-scripts/config/paths.js:143:22)
at Object.<anonymous> (/Users/adeviankakrisnafadlil/Projects/eurecah/node_modules/react-scripts/config/paths.js:155:55)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
error Command failed with exit code 1.
```
* also check for pkgPatterns for null
* Update paths.js
* 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.
* support different env configs.
* fomrat code
* Hide doc
* Slightly rework the PR
* Remove .env in default template
* Use just one entry in the paths
* Unify env.js and loadEnv.js
* Oops, forgot these folks
* 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
* Read script names from own bin instead of guessing
This fixes ejecting from a fork that uses a different bin script name.
* Fix ejecting for a scoped react-scripts fork
We shouldn't hardcode react-scripts because fork name might differ.
We also shouldn't rely on it being an immediate child because scoped packages are a level deeper.
* Clarify that own* properties only exist before ejecting
* add npm-link support
* - remove extra veriable
- simplify condition
* update code after review:
- remove utils/isReactScriptsLinked
- add appPath and ownPath to paths.js (but only for "before eject" export case)
* update code after review:
- remove utils/isReactScriptsLinked
- add appPath and ownPath to paths.js (but only for "before eject" export case)
* update code after review:
- remove utils/isReactScriptsLinked
- add appPath and ownPath to paths.js (but only for "before eject" export case)
- remove "if" block for fs.removeSync(ownPath) at ejec.tjs
* change ownPath value
In the `create-react-app` command, try to install packages using Yarn.
If Yarn is not installed, use npm instead.
In `react-scripts`, detect if the project is using Yarn by checking if
a `yarn.lock` file exists. If the project is using Yarn, display all
the instructions with Yarn commands and use Yarn to install packages
in `init` and `eject` scripts.