Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinvdburgt committed Mar 26, 2020
1 parent 642fd59 commit 4f263de
Show file tree
Hide file tree
Showing 15 changed files with 1,040 additions and 67 deletions.
23 changes: 23 additions & 0 deletions packages/spa/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "@react-hooks-issue/spa",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "NODE_ENV=development webpack-dev-server --mode development --host 127.0.0.1"
},
"dependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1",
"styled-components": "^5.0.1"
},
"devDependencies": {
"@types/react": "^16.9.25",
"@types/react-dom": "^16.9.5",
"html-webpack-plugin": "^4.0.1",
"ts-loader": "^6.2.2",
"typescript": "^3.8.3",
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3"
}
}
11 changes: 11 additions & 0 deletions packages/spa/src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>SPA</title>
</head>
<body>
<div id="root"></div>
</body>
</html>
8 changes: 8 additions & 0 deletions packages/spa/src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React, { Fragment } from 'react';
import ReactDOM from 'react-dom';

import { Example } from '@react-hooks-issue/uikit';

ReactDOM.render(<Fragment>
<Example />
</Fragment>, document.getElementById('root'));
17 changes: 17 additions & 0 deletions packages/spa/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": true,
"esModuleInterop": true,
"module": "commonjs",
"target": "es6",
"jsx": "react"
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules"
]
}
51 changes: 51 additions & 0 deletions packages/spa/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
const { resolve } = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
devtool: 'source-map',

resolve: {
extensions: ['.ts', '.tsx', '.js', '.json'],
},

entry: resolve(__dirname, 'src', 'index.tsx'),

output: {
path: resolve(__dirname, 'dist'),
filename: '[name].[hash].js',
publicPath: '/',
},

optimization: {
splitChunks: {
chunks: 'all',
minChunks: 1,
},
},

module: {
rules: [
{
test: /\.ts(x?)$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader',
},
],
},
],
},

plugins: [
new HtmlWebpackPlugin({
template: resolve(__dirname, 'src', 'index.html'),
filename: 'index.html',
inject: 'body',
}),
],

devServer: {
historyApiFallback: true,
},
};
8 changes: 2 additions & 6 deletions packages/uikit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@
"build": "webpack --mode production",
"build:dev": "webpack --mode development"
},
"dependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1",
"styled-components": "^5.0.1"
"peerDependencies": {
"react": "^16.13.1"
},
"devDependencies": {
"@types/react": "^16.9.25",
"@types/react-dom": "^16.9.5",
"@types/styled-components": "^5.0.1",
"ts-loader": "^6.2.2",
"typescript": "^3.8.3",
"webpack": "^4.42.1",
Expand Down
13 changes: 13 additions & 0 deletions packages/uikit/src/components/Example/Example.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React, { FunctionComponent, useState } from 'react';

const Example: FunctionComponent = () => {
const [counter, setCounter] = useState(0);

return <div>
<button onClick={() => setCounter(counter - 1)}>-</button>
<span>{counter}</span>
<button onClick={() => setCounter(counter + 1)}>+</button>
</div>;
};

export default Example;
1 change: 1 addition & 0 deletions packages/uikit/src/components/Example/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as Example } from './Example';
25 changes: 0 additions & 25 deletions packages/uikit/src/components/Faq/Faq.tsx

This file was deleted.

1 change: 0 additions & 1 deletion packages/uikit/src/components/Faq/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/uikit/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './components/Faq';
export * from './components/Example';
6 changes: 3 additions & 3 deletions packages/uikit/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ module.exports = {
entry: resolve(__dirname, 'src', 'index.ts'),

externals: {
'styled-components': {
commonjs: 'styled-components',
'react': {
commonjs: 'react',
},
},

output: {
path: resolve(__dirname, 'dist'),
filename: 'index.js',
library: '',
// library: '',
libraryTarget: 'commonjs',
},

Expand Down
10 changes: 10 additions & 0 deletions packages/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,21 @@
"next": "^9.3.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"styled-components": "^5.0.1",
"styled-reset": "^4.1.2"
},
"devDependencies": {
"@types/react": "^16.9.25",
"@types/react-dom": "^16.9.5",
"@types/styled-components": "^5.0.1",
"typescript": "^3.8.3"
},
"workspaces": {
"nohoist": [
"react",
"react/**",
"react-dom",
"react-dom/**"
]
}
}
6 changes: 2 additions & 4 deletions packages/website/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import React from 'react';
import { NextPage } from 'next';
import { Faq } from '@react-hooks-issue/uikit';
import { Example } from '@react-hooks-issue/uikit';

const Index: NextPage = () => {
return <div>
<Faq title="Hello">
World
</Faq>
<Example />
</div>;
};

Expand Down
Loading

0 comments on commit 4f263de

Please sign in to comment.