Skip to content

Commit

Permalink
Initial commit from nwb v0.25.2
Browse files Browse the repository at this point in the history
  • Loading branch information
benmneb committed Sep 24, 2021
0 parents commit 7e8da16
Show file tree
Hide file tree
Showing 10 changed files with 165 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/coverage
/demo/dist
/es
/lib
/node_modules
/umd
npm-debug.log*
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
sudo: false

language: node_js
node_js:
- 10

before_install:
- npm install codecov.io coveralls

after_success:
- cat ./coverage/lcov.info | ./node_modules/codecov.io/bin/codecov.io.js
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js

branches:
only:
- master
25 changes: 25 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Prerequisites

[Node.js](http://nodejs.org/) >= 10 must be installed.

## Installation

- Running `npm install` in the component's root directory will install everything you need for development.

## Demo Development Server

- `npm start` will run a development server with the component's demo app at [http://localhost:3000](http://localhost:3000) with hot module reloading.

## Running Tests

- `npm test` will run the tests once.

- `npm run test:coverage` will run the tests and produce a coverage report in `coverage/`.

- `npm run test:watch` will run the tests on every change.

## Building

- `npm run build` will build the component for publishing to npm and also bundle the demo app.

- `npm run clean` will delete built resources.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# mui-image

[![Travis][build-badge]][build]
[![npm package][npm-badge]][npm]
[![Coveralls][coveralls-badge]][coveralls]

Describe mui-image here.

[build-badge]: https://img.shields.io/travis/user/repo/master.png?style=flat-square
[build]: https://travis-ci.org/user/repo

[npm-badge]: https://img.shields.io/npm/v/npm-package.png?style=flat-square
[npm]: https://www.npmjs.org/package/npm-package

[coveralls-badge]: https://img.shields.io/coveralls/user/repo/master.png?style=flat-square
[coveralls]: https://coveralls.io/github/user/repo
15 changes: 15 additions & 0 deletions demo/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React, {Component} from 'react'
import {render} from 'react-dom'

import Example from '../../src'

export default class Demo extends Component {
render() {
return <div>
<h1>mui-image Demo</h1>
<Example/>
</div>
}
}

render(<Demo/>, document.querySelector('#demo'))
12 changes: 12 additions & 0 deletions nwb.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
type: 'react-component',
npm: {
esModules: true,
umd: {
global: 'MuiImage',
externals: {
react: 'React'
}
}
}
}
37 changes: 37 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "mui-image",
"version": "1.0.0",
"description": "mui-image React component",
"main": "lib/index.js",
"module": "es/index.js",
"files": [
"css",
"es",
"lib",
"umd"
],
"scripts": {
"build": "nwb build-react-component",
"clean": "nwb clean-module && nwb clean-demo",
"prepublishOnly": "npm run build",
"start": "nwb serve-react-demo",
"test": "nwb test-react",
"test:coverage": "nwb test-react --coverage",
"test:watch": "nwb test-react --server"
},
"peerDependencies": {
"react": "16.x"
},
"devDependencies": {
"nwb": "0.25.x",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"author": "",
"homepage": "",
"license": "MIT",
"repository": "",
"keywords": [
"react-component"
]
}
9 changes: 9 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React, {Component} from 'react'

export default class extends Component {
render() {
return <div>
<h2>Welcome to React components</h2>
</div>
}
}
5 changes: 5 additions & 0 deletions tests/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"env": {
"mocha": true
}
}
23 changes: 23 additions & 0 deletions tests/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import expect from 'expect'
import React from 'react'
import {render, unmountComponentAtNode} from 'react-dom'

import Component from 'src/'

describe('Component', () => {
let node

beforeEach(() => {
node = document.createElement('div')
})

afterEach(() => {
unmountComponentAtNode(node)
})

it('displays a welcome message', () => {
render(<Component/>, node, () => {
expect(node.innerHTML).toContain('Welcome to React components')
})
})
})

0 comments on commit 7e8da16

Please sign in to comment.