Skip to content

Commit

Permalink
refactor: refactoring to es7, adding jest (#45)
Browse files Browse the repository at this point in the history
* refactor: refactoring to es7, adding jest

* docs: fixed typo on examples
  • Loading branch information
avishayil authored Apr 26, 2020
1 parent dbe43d3 commit 6637b32
Show file tree
Hide file tree
Showing 101 changed files with 2,035 additions and 10,574 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Example/
lib/
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,7 @@ buck-out/
.expo-shared

# Jest
coverage
coverage

# Bob
lib/
4 changes: 0 additions & 4 deletions .npmignore

This file was deleted.

57 changes: 57 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Contributing to React Native User Avatar

## Development Process

I am an individual wokring on this project, all the work is public and presented on GitHub.

### Development workflow

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/)).
2. Run `yarn bootstrap` to setup the development environment.
3. Do the changes you want and test them out in the example app before sending a pull request.

### Commit message convention

We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for commit messages:

* `fix`: bug fixes, e.g. fixed issues with custom component.
* `feat`: new features, e.g. added a prop or a capability.
* `refactor`: code refactor, e.g. new folder structure.
* `docs`: changes into documentation, e.g. add usage example.
* `test`: adding or updating tests, eg unit, snapshot testing.
* `chore`: tooling changes, e.g. change travis.yml config.
* `BREAKING CHANGE`: for changes that break existing usage, e.g. changed usage.

The built-in pre-commit hooks verify that your commit message matches this format when committing.

### Linting and tests

We use `typescript` for type checking, `eslint` for linting and formatting the code, and `jest` for testing. Our pre-commit hooks verify that the linter and tests pass when commiting. You can also run the following commands manually:

* `yarn typescript`: type-check files with `tsc`.
* `yarn lint`: lint files with `eslint`.
* `yarn test`: run unit tests with `jest`.

### Sending a pull request

When you're sending 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.
* Update the type definitions for Typescript if you changed an API or added a prop.

### Running the example

The example app uses [Expo](https://expo.io/) for the React Native example. You will need to install the Expo app for [Android](https://play.google.com/store/apps/details?id=host.exp.exponent) and [iOS](https://itunes.apple.com/app/apple-store/id982107779) to start developing.

After you're done, you can run `yarn example start` in the project root (or `expo start` in the `Example/` folder) and scan the QR code to launch it on your device.

## Reporting issues

You can report issues on the [bug tracker](https://github.com/avishayil/react-native-user-avatar/issues). Please follow the issue template when opening an issue.

## License

By contributing to React Native User Avatar, you agree that your contributions will be licensed under its **MIT** license.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
42 changes: 42 additions & 0 deletions Example/metro.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const path = require('path');
const fs = require('fs');
const blacklist = require('metro-config/src/defaults/blacklist');
const escape = require('escape-string-regexp');

const root = path.resolve(__dirname, '..');
const pak = JSON.parse(
fs.readFileSync(path.join(root, 'package.json'), 'utf8')
);

const modules = [
'@babel/runtime',
...Object.keys({
...pak.dependencies,
...pak.peerDependencies,
}),
];

module.exports = {
projectRoot: __dirname,
watchFolders: [root],

resolver: {
blacklistRE: blacklist([
new RegExp(`^${escape(path.join(root, 'node_modules'))}\\/.*$`),
]),

extraNodeModules: modules.reduce((acc, name) => {
acc[name] = path.join(__dirname, 'node_modules', name);
return acc;
}, {}),
},

transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
}),
},
};
8 changes: 5 additions & 3 deletions Examples/ExpoExample/package.json → Example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz",
"react-native-web": "~0.11.7",
"react-native-user-avatar": "../../"
"react-native-web": "~0.11.7"
},
"devDependencies": {
"@babel/core": "^7.8.6",
"@babel/runtime": "^7.8.6",
"babel-preset-expo": "~8.1.0",
"@babel/core": "^7.8.6"
"initials": "^3.0.1",
"metro-react-native-babel-preset": "^0.59.0"
},
"private": true
}
Loading

0 comments on commit 6637b32

Please sign in to comment.