Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: finish migration to TypeScript #788

Merged
merged 4 commits into from
Oct 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 0 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ commands:
- attach_workspace:
at: ~/react-native-cli
- run: yarn lint
run-typecheck:
steps:
- attach_workspace:
at: ~/react-native-cli
- run: yarn flow-check
run-cocoa-pods-tests:
steps:
- attach_workspace:
Expand Down Expand Up @@ -74,10 +69,6 @@ jobs:
executor: node8
steps:
- run-lint
typecheck:
executor: node8
steps:
- run-typecheck
cocoa-pods:
executor: noderuby
steps:
Expand All @@ -95,7 +86,6 @@ jobs:
steps:
- install-dependencies
- run-lint
- run-typecheck
- run-unit-tests
# TODO: figure out why e2e tests fail even though not interfering with
# other tests
Expand All @@ -108,9 +98,6 @@ workflows:
- lint:
requires:
- setup
- typecheck:
requires:
- setup
- unit-tests:
requires:
- setup
Expand Down
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ node_modules/
debugger-ui/
templates/
global-cli/
flow-typed/
build/
68 changes: 0 additions & 68 deletions .flowconfig

This file was deleted.

68 changes: 40 additions & 28 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

All work on React Native CLI happens directly on GitHub. Contributors send pull requests which go through review process.

> **Working on your first pull request?** You can learn how from this *free* series: [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
> **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).

1. Fork the repo and create your branch from `master` (a guide on [how to fork a repository](https://help.github.com/articles/fork-a-repo/)).
1. Run `yarn` or `npm install` to install all required dependencies.
Expand All @@ -15,8 +15,8 @@ All work on React Native CLI happens directly on GitHub. Contributors send pull

Repository is splitted into two packages:

* `cli` - Historically, it was included in `react-native` package. Contains all the commands code.
* `global-cli` - Historically, it was a `react-native-cli` package and the only reason this package existed was to initialize an empty project.
- `cli` - Historically, it was included in `react-native` package. Contains all the commands code.
- `global-cli` - Historically, it was a `react-native-cli` package and the only reason this package existed was to initialize an empty project.

## Testing your changes

Expand All @@ -30,34 +30,47 @@ node /path/to/cloned/project/packages/cli/build/index.js

You can test your changes by installing local npm proxy - `verdaccio`, and publishing custom versions of `@react-native-community/cli` and `react-native`.

* Install `verdaccio`
- Install `verdaccio`

```sh
yarn global add verdaccio
```
* Run verdaccio

- Run verdaccio

```sh
verdaccio
```
* Set npm registry to `verdaccio` proxy server

- Set npm registry to `verdaccio` proxy server

```sh
npm set registry http://localhost:4873/
```
* Clone `react-native` and `@react-native-community/cli`
* Release new version of `@react-native-community/cli` to local npm proxy. If you have any issues, head over to [verdaccio](https://github.com/verdaccio/verdaccio) and check out the docs.

- Clone `react-native` and `@react-native-community/cli`
- Release new version of `@react-native-community/cli` to local npm proxy. If you have any issues, head over to [verdaccio](https://github.com/verdaccio/verdaccio) and check out the docs.

```
cd /path/to/cli/packages/cli && npm publish
```
* Install new version of `@react-native-community/cli` in `react-native` and publish new version of it.

- Install new version of `@react-native-community/cli` in `react-native` and publish new version of it.

```sh
# RN_CLI_VERSION is the version of localy released cli
cd /path/to/react-native && yarn add @react-native-community/cli@${RN_CLI_VERSION} && npm publish
```
* You are ready to go

- You are ready to go

```sh
# RN_VERSION is the version of localy released react-native
react-native init --version ${RN_VERSION}
```
* Cleanup

- Cleanup

```sh
npm config set registry https://registry.npmjs.org/
```
Expand All @@ -84,34 +97,33 @@ First make sure you have RN repo checked out and CLI repo checked out and built.

## Typechecking, linting and testing

Currently we use `flow` for typechecking, `eslint` with `prettier` for linting and formatting the code and `jest` for testing.
Currently we use TypeScript for typechecking, `eslint` with `prettier` for linting and formatting the code and `jest` for testing.

* `yarn flow`: run `flow`
* `yarn lint`: run `eslint` and `prettier`
* `yarn test`: run unit tests
- `yarn lint`: run `eslint` and `prettier`
- `yarn test`: run unit tests

## Commit message convention

We prefix our commit messages with one of the following to signify the kind of change:

* **build**: Changes that affect the build system or external dependencies
* **ci**, **chore**: Changes to our CI configuration files and scripts
* **docs**: Documentation only changes
* **feat**: A new feature
* **fix**: A bug fix
* **perf**: A code change that improves performance
* **refactor**: A code change that neither fixes a bug nor adds a feature
* **style**: Changes that do not affect the meaning of the code
* **test**: Adding missing tests or correcting existing tests
- **build**: Changes that affect the build system or external dependencies
- **ci**, **chore**: Changes to our CI configuration files and scripts
- **docs**: Documentation only changes
- **feat**: A new feature
- **fix**: A bug fix
- **perf**: A code change that improves performance
- **refactor**: A code change that neither fixes a bug nor adds a feature
- **style**: Changes that do not affect the meaning of the code
- **test**: Adding missing tests or correcting existing tests

## Sending a pull request

When you're sending a pull request:

* Prefer small pull requests focused on one change.
* Verify that `flow`, `eslint` and all tests are passing.
* Preview the documentation to make sure it looks good.
* Follow the pull request template when opening a pull request.
- Prefer small pull requests focused on one change.
- Verify that TypeScript, `eslint` and all tests are passing.
- Preview the documentation to make sure it looks good.
- Follow the pull request template when opening a pull request.

## Reporting issues

Expand Down
1 change: 0 additions & 1 deletion __e2e__/init.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @flow
import fs from 'fs';
import path from 'path';
import {run, getTempDirectory, cleanup, writeFiles} from '../jest/helpers';
Expand Down
1 change: 0 additions & 1 deletion __e2e__/install.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @flow
import path from 'path';
import {run, getTempDirectory, cleanup, writeFiles} from '../jest/helpers';

Expand Down
1 change: 0 additions & 1 deletion __e2e__/legacyInit.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @flow
import fs from 'fs';
import path from 'path';
// @ts-ignore
Expand Down
1 change: 0 additions & 1 deletion __e2e__/uninstall.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @flow
import {run, getTempDirectory, cleanup, writeFiles} from '../jest/helpers';

const DIR = getTempDirectory('command-uninstall-test');
Expand Down
4 changes: 0 additions & 4 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
module.exports = {
babelrcRoots: ['packages/*'],
overrides: [
{
presets: ['@babel/preset-flow'],
test: '**/*.js',
},
{
presets: ['@babel/preset-typescript'],
test: '**/*.ts',
Expand Down
103 changes: 0 additions & 103 deletions flow-typed/npm/execa_v1.0.x.js

This file was deleted.

Loading