Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
b69309c
react-native-cli initial commit
amasad Mar 20, 2015
28025ee
Allow react-native init <project-or-dir-name>
frantic Mar 22, 2015
67be5a2
Fix few paths for react-native cli scripts
frantic Mar 22, 2015
c09eb8a
Use full path to packager for generated project
frantic Mar 26, 2015
4abb0b5
Lint code - change double to single quotes to keep code style
stephenlacy Mar 26, 2015
eaf1101
Only allow valid identifier names as project names. Fixes #213
amasad Mar 26, 2015
47453c7
Bump react-native-cli version actually
sophiebits Mar 26, 2015
c8172be
Adds missing space character to CLI error message
pgaspar Mar 27, 2015
d8a4b45
created install command and moved cli to local-cli directory
Apr 4, 2015
53a0dba
1-1 port of init script to Nodejs
JoeStanton Mar 29, 2015
c332c32
Require directly, don't spawn
JoeStanton May 14, 2015
39684ea
Added react-native new-library command
JoeStanton Mar 28, 2015
0a3a2f0
Duplicate the name validation for now
JoeStanton May 15, 2015
af26e96
ask confirmation on init command
skv-headless May 15, 2015
e12762e
Merge pull request #1293 from skv-headless/confirm-init-overwrite
frantic May 18, 2015
d4f158a
Fix react-native-cli code formatting
frantic May 18, 2015
3b3ee61
Adds validation check for "React" package name
dsibiski May 23, 2015
b1b93f9
Fixes typo
dsibiski May 23, 2015
00ee669
add README for react-native cli
jsierles May 29, 2015
f3d8c92
capitalize sample app name to avoid issues with JSX
jsierles May 29, 2015
a61abac
Bump react-native-cli version
vjeux Jun 8, 2015
32768cb
Merge pull request #1448 from jsierles/cli-documentation
sahrens Jun 11, 2015
0b1246d
Hide npm output when doing react-native init
frantic Aug 7, 2015
7a8c32a
[cli] add docs on how to contribute to the CLI
foghina Aug 18, 2015
b79bae7
Update react-native-cli/CONTRIBUTING.md
mkonicek Aug 26, 2015
515f562
Update react-native-cli/CONTRIBUTING.md
mkonicek Aug 26, 2015
3a9d129
Update react-native-cli/CONTRIBUTING.md
mkonicek Aug 26, 2015
2f720d3
Update CONTRIBUTING.md
mkonicek Aug 26, 2015
cf47380
updated contributing guide sinopia section to deal with use auth issue
Sep 5, 2015
4a2dea2
[CLI] Add version argument
Sep 6, 2015
db32d70
Merge pull request #2573 from nsimmons/cli/add_version_argument
frantic Sep 10, 2015
17c6e8a
Release React Native for Android
Sep 14, 2015
43f2e1d
[cli] don't swallow require(local_cli) errors
foghina Sep 16, 2015
9cb98bd
Respect projectName on template creation
jmhdez Sep 15, 2015
cc6fc2f
Merge pull request #2713 from jmhdez/fix-appName-on-init
Oct 1, 2015
baa4621
Add --verbose option (fixes #2797)
winterbe Oct 2, 2015
47384a6
[cli] Use contributing.md as readme
vjeux Oct 5, 2015
9c153e4
[cli] Add a big warning to stop people from modifying the global cli
vjeux Oct 5, 2015
4225f4e
Merge pull request #3241 from vjeux/warning_cli
vjeux Oct 5, 2015
09a7e73
[CLI] Add Node >= 4 requirement to CLI tools
ide Oct 9, 2015
ba08ec8
[react-native-cli] Remove reference to packager.sh
martinbigio Oct 21, 2015
59281bc
[react-native-cli] Make 'npm start' call 'react-native start'
Oct 21, 2015
f09423f
[CLI] Make `react-native init` check your Node version
ide Oct 21, 2015
5c6a68a
Merge pull request #3297 from exponentjs/node-4-cli
Oct 23, 2015
e677522
Merge pull request #3580 from exponentjs/cli-version-check
Oct 23, 2015
5ad39df
Update README.md
mkonicek Oct 27, 2015
1af27fc
[global-cli] Link to docs on Node version mismatch
Oct 27, 2015
91ec2fd
[global-cli] Bump version to 0.1.7
Oct 28, 2015
ee4a160
Steps for alternative testing workflow on the cli
martinbigio Oct 28, 2015
202b826
Add license and source info
mkotsbak Nov 12, 2015
b22b7d4
Fix typo
aknuds1 Dec 12, 2015
dc479b0
npm progress shown on react init
udnisap Dec 17, 2015
82ed1c7
add react-native version output for -v/--version
sunnylqm Dec 26, 2015
46292ce
[global-cli] Fix npm start
Jan 4, 2016
f34fe00
[global-cli] react-native init [--debug|verbose]
Jan 5, 2016
ea2282d
Do some dirty for windows compatible
Jan 7, 2016
3d656e2
[global-cli] Bump version to 0.1.9
Jan 7, 2016
9c1c2b8
Revert 5da0e135b6224a2ec9677da3494b8c1e90b06908
Jan 9, 2016
8a9c406
Allow react-native init <version> + removed sinopia from being requir…
bestander Mar 24, 2016
1785cb2
Making sinopia setup easier for the user
radko93 Apr 22, 2016
c13a769
Update error message on unrecognized commands
Jun 3, 2016
26166d7
Made react installed via reac-native init strict to unbreak 15.1.0
bestander Jun 3, 2016
d36986c
Warn about long run time of init.
edthedev Aug 15, 2016
c0eed4f
remove the unnecessary 'var' in `runVerbose`
dragonwong Sep 6, 2016
2801366
Fix ENOENT when react-native init with --verbose on Windows
flyskywhy Sep 25, 2016
aa9f79c
Use yarn when available
Nov 1, 2016
abcae49
Bump to 1.2.0
Nov 1, 2016
adda515
Add help option to react-native-cli
fahrradflucht Nov 12, 2016
b02f0e8
Rewrite 'react-native init' and 'react-native upgrade' without using …
Nov 19, 2016
0d61587
Fix 'Unexpected strict mode reserved word', bump version to 1.3
Nov 28, 2016
22a4862
Allow configuring the way CLI installs react-native
Dec 6, 2016
5a21897
CLI: Remove message 'This might take a while'
Dec 9, 2016
f084ca6
Fix react-native -v
Laguana Dec 16, 2016
6a1b3f8
CLI: Refactor printing of version a bit
Dec 16, 2016
1177973
Run application using package.json scripts
Kureev Jan 20, 2017
eda9215
CLI: Add support for project templates
Feb 6, 2017
7c4e9e3
Cast name to String to ensure .match is available
benjick Feb 18, 2017
64383bd
14081 mute yarn check error on Windows
FLGMwt May 26, 2017
d26db7d
Fail gracefully for node<4 in react-native-cli (const->var)
rh389 Jun 6, 2017
8b89f87
Convert easy files to Prettier
elicwhite Jul 12, 2017
aab032e
Revert D5409825: [RN] Convert easy files to Prettier
elicwhite Jul 13, 2017
c6f5f4f
Update license headers for MIT license
sophiebits Feb 17, 2018
444fd5c
Update to MIT license
sophiebits Feb 17, 2018
dfa88e7
Prettier files with shebang
elicwhite May 11, 2018
4106e33
added extra sinopia config to support packages (#20789)
falconmick Aug 23, 2018
0324d46
Update copyright headers to yearless format
hramos Sep 11, 2018
0b4449c
Adopt to new structure
grabbou Sep 28, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions packages/global-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
## Running CLI with local modifications

React Native is distributed as two npm packages, `react-native-cli` and `react-native`. The first one is a lightweight package that should be installed globally (`npm install -g react-native-cli`), while the second one contains the actual React Native framework code and is installed locally into your project when you run `react-native init`.

Because `react-native init` calls `npm install react-native`, simply linking your local github clone into npm is not enough to test local changes.

### Introducing Sinopia

[Sinopia] is an npm registry that runs on your local machine and allows you to publish packages to it. Everything else is proxied from `npmjs.com`. We'll set up sinopia for React Native CLI development. First, install it with:

$ npm install -g sinopia

Now you can run sinopia by simply doing:

$ sinopia

Running it for the first time creates a default config file. Open `~/.config/sinopia/config.yaml` and configure it like this (note the `max_body_size`):

storage: ./storage

auth:
htpasswd:
file: ./htpasswd

uplinks:
npmjs:
url: https://registry.npmjs.org/

packages:
'react-native':
allow_access: $all
allow_publish: $all

'react-native-cli':
allow_access: $all
allow_publish: $all

'**':
allow_access: $all
proxy: npmjs

'*':
allow_access: $all
proxy: npmjs

logs:
- {type: stdout, format: pretty, level: http}

max_body_size: '50mb'

Remember to restart sinopia afterwards.

### Publishing to sinopia

Now we need to publish the two React Native packages to our local registry. To do this, we configure npm to use the new registry, unpublish any existing packages and then publish the new ones:

react-native$ npm set registry http://localhost:4873/
react-native$ npm adduser --registry http://localhost:4873/
# Check that it worked:
react-native$ npm config list
react-native$ npm unpublish --force
react-native$ npm publish
react-native$ cd react-native-cli/
react-native-cli$ npm unpublish --force
react-native-cli$ npm publish

### Running the local CLI

Now that the packages are installed in sinopia, you can install the new `react-native-cli` package globally and when you use `react-native init`, it will install the new `react-native` package as well:

$ npm uninstall -g react-native-cli
$ npm install -g react-native-cli
$ react-native init AwesomeApp

## Testing changes

Most of the CLI code is covered by jest tests, which you can run with:

$ npm test

Project generation is also covered by e2e tests, which you can run with:

$ ./scripts/e2e-test.sh

These tests actually create a very similar setup to what is described above (using sinopia) and they also run iOS-specific tests, so you will need to run this on OSX and have [xctool] installed.

Both of these types of tests also run on Travis both continuously and on pull requests.

[sinopia]: https://www.npmjs.com/package/sinopia
[xctool]: https://github.com/facebook/xctool

## Clean up

To unset the npm registry, do:

$ npm set registry https://registry.npmjs.org/
# Check that it worked:
$ npm config list

## Troubleshooting

##### Sinopia crashes with "Module version mismatch"

This usually happens when you install a package using one version of Node and then change to a different version. This can happen when you update Node, or switch to a different version with nvm. Do:

$ npm uninstall -g sinopia
$ npm install -g sinopia

After upgrading to Node 4 you might also need to reinstall npm. What worked for me was:

$ npm uninstall -g npm
$ nvm install npm

See the [nvm guide](https://github.com/creationix/nvm#usage) for more info.

### Alternative workflow

If you don't want to install Sinopia you could still test changes done on the cli by creating a sample project and installing your checkout of `react-native` on that project instead of downloading it from npm. The simplest way to do this is by:

$ npm init AwesomeProject
$ cd AwesomeProject
$ npm install $REACT_NATIVE_GITHUB

Note that `REACT_NATIVE_GITHUB` should point to the directory where you have a checkout.

Also, if the changes you're making get triggered when running `react-native init AwesomeProject` you will want to tweak the global installed `react-native-cli` library to install the local checkout instead of downloading the module from npm. To do so just change this [line](https://github.com/facebook/react-native/blob/master/react-native-cli/index.js#L191) and refer the local checkout instead.
Loading