Commit Graph
63 Commits
Author SHA1 Message Date
Michał Pierzchała ba14149103 v2.0.0-alpha.21 2019-05-20 14:53:47 +02:00
Kacper WiszczukandMichał Pierzchała b03f7413cc chore: migrate tools to TypeScript (#296)
* Migrate tools package to Typescript

* Prebuild ts

* Improve yarn build-clean

* Remove unnecessary statements

* Fix linting

* Fix eslint

* Update packages/tools/src/isPackagerRunning.ts

Co-Authored-By: Michał Pierzchała <[email protected]>

* adjust package.json

* add vscode helper settings

* remove dead node-fetch references
2019-05-17 22:32:54 +02:00
Michał Pierzchała d3f3aca16f v2.0.0-alpha.20 2019-05-15 17:21:57 +02:00
Michał Pierzchała a41b7a3198 chore: upgrade joi to @hapi/joi to remove npm warnings (#388) 2019-05-15 15:00:37 +02:00
Michał Pierzchała 6947ae2894 v2.0.0-alpha.19 2019-05-13 12:25:44 +02:00
Eric Lewis c423d20317 Add openURLMiddleware (#383)
* Add openURLMiddleware

This allow’s react-native to open Chrome windows arbitrarily.

* Upgrade open, add launchBrowser command.
2019-05-13 11:22:31 +01:00
Lucas Bento 23c52cfbd1 feat: automatically run pod install when running init command (#373)
* Specify `.xcworkspace` on run instructions instead of `.xcodeproj`

* Add `command-exists` package

* Remove unneeded space after log message

* Run `pod install` and check for cocoa pods when running `init` command

* Put pods installation directly on `init` file and verify if `Podfile` exists before running

* Revert change to space

* Remove unneeded `console.log`

* `cd` back to the directory after pod installation

* Throw with `CLIError` instead of `Error`

* Remove unneeded `try…catch`

* Fix wrong uppercased word

* Try to install `cocoapods` without sudo before trying with it

* Run pods installation only on macOS

* Check which extension for the project to print out on the run instructions for iOS

* Use `fs` instead of `fs-extra`

* Move `installPods` to separate file

* Add missing `logger` import

* Fix warnings on duplicated variable declaration

* fixups
2019-05-12 09:38:08 +02:00
Michał Pierzchała 1e60601fac v2.0.0-alpha.18 2019-05-10 15:21:25 +02:00
Michał Pierzchała c7fe3a33ce feat: copy all files in init through streams (#363)
* feat: copy all files in init through streams

* fix asynchrony

* only replace file if necessary
2019-04-30 18:01:21 +02:00
Michał Pierzchała 483003e5d6 v2.0.0-alpha.17 2019-04-25 16:17:49 +02:00
Kacper Wiszczuk afa9680253 feat: improve copying binary files in init (#353) 2019-04-24 20:33:31 +02:00
Mike Grabowski 58b9143fc3 v2.0.0-alpha.15 2019-04-23 23:04:02 +02:00
Michał Pierzchała 513d27bd4c v2.0.0-alpha.14 2019-04-20 11:50:31 +02:00
Michał Pierzchała 827daa4c16 v2.0.0-alpha.13 2019-04-19 19:51:30 +02:00
Mike Grabowski 15cea82c3e v2.0.0-alpha.12 2019-04-18 23:05:23 +02:00
Mike Grabowski a0b9e31542 v2.0.0-alpha.11 2019-04-18 22:12:34 +02:00
Mike Grabowski cacaa075ba v2.0.0-alpha.10 2019-04-18 18:03:21 +02:00
Mike Grabowski e7eeea4a80 v2.0.0-alpha.9 2019-04-18 17:48:52 +02:00
Michał Pierzchała 98d88d5f43 v2.0.0-alpha.8 2019-04-18 16:32:28 +02:00
Michał Pierzchała 60606efd56 v2.0.0-alpha.7 2019-04-17 22:20:33 +02:00
Michał Pierzchała 964c45296d chore: use files instead of npmignore for publishing (#314) 2019-04-13 11:02:02 +02:00
Michał Pierzchała 0a049714b0 v2.0.0-alpha.6 2019-04-10 17:21:42 +02:00
Mike Grabowski 6343e2a892 feat: extract commands out to platform packages (#302)
* wip

* Finish it up

* Clean up packages

* Move files around

* Simplify regex

* Remove unused type

* Move packages around

* Fix type

* Update snapshot

* Make snapshot even smaller

* Throw unlink error
2019-04-10 14:24:20 +02:00
Kacper Wiszczuk 978935ff26 feat: use logkitty to format android logs (#294)
feat: use `logkitty` to format android logs
2019-04-09 12:45:14 +02:00
Michał Pierzchała f1c72e9256 v2.0.0-alpha.5 2019-04-09 08:56:14 +02:00
Michał Pierzchała 49352be129 v2.0.0-alpha.4 2019-04-06 18:40:21 +02:00
Mike Grabowski 5f7dba3d6e feat: extract iOS and Android specific linking files out of the core (#290)
Summary:
---------

Historically, Android and iOS platform were hardcoded inside CLI and provided by default. Then, other packages could export additional platforms on top of it.

React Native as a platform was hardcoded in Metro configuration (default platforms, default extensions) and inside link. That means all new features were always developed with these platforms in mind, leaving others behind. We often used private APIs, which made things more complicated for 3rd party platform developers.

From this PR on, there's no longer concept of an out-of-tree platform inside of the CLI. In a follow up PR to React Native, I am going to configure iOS and Android platforms inside React Native, just like React Native Windows exposes Windows platform.

This will open room for improvements and should make it even easier for the CLI to welcome other platforms.
2019-04-05 22:02:26 +02:00
Kacper Wiszczuk 0d8f2e4182 feat: add React logo and spinners to make init UI nicer (#292)
* Implement spinners for initializing flow

* Use execa module

* Change banner

* Ignore silent flag when in verbose mode

* Refactor packageManager test

* Change loader exports

* Fix e2e test

* Rename packageManager

* Add e2e test

* smaller paddings for React logo

* Cleanup tests

* fix flowfixme

* add space for post install script

* rename packageManager.test as well
2019-04-05 20:37:23 +02:00
Michał Pierzchała 90c0f49249 chore: make legacyInit test less flaky (#286)
Summary:
---------

Get rid of moving parts in legacy init test


Test Plan:
----------

Test runs fine
2019-04-03 10:43:15 +02:00
Michał Pierzchała 65f5f9cdd7 v2.0.0-alpha.1 2019-04-03 09:12:22 +02:00
Michał Pierzchała 05fc3f6ecd fix: set correct peer dep of RN 0.60 for [email protected] (#280) 2019-04-01 18:31:10 +02:00
Mike Grabowski a76fcd4c1d Standardise configuration mechanism (#254)
Summary:
---------

This pull requests brings a new way of configuring the CLI and drops never properly standardised and documented "rnpm" configuration.

This is done in order to support new "auto-linking" feature and consolidate the configuration into a single place, that is easy to customise by developers.

### Highlights

Given the scope of this PR, it's hard to write down every tiny detail. I've tried to leave as many comments as possible throughout the code to make it easier for you to navigate and understand some of the code patterns.

Please see the highlighted changes below:

- We now use `cosmiconfig` to load user preferences. We do that by taking "react-native" out of "package.json" and reading "react-native.config.js". We still read "rnpm" for legacy purposes and print appropriate deprecation messages along the instructions on what to do in order to upgrade. Jest validation library makes this kind of things super easy.

- We validate the provided configuration by user using Jest validation library. This gives instant feedback whether the configuration is correct or not.

- We now read configuration in a single place (happens in main CLI file) and pass it down to commands. Previously, we used to call `findPlugins` multiple times w/o cache, causing expensive globs to be performed.

- Project configuration is lazy. We won't glob node_modules and/or look for native files unless you explicitly read for that package configuration.

- Better support for out-of-tree-platforms - no need to define "haste" yourself, we are able to infer it from other properties. The files are also better organised now, causing less of maintenance pain with "linkConfig" 

- We consider our automatically generated configuration a set of defaults. Users can override settings for the project and each of the dependencies. Useful, especially with auto-linking feature to disable certain packages from it or when you don't want to link particular platform automatically. This has been historically really hard to implement

- Global flags (e.g. "reactNativePath") can now be defined in configuration, instead of passing every time around. This fixes issues with "packager.sh" script (starting automatically Metro when running from Xcode) when run from RNTester.xcodeproj

### Next steps

Once this PR is merged, we can concurrently start working/merging other "auto-linking" PRs. In the meantime, I'll submit a PR to move regular "link" (soon to be considered a legacy) to use the new configuration format as well.

The new configuration has been designed in the way to still include previous configuration keys to support "link" and other community packages. 

For now, we print handy deprecation messages to help migrate the community from "rnpm" to "react-native" configuration. 

When "link" gets deprecated/removed forever in favour of "auto-linking", we should revisit the configuration and eventually, remove extraneous keys out of it. With "auto-linking", we don't need majority of it.

Test Plan:
----------

Run `react-native config` to output the configuration.
2019-04-01 18:10:37 +02:00
Michał Pierzchała 60d93dc166 feat: upgrade envinfo for better output of info command (#265)
* feat: upgrade envinfo for better output

* remove --packages options
2019-03-28 14:09:27 +01:00
Michał Pierzchała af7ac5e3fc v2.0.0 2019-03-15 14:29:33 +01:00
Benoit Lemaire c2fead3c3d chore: bump metro to 0.53 2019-03-15 10:23:52 +01:00
Michał Pierzchała f46578964a v1.4.5 2019-03-14 23:25:17 +01:00
Mike Grabowski ad65130e76 Publish
- @react-native-community/[email protected]
2019-03-14 22:42:20 +01:00
Mike Grabowski 962a59c9f4 Publish
- @react-native-community/[email protected]
2019-03-14 22:35:18 +01:00
Michał Pierzchała a20aad7d9a v1.4.2 2019-03-14 13:09:23 +01:00
Michał Pierzchała 07a976127d fix: linking assets on Android (#231) 2019-03-14 10:32:34 +01:00
Michał Pierzchała b572a9cabc v1.4.1 2019-03-12 21:39:47 +01:00
Michał Pierzchała 2057a9b3c9 fix: set proper peer dependencies (#227) 2019-03-12 21:31:12 +01:00
Michał Pierzchała e32dbb9978 v1.4.0 2019-03-12 17:43:48 +01:00
Michał Pierzchała 069163376f chore: remove some unused files (#217) 2019-03-12 09:14:52 +01:00
Michał Pierzchała 5564634044 chore: simplify commander/minimist usage (#209)
* chore: simplify commander/minimist usage

* feedback

* remove extra parse

* add options back

* rephrase comment

* remove excess whitespace
2019-03-11 16:28:05 +01:00
Mike Grabowski eead4d57d9 Publish
- @react-native-community/[email protected]
2019-02-27 23:02:25 +01:00
Mike Grabowski 49a5fba760 Publish
- @react-native-community/[email protected]
2019-02-27 21:00:22 +01:00
Michał Pierzchała 762c1fdf0c Publish
- @react-native-community/[email protected]
2019-02-22 17:23:39 +01:00
Michał Pierzchała 06036f5473 feat: improve upgrade to use rn-diff-purge (#176)
Summary:
---------

Upgrading experience is a bit harsh for React Native. We either need to install global `react-native-git-upgrade` and try that, or patch projects manually using tools like [`rn-diff-purge`](https://github.com/pvinis/rn-diff-purge).

Since `rn-diff-purge` gets some recognition in RN core and website and it has an automated path of applying patches, I thought that it would be nice to use it in our `upgrade` command.

What the command does now:

1. Determine version to upgrade and run some validation checks
1. Fetch patch between current version and specified from [`rn-diff-purge`](https://github.com/pvinis/rn-diff-purge#version-changes) and rename diff app to current project name
	1. If the patch is empty, install RN and its peer deps
	1. Exit with success
1. Prepare for 3-way merge by creating temporary patch file and adding new git remote
1. Apply patch with a fallback to 3-way merge, exclude `package.json` because it will always be failing
1. Install RN and its peer deps
1. Cleanup temporary files and git remote
1. Exit with success

This PR is technically breaking change, so I'm cool with introducing a temporary new command or put old one behind a different name.

Test Plan:
----------

Added tests with various scenarios. 

Successfully upgrading to specified version:

<img width="648" alt="screenshot 2019-02-16 at 22 22 24" src="https://user-images.githubusercontent.com/5106466/52905364-75a84f00-3239-11e9-9c3a-d3612d194cbf.png">

Failed to fetch a non-existent diff:

<img width="680" alt="screenshot 2019-02-16 at 22 22 49" src="https://user-images.githubusercontent.com/5106466/52905365-75a84f00-3239-11e9-9e92-6fd410271151.png">

No upgrade needed:

<img width="904" alt="screenshot 2019-02-16 at 22 33 27" src="https://user-images.githubusercontent.com/5106466/52905501-4abefa80-323b-11e9-9fec-2e6a44ff09a4.png">

Dependency mismatch:

<img width="988" alt="screenshot 2019-02-16 at 22 36 04" src="https://user-images.githubusercontent.com/5106466/52905502-4abefa80-323b-11e9-92db-ed0d661e493c.png">

Upgrading to older version:

<img width="556" alt="screenshot 2019-02-16 at 22 39 50" src="https://user-images.githubusercontent.com/5106466/52905533-cfaa1400-323b-11e9-9685-d45e24cf0d97.png">
2019-02-22 16:30:24 +01:00
Mike Grabowski 760d384ae1 Publish
- @react-native-community/[email protected]
2019-02-18 17:57:33 +01:00