Commit Graph

73 Commits

Author SHA1 Message Date
Alexey Kureev bc8b23a009 Run application using package.json scripts
Summary:
**Motivation:**
According to the meeting notes published by mkonicek yesterday, RN should support `yarn run ios` and `yarn run android` commands.

**Test plan (required)**
- [x] Generate a new project and start scaffolded app using `yarn(npm) run ios(android)`
Closes https://github.com/facebook/react-native/pull/12004

Differential Revision: D4441837

Pulled By: mkonicek

fbshipit-source-id: 250f7a9e1efc59e0caa5c2c071b59b97e14e939b
2017-01-20 06:43:41 -08:00
Martin Konicek c4abd5b82a CLI: Refactor printing of version a bit
Summary:
Small renaming after https://github.com/facebook/react-native/pull/11464

**Test plan**

Ran 'react-native init' and 'react-native -v' inside and outside a RN project.

Reviewed By: mkonicek

Differential Revision:
D4339481
Ninja: OSS only

fbshipit-source-id: b23daaee55907761ed0820a707f36ad70d1f1d09
2016-12-16 06:43:33 -08:00
Laguana 349bbb54f7 Fix react-native -v
Summary:
The `checkForVersionArgument` function tries to call `REACT_NATIVE_PACKAGE_JSON_PATH` which isn't defined yet prior to this change. This means that `react-native -v` never reports the version of react-native used in the current project, and in fact never detects the current project.

Fixes #11463
Closes https://github.com/facebook/react-native/pull/11464

Differential Revision: D4339279

Pulled By: mkonicek

fbshipit-source-id: 324d96c97bb06b6156e5582f889bc30b28ca68b2
2016-12-16 04:44:18 -08:00
Martin Konicek 1103a91d8d CLI: Remove message 'This might take a while'
Summary: We now show the npm progress bar.

Reviewed By: mkonicek

Differential Revision:
D4307964
Ninja: OSS only, nit

fbshipit-source-id: 7338ab08abe8cf6354f9a9c6d36c51b0cffc69ee
2016-12-09 13:13:31 -08:00
Martin Konicek 76cd2f7bf2 Allow configuring the way CLI installs react-native
Summary:
- Added an option to override the install command in CI environments (see comment in code)
- Simplify the verbose mode
- Simplify how options are passed round

Test plan (only tested on Mac OS):

    react-native init TestApp
    react-native init TestApp --version 0.36

In both cases the app was generated, package.json contained the correct version (latest, or 0.36).

    react-native init TestApp --verbose

Saw progress bar.

    react-native init InstallCommandTest --installCommand "npm install bad-package-doesnt-exist"

404 error is printed to stdout correctly.

    react-native init TestApp --installCommand "npm install react-native"

The app was generated.

    react-native init InstallCommandTest --installCommand "npm install react-native --verbose" --verbose

Saw verbose output from npm.

Reviewed By: bestander

Differential Revision: D4284642

fbshipit-source-id: f2cdee52ab64831ae3ca064d50f23c5f73a0301f
2016-12-06 13:28:30 -08:00
Martin Konicek fc502704b7 Fix 'Unexpected strict mode reserved word', bump version to 1.3
Summary:
Looks like using 'let' was too ambitious :)

This should fix the issue https://github.com/facebook/react-native/issues/10976.

**Test plan (required)**

Travis & Circle CI tests on this PR.
Closes https://github.com/facebook/react-native/pull/11166

Differential Revision: D4237047

Pulled By: bestander

fbshipit-source-id: 85b548d74a0847621519364201cf71d6649ad605
2016-11-28 03:58:39 -08:00
Martin Konicek a477aec10d Rewrite 'react-native init' and 'react-native upgrade' without using Yeoman in preparation for templates support
Summary:
This is the manually imported version of https://github.com/facebook/react-native/pull/10786

This was mostly straigthforward by replacing the local-cli folder with the version I had in my local git checkout,
plus a few other files I listed with git diff --name-only.

Reviewed By: hramos

Differential Revision: D4201118

fbshipit-source-id: 4d0fb54b0edda9de1abba427958e420fd2ac105c
2016-11-18 18:28:51 -08:00
Fahrradflucht 9c667f2968 Add help option to react-native-cli
Summary:
This PR fixes #10784 by adding a `--help` and a `-h` option to `react-native-cli`.

**Test plan:**
Publish to sinopia and then outside of `react-native` project:
```
$ react-native --help          #same goes for -h

  Usage: react-native [command] [options]

  Commands:

    init <ProjectName> [options]  generates a new project and installs its dependencies

  Options:

    -h, --help    output usage information
    -v, --version output the version number

```
```
$ react-native
You did not pass any commands, run `react-native --help` to see a list of all available commands.
```

**Notes:**
- There is no real consistency in the UX for `react-native-cli` and `local-cli` and even is no real consistency between the UI of `react-native [command] --help` and `react-native --help` in `local-cli` either. I tried to resemble the UX of `react-native --help` as close as possible since it's kind of the nearest neighbour.
- This *doesn't* add support for `react-native init --help` in `react-na
Closes https://github.com/facebook/react-native/pull/10828

Differential Revision: D4168266

Pulled By: hramos

fbshipit-source-id: 079917622bf5b22a3cd6414f13865c1b9c01da01
2016-11-11 23:58:32 -08:00
Martin Konicek 85b8c6ba23 Bump to 1.2.0
Summary:
Turns out I published 1.1.0 previously by accident and unpublished /ducks
Closes https://github.com/facebook/react-native/pull/10684

Differential Revision: D4111999

Pulled By: bestander

fbshipit-source-id: a85c8db6e7f48c9e96a649f017d82cbef44c73ae
2016-11-01 12:50:30 -07:00
Martin Konicek 94711bfb06 Use yarn when available
Summary:
**Motivation**

`react-native init` takes minutes even on a fast network. Yarn makes it much quicker.

When yarn is not installed on the system:

<img width="440" alt="screenshot 2016-10-31 22 21 19" src="https://cloud.githubusercontent.com/assets/346214/19873897/7bad5662-9fb9-11e6-85fb-ad4879949dad.png">

When yarn is installed:

<img width="441" alt="screenshot 2016-10-31 22 02 20" src="https://cloud.githubusercontent.com/assets/346214/19873898/7baf4c56-9fb9-11e6-96b3-007f93d2438a.png">

Also added the option `react-native init AwesomeApp --npm` as a fallback in case yarn is not stable enough for some people (I saw some Github issues that yarn hangs for example; for me it works great though).

**Test plan**
1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli
2. `react-native init AwesomeApp`

***Tested the following setups***

- New CLI - uses yarn, new react-native - uses yarn
- Old CLI (1.0.0) - doesn't use yarn, new react-native - uses yarn
-
Closes https://github.com/facebook/react-native/pull/10626

Differential Revision: D4110883

Pulled By: bestander

fbshipit-source-id: 8a3427e2bc9158cf5fadd8ddf5b31e4b50ce6453
2016-11-01 09:28:52 -07:00
Li Zheng 2289909374 Fix ENOENT when react-native init with --verbose on Windows
Summary:
As PR #5171 was reverted in 521bd03f0a for breaking reason, ENOENT again in issues #5169 , this commit fix it ref to https://github.com/nodejs/node-v0.x-archive/issues/2318#issuecomment-249355505 , and this is the smallest change in file to fix such Windows platform specific bug tdzl2003 mkonicek snowdream sunnylqm
Closes https://github.com/facebook/react-native/pull/10086

Differential Revision: D3919761

Pulled By: bestander

fbshipit-source-id: b878bbade8142a87bd6703d485e501eb28761af5
2016-09-24 17:58:31 -07:00
王大根 f799fa13b8 remove the unnecessary 'var' in `runVerbose`
Summary:
[react-native-cli] Remove the unnecessary 'var' in `runVerbose`, keep pace with `run`.
Closes https://github.com/facebook/react-native/pull/9758

Differential Revision: D3821139

Pulled By: javache

fbshipit-source-id: 7651135a91a22d7e07af89fde20da3194ce054c8
2016-09-06 04:28:38 -07:00
Edward Delaporte 1a683fa5e8 Warn about long run time of init.
Summary:
I, like many before me, had to Google why react-native init appeared to hang the first time I tried it.

It turns out it can just take a really long time, but does not give any warning of this fact.

This patch provides such a warning.
Closes https://github.com/facebook/react-native/pull/9406

Differential Revision: D3716357

Pulled By: bestander

fbshipit-source-id: 6a460c881a20b9edb1bd1c8c5df09e5a7e5020ed
2016-08-15 04:43:51 -07:00
Konstantin Raev f22e9353a7 Made react installed via reac-native init strict to unbreak 15.1.0
Summary:
React@15.1.0 is incompatible with React-Native@0.26.
This PR was cherry-picked to 0.26-stable branch now.

What this change does:
- react-native-cli (major release bump) saves exact versions of react-native and react (only in npm2) dependencies into package.json
- local-cli saves exact version of react (only npm3) dependency into package.json
Closes https://github.com/facebook/react-native/pull/7879

Differential Revision: D3384705

Pulled By: davidaurelio

fbshipit-source-id: d4dff418f9659bd083ae8826433a4e7c0355d03b
2016-06-03 03:43:31 -07:00
Kevin Lacker 16a97c8027 Update error message on unrecognized commands
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

Kevin: This isn't quite a typo, but it's a change to an error message.

In my experience, frequently when this error message is displayed, the command is unrecognized because I haven't run npm install, I just checked out a repo of someone else's. We could just update this error message a bit, and I think it would improve the developer experience.
Closes https://github.com/facebook/react-native/pull/7859

Differential Revision: D3379234

fbshipit-source-id: 4fb6e5bae20904871c9c4f7504013dc18b1fe707
2016-06-02 17:58:28 -07:00
Radek Czemerys dfd1c7dd6a Making sinopia setup easier for the user
Summary:Simply installing `sinopia` does not create a config file (or even a
directory when it should be placed). Running `sinopia` for the first time
generates a default config file so it?s easier for the user to
configure it properly.
Closes https://github.com/facebook/react-native/pull/7146

Differential Revision: D3212613

Pulled By: mkonicek

fb-gh-sync-id: e1a2bbd8311a93b4d8a230902dd8031c85a205c3
fbshipit-source-id: e1a2bbd8311a93b4d8a230902dd8031c85a205c3
2016-04-22 09:26:24 -07:00
Konstantin Raev 993835c815 Allow react-native init <version> + removed sinopia from being required for e2e testing
Reviewed By: mkonicek, frantic

Differential Revision: D3087524

fb-gh-sync-id: 048e23b55916a6be17fa9fabb6e41b0b2f3f7a16
shipit-source-id: 048e23b55916a6be17fa9fabb6e41b0b2f3f7a16
2016-03-24 05:31:23 -07:00
Martin Konicek 521bd03f0a Revert 5da0e135b6
It caused problems on Windows unfortunately and when we tried to
fix it we got: https://github.com/facebook/react-native/issues/5159

Reverting to unblock people. In the future we'll do careful rc
releases of the CLI. We should try to make the change again without
breaking anyone, regardless of OS (OSX, Linux, Windows) or npm version.
2016-01-09 15:30:14 +00:00
Martin Konicek 811079ede2 [global-cli] Bump version to 0.1.9
To release a new version with the fix for Windows:
https://github.com/facebook/react-native/pull/5171

Thanks a lot @tdzl2003!

Tweaked the platform check to use `process.platform`
as that's more common in the codebase. No strong preference,
just for consistency.
2016-01-07 17:03:56 +00:00
DengYun dee984d1dd Do some dirty for windows compatible 2016-01-07 11:43:01 +08:00
Martin Konicek 6af7ae55b1 [global-cli] react-native init [--debug|verbose]
`npm install` prints a lot of junk like gyp warnings
and the rest of the output is not super useful for
tracking progress.

Supress the output by default, show the output with
--debug, and show verbose output with --verbose.
2016-01-05 16:51:28 +00:00
Martin Konicek d87d127402 [global-cli] Fix npm start
Before releasing new react-native-cli, need to look into
suppressing output from 'npm install', added in
5da0e135b6
2016-01-04 23:37:44 +00:00
sunnylqm 1dea58c7df add react-native version output for -v/--version 2015-12-26 22:59:31 +08:00
Pasindu Perera 5da0e135b6 npm progress shown on react init
fixes #3771 for npm 5 and upwards
2015-12-17 14:04:18 +05:30
Arve Knudsen 70b695922e Fix typo 2015-12-12 13:10:36 +01:00
Marius B. Kotsbak c27cfd38e4 Add license and source info
Fixes #4101.
2015-11-12 20:07:28 +01:00
Martín Bigio 539c4d0f64 Steps for alternative testing workflow on the cli 2015-10-28 15:46:23 -04:00
Martin Konicek 9dbb18ad6b [global-cli] Bump version to 0.1.7 2015-10-28 01:31:28 +00:00
Martin Konicek 72c55c525b [global-cli] Link to docs on Node version mismatch 2015-10-27 23:42:25 +00:00
Martin Konicek 20073fcab2 Update README.md 2015-10-27 15:33:42 +00:00
Felix Oghină 864fdd1ebd Merge pull request #3580 from exponentjs/cli-version-check
[CLI] Make `react-native init` check your Node version
2015-10-23 11:57:25 +01:00
Felix Oghină 6f71b790f1 Merge pull request #3297 from exponentjs/node-4-cli
[CLI] Add Node >= 4 requirement to CLI tools
2015-10-23 11:18:44 +01:00
James Ide 64c809345f [CLI] Make `react-native init` check your Node version
We get a bunch of bugs because people are running old versions of Node that don't support modern JS. We have "engines" entries in the package.json files to catch this earlier but printing an explicit error message will also make this clear.

Test Plan: Changed react-native's package.json to require Node >= 5 and got an error message when running the CLI with Node 4.
2015-10-21 12:51:14 -07:00
Martin Konicek f1ab581337 [react-native-cli] Make 'npm start' call 'react-native start' 2015-10-21 11:27:37 +01:00
Martín Bigio 774bbc2f3a [react-native-cli] Remove reference to packager.sh
This script was removed, need to remove the reference we had here.
2015-10-20 22:15:30 -04:00
James Ide 72b713262f [CLI] Add Node >= 4 requirement to CLI tools
React Native's packager now relies on modern V8 so it depends on modern Node. The CLI tools actually run with older versions of Node but the version constraint in the CLI's package.json accomplishes two things:

- Lets us rely on modern V8 in the CLI so we don't have to think about which JS features we can use
- Fails faster up front. So if someone has Node 0.10 for example they will get an error when setting up the CLI tools instead of later on in the process.
2015-10-15 16:15:35 -07:00
Christopher Chedeau d409f13abe Merge pull request #3241 from vjeux/warning_cli
[cli] Add a big warning to stop people from modifying the global cli
2015-10-05 11:21:51 -07:00
Christopher Chedeau cfd19bb6cd [cli] Add a big warning to stop people from modifying the global cli 2015-10-05 11:20:04 -07:00
Christopher Chedeau 92fd668653 [cli] Use contributing.md as readme
The readme is basically empty but contributing has a ton of useful information. Github's interface show everything in readme inline when you open the folder, so might as well make this information more visible.
2015-10-05 10:57:39 -07:00
Benjamin Winterberg a7047d5764 Add --verbose option (fixes #2797) 2015-10-02 10:51:45 +02:00
Felix Oghină 7f9cf97767 Merge pull request #2713 from jmhdez/fix-appName-on-init
[cli] pass arguments from cli instead of using process.argv in init
2015-10-01 12:06:24 +01:00
jmhdez 575e9b7b9a Respect projectName on template creation 2015-10-01 12:39:35 +02:00
Felix Oghină 373c8777f6 [cli] don't swallow require(local_cli) errors 2015-09-16 17:17:13 +01:00
Martin Konicek 42eb5464fd Release React Native for Android
This is an early release and there are several things that are known
not to work if you're porting your iOS app to Android.

See the Known Issues guide on the website.

We will work with the community to reach platform parity with iOS.
2015-09-14 18:13:39 +01:00
Alexander Kotliarskyi 65c4088340 Merge pull request #2573 from nsimmons/cli/add_version_argument
[CLI] Add version argument
2015-09-10 16:23:04 +01:00
Nick Simmons 4f89c61bd8 [CLI] Add version argument 2015-09-08 17:48:16 -04:00
Nick Simmons dca6135d35 updated contributing guide sinopia section to deal with use auth issue 2015-09-05 14:39:57 -04:00
Martin Konicek 6d78b75a10 Update CONTRIBUTING.md 2015-08-26 17:04:53 +01:00
Martin Konicek a0c3b426de Update react-native-cli/CONTRIBUTING.md 2015-08-26 16:35:03 +01:00
Martin Konicek 9576657b57 Update react-native-cli/CONTRIBUTING.md 2015-08-26 16:04:48 +01:00