From d1680f36a75d58c5aeba8547587cb1af25c1e4fb Mon Sep 17 00:00:00 2001 From: jxom Date: Sun, 12 May 2019 11:10:27 +1000 Subject: [PATCH] Initial commit from nwb v0.21.5 --- .gitignore | 7 +++++++ .travis.yml | 16 ++++++++++++++++ CONTRIBUTING.md | 25 +++++++++++++++++++++++++ README.md | 16 ++++++++++++++++ demo/src/index.js | 15 +++++++++++++++ nwb.config.js | 12 ++++++++++++ package.json | 37 +++++++++++++++++++++++++++++++++++++ src/index.js | 9 +++++++++ tests/.eslintrc | 5 +++++ tests/index-test.js | 23 +++++++++++++++++++++++ 10 files changed, 165 insertions(+) create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 CONTRIBUTING.md create mode 100644 README.md create mode 100644 demo/src/index.js create mode 100644 nwb.config.js create mode 100644 package.json create mode 100644 src/index.js create mode 100644 tests/.eslintrc create mode 100644 tests/index-test.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c452c58 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +/coverage +/demo/dist +/es +/lib +/node_modules +/umd +npm-debug.log* diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..06e30d9 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,16 @@ +sudo: false + +language: node_js +node_js: + - 8 + +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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..d8b0984 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,25 @@ +## Prerequisites + +[Node.js](http://nodejs.org/) >= v4 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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..7503031 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# use-payment-inputs + +[![Travis][build-badge]][build] +[![npm package][npm-badge]][npm] +[![Coveralls][coveralls-badge]][coveralls] + +Describe use-payment-inputs 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 diff --git a/demo/src/index.js b/demo/src/index.js new file mode 100644 index 0000000..6e8e911 --- /dev/null +++ b/demo/src/index.js @@ -0,0 +1,15 @@ +import React, {Component} from 'react' +import {render} from 'react-dom' + +import Example from '../../src' + +class Demo extends Component { + render() { + return
+

use-payment-inputs Demo

+ +
+ } +} + +render(, document.querySelector('#demo')) diff --git a/nwb.config.js b/nwb.config.js new file mode 100644 index 0000000..0027855 --- /dev/null +++ b/nwb.config.js @@ -0,0 +1,12 @@ +module.exports = { + type: 'react-component', + npm: { + esModules: true, + umd: { + global: 'PaymentInputs', + externals: { + react: 'React' + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..205e95d --- /dev/null +++ b/package.json @@ -0,0 +1,37 @@ +{ + "name": "use-payment-inputs", + "version": "1.0.0", + "description": "use-payment-inputs 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", + "start": "nwb serve-react-demo", + "test": "nwb test-react", + "test:coverage": "nwb test-react --coverage", + "test:watch": "nwb test-react --server" + }, + "dependencies": {}, + "peerDependencies": { + "react": "16.x" + }, + "devDependencies": { + "nwb": "0.21.x", + "react": "16.8.6", + "react-dom": "16.8.6" + }, + "author": "", + "homepage": "", + "license": "MIT", + "repository": "", + "keywords": [ + "react-component" + ] +} diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..00c9954 --- /dev/null +++ b/src/index.js @@ -0,0 +1,9 @@ +import React, {Component} from 'react' + +export default class extends Component { + render() { + return
+

Welcome to React components

+
+ } +} diff --git a/tests/.eslintrc b/tests/.eslintrc new file mode 100644 index 0000000..7eeefc3 --- /dev/null +++ b/tests/.eslintrc @@ -0,0 +1,5 @@ +{ + "env": { + "mocha": true + } +} diff --git a/tests/index-test.js b/tests/index-test.js new file mode 100644 index 0000000..0d00909 --- /dev/null +++ b/tests/index-test.js @@ -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(, node, () => { + expect(node.innerHTML).toContain('Welcome to React components') + }) + }) +})