tweak(phone): Bumped deps & tweaked craco

This updates our craco config to match our current custom webpack build rather than having to eject. This also bumps several of our dependencies that were outdated for React 17.
This commit is contained in:
Taso committed 2021-04-13 21:24:25 -04:00
1 parent ecd7689742
commit 6154dfc7a3
8 files changed
+183 -2270

No files matched your search

+1 -3
View File
@@ -16,7 +16,5 @@ ui_page 'resources/html/index.html'
files {
'config.json',
'resources/html/index.html',
'resources/html/*.js',
'resources/html/*.map',
'resources/html/media/**/*'
'resources/html/**/*',
}
-12
View File
@@ -1,12 +0,0 @@
{
"presets": [
[
"@babel/preset-env",
{
"modules": false
}
],
"@babel/preset-react"
],
"plugins": ["@babel/plugin-proposal-class-properties", "@babel/plugin-syntax-dynamic-import"]
}
+4
View File
@@ -1,3 +1,5 @@
const path = require('path')
const {
addAfterLoader,
removeLoaders,
@@ -52,6 +54,8 @@ module.exports = {
if (!babelLoaderIsAdded) throwError('failed to add back babel-loader for non-application JS');
paths.appBuild = webpackConfig.output.path = path.resolve('../resources/html')
return webpackConfig;
},
},
+16 -47
View File
@@ -2,52 +2,40 @@
"name": "npwd-nui",
"version": "0.1.0",
"repository": "https://github.com/project-error/new-phone-who-dis",
"private": false,
"private": true,
"license": "CC-BY-NC-SA-4.0",
"homepage": "/resources/html",
"dependencies": {
"@babel/polyfill": "^7.4.4",
"@fortawesome/fontawesome-svg-core": "^1.2.32",
"@fortawesome/fontawesome-svg-core": "^1.2.35",
"@fortawesome/free-brands-svg-icons": "^5.15.1",
"@fortawesome/free-solid-svg-icons": "^5.15.1",
"@fortawesome/react-fontawesome": "^0.1.11",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@fortawesome/react-fontawesome": "^0.1.14",
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.56",
"@popperjs/core": "^2.5.3",
"@sentry/react": "^5.29.2",
"@sentry/tracing": "^5.29.2",
"core-js": "^3.8.3",
"core-js": "3",
"dayjs": "^1.10.4",
"dompurify": "^2.2.6",
"emoji-mart": "^3.0.0",
"emoji-mart": "^3.0.1",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
"fivem-nui-react-lib": "2.2.6",
"howler": "^2.2.1",
"i18next": "^19.7.0",
"jsonschema": "^1.4.0",
"parse-url": "^5.0.2",
"qs": "^6.9.6",
"react": "17.0.2",
"react-dom": "17",
"react-hotkeys": "^2.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-i18next": "^11.7.1",
"react-popper": "^2.2.3",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.1",
"recoil": "^0.1.2"
"recoil": "^0.2.0"
},
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/preset-env": "^7.4.5",
"@babel/preset-react": "^7.0.0",
"@babel/polyfill": "^7.12.1",
"@craco/craco": "^6.1.1",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"@types/enzyme": "^3.10.7",
"@types/howler": "^2.2.1",
"@types/jest": "^26.0.14",
@@ -56,39 +44,20 @@
"@types/react": "^16.9.51",
"@types/react-dom": "^16.9.8",
"@types/react-router-dom": "^5.1.7",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.1.0",
"babel-plugin-styled-components": "^1.10.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"copy-webpack-plugin": "6.2.1",
"cp-cli": "^2.0.0",
"cra-build-watch": "^3.2.0",
"cross-env": "^7.0.2",
"css-loader": "^2.1.1",
"customize-cra": "^1.0.0",
"file-loader": "^3.0.1",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^4.3.0",
"react-devtools": "^4.10.1",
"react-test-renderer": "^16.13.1",
"style-loader": "^0.23.1",
"svg-url-loader": "^2.3.2",
"terser-webpack-plugin": "^1.3.0",
"ts-loader": "^8.0.4",
"typescript": "3.9.7",
"url-loader": "^1.1.2",
"webpack-cli": "^3.3.12"
"ts-loader": "^8.1.0",
"typescript": "3.9.7"
},
"scripts": {
"i18n:missing": "node --experimental-json-modules i18n.missingKeys.js",
"copy:config": "cp-cli ../config.json ./src/config.autogen.json",
"start": "craco start",
"watch": "cra-build-watch --disable-chunks --build-path ../resources/html --output-filename dev.js",
"build": "yarn copy:config && cross-env NODE_ENV=production webpack --config webpack/prod.config.js --color -p --progress --hide-modules --display-optimization-bailout",
"build:dev": "cross-env NODE_ENV=development webpack --config webpack/dev.config.js --color -p --progress --hide-modules --display-optimization-bailout --analyze",
"build": "yarn copy:config && craco build",
"test": "craco test --watchAll=false --testMatch **/src/**/*.test.{ts,js,tsx}",
"test:watch": "react-scripts test --watchAll --testMatch **/src/**/*.test.{ts,js,tsx}",
"eject": "react-scripts eject"
"build:craco": "craco build"
},
"eslintConfig": {
"extends": "react-app"
-21
View File
@@ -1,21 +0,0 @@
const path = require('path');
const CommonWebpack = require('./webpack.common');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = CommonWebpack({
mode: 'development',
devtool: 'inline-source-map',
entry: ['react-devtools', './src/index.tsx'],
// Output path
output: {
path: path.resolve(process.cwd(), 'build'),
filename: 'index.js',
},
plugins: [
new HtmlWebpackPlugin({
template: 'public/index.html',
inject: true,
minify: false,
}),
],
});
-40
View File
@@ -1,40 +0,0 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
module.exports = require('./webpack.common')({
mode: 'production',
entry: [path.join(process.cwd(), 'src/index.tsx')],
plugins: [
new HtmlWebpackPlugin({
template: 'public/index.html',
minify: {
removeComments: true,
collapseWhitespace: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true,
},
inject: true,
}),
new CopyPlugin({
patterns: [
{
from: 'public/media',
to: path.resolve(process.cwd(), '../resources/html/media'),
},
],
}),
],
performance: {
assetFilter: (assetFilename) => !/(\.map$)|(^(main\.|favicon\.))/.test(assetFilename),
},
});
-125
View File
@@ -1,125 +0,0 @@
const path = require('path');
const webpack = require('webpack');
module.exports = (options) => ({
mode: options.mode,
entry: options.entry,
devtool: 'source-maps',
output: {
path: path.resolve(process.cwd(), '../resources/html'),
filename: '[name].js',
},
module: {
rules: [
{
test: /\.tsx?$/,
use: [
{
loader: 'ts-loader',
options: {
transpileOnly: true,
},
},
],
exclude: /node_modules/,
},
{
test: /\.jsx?$/, // Transform all .js and .jsx files required somewhere with Babel
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
},
{
// Preprocess our own .css files
// This is the place to add your own loaders (e.g. sass/less etc.)
// for a list of loaders, see https://webpack.js.org/loaders/#styling
test: /\.css$/,
exclude: /node_modules/,
use: ['style-loader', 'css-loader'],
},
{
// Preprocess 3rd party .css files located in node_modules
test: /\.css$/,
include: /node_modules/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.(eot|otf|ttf|woff|woff2)$/,
use: 'file-loader',
},
{
test: /\.svg$/,
use: [
{
loader: 'svg-url-loader',
options: {
// Inline files smaller than 10 kB
limit: 10 * 1024,
noquotes: true,
},
},
],
},
{
test: /\.(jpg|png|gif)$/,
use: [
{
loader: 'url-loader',
options: {
// Inline files smaller than 10 kB
limit: 10 * 1024,
},
},
{
loader: 'image-webpack-loader',
options: {
mozjpeg: {
enabled: false,
// NOTE: mozjpeg is disabled as it causes errors in some Linux environments
// Try enabling it in your environment by switching the config to:
// enabled: true,
// progressive: true,
},
gifsicle: {
interlaced: false,
},
optipng: {
optimizationLevel: 7,
},
pngquant: {
quality: '65-90',
speed: 4,
},
},
},
],
},
{
test: /\.html$/,
use: 'html-loader',
},
{
test: /\.(mp4|webm)$/,
use: {
loader: 'url-loader',
options: {
limit: 10000,
},
},
},
],
},
plugins: options.plugins.concat([
// Always expose NODE_ENV to webpack, in order to use `process.env.NODE_ENV`
// inside your code for any environment checks; Terser will automatically
// drop any unreachable code.
new webpack.EnvironmentPlugin({
NODE_ENV: options.mode,
}),
]),
resolve: {
modules: ['src', 'node_modules'],
extensions: ['.js', '.jsx', '.ts', '.tsx', '.react.js'],
},
});
+162 -2022
View File
File diff suppressed because it is too large. Load diff