Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristofer Selbekk committed May 11, 2017
0 parents commit 4a51068
Show file tree
Hide file tree
Showing 16 changed files with 220 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .babelrc
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"
]
}
15 changes: 15 additions & 0 deletions .editorconfig
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
6 changes: 6 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "eslint-config-ffe",
"env": {
"browser": true
}
}
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto
*.js text eol=lf
23 changes: 23 additions & 0 deletions .gitignore
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 added .npmignore
Empty file.
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
git-tag-version=false
registry=***REMOVED***
4 changes: 4 additions & 0 deletions CHANGELOG.md
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.
28 changes: 28 additions & 0 deletions README.md
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
```
18 changes: 18 additions & 0 deletions buildCI.sh
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 "$@"
62 changes: 62 additions & 0 deletions package.json
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"
}
14 changes: 14 additions & 0 deletions src/Core.js
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,
};
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Core from './Core';

export default Core;
8 changes: 8 additions & 0 deletions test/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"env": {
"mocha": true
},
"globals": {
"expect": false
}
}
18 changes: 18 additions & 0 deletions test/Core.test.js
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');
});
});
8 changes: 8 additions & 0 deletions test/setup.test.js
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;

0 comments on commit 4a51068

Please sign in to comment.