@anandaroop/yat
Advanced tools
Comparing version 0.3.0 to 1.0.1
{ | ||
"name": "@anandaroop/yat", | ||
"version": "0.3.0", | ||
"version": "1.0.1", | ||
"description": "A silly geolocation component", | ||
@@ -20,2 +20,3 @@ "main": "./lib/index.js", | ||
"babel-preset-react": "^6.24.1", | ||
"jest": "^20.0.4", | ||
"react": "^15.6.1", | ||
@@ -26,9 +27,13 @@ "react-dom": "^15.6.1", | ||
"scripts": { | ||
"build": "rm -rf lib && babel src --out-dir lib", | ||
"transpile": "rm -rf lib && babel src --ignore spec.js,stories.js --out-dir lib", | ||
"build-storybook": "build-storybook", | ||
"bundle": "webpack", | ||
"publish": "npm publish --access public", | ||
"prepare": "yarn run build", | ||
"prepare": "yarn run transpile", | ||
"storybook": "start-storybook -p 6006", | ||
"build-storybook": "build-storybook" | ||
"test": "jest" | ||
}, | ||
"dependencies": { | ||
"react-test-renderer": "^15.6.1" | ||
} | ||
} |
@@ -62,9 +62,30 @@ # yat | ||
- Component source code lives under `/src/components` | ||
- Use Storybook for a nice developer experience, and to document | ||
Component source code lives under `/src/components`. | ||
```sh | ||
cd yat | ||
yarn run storybook | ||
open http://localhost:6006 | ||
Implementations, specs and stories are all co-located under each component directory. | ||
``` | ||
src/components/ | ||
└── Yat | ||
├── __snapshots__ | ||
├── index.js | ||
├── spec.js | ||
└── stories.js | ||
``` | ||
### Testing | ||
Use Jest for behavior and snapshot testing | ||
``` | ||
$ yarn test | ||
``` | ||
### Stories | ||
Use Storybook for a nice developer experience, and to document | ||
``` | ||
$ yarn run storybook | ||
$ open http://localhost:6006 | ||
``` |
import React, { Component } from 'react' | ||
const coordinateString = (coordinates, order) => { | ||
return order === 'lat,lon' | ||
? `${coordinates.latitude}, ${coordinates.longitude}` | ||
: `${coordinates.longitude}, ${coordinates.latitude}` | ||
} | ||
class Yat extends Component { | ||
@@ -26,5 +31,6 @@ constructor(props) { | ||
const { isLocated, longitude, latitude } = this.state | ||
const { order } = this.props | ||
return ( | ||
<div> | ||
{isLocated ? `${longitude}, ${latitude}` : 'locating…'} | ||
{isLocated ? coordinateString({ longitude, latitude }, order) : 'locating…'} | ||
</div> | ||
@@ -35,2 +41,6 @@ ) | ||
Yat.defaultProps = { | ||
order: 'lon,lat' | ||
} | ||
export default Yat |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
284
1
91
12747
1
10
14
+ Addedreact-test-renderer@^15.6.1
+ Addedasap@2.0.6(transitive)
+ Addedcore-js@1.2.7(transitive)
+ Addedcreate-react-class@15.7.0(transitive)
+ Addedencoding@0.1.13(transitive)
+ Addedfbjs@0.8.18(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedisomorphic-fetch@2.2.1(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addednode-fetch@1.7.3(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedpromise@7.3.1(transitive)
+ Addedprop-types@15.8.1(transitive)
+ Addedreact@15.7.0(transitive)
+ Addedreact-is@16.13.1(transitive)
+ Addedreact-test-renderer@15.7.0(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsetimmediate@1.0.5(transitive)
+ Addedua-parser-js@0.7.40(transitive)
+ Addedwhatwg-fetch@3.6.20(transitive)