Skip to content

Commit

Permalink
refactor: create-react-app react-google-maps
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchentw committed Oct 4, 2016
1 parent 5ca2057 commit e75d33c
Show file tree
Hide file tree
Showing 126 changed files with 471 additions and 1,866 deletions.
3 changes: 3 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@ ratings:
# exclude_paths key.

exclude_paths:
- coverage/**
- docs/**
- lib/**
- public/**

3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/node_modules/**
coverage/**
docs/**
lib/**
public/**
37 changes: 4 additions & 33 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,39 +1,10 @@
{
"parser": "babel-eslint",
"extends": "airbnb",
"env": {
"browser": true,
"mocha": true,
"node": true,
},
"ecmaFeatures": {
"arrowFunctions": true,
"classes": true,
"modules": true,
"jsx": true
},
"plugins": [
"react"
],
"extends": "react-app",
"rules": {
// Possible Errors
"comma-dangle": [2, "always-multiline"],
// Best Practices
"consistent-return": [0],
"no-else-return": [0],
"yoda": [2, "never", {"exceptRange": true}],
// Variables
"no-use-before-define": [2, "nofunc"],
"no-unused-vars": [2, {"args": "none"}],
"comma-dangle": ["error", "always-multiline"],
// Stylistic Issues
"camelcase": [0],
"no-underscore-dangle": [0],
"quotes": [2, "backtick"],
// React extensions
"react/sort-comp": [1],
"react/prop-types": [1],
},
"globals": {
"google": true,
"jsx-quotes": ["error", "prefer-double"],
"quotes": ["error", "backtick"]
}
}
10 changes: 0 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,3 @@ node_modules

# Users Environment Variables
.lock-wscript


### Project ###

.module-cache
public/assets
public/**/assets
public/**/*.html
public/*.gz
tmp/*
15 changes: 4 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
sudo: false
language: node_js
node_js:
- '5'
- '4'
before_install:
- git submodule update --init
- npm install -g npm
install:
- npm install
- cd examples/gh-pages && npm install && cd ../..
- cd examples/simple-map && npm install && cd ../..
- '6'
script:
- npm run test:cov
- npm test -- --coverage
after_script:
- if [[ `node --version` == *v4* ]]; then cat ./coverage/lcov.info | ./node_modules/.bin/codeclimate-test-reporter; fi
- if [[ `node --version` == *v6* ]]; then cat ./coverage/lcov.info | ./node_modules/.bin/codeclimate-test-reporter;
fi
env:
global:
secure: gYr2P0NQiF4sdolyrwfAURyM/SWPeYvYjhZdVQrGC1RszfpKFJuXvUAZsxA8zdco+oPTn1YeVbbqvOL+ZwAAZr58N9Ou0v/wwDc7XPRpn1odAHTFi5o5yAmX12SIKmt7O9UeT/hIu0ejyd85d2XHsQiGdVWDno4nrNZUnar/PgE=
38 changes: 37 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,33 @@
# Contributor Guideline
# Contributing to React-Google-Maps

## Convention

### `src/lib` contains core library

* Please add new features/fix bugs here
* They'll be compiled by babel into `lib` folder
* Don't manually modify contents under `lib` folder

### `src/app` contains docs app

* It can be served as local app for core library development
* It'll be released as `gh-pages` into `build` folder
* Don't manually modify contents under `build` folder


## Development

[![devDependency Status][david-dm-image]][david-dm-url]


```shell
git clone ...
npm install
npm start
```

Now you can develop!


## Reporting bugs

Expand All @@ -9,14 +38,17 @@ Please provide a test case of some sort that reproduces the bug. Possible ways o
- a gist that that illustrates the bug.
- some copy/pastable code is acceptable.


## New or Changed API proposals

Please provide thoughtful comments and some sample code. Proposals without substance will not be considered and closed.


## Issue not getting attention

We do our best to work all the issues, but if you report a bug and need it fixed and nobody is fixing it, we highly appreciate if you can fix it. Issues with no activity for long time may be closed.


## How to make a PR

Simple rules when making a pull request:
Expand All @@ -32,6 +64,7 @@ Simple rules when making a pull request:
We use [standard-version][standard-version] to automatically generate [CHANGELOG.md][CHANGELOG.md] from the `git commit` history. Please **do** follow [the commit format][commit-format] before commiting.


## For collaborators with write permissions

If you are a collaborator with write permission for this repository, you're free to do changes. But in order to keep changes trackable, please follow the guideline here:
Expand Down Expand Up @@ -67,6 +100,9 @@ Right now, only the owner (author) has the write permission on npm. But the proc
* The last step is release the changes to `origin` and `npm`.



[david-dm-image]: https://img.shields.io/david/dev/tomchentw/react-google-maps.svg?style=flat-square
[david-dm-url]: https://david-dm.org/tomchentw/react-google-maps#info=devDependencies
[standard-version]: https://github.com/conventional-changelog/standard-version
[CHANGELOG.md]: ./CHANGELOG.md
[commit-format]: https://github.com/conventional-changelog/standard-version#commit-message-convention-at-a-glance
68 changes: 7 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ As the author ([tomchentw][tomchentw]) currently doesn't actively use this modul

Declare your Google Maps components using React components.

```js
```jsx
import {GoogleMapLoader, GoogleMap, Marker} from "react-google-maps";

export default function SimpleMap (props) {
Expand Down Expand Up @@ -79,7 +79,7 @@ Anything that is inside components' `options` property can __ONLY__ be accessibl

Event handlers on these components can be bound using React component convention. There's a list of event names that exist in the `eventLists` folder. Find the supported event name and use the form of `on${ camelizedEventName }`. For example, If I want to add `center_changed` callback to a map instance, I'll do the following with `react-google-maps`:

```js
```jsx
<GoogleMap
// onCenterChanged: on + camelizedEventName(center_change)
onCenterChanged={this.handleCenterChanged}
Expand Down Expand Up @@ -120,15 +120,15 @@ You could do it synchronously like so:
</script>
```

```js
```jsx
<GoogleMapLoader
query={{ libraries: "geometry,drawing,places,visualization" }}
...
```

Or asynchronously using the ScriptjsLoader:

```js
```jsx
<ScriptjsLoader
hostname={"maps.googleapis.com"}
pathname={"/maps/api/js"}
Expand All @@ -140,7 +140,7 @@ Or asynchronously using the ScriptjsLoader:

`triggerEvent(component, ...args)`: One common event trigger is to resize map after the size of the container div change.

```js
```jsx
import {triggerEvent} from "react-google-maps/lib/utils";

function handleWindowResize () {
Expand All @@ -154,15 +154,15 @@ function handleWindowResize () {

You could of course import from individual modules to save your [webpack][webpack]'s bundle size.

```js
```jsx
import GoogleMap from "react-google-maps/lib/GoogleMap"; // Or import {default as GoogleMap} ...
```

### Additional Addons

Some addons component could __ONLY__ be accessible via direct import:

```js
```jsx
import InfoBox from "react-google-maps/lib/addons/InfoBox";
```

Expand All @@ -172,58 +172,6 @@ import InfoBox from "react-google-maps/lib/addons/InfoBox";
The changelog is automatically generated via [conventional-changelog][conventional-changelog] and [can be found in project root](https://github.com/tomchentw/react-google-maps/blob/master/CHANGELOG.md) as well as npm tarball.


## Development

First, clone the project.

```shell
git clone ...
```

### With Docker

Install `docker@^1.8.2`, `docker-compose@^1.4.0` and optionally `docker-machine@^0.4.1`. Then,

```shell
docker-compose run --service-ports web
```

Then open [http://192.168.59.103:8080](http://192.168.59.103:8080).

**192.168.59.103** is actually your ip from `docker-machine ip`.

If you change code in your local, you'll need to rebuild the image to make changes happen.

If you're previously using `boot2docker`, you may want to migrate to [docker-machine](https://docs.docker.com/machine/migrate-to-machine/) instead.

```shell
docker-compose build
```

### Without Docker

Install `node`. Then,

```shell
npm install
cd examples/gh-pages
npm install
npm start
```

Then open [http://localhost:8080/webpack-dev-server/](http://localhost:8080/webpack-dev-server/).


## Contributing

[![devDependency Status][david-dm-image]][david-dm-url]

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request


[npm-image]: https://img.shields.io/npm/v/react-google-maps.svg?style=flat-square
[npm-url]: https://www.npmjs.org/package/react-google-maps
Expand All @@ -238,8 +186,6 @@ Then open [http://localhost:8080/webpack-dev-server/](http://localhost:8080/webp
[gemnasium-url]: https://gemnasium.com/tomchentw/react-google-maps
[gitter-image]: https://badges.gitter.im/Join%20Chat.svg
[gitter-url]: https://gitter.im/tomchentw/react-google-maps?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
[david-dm-image]: https://img.shields.io/david/dev/tomchentw/react-google-maps.svg?style=flat-square
[david-dm-url]: https://david-dm.org/tomchentw/react-google-maps#info=devDependencies


[tomchentw]: https://github.com/tomchentw
Expand Down
18 changes: 0 additions & 18 deletions examples/gh-pages/.babelrc

This file was deleted.

12 changes: 0 additions & 12 deletions examples/gh-pages/Dockerfile

This file was deleted.

44 changes: 0 additions & 44 deletions examples/gh-pages/package.json

This file was deleted.

Loading

0 comments on commit e75d33c

Please sign in to comment.