-
Notifications
You must be signed in to change notification settings - Fork 20
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
Showing
12 changed files
with
128 additions
and
9 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
build/ | ||
npm-package-test/build/ | ||
npm-package-test/Babel/build/ | ||
npm-package-test/TypeScript/build/ | ||
coverage/ |
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,25 @@ | ||
// @ts-check | ||
|
||
import * as React from 'react'; | ||
import * as ReactDOM from 'react-dom'; | ||
|
||
import { FormWithConstraints, FieldFeedbacks, FieldFeedback } from 'react-form-with-constraints'; | ||
|
||
import 'file-loader?name=[path][name].[ext]!./index.html'; | ||
|
||
class Form extends FormWithConstraints { | ||
render() { | ||
return ( | ||
<form onSubmit={this.handleSubmit.bind(this)} noValidate> | ||
<input type="email" name="username" defaultValue="John Doe" required /> | ||
<FieldFeedbacks for="username"> | ||
<FieldFeedback when="*" /> | ||
</FieldFeedbacks> | ||
|
||
<button>Submit</button> | ||
</form> | ||
); | ||
} | ||
} | ||
|
||
ReactDOM.render(<Form />, document.getElementById('app')); |
File renamed without changes.
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,29 @@ | ||
{ | ||
"name": "npm-package-test-babel", | ||
"version": "0.0.1", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/tkrotoff/ReactFormWithConstraints.git" | ||
}, | ||
"description": "Simple form validation for React", | ||
"license": "MIT", | ||
|
||
"scripts": { | ||
"clean": "rm -rf build", | ||
"build": "webpack -d --env.development", | ||
"test": "./test.sh" | ||
}, | ||
|
||
"dependencies": { | ||
"react-form-with-constraints": "../.." | ||
}, | ||
|
||
"devDependencies": { | ||
"babel-core": "latest", | ||
"babel-preset-react": "latest", | ||
|
||
"webpack": "latest", | ||
"babel-loader": "latest", | ||
"file-loader": "latest" | ||
} | ||
} |
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
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,30 @@ | ||
const path = require('path'); | ||
const optimize = require('webpack').optimize; | ||
|
||
module.exports = { | ||
entry: { | ||
'App': './App.jsx', | ||
|
||
'react-form-with-constraints': 'react-form-with-constraints', | ||
react: ['react', 'prop-types', 'react-dom'] | ||
}, | ||
|
||
output: { | ||
path: path.join(__dirname, 'build'), | ||
filename: '[name].js' | ||
}, | ||
|
||
plugins: [ | ||
new optimize.CommonsChunkPlugin({names: ['react-form-with-constraints', 'react']}) | ||
], | ||
|
||
resolve: { | ||
extensions: ['.js', '.jsx'] | ||
}, | ||
|
||
module: { | ||
rules: [ | ||
{ test: /\.jsx?$/, loader: 'babel-loader', options: {presets: ['react']} } | ||
] | ||
} | ||
}; |
File renamed without changes.
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,17 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
||
<title>npm-package-test</title> | ||
</head> | ||
|
||
<body> | ||
<div id="app"></div> | ||
|
||
<script src="react.js"></script> | ||
<script src="react-form-with-constraints.js"></script> | ||
<script src="App.js"></script> | ||
</body> | ||
</html> |
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
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 @@ | ||
#!/bin/sh | ||
echo '** Running rm -rf node_modules' | ||
rm -rf node_modules | ||
|
||
echo '** Running (cd ../.. && npm install)' | ||
(cd ../.. && npm install) | ||
|
||
echo '** Running npm install' | ||
npm install | ||
|
||
echo '** Running (cd ../.. && rm -rf node_modules)' | ||
(cd ../.. && rm -rf node_modules) | ||
|
||
echo '** Running npm run build' | ||
npm run build |
File renamed without changes.
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