mirror of
https://github.com/aleleba/create-react-ssr.git
synced 2025-07-22 12:38:30 -06:00
PR-753737: moviendo toda la logica de front-end a src.
This commit is contained in:
6
src/.babelrc
Normal file
6
src/.babelrc
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"presets": [
|
||||
"@babel/preset-env",
|
||||
"@babel/preset-react"
|
||||
]
|
||||
}
|
3
src/.env.example
Normal file
3
src/.env.example
Normal file
@ -0,0 +1,3 @@
|
||||
#Port of React App
|
||||
PORT_DEV= #Default Port 3000
|
||||
PORT_RELOAD_DEV= #Default Port PORT_DEV
|
21
src/LICENSE
Normal file
21
src/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Alejandro Lembke Barrientos
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
11
src/PRNameGenerator.ts
Normal file
11
src/PRNameGenerator.ts
Normal file
@ -0,0 +1,11 @@
|
||||
const PRName = function () {
|
||||
let ID = "";
|
||||
// let characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
let characters = "0123456789";
|
||||
for ( var i = 0; i < 6; i++ ) {
|
||||
ID += characters.charAt(Math.floor(Math.random() * 10));
|
||||
}
|
||||
return 'PR-'+ID;
|
||||
};
|
||||
|
||||
console.log(PRName())
|
12751
src/package-lock.json
generated
Normal file
12751
src/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
49
src/package.json
Normal file
49
src/package.json
Normal file
@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "create-react-ssr",
|
||||
"version": "1.0.0",
|
||||
"description": "Starter Kit de server side render de react",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "webpack serve --config webpack.config.dev.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"build": "webpack --config webpack.config.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/aleleba/create-react-ssr.git"
|
||||
},
|
||||
"keywords": [
|
||||
"react",
|
||||
"ssr"
|
||||
],
|
||||
"author": "Alejandro Lembke Barrientos",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/aleleba/create-react-ssr/issues"
|
||||
},
|
||||
"homepage": "https://github.com/aleleba/create-react-ssr#readme",
|
||||
"dependencies": {
|
||||
"dotenv": "^16.0.0",
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.17.9",
|
||||
"@babel/preset-env": "^7.16.11",
|
||||
"@babel/preset-react": "^7.16.7",
|
||||
"babel-loader": "^8.2.4",
|
||||
"clean-webpack-plugin": "^4.0.0",
|
||||
"css-loader": "^6.7.1",
|
||||
"css-minimizer-webpack-plugin": "^3.4.1",
|
||||
"html-loader": "^3.1.0",
|
||||
"html-webpack-plugin": "^5.5.0",
|
||||
"mini-css-extract-plugin": "^2.6.0",
|
||||
"sass": "^1.50.0",
|
||||
"sass-loader": "^12.6.0",
|
||||
"style-loader": "^3.3.1",
|
||||
"terser-webpack-plugin": "^5.3.1",
|
||||
"webpack": "^5.72.0",
|
||||
"webpack-cli": "^4.9.2",
|
||||
"webpack-dev-server": "^4.8.1"
|
||||
}
|
||||
}
|
12
src/public/index.html
Normal file
12
src/public/index.html
Normal file
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>App</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
66
src/webpack.config.dev.js
Normal file
66
src/webpack.config.dev.js
Normal file
@ -0,0 +1,66 @@
|
||||
const path = require('path');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
const { config: { portDev, portReloadDev } } = require('./config')
|
||||
|
||||
|
||||
module.exports = {
|
||||
entry: './frontend/index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'build'),
|
||||
filename: 'bundle.js',
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.js', '.jsx'],
|
||||
},
|
||||
mode: 'development',
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(js|jsx)$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.html$/,
|
||||
use: [
|
||||
{ loader: 'html-loader' }
|
||||
],
|
||||
},
|
||||
{
|
||||
test: /\.s[ac]ss$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
'css-loader',
|
||||
'sass-loader',
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
template: './public/index.html',
|
||||
filename: './index.html',
|
||||
}),
|
||||
new MiniCssExtractPlugin({
|
||||
filename: '[name].css',
|
||||
}),
|
||||
],
|
||||
devServer: {
|
||||
static: {
|
||||
directory: path.join(__dirname, 'build')
|
||||
},
|
||||
allowedHosts: "all",
|
||||
compress: true,
|
||||
port: portDev,
|
||||
hot: true,
|
||||
client: {
|
||||
reconnect: true,
|
||||
webSocketURL: {
|
||||
port: portReloadDev ? portReloadDev : portDev,
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
65
src/webpack.config.js
Normal file
65
src/webpack.config.js
Normal file
@ -0,0 +1,65 @@
|
||||
const path = require('path');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
entry: './frontend/index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'build'),
|
||||
filename: 'bundle.js',
|
||||
publicPath: '/',
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.js', '.jsx'],
|
||||
alias: {
|
||||
'@components': path.resolve(__dirname, 'src/components/'),
|
||||
'@styles': path.resolve(__dirname, 'frontend/styles/'),
|
||||
}
|
||||
},
|
||||
mode: 'production',
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(js|jsx)$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.html$/,
|
||||
use: [
|
||||
{ loader: 'html-loader' }
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.s[ac]ss$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
'css-loader',
|
||||
'sass-loader',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
template: './public/index.html',
|
||||
filename: './index.html'
|
||||
}),
|
||||
new MiniCssExtractPlugin({
|
||||
filename: '[name].css'
|
||||
}),
|
||||
new CleanWebpackPlugin(),
|
||||
],
|
||||
optimization: {
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
new CssMinimizerPlugin(),
|
||||
new TerserPlugin(),
|
||||
],
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user