Skip to content

Commit 2d4ae3c

Browse files
committed
Initial commit from nwb v0.21.5
0 parents  commit 2d4ae3c

10 files changed

+160
-0
lines changed

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/coverage
2+
/demo/dist
3+
/es
4+
/lib
5+
/node_modules
6+
/umd
7+
npm-debug.log*

.travis.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
sudo: false
2+
3+
language: node_js
4+
node_js:
5+
- 8
6+
7+
before_install:
8+
- npm install codecov.io coveralls
9+
10+
after_success:
11+
- cat ./coverage/lcov.info | ./node_modules/codecov.io/bin/codecov.io.js
12+
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
13+
14+
branches:
15+
only:
16+
- master

CONTRIBUTING.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Prerequisites
2+
3+
[Node.js](http://nodejs.org/) >= v4 must be installed.
4+
5+
## Installation
6+
7+
- Running `npm install` in the component's root directory will install everything you need for development.
8+
9+
## Demo Development Server
10+
11+
- `npm start` will run a development server with the component's demo app at [http://localhost:3000](http://localhost:3000) with hot module reloading.
12+
13+
## Running Tests
14+
15+
- `npm test` will run the tests once.
16+
17+
- `npm run test:coverage` will run the tests and produce a coverage report in `coverage/`.
18+
19+
- `npm run test:watch` will run the tests on every change.
20+
21+
## Building
22+
23+
- `npm run build` will build the component for publishing to npm and also bundle the demo app.
24+
25+
- `npm run clean` will delete built resources.

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# react-lazyload-fadein
2+
3+
[![Travis][build-badge]][build]
4+
[![npm package][npm-badge]][npm]
5+
[![Coveralls][coveralls-badge]][coveralls]
6+
7+
Describe react-lazyload-fadein here.
8+
9+
[build-badge]: https://img.shields.io/travis/user/repo/master.png?style=flat-square
10+
[build]: https://travis-ci.org/user/repo
11+
12+
[npm-badge]: https://img.shields.io/npm/v/npm-package.png?style=flat-square
13+
[npm]: https://www.npmjs.org/package/npm-package
14+
15+
[coveralls-badge]: https://img.shields.io/coveralls/user/repo/master.png?style=flat-square
16+
[coveralls]: https://coveralls.io/github/user/repo

demo/src/index.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React, {Component} from 'react'
2+
import {render} from 'react-dom'
3+
4+
import Example from '../../src'
5+
6+
class Demo extends Component {
7+
render() {
8+
return <div>
9+
<h1>react-lazyload-fadein Demo</h1>
10+
<Example/>
11+
</div>
12+
}
13+
}
14+
15+
render(<Demo/>, document.querySelector('#demo'))

nwb.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
type: 'react-component',
3+
npm: {
4+
esModules: true,
5+
umd: false
6+
}
7+
}

package.json

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "react-lazyload-fadein",
3+
"version": "1.0.0",
4+
"description": "react-lazyload-fadein React component",
5+
"main": "lib/index.js",
6+
"module": "es/index.js",
7+
"files": [
8+
"css",
9+
"es",
10+
"lib",
11+
"umd"
12+
],
13+
"scripts": {
14+
"build": "nwb build-react-component",
15+
"clean": "nwb clean-module && nwb clean-demo",
16+
"start": "nwb serve-react-demo",
17+
"test": "nwb test-react",
18+
"test:coverage": "nwb test-react --coverage",
19+
"test:watch": "nwb test-react --server"
20+
},
21+
"dependencies": {},
22+
"peerDependencies": {
23+
"react": "16.x"
24+
},
25+
"devDependencies": {
26+
"nwb": "0.21.x",
27+
"react": "^16.2.0",
28+
"react-dom": "^16.2.0"
29+
},
30+
"author": "",
31+
"homepage": "",
32+
"license": "MIT",
33+
"repository": "",
34+
"keywords": [
35+
"react-component"
36+
]
37+
}

src/index.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React, {Component} from 'react'
2+
3+
export default class extends Component {
4+
render() {
5+
return <div>
6+
<h2>Welcome to React components</h2>
7+
</div>
8+
}
9+
}

tests/.eslintrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"env": {
3+
"mocha": true
4+
}
5+
}

tests/index-test.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import expect from 'expect'
2+
import React from 'react'
3+
import {render, unmountComponentAtNode} from 'react-dom'
4+
5+
import Component from 'src/'
6+
7+
describe('Component', () => {
8+
let node
9+
10+
beforeEach(() => {
11+
node = document.createElement('div')
12+
})
13+
14+
afterEach(() => {
15+
unmountComponentAtNode(node)
16+
})
17+
18+
it('displays a welcome message', () => {
19+
render(<Component/>, node, () => {
20+
expect(node.innerHTML).toContain('Welcome to React components')
21+
})
22+
})
23+
})

0 commit comments

Comments
 (0)