-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kristofer Selbekk
committed
May 11, 2017
0 parents
commit 4a51068
Showing
16 changed files
with
220 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"presets": ["latest", "react"], | ||
"plugins": [ | ||
'transform-object-rest-spread' | ||
], | ||
"ignore": [ | ||
"test/**/*.js" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.js] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[package.json] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "eslint-config-ffe", | ||
"env": { | ||
"browser": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* text=auto | ||
*.js text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Test coverage reports | ||
.nyc_output/ | ||
coverage/ | ||
|
||
# Node | ||
node_modules/ | ||
npm-debug.log* | ||
|
||
# Generated files | ||
fonts/ | ||
lib/ | ||
!lib/images | ||
examples/*.css | ||
|
||
# Editor files | ||
*sublime-project | ||
*sublime-workspace | ||
.idea/ | ||
|
||
# Added by precommit-hook module | ||
.jshintignore | ||
.jshintrc | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
git-tag-version=false | ||
registry=***REMOVED*** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Changelog for ffe-core-react | ||
|
||
## v.1.0.0 | ||
* First release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# ffe-core-react | ||
|
||
React implementation of the components found in `ffe-core`. | ||
|
||
## Install | ||
|
||
``` | ||
$ npm install --save ffe-core-react | ||
``` | ||
|
||
## Usage | ||
|
||
```javascript | ||
import Core from 'ffe-core-react'; | ||
``` | ||
|
||
## Test | ||
|
||
### Local | ||
|
||
For å teste endringer lokalt kan man kjøre dette i prosjektes mappe: | ||
``` | ||
npm link | ||
``` | ||
Og i prosjektet som skal bruke endringene kan man kjøre | ||
``` | ||
npm link ffe-core-react | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash -e | ||
|
||
main() { | ||
npm install | ||
npm run lint | ||
npm test | ||
npm run build | ||
|
||
if should_publish; then | ||
npm run has-published -s || npm publish | ||
fi | ||
} | ||
|
||
function should_publish() { | ||
[[ $GIT_BRANCH =~ ^(origin/)?master$ ]] | ||
} | ||
|
||
main "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
"name": "ffe-core-react", | ||
"version": "1.0.0", | ||
"description": "React components for ffe-core components", | ||
"scripts": { | ||
"build": "babel -d lib/ src/", | ||
"watch": "onchange 'src/**.js' -- npm run build", | ||
"lint": "eslint src/ test/", | ||
"lint:fix": "eslint --fix src/ test/", | ||
"test": "npm run test:spec && npm run test:nsp", | ||
"test:nsp": "nsp check", | ||
"test:spec": "mocha -G --compilers js:babel-core/register --require ./test/setup.test.js test/**/*.test.js", | ||
"test:watch": "npm run tdd", | ||
"tdd": "mocha -G --compilers js:babel-core/register --require ./test/setup.test.js test/**/*.test.js -w", | ||
"prepublish": "npm run build", | ||
"has-published": "npm show . versions -s --json | grep -q \\\"${npm_package_version}\\\"" | ||
}, | ||
"keywords": [ | ||
"ffe" | ||
], | ||
"peerDependencies": { | ||
"react": "^15.4.0" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.23.0", | ||
"babel-core": "^6.23.1", | ||
"babel-plugin-transform-object-rest-spread": "^6.23.0", | ||
"babel-polyfill": "^6.23.0", | ||
"babel-preset-latest": "^6.22.0", | ||
"babel-preset-react": "^6.23.0", | ||
"babel-register": "^6.23.0", | ||
"enzyme": "^2.7.1", | ||
"eslint": "^3.17.1", | ||
"eslint-config-ffe": "^6.0.1", | ||
"eslint-plugin-import": "^2.2.0", | ||
"eslint-plugin-jsx-a11y": "^3.0.2", | ||
"eslint-plugin-react": "^6.10.0", | ||
"expect.js": "^0.3.1", | ||
"install": "^0.8.7", | ||
"jsdom": "^9.11.0", | ||
"mocha": "^3.2.0", | ||
"nsp": "^2.6.3", | ||
"onchange": "3.2.1", | ||
"react": "^15.4.2", | ||
"react-addons-test-utils": "^15.4.2", | ||
"react-dom": "^15.4.2" | ||
}, | ||
"files": [ | ||
"lib", | ||
"*.js" | ||
], | ||
"main": "lib/index.js", | ||
"author": "SpareBank 1", | ||
"repository": { | ||
"type": "git", | ||
"url": "***REMOVED***" | ||
}, | ||
"publishConfig": { | ||
"registry": "***REMOVED***" | ||
}, | ||
"license": "ISC" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React, { PropTypes } from 'react'; | ||
|
||
export default function Core({ children }) { | ||
return ( | ||
<div> | ||
<h1>Hello FFE!</h1> | ||
{ children } | ||
</div> | ||
); | ||
} | ||
|
||
Core.propTypes = { | ||
children: PropTypes.node, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Core from './Core'; | ||
|
||
export default Core; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"env": { | ||
"mocha": true | ||
}, | ||
"globals": { | ||
"expect": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
|
||
import Core from '../src'; | ||
|
||
const defaultProps = { | ||
children: <p>I'm in a test!</p>, | ||
}; | ||
|
||
const renderShallow = (props = {}) => shallow(<Core {...defaultProps} {...props} />); | ||
|
||
describe('Core', () => { | ||
it('renders children', () => { | ||
const el = renderShallow(); | ||
|
||
expect(el.find('p').text()).to.contain('in a test'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import 'babel-polyfill'; | ||
import jsdom from 'jsdom'; | ||
import expectjs from 'expect.js'; | ||
|
||
global.document = jsdom.jsdom(''); | ||
global.window = document.defaultView; | ||
global.navigator = window.navigator; | ||
global.expect = expectjs; |