boilerplate no modules

This commit is contained in:
gbrochar 2020-11-22 10:45:29 +01:00
parent 2090c08cb5
commit 70b6ff02a1
13 changed files with 219 additions and 6 deletions

16
.babelrc Normal file
View File

@ -0,0 +1,16 @@
{
"presets": [
[
"@babel/env", {
useBuiltIns: "usage",
corejs: 3,
}
],
"@babel/typescript",
"@babel/react",
],
"plugins": [
"@babel/proposal-class-properties",
"@babel/proposal-object-rest-spread",
]
}

34
.eslintrc.js Normal file
View File

@ -0,0 +1,34 @@
module.exports = {
'env': {
'browser': true,
'es2021': true,
'node': true,
},
'extends': [
'plugin:react/recommended',
'google',
],
'parser': '@typescript-eslint/parser',
'parserOptions': {
'ecmaFeatures': {
'jsx': true,
},
'ecmaVersion': 12,
'sourceType': 'module',
},
'plugins': [
'react',
'@typescript-eslint',
],
'settings': {
'react': {
'version': 'detect',
},
},
'rules': {
'indent': ['error', "tab"],
'no-tabs': ['error', {'allowIndentationTabs': true}],
'max-len': ['error', {'tabWidth': 4}],
},
};

18
.gitignore vendored
View File

@ -1,4 +1,14 @@
# ---> Node
# vim
*.swp
*.swo
*~
# build and dev deprecated
build
dev
# new build dir
dist
# Logs
logs
*.log
@ -85,7 +95,7 @@ dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
@ -103,7 +113,3 @@ dist
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test

View File

@ -0,0 +1,10 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"target": "es5",
"declarationDir": "../dist/types"
},
"include": [
"../src/client/**/*"
]
}

View File

@ -0,0 +1,10 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"target": "es6",
"declarationDir": "../dist/types"
},
"include": [
"../src/server/**/*"
]
}

View File

@ -0,0 +1,28 @@
const path = require('path');
const nodeExternals = require('webpack-node-externals');
const EsLint = require('eslint-webpack-plugin');
module.exports = {
entry: path.resolve(__dirname, '../src/client/main.tsx'),
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, '../dist/client'),
},
target: 'web',
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json']
},
module: {
rules: [{
test: /\.tsx?$/,
loader: 'babel-loader',
include: path.join(__dirname, '../src/client'),
}],
},
plugins: [
new EsLint({
extensions: ['.ts', '.tsx'],
context: path.join(__dirname, '../src/client'),
}),
],
};

View File

@ -0,0 +1,9 @@
const path = require('path');
const { merge } = require('webpack-merge');
const common = require('./webpack.client.common.js');
module.exports = merge(common, {
devtool: 'eval-cheap-module-source-map',
mode: 'development',
watch: true
});

View File

@ -0,0 +1,14 @@
const path = require('path');
const { merge } = require('webpack-merge');
const common = require('./webpack.client.common.js');
const TerserPlugin = require('terser-webpack-plugin');
module.exports = merge(common, {
mode: 'production',
optimization: {
minimize: true,
minimizer: [new TerserPlugin({
parallel: true
})]
}
});

View File

@ -0,0 +1,29 @@
const path = require('path');
const nodeExternals = require('webpack-node-externals');
const EsLint = require('eslint-webpack-plugin');
module.exports = {
entry: path.resolve(__dirname, '../src/server/main.ts'),
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, '../dist/server'),
},
target: 'node',
externals: [nodeExternals()],
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json']
},
module: {
rules: [{
test: /\.tsx?$/,
loader: 'babel-loader',
include: path.join(__dirname, '../src/server'),
}],
},
plugins: [
new EsLint({
extensions: ['.ts', '.tsx'],
context: path.join(__dirname, '../src/server'),
}),
],
};

View File

@ -0,0 +1,9 @@
const path = require('path');
const { merge } = require('webpack-merge');
const common = require('./webpack.server.common.js');
module.exports = merge(common, {
devtool: 'eval-cheap-module-source-map',
mode: 'development',
watch: true
});

View File

@ -0,0 +1,14 @@
const path = require('path');
const { merge } = require('webpack-merge');
const common = require('./webpack.server.common.js');
const TerserPlugin = require('terser-webpack-plugin');
module.exports = merge(common, {
mode: 'production',
optimization: {
minimize: true,
minimizer: [new TerserPlugin({
parallel: true
})]
}
});

13
package.json Normal file
View File

@ -0,0 +1,13 @@
{
"name": "weblgl",
"version": "1.0.0",
"description": "A simple WebGL app to demonstrate my skills",
"scripts": {
},
"repository": {
"type": "git",
"url": "https://git.gaetanbrochard.dev/gbrochar/weblgl.git"
},
"author": "gbrochar",
"license": "AGPL-3.0-only"
}

21
tsconfig.json Normal file
View File

@ -0,0 +1,21 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"noFallthroughCasesInSwitch": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"esModuleInterop": true,
"noUnusedLocals": true,
"noImplicitAny": true,
"declaration": true,
"jsx" : "preserve",
"module": "commonjs",
"strict": true
},
"exclude": [
"node_modules",
"config",
"views",
"dist"
]
}