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

Refactor for plugin capability, add pods and npm clean commands #12

Merged
merged 7 commits into from
May 20, 2019
Merged
Show file tree
Hide file tree
Changes from 6 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules
npm-debug.log
.yarn-error.log
coverage
example
20 changes: 10 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ Please note we have a code of conduct, please follow it in all your interactions

## Pull Request Process

1. Ensure any install or build dependencies are removed before the end of the layer when doing a
build.
2. Update the README.md with details of changes to the interface, this includes new environment
variables, exposed ports, useful file locations and container parameters.
3. Increase the version numbers in any examples files and the README.md to the new version that this
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
do not have permission to do that, you may request the second reviewer to merge it for you.
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
build.
1. Update the README.md with details of changes to the interface, this includes new environment
variables, exposed ports, useful file locations and container parameters.
1. Increase the version numbers in any examples files and the README.md to the new version that this
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
1. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
mikehardy marked this conversation as resolved.
Show resolved Hide resolved
do not have permission to do that, you may request the second reviewer to merge it for you.

## Commit guidelines

Expand All @@ -23,7 +23,7 @@ Please note we have a code of conduct, please follow it in all your interactions
Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
format that includes a **type**, a **scope** and a **subject**:

```
```text
<type>(<scope>): <subject>
<BLANK LINE>
<body>
Expand Down Expand Up @@ -119,7 +119,7 @@ that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

### Scope
### Code of Conduct Scope
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was markdown lint - there were two headings with identical contents, so generated header anchors won't work. So I just changed one slightly. It's just lint so I don't really care, but it's a valid technical change - if it's a poor stylistic change, easy to revert. What do you think?

Copy link
Owner

@pmadruga pmadruga May 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thank you!


This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
Expand Down
50 changes: 28 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,45 @@ Cleans your React Native project by purging caches and modules, and reinstalling

## Running

To run on your console, just run:
### React-Native CLI plugin

This module is automatically detected as a plugin by the standard `react-native` command, adding new sub-commands:

* `react-native clean-project-auto` - fully automated project state clean: like a freshly-cloned, never-started repo
* `react-native clean-project` - interactive project state clean: choose types of react-native state to clean

### Direct execution

For complete control (including using command-line arguments to non-interactively fine-tune what state is cleaned):

`./node_modules/.bin/react-native-clean-project`

Or add it as a script to your `package.json`

```
```json
"scripts": {
"clean": "react-native-clean-project"
}
```

## Content

This is a combination of the commands suggested in the React Native documentation plus others. They are:

1. `rm -rf ios/build` (optional)
2. `rm -rf android/build` (optional)
3. `watchman watch-del-all`
4. `rm -rf $TMPDIR/react-*`
5. `rm -rf $TMPDIR/metro-*`
6. `brew update` (optional)
7. `brew upgrade` (optional)
8. `rm -rf node_modules` (optional)
9. `yarn cache clean`
10. `yarn install`

Command line arguments available for CI's:

- `--remove-iOS-build`
- `--remove-android-build`
- `--keep-node-modules`
- `--keep-brew`
This is a combination of the commands suggested in the React Native documentation plus others.
mikehardy marked this conversation as resolved.
Show resolved Hide resolved

| State Type | Command | In `clean-project-auto`? | Optional? | Default? | Option Flag |
| -------------------- | ----------------------------- | ------------------------ | ---------- | -------- | ---------------------- |
| React-native cache | `rm -rf $TMPDIR/react-*` | Yes | No | true | |
| Metro bundler cache | `rm -rf $TMPDIR/metro-*` | Yes | No | true | |
| Watchman cache | `watchman watch-del-all` | Yes | No | true | |
| NPM modules | `rm -rf node_modules` | Yes | Yes | true | --keep-node_modules |
| Yarn cache | `yarn cache clean` | Yes | Yes | true | --keep-node-modules |
| Yarn packages | `yarn install` | No | Yes | true | --keep-node-modules |
| NPM cache | `npm cache verify` | Yes | Yes | true | --keep-node-modules |
| iOS build folder | `rm -rf ios/build` | Yes | Yes | false | --remove-iOS-build |
| iOS pods folder | `rm -rf ios/pods` | Yes | Yes | false | --remove-iOS-pods |
| Android build folder | `rm -rf android/build` | Yes | Yes | false | --remove-android-build |
| Brew package | `brew update && brew upgrade` | No | Yes | true | --keep-brew |
| Pod packages | `pod update` | No | Yes | true | --keep-pods |

Example: `./node_modules/.bin/react-native-clean-project --remove-iOS-build`

Expand All @@ -58,7 +64,7 @@ Please read [CONTRIBUTING.md](https://github.com/pmadruga/react-native-clean-pro

## Authors

- **Pedro Madruga** - _Initial work and maintenance_ - [pmadruga](https://github.com/pmadruga)
* **Pedro Madruga** - _Initial work and maintenance_ - [pmadruga](https://github.com/pmadruga)

See also the list of [contributors](https://github.com/pmadruga/react-native-clean-project/graphs/contributors) who participated in this project.

Expand Down
9 changes: 5 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ module.exports = {
// snapshotSerializers: [],

// The test environment that will be used for testing
testEnvironment: 'node'
testEnvironment: 'node',

// Options that will be passed to the testEnvironment
// testEnvironmentOptions: {},
Expand All @@ -146,9 +146,10 @@ module.exports = {
// ],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
// testPathIgnorePatterns: [
// "/node_modules/"
// ],
testPathIgnorePatterns: [
'/node_modules/',
'/example/',
],

// The regexp pattern or array of patterns that Jest uses to detect test files
// testRegex: [],
Expand Down
Loading