Move all to webapp.

This commit is contained in:
Paulo Gustavo Veiga 2020-12-06 16:31:48 -08:00
parent 496455d1ea
commit e8d38678c7
38 changed files with 111 additions and 328 deletions

View File

@ -1,50 +0,0 @@
{
"name": "@wisemapping/login",
"version": "0.1.3",
"main": "app.jsx",
"scripts": {
"start": "webpack serve",
"build": "webpack --mode production",
"lint": "eslint src"
},
"repository": "http://www.wisemapping.com",
"author": "Paulo Veiga <pveiga@gmail.com>, Ezequiel Bergamaschi <ezequielbergamaschi@gmail.com>",
"license": "MIT",
"private": false,
"devDependencies": {
"@babel/preset-env": "^7.12.7",
"@babel/preset-react": "^7.12.7",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@types/react-router-dom": "^5.1.6",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
"babel-loader": "^8.2.2",
"brotli-webpack-plugin": "^1.1.0",
"clean-webpack-plugin": "^3.0.0",
"css-loader": "^5.0.1",
"eslint": "^7.14.0",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0",
"html-webpack-plugin": "^4.5.0",
"sass-loader": "^10.1.0",
"style-loader": "^2.0.0",
"svg-url-loader": "^7.1.1",
"ts-loader": "^8.0.11",
"ts-node": "^9.0.0",
"typescript": "^4.1.2",
"url-loader": "^4.1.1",
"webpack": "^5.6.0",
"webpack-bundle-analyzer": "^4.2.0",
"webpack-cli": "^4.2.0",
"webpack-dev-server": "^3.11.0"
},
"dependencies": {
"axios": "^0.21.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-google-recaptcha": "^2.1.0",
"react-intl": "^5.10.6",
"react-router-dom": "^5.2.0"
}
}

View File

@ -1,15 +0,0 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './app';
import { BrowserRouter as Router } from 'react-router-dom';
function bootstrapApplication() {
ReactDOM.render(
<Router>
<App />
</Router>,
document.getElementById('root') as HTMLElement
)
}
bootstrapApplication()

View File

@ -1,12 +0,0 @@
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": true,
"module": "commonjs",
"target": "es5",
"jsx": "react",
"allowJs": true,
"esModuleInterop": true
}
}

View File

@ -1,60 +0,0 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
module.exports = {
mode: 'development',
devtool: 'eval-source-map',
entry: {
app: path.join(__dirname, 'src', 'index.tsx')
},
target: 'web',
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx']
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: '/node_modules/'
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"]
},
{
test: /\.(png|jpe?g|gif|svg)$/,
use: [{
loader: 'file-loader',
options: {
esModule: false,
}
}, ],
}
]
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
template: path.join(__dirname, 'public/index.html')
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
'process.env.PUBLIC_URL': 'http://localhost:3000'
})
],
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: true,
port: 3000,
hot: true
}
}

View File

@ -1,5 +0,0 @@
{
"plugins": [
"@babel/plugin-transform-runtime"
]
}

View File

@ -1 +0,0 @@
declare module '@wisemapping/login'; //FIXME: temporal hasta pasarlo a ts

View File

@ -1,13 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Wisemapping</title>
</head>
<body>
<!-- React app root element -->
<div id="root"></div>
</body>
</html>

View File

@ -1,7 +1,7 @@
{ {
"name": "@wisemapping/webapp", "name": "@wisemapping/webapp",
"version": "1.0.0", "version": "0.1.3",
"main": "index.js", "main": "app.jsx",
"scripts": { "scripts": {
"start": "webpack serve", "start": "webpack serve",
"build": "webpack --mode production", "build": "webpack --mode production",
@ -20,6 +20,7 @@
"@typescript-eslint/eslint-plugin": "^4.8.1", "@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1", "@typescript-eslint/parser": "^4.8.1",
"babel-loader": "^8.2.2", "babel-loader": "^8.2.2",
"brotli-webpack-plugin": "^1.1.0",
"clean-webpack-plugin": "^3.0.0", "clean-webpack-plugin": "^3.0.0",
"css-loader": "^5.0.1", "css-loader": "^5.0.1",
"eslint": "^7.14.0", "eslint": "^7.14.0",
@ -34,16 +35,16 @@
"typescript": "^4.1.2", "typescript": "^4.1.2",
"url-loader": "^4.1.1", "url-loader": "^4.1.1",
"webpack": "^5.6.0", "webpack": "^5.6.0",
"webpack-bundle-analyzer": "^4.2.0",
"webpack-cli": "^4.2.0", "webpack-cli": "^4.2.0",
"webpack-dev-server": "^3.11.0" "webpack-dev-server": "^3.11.0"
}, },
"dependencies": { "dependencies": {
"@types/styled-components": "^5.1.4", "axios": "^0.21.0",
"@wisemapping/editor": "1.0.0",
"@wisemapping/login": "0.1.3",
"react": "^17.0.1", "react": "^17.0.1",
"react-dom": "^17.0.1", "react-dom": "^17.0.1",
"react-router-dom": "^5.2.0", "react-google-recaptcha": "^2.1.0",
"styled-components": "^5.2.1" "react-intl": "^5.10.6",
"react-router-dom": "^5.2.0"
} }
} }

View File

Before

Width:  |  Height:  |  Size: 148 KiB

After

Width:  |  Height:  |  Size: 148 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@ -1,46 +1,15 @@
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { createGlobalStyle } from 'styled-components'; import App from './app';
import { import { BrowserRouter as Router } from 'react-router-dom';
Switch,
Route,
Link,
BrowserRouter as Router,
} from "react-router-dom";
import Editor from '@wisemapping/editor';
import Login from '@wisemapping/login';
const GlobalStyle = createGlobalStyle` function bootstrapApplication() {
body { ReactDOM.render(
margin: 0;
}
`;
const Component = () => (
<React.Fragment>
<Router> <Router>
<GlobalStyle /> <App />
<Switch> </Router>,
<Route path="/login"> document.getElementById('root') as HTMLElement
<Login /> )
</Route> }
<Route path="/editor">
<Editor />
</Route>
<Route path="/">
<ul>
<li>
<Link to='/login'>/login</Link>
</li>
<li>
<Link to='/editor'>/editor</Link>
</li>
</ul>
</Route>
</Switch>
</Router>
</React.Fragment> bootstrapApplication()
);
ReactDOM.render(<Component />, document.querySelector('#root'));

View File

@ -7,6 +7,6 @@
"target": "es5", "target": "es5",
"jsx": "react", "jsx": "react",
"allowJs": true, "allowJs": true,
"esModuleInterop": true "esModuleInterop": true
} }
} }

View File

@ -7,85 +7,54 @@ module.exports = {
mode: 'development', mode: 'development',
devtool: 'eval-source-map', devtool: 'eval-source-map',
entry: { entry: {
app: [path.join(__dirname, 'src', 'index.tsx')] app: path.join(__dirname, 'src', 'index.tsx')
}, },
target: 'web', target: 'web',
resolve: { resolve: {
extensions: ['.ts', '.tsx', '.js'] extensions: ['.ts', '.tsx', '.js', '.jsx']
}, },
module: { module: {
rules: [ rules: [
{ {
test: /\.tsx?$/, test: /\.tsx?$/,
use: 'ts-loader', use: 'ts-loader',
exclude: '/node_modules/' exclude: '/node_modules/'
}, },
{ {
test: /\.jsx?$/, test: /\.css$/,
exclude: '/node_modules/', use: ["style-loader", "css-loader"]
resolve: {
extensions: [".js", ".jsx"]
},
use: {
loader: 'babel-loader',
options: {
presets: [
[
"@babel/preset-env",
{
"targets": {
"esmodules": true
}
}
],
'@babel/preset-react',
],
}
},
},
{
test: /\.svg$/,
exclude: /\.x.svg$/,
loader: 'svg-url-loader',
},
// Inline PNGs in Base64 if it is smaller than 10KB; otherwise, emmit files using file-loader.
{
test: /\.png$/,
loader: 'url-loader',
options: { mimetype: 'image/png', limit: 10000, name: '[name]-[hash:6].[ext]' },
}, },
// Style loader
{ {
test: /\.css$/i, test: /\.(png|jpe?g|gif|svg)$/,
use: [{ use: [{
loader: 'style-loader', loader: 'file-loader',
}, { options: {
loader: 'css-loader', esModule: false,
}], }
}, }, ],
], }
]
}, },
output: { output: {
filename: 'bundle.js', filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, 'dist')
publicPath: '/'
}, },
plugins: [ plugins: [
new CleanWebpackPlugin(), new CleanWebpackPlugin(),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: path.join(__dirname, 'index.html') template: path.join(__dirname, 'public/index.html')
}), }),
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development') 'process.env.NODE_ENV': JSON.stringify('development'),
}), 'process.env.PUBLIC_URL': 'http://localhost:3000'
})
], ],
devServer: { devServer: {
contentBase: path.join(__dirname, 'dist'), contentBase: path.join(__dirname, 'dist'),
compress: true, compress: true,
port: 9000, port: 3000,
hot: true, hot: true
historyApiFallback: true,
} }
} }