chore: rewrite package

This commit is contained in:
divlo
2021-06-17 18:48:19 +02:00
parent 7c878fd5f1
commit d4a3fc4573
47 changed files with 46008 additions and 49639 deletions

3
example/.npmignore Normal file
View File

@ -0,0 +1,3 @@
node_modules
.cache
dist

View File

@ -1,5 +0,0 @@
This example was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
It is linked to the react-component-form package in the parent directory for development purposes.
You can run `npm install` and then `npm start` to test your package.

View File

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 83 KiB

1
example/globals.d.ts vendored Normal file
View File

@ -0,0 +1 @@
declare module "*.jpg"

14
example/index.html Normal file
View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="shortcut icon" href="./github.jpg" type="image/jpg">
<title>Playground</title>
</head>
<body>
<div id="root"></div>
<script src="./index.tsx"></script>
</body>
</html>

View File

@ -1,10 +1,9 @@
//eslint-disable-next-line
import React from 'react'
import ReactDOM from 'react-dom'
import Form, { HandleForm } from 'react-component-form'
import * as React from 'react'
import * as ReactDOM from 'react-dom'
import Form, { HandleForm } from '../.'
import GithubLogo from './github.jpg'
import './index.css'
import GitHubLogo from 'url:./github.jpg'
const App = () => {
const handleSubmit: HandleForm = (formData, formElement) => {
@ -20,7 +19,7 @@ const App = () => {
return (
<div className='container'>
<h2>{'<Form />'}</h2>
<h5 className='title-install'>npm i react-component-form</h5>
<h5 className='title-install'>npm install --save react-component-form</h5>
<Form onSubmit={handleSubmit} onChange={handleChange}>
<div className='form-group'>
@ -54,7 +53,7 @@ const App = () => {
rel='noopener noreferrer'
href='https://github.com/Divlo/react-component-form'
>
<img width='30px' alt='github' src={GithubLogo} />
<img width='30px' alt='github' src={GitHubLogo} />
</a>
</div>
</div>

60137
example/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,44 +1,20 @@
{
"name": "react-component-form-example",
"homepage": ".",
"version": "0.0.0",
"private": true,
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"name": "example",
"version": "1.0.0",
"license": "MIT",
"scripts": {
"start": "node ../node_modules/react-scripts/bin/react-scripts.js start",
"build": "node ../node_modules/react-scripts/bin/react-scripts.js build",
"test": "node ../node_modules/react-scripts/bin/react-scripts.js test",
"eject": "node ../node_modules/react-scripts/bin/react-scripts.js eject"
"start": "parcel index.html",
"build": "parcel build index.html"
},
"dependencies": {
"@testing-library/jest-dom": "file:../node_modules/@testing-library/jest-dom",
"@testing-library/react": "file:../node_modules/@testing-library/react",
"@testing-library/user-event": "file:../node_modules/@testing-library/user-event",
"@types/jest": "file:../node_modules/@types/jest",
"@types/node": "file:../node_modules/@types/node",
"@types/react": "file:../node_modules/@types/react",
"@types/react-dom": "file:../node_modules/@types/react-dom",
"react": "file:../node_modules/react",
"react-component-form": "file:..",
"react-dom": "file:../node_modules/react-dom",
"react-scripts": "file:../node_modules/react-scripts",
"typescript": "file:../node_modules/typescript"
"alias": {
"react": "../node_modules/react",
"react-dom": "../node_modules/react-dom/profiling"
},
"devDependencies": {
"@babel/plugin-syntax-object-rest-spread": "^7.8.3"
"@parcel/transformer-image": "2.0.0-beta.2",
"@types/react": "17.0.11",
"@types/react-dom": "17.0.7",
"parcel": "2.0.0-beta.2",
"typescript": "4.3.3"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -1,48 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>react-component-form</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>

View File

@ -1,15 +0,0 @@
{
"short_name": "react-component-form",
"name": "react-component-form",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

View File

@ -1 +0,0 @@
/// <reference types="react-scripts" />

View File

@ -1,30 +1,18 @@
{
"compilerOptions": {
"outDir": "dist",
"module": "esnext",
"lib": ["dom", "esnext", "DOM.Iterable"],
"moduleResolution": "node",
"jsx": "react",
"sourceMap": true,
"declaration": true,
"esModuleInterop": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"allowSyntheticDefaultImports": true,
"allowSyntheticDefaultImports": false,
"target": "es5",
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true
},
"include": ["src"],
"exclude": ["node_modules", "build"]
"module": "commonjs",
"jsx": "react",
"moduleResolution": "node",
"noImplicitAny": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"removeComments": true,
"strictNullChecks": true,
"preserveConstEnums": true,
"sourceMap": true,
"lib": ["es2015", "es2016", "dom"],
"types": ["node"]
}
}