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,49 +1,50 @@
{ {
"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",
"lint": "eslint src" "lint": "eslint src"
}, },
"repository": "http://www.wisemapping.com", "repository": "http://www.wisemapping.com",
"author": "Paulo Veiga <pveiga@gmail.com>, Ezequiel Bergamaschi <ezequielbergamaschi@gmail.com>", "author": "Paulo Veiga <pveiga@gmail.com>, Ezequiel Bergamaschi <ezequielbergamaschi@gmail.com>",
"license": "MIT", "license": "MIT",
"private": false, "private": false,
"devDependencies": { "devDependencies": {
"@babel/preset-env": "^7.12.7", "@babel/preset-env": "^7.12.7",
"@babel/preset-react": "^7.12.7", "@babel/preset-react": "^7.12.7",
"@types/react": "^17.0.0", "@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0", "@types/react-dom": "^17.0.0",
"@types/react-router-dom": "^5.1.6", "@types/react-router-dom": "^5.1.6",
"@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",
"clean-webpack-plugin": "^3.0.0", "brotli-webpack-plugin": "^1.1.0",
"css-loader": "^5.0.1", "clean-webpack-plugin": "^3.0.0",
"eslint": "^7.14.0", "css-loader": "^5.0.1",
"eslint-plugin-react": "^7.21.5", "eslint": "^7.14.0",
"eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-react": "^7.21.5",
"html-webpack-plugin": "^4.5.0", "eslint-plugin-react-hooks": "^4.2.0",
"sass-loader": "^10.1.0", "html-webpack-plugin": "^4.5.0",
"style-loader": "^2.0.0", "sass-loader": "^10.1.0",
"svg-url-loader": "^7.1.1", "style-loader": "^2.0.0",
"ts-loader": "^8.0.11", "svg-url-loader": "^7.1.1",
"ts-node": "^9.0.0", "ts-loader": "^8.0.11",
"typescript": "^4.1.2", "ts-node": "^9.0.0",
"url-loader": "^4.1.1", "typescript": "^4.1.2",
"webpack": "^5.6.0", "url-loader": "^4.1.1",
"webpack-cli": "^4.2.0", "webpack": "^5.6.0",
"webpack-dev-server": "^3.11.0" "webpack-bundle-analyzer": "^4.2.0",
}, "webpack-cli": "^4.2.0",
"dependencies": { "webpack-dev-server": "^3.11.0"
"@types/styled-components": "^5.1.4", },
"@wisemapping/editor": "1.0.0", "dependencies": {
"@wisemapping/login": "0.1.3", "axios": "^0.21.0",
"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

@ -4,88 +4,57 @@ const webpack = require('webpack');
const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const { CleanWebpackPlugin } = require('clean-webpack-plugin');
module.exports = { 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?$/,
use: 'ts-loader',
exclude: '/node_modules/'
},
{
test: /\.jsx?$/,
exclude: '/node_modules/',
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: /\.tsx?$/,
test: /\.png$/, use: 'ts-loader',
loader: 'url-loader', exclude: '/node_modules/'
options: { mimetype: 'image/png', limit: 10000, name: '[name]-[hash:6].[ext]' }, },
}, {
test: /\.css$/,
use: ["style-loader", "css-loader"]
// 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: {
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: {
output: { contentBase: path.join(__dirname, 'dist'),
filename: 'bundle.js', compress: true,
path: path.resolve(__dirname, 'dist'), port: 3000,
publicPath: '/' hot: true
}, }
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
template: path.join(__dirname, 'index.html')
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
}),
],
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: true,
port: 9000,
hot: true,
historyApiFallback: true,
}
} }