Commit Graph
50 Commits
Author SHA1 Message Date
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
Michał Pierzchała bd332b3add fix: setup_env script failure (#182)
* fix: setup_env script failure

* chore: adjust the message and remove unused windows script

* fix: adjust platform check and wording

* chore: remove dot for continuity with error
2019-02-22 09:16:19 +01:00
Eric Lewis 489ab232c0 allow absolute path for templates 2019-02-20 17:26:15 -05:00
Michał Pierzchała 27d4924a58 feat: refactor install to use link directly instead of spawning it (#180)
Summary:
---------

Attempt No. 2 after https://github.com/react-native-community/react-native-cli/pull/178. Turned out I passed empty array as `platforms` argument to link, while I should pass `undefined`. We could actually add `--platforms` support to `install`/`uninstall` now, what do you think?

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

Uninstalling:

<img width="677" alt="screenshot 2019-02-19 at 13 42 54" src="https://user-images.githubusercontent.com/5106466/53015940-8ed51980-344c-11e9-9f22-0406c468a10d.png">

Installing: 

<img width="668" alt="screenshot 2019-02-19 at 13 43 02" src="https://user-images.githubusercontent.com/5106466/53015941-8ed51980-344c-11e9-8556-a6350f05536f.png">
2019-02-19 13:54:36 +01:00
Mike Grabowski 760d384ae1 Publish
- @react-native-community/[email protected]
2019-02-18 17:57:33 +01:00
Mike Grabowski ce12f21ce1 fix: unlink not working (#177) 2019-02-18 17:54:14 +01:00
Mike Grabowski cf99cd1b2c Revert "feat: better logging for install/uninstall; less spawning; fix unlinking (#174)"
This reverts commit 32cc3a2d75.
2019-02-18 17:53:33 +01:00
Michał Pierzchała 32cc3a2d75 feat: better logging for install/uninstall; less spawning; fix unlinking (#174)
Summary:
---------

- [x] use link/unlink directly from source instead of spawning
- [x] fix unlinking failing to get dependencies
- [x] improve logging

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

<img width="684" alt="screenshot 2019-02-15 at 23 40 29" src="https://user-images.githubusercontent.com/5106466/52888210-2996d500-317b-11e9-9a37-402de8f50167.png">
<img width="692" alt="screenshot 2019-02-15 at 23 40 50" src="https://user-images.githubusercontent.com/5106466/52888211-2996d500-317b-11e9-8b7e-2cdc4a4f6a94.png">
2019-02-16 16:11:12 +01:00
Michał Pierzchała b119dd2ae6 Update cli README subheadings 2019-02-16 10:00:23 +01:00
Mehdi A 9bc53ff8ca docs: document the run-ios command (#175)
document the --simulator argument for the react-native run-ios command to allow user to launch their app on a specific iOS simulator based by its official name

Regarding the #169 issue

cc @thymikee
2019-02-16 09:58:52 +01:00
Mike Grabowski 74a5cb6ea2 Publish
- @react-native-community/[email protected]
 - [email protected]
2019-02-15 10:53:06 +01:00
Mike Grabowski 17b73b3e32 fix: printing error and unknown command messages when unnecessary (#171)
Summary:
---------

The logic for printing an unknown command was always a hack and the one for printing a help when no command provided never worked.

I did a research and found out there's a recommended (Commander way) of doing this.

It also fixes a regression I've noticed in https://github.com/react-native-community/react-native-releases/issues/79#issuecomment-463933483

![](https://user-images.githubusercontent.com/5376380/52840468-f711bb80-312b-11e9-9bb3-65b9676e3132.png)

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

Run w/o command, run with wrong command.
2019-02-15 10:46:47 +01:00
Dulmandakh 9390ad889f fix: exclude debug folder from findManifest command (#170)
* exclude debug folder from findManifest command

* fix formatting

* fix lint
2019-02-15 10:14:32 +01:00
Michał Pierzchała 3a3028d4f3 Publish
- @react-native-community/[email protected]
2019-02-14 08:40:13 +01:00
Michał Pierzchała 251e34a7b3 v1.2.1 2019-02-14 08:32:22 +01:00
Michael Diarmid 28d4de9733 fear: export getDefaultConfig (#167) 2019-02-14 06:55:15 +01:00
Michael Diarmid c50e64b8ec fix: return full file path for InitializeCore incl. extension (#165)
* require.resolve `InitializeCore` 

Ensure `InitializeCore` path is the full path with extension.

* linting
2019-02-14 06:54:51 +01:00
Mike Grabowski dee16f3b73 fix: improve passing global flags to the CLI (#162)
* fix: use absolute path in init

* fix: Improve CLI logic

* chore: make the flags appear in the output

* chore: use else-if
2019-02-13 16:00:01 +01:00
Mike Grabowski 2d185c72ef Publish
- @react-native-community/[email protected]
 - [email protected]
2019-02-13 15:00:56 +01:00
ifsnow b3c20b9351 Fix: problem on run-android with deviceId (#137)
* fix: problem on run-android with deviceId

* fix: change the logic to find the appropriate apk file

* fix: adding logging message

* fix: added command default value
2019-02-12 15:11:02 +01:00
Kacper Wiszczuk 7b77b36ddb fix: make prettier happy (#161) 2019-02-12 10:53:26 +01:00
Connor Love 6178e05d93 fix: ignore non-nativetargets during ios linking (#123)
* fix: ignore non-nativetargets during ios linking

fixes issue #57

* refactor: reuse variable and reorder array methods

Makes use of the single variable nativeTargetSection and puts filter before map when filtering out non-native targets.
2019-02-11 17:09:37 +01:00
Lucas Bento fb62f9b27d feat: show help when no arguments are provided (#160)
* feat: show help when no arguments are provided

* fix: add unknown command info back

* chore: visual adjustments
2019-02-11 12:20:56 +01:00
Kacper Wiszczuk 72c3dd4282 refactor: use PackageManager and improve init logging (#156)
* refactor: use PackageManager and improve init logging

* fix: review suggestions

* refactor: improve logger once again

* refactor: bold to logs status
2019-02-11 12:11:14 +01:00
Sid Ferreira fb4c39940f chore: use ESM exports where appropriate (#151)
This is an extra for #150 
Fixes exports and tweaks some tests.

The `link`, `linkAssets`, and `linkDependency` where trickier as hell, but we have all tests working.

I suggest take it easy in this review as I'm worried in a "false positive" in tests as there was a LOT of changes.

We need to improve the code coverage for changes like this have smaller chances of failing...
2019-02-07 19:16:24 +01:00
Kacper Wiszczuk d485824105 build: refactor installing packages
* build: refactor installing packages

* chore: revert version change

* fix: review fixes

* fix: review changes and install/uninstall command fixes

* fix: one more review fix
2019-02-06 17:31:47 +01:00
Kacper Wiszczuk 5fa631d2ae refactor: disable logger in tests (#155)
* refactor: disable logger in tests

* fix: review fixes

* fix: implement review suggestion
2019-02-06 16:40:23 +01:00
Sid Ferreira b2a6359a74 refactor: change require to imports (#150)
* refactor(imports): replaces most uses of require by import

* fix: fixes export and revert wrong change

* fix: fix import order

* fix: revert export change

* fix: revert global-cli/index

* fix: typo
2019-02-05 14:06:03 +01:00
Devin Canterberry b7d2c8fe23 fix: xcode 10.2 compatibility for run-ios command (#138)
parse output of simulator list provided by xcode 10.2

In Xcode 10.2, the output of `xcrun simctl list --json devices`
has changed to include a namespace within each version group.
This commit makes a backwards-compatible adjustment to account
for this change in format.

To illustrate:

Before
======

```
{
  "devices": {
    "iOS 10.0": [
      ...
    ]
  }
}
```

After
=====

```
{
  "devices": {
    "com.apple.CoreSimulator.SimRuntime.iOS-10-0": [
      ...
    ]
  }
}
```
2019-02-04 23:12:07 +01:00
Michał Pierzchała 986fc35384 chore: remove npmlog dependency (#149) 2019-02-04 14:26:02 +01:00
Sid Ferreira 486a65a931 refactor: Unify logging (#146)
* refactor(logger): replaces all `console` uses

* refactor(logger): tweaks chalk usage

* fix: remove unused chalk

* fix: remove `chalk.yellow` and unused chalk

* fix: changes some info to error

* fix: revert Debugger changes

* fix: remove pending bold, join outputs
2019-02-04 14:22:30 +01:00
Mike Grabowski 65eff59246 build: update xcode version to 2.0.0 (#147) 2019-02-04 13:16:37 +01:00
Mike Grabowski 2a180e0231 feat: allow setting different React Native path (#144)
* feat: allow setting different React Native path

* fix: remaining flow errors

* feat: remove dep on React Native

* chore: ignore error from init

* Update packages/cli/src/cliEntry.js

Co-Authored-By: grabbou <[email protected]>

* chore: explicitly disable eslint
2019-02-04 13:12:27 +01:00
Mike Grabowski 4ee44da8f8 fix: run-android not finding scripts to overwrite (#141)
Fixes #126 

We need to change this approach, issue tracking in #140.
2019-02-01 15:36:06 +01:00
Mike Grabowski 6526bdd834 fix: improve overall run-ios experience and get rid of CFBundleIdentifier (#139)
Fixes #107 

Summary:
---------

Bugs fixed:
- "CFBundleIdentifier" printed every time "run-ios" fails, shadowing the real cause for the problem
- "run-ios" running a previous/cached version of an app (usually when there was an error during build step that was ignored)

Changes made:
- Decided to turn Flow and ESLint and apply all the changes as I am working on it. I know the diff might be strange at first sight, but if you look closely, it's just cosmetics to satisfy various rules
- I also extracted some blocks to separate utilities for better readability
- I also removed a no longer needed check for CRNA which is deprecated (and IMO, is not needed)
- Converted few functions to "async" form for better readability
- Started capturing the "stderr" of "xcodebuild" and started relying on its error code in order to avoid going to next step when it fails
- Added a new type of error to differentiate from other errors and also be able to capture additional data. Logic and styling subject to change, encapsulated inside Logger.

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

Here's how the error messages look before/now:

While try to build a project with a wrong "schema" :

Before:
<img width="882" alt="screenshot 2019-01-31 at 18 07 43" src="https://user-images.githubusercontent.com/2464966/52071369-200a4c00-2583-11e9-8700-28766daae122.png">

After:
<img width="880" alt="screenshot 2019-01-31 at 18 05 23" src="https://user-images.githubusercontent.com/2464966/52071244-d91c5680-2582-11e9-83e7-e9e549a570cc.png">

While building a project that has a typo in "AppDelegate.m":

Before:
<img width="885" alt="screenshot 2019-01-31 at 18 08 19" src="https://user-images.githubusercontent.com/2464966/52071411-344e4900-2583-11e9-8613-96ddf6c68006.png">

After:
<img width="886" alt="screenshot 2019-01-31 at 18 06 36" src="https://user-images.githubusercontent.com/2464966/52071300-f6e9bb80-2582-11e9-9c9f-3a4b67318119.png">

You can try it out by running `run-ios` command on a broken project (typo, wrong configuration) or by passing a non-existing `schema`
2019-02-01 11:33:17 +01:00
Soo Jae Hwang b33d079eb9 fix: schema option on run-ios not installing and loading the right bundle (#128) 2019-01-31 15:54:44 +01:00
Kacper Wiszczuk 2ff7ef9260 feat: use logger to cliEntry and bin files (#120)
* feat: add logger

* feat: change separator of logs

* feat: use logger

* feat: add logger in bin and cliEntry files

* feat: review suggestions
2019-01-28 17:36:48 +01:00
Michał Pierzchała 56e890dc7f fix: normalize paths for Gradle on Windows (#130)
Summary:
---------

Fixes #129


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

I added a test that simulates Windows on POSIX machines, because we don't run our tests on Windows.
@cherniavskii can you test this on a Windows machine?
2019-01-28 17:36:18 +01:00
Michał Pierzchała baae22176c feat: use logger in info, init, install, uninstall (#122)
Summary:
---------

More files using `logger`!

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

Green CI
2019-01-28 17:28:15 +01:00
Arnab Sen 03dc0768f7 Update runAndroid.js (#119)
Remove non-existent react-native android message
2019-01-24 16:46:07 +01:00
Michał Pierzchała ec1e97d7a0 feat: add logger to link command (#118)
* feat: add logger to link command

* chore: simplify jest config

* fix: lint
2019-01-24 12:33:40 +01:00
K. P. Sroka 1c181095c2 feat: Removes calls to process.pwd() in favor of using context.root (#116)
* feat: use ctx.root instead of process.cwd() in several commands

* test: upgrading patch version of jest to avoid worker system bug
2019-01-23 19:59:16 +01:00
Kacper Wiszczuk 7ca57a5ad8 feat: use common logger part 1
Introduce logger to bundle core and eject
2019-01-23 19:04:27 +01:00
Kacper Wiszczuk 802e4ec3f2 feat: add logger (#113)
Add simple logger.
2019-01-23 18:28:36 +01:00
Michał Pierzchała 61bc2882f5 chore: setup monorepo with Lerna (#109)
* chore: setup monorepo with lerna

* chore: move flow to root

* fix: lint

* chore: add watch command
2019-01-23 18:04:01 +01:00
Michał Pierzchała 861b0c3fb4 chore: don't publish src now that we build it (#108) 2019-01-21 14:18:54 +01:00
Michał Pierzchała db27b413a2 chore: use babel --copy-files flag (#106) 2019-01-21 13:54:05 +01:00
Michał Pierzchała 5480060e5f chore: followup after #104 (#105)
* feat: build before publishing

* fix(tests): use jest.doMock instead of setMock

* chore: rename local-cli -> cli

* chore: get rid of local-cli leftovers

* fix: typo
2019-01-21 13:49:30 +01:00
Michał Pierzchała 3aac9df01c feat: build before publishing (#104)
* feat: build before publishing

* fix(tests): use jest.doMock instead of setMock

* chore: rename local-cli -> cli
2019-01-21 13:40:58 +01:00