Skip to content

Commit

Permalink
add: structured basic for lib
Browse files Browse the repository at this point in the history
  • Loading branch information
Hector Rodrigues da Silva committed Nov 29, 2022
1 parent d9eed87 commit f5738b0
Show file tree
Hide file tree
Showing 8 changed files with 5,971 additions and 3 deletions.
7 changes: 7 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
presets: [
"@babel/preset-env",
"@babel/preset-typescript",
["@babel/preset-react", { runtime: "automatic" }]
]
}
36 changes: 33 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"description": "Data table for React",
"main": "index.js",
"license": "MIT",
"scripts": {
"start": "webpack serve --progress --config webpack.dev.config.js"
},
"engines": {
"node": ">=16.0"
},
Expand All @@ -17,9 +20,7 @@
"bugs": {
"url": "https://github.com/theonlyducks/react-table/issues"
},
"files": [

],
"files": [],
"keywords": [
"theonlyducks",
"table",
Expand All @@ -30,7 +31,36 @@
"react-boostrap-table"
],
"peerDependencies": {
"bootstrap": "^5.0.0",
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0"
},
"devDependencies": {
"@babel/cli": "^7.19.3",
"@babel/core": "^7.20.5",
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@types/react": "^18.0.25",
"@types/react-dom": "^18.0.9",
"babel-jest": "^29.3.1",
"babel-loader": "^9.1.0",
"bootstrap": "^5.2.3",
"clean-webpack-plugin": "^4.0.0",
"css-loader": "^6.7.2",
"html-webpack-plugin": "^5.5.0",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"style-loader": "^3.3.1",
"terser-webpack-plugin": "^5.3.6",
"ts-loader": "^9.4.1",
"typescript": "^4.9.3",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.0",
"webpack-dev-server": "^4.11.1"
}
}
7 changes: 7 additions & 0 deletions public/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@


export const App = (): JSX.Element => {
return (
<div>Hello</div>
)
}
15 changes: 15 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" type="text/css" href="styles.css">
<title>React Block Duck</title>
</head>
<body>
<noscript>Not support this javascript</noscript>
<div id="root"></div>
</body>
</html>
11 changes: 11 additions & 0 deletions public/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react'
import {createRoot} from 'react-dom/client'
import {App} from './App';

const root = createRoot(document.getElementById('root'));

root.render(
<React.StrictMode>
<App/>
</React.StrictMode>
)
12 changes: 12 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"outDir": "./dist/",
"noImplicitAny": true,
"module": "es6",
"target": "es5",
"jsx": "react-jsx",
"allowJs": true,
"moduleResolution": "node",
"allowSyntheticDefaultImports": true
}
}
54 changes: 54 additions & 0 deletions webpack.dev.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
const path = require('path');
const ProvidePlugin = require('webpack/lib/ProvidePlugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');

module.exports = {
mode: "development",
devtool: 'source-map',
entry: {
table: path.resolve(__dirname, "public")
},
output: {
clean: true,
path: path.resolve(__dirname, "build"),
filename: "bundle.js",
},
devServer: {
port: 3000,
hot: true,
open: true,
allowedHosts: 'all',
},
resolve: {
extensions: [".js", ".jsx", ".ts", ".tsx"]
},
plugins: [
new ProvidePlugin({
React: 'react'
}),
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
inject: true,
template: path.join(__dirname, "public", "index.html")
})
],
module: {
rules: [
{
test: /.(ts|js)[x]?$/i,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /.css$/i,
use: [
{loader: "style-loader"},
{loader: "css-loader"},
]
},
]
}
}
Loading

0 comments on commit f5738b0

Please sign in to comment.