chore: remove unused code and files

This commit is contained in:
Tristan Yang
2023-08-04 21:17:50 +08:00
parent dbb1338cbe
commit 6204091c0e
6 changed files with 116 additions and 3377 deletions
-27
View File
@@ -2,7 +2,6 @@
const fs = require("fs");
const path = require("path");
const paths = require("./paths");
// Make sure that including paths.js after env.js will read .env variables.
delete require.cache[require.resolve("./paths")];
@@ -12,32 +11,6 @@ if (!NODE_ENV) {
throw new Error("The NODE_ENV environment variable is required but was not specified.");
}
// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
const dotenvFiles = [
`${paths.dotenv}.${NODE_ENV}.local`,
// Don't include `.env.local` for `test` environment
// since normally you expect tests to produce the same
// results for everyone
NODE_ENV !== "test" && `${paths.dotenv}.local`,
`${paths.dotenv}.${NODE_ENV}`,
paths.dotenv
].filter(Boolean);
// Load environment variables from .env* files. Suppress warnings using silent
// if this file is missing. dotenv will never modify any environment variables
// that have already been set. Variable expansion is supported in .env files.
// https://github.com/motdotla/dotenv
// https://github.com/motdotla/dotenv-expand
dotenvFiles.forEach((dotenvFile) => {
if (fs.existsSync(dotenvFile)) {
require("dotenv-expand")(
require("dotenv").config({
path: dotenvFile
})
);
}
});
// We support resolving modules according to `NODE_PATH`.
// This lets you use absolute paths in imports inside large monorepos:
// https://github.com/facebook/create-react-app/issues/253.
-1
View File
@@ -52,7 +52,6 @@ const resolveModule = (resolveFn, filePath) => {
// config after eject: we're in ./config/
module.exports = {
dotenv: resolveApp(".env"),
appPath: resolveApp("."),
appBuild: resolveApp(buildPath),
appPublic: resolveApp("public"),
+1 -62
View File
@@ -17,10 +17,6 @@ const modules = require("./modules");
const getClientEnvironment = require("./env");
const ModuleNotFoundPlugin = require("react-dev-utils/ModuleNotFoundPlugin");
const ReactRefreshWebpackPlugin = require("@pmmmwh/react-refresh-webpack-plugin");
// const ForkTsCheckerWebpackPlugin =
// process.env.TSC_COMPILE_ON_ERROR === "true"
// ? require("react-dev-utils/ForkTsCheckerWarningWebpackPlugin")
// : require("react-dev-utils/ForkTsCheckerWebpackPlugin");
const createEnvironmentHash = require("./webpack/persistentCache/createEnvironmentHash");
// Source maps are resource heavy and can cause out of memory issue for large source files.
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== "false";
@@ -46,7 +42,6 @@ const imageInlineSizeLimit = parseInt(process.env.IMAGE_INLINE_SIZE_LIMIT || "10
// Check if TypeScript is setup
const useTypeScript = fs.existsSync(paths.appTsConfig);
// const useTypeScript = false;
// Get the path to the uncompiled service worker (if it exists).
const swSrc = paths.swSrc;
@@ -55,19 +50,6 @@ const swSrc = paths.swSrc;
const cssRegex = /\.css$/;
const cssModuleRegex = /\.module\.css$/;
const hasJsxRuntime = (() => {
if (process.env.DISABLE_NEW_JSX_TRANSFORM === "true") {
return false;
}
try {
require.resolve("react/jsx-runtime");
return true;
} catch (e) {
return false;
}
})();
// This is the production and development configuration.
// It is focused on developer experience, fast rebuilds, and a minimal bundle.
module.exports = function (webpackEnv) {
@@ -332,7 +314,7 @@ module.exports = function (webpackEnv) {
[
require.resolve("babel-preset-react-app"),
{
runtime: hasJsxRuntime ? "automatic" : "classic",
runtime: "automatic",
development: process.env.NODE_ENV === "development",
importSource: "@welldone-software/why-did-you-render"
}
@@ -544,49 +526,6 @@ module.exports = function (webpackEnv) {
// See https://github.com/cra-template/pwa/issues/13#issuecomment-722667270
maximumFileSizeToCacheInBytes: 5 * 1024 * 1024
})
// // TypeScript type checking
// useTypeScript &&
// new ForkTsCheckerWebpackPlugin({
// async: isEnvDevelopment,
// typescript: {
// typescriptPath: resolve.sync("typescript", {
// basedir: paths.appNodeModules
// }),
// configOverwrite: {
// compilerOptions: {
// sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
// skipLibCheck: true,
// inlineSourceMap: false,
// declarationMap: false,
// noEmit: true,
// incremental: true,
// tsBuildInfoFile: paths.appTsBuildInfoFile
// }
// },
// context: paths.appPath,
// diagnosticOptions: {
// syntactic: true
// },
// mode: "write-references"
// // profile: true,
// },
// issue: {
// // This one is specifically to match during CI tests,
// // as micromatch doesn't match
// // '../cra-template-typescript/template/src/App.tsx'
// // otherwise.
// include: [{ file: "../**/src/**/*.{ts,tsx}" }, { file: "**/src/**/*.{ts,tsx}" }],
// exclude: [
// { file: "**/src/**/__tests__/**" },
// { file: "**/src/**/?(*.){spec|test}.*" },
// { file: "**/src/setupProxy.*" },
// { file: "**/src/setupTests.*" }
// ]
// },
// logger: {
// infrastructure: "silent"
// }
// })
].filter(Boolean),
// Turn off performance processing because we utilize
// our own hints via the FileSizeReporter
+9 -19
View File
@@ -1,6 +1,6 @@
{
"name": "vocechat-web",
"version": "0.4.16",
"version": "0.4.17",
"homepage": "https://voce.chat",
"dependencies": {
"@electron-toolkit/preload": "^2.0.0",
@@ -24,11 +24,8 @@
"css-loader": "^6.8.1",
"css-minimizer-webpack-plugin": "^5.0.1",
"dayjs": "^1.11.9",
"dotenv": "^16.3.1",
"dotenv-expand": "^10.0.0",
"emoji-mart": "5.5.2",
"eslint": "^8.46.0",
"file-loader": "^6.2.0",
"firebase": "^10.1.0",
"framer-motion": "^10.15.0",
"fs-extra": "^11.1.1",
@@ -54,11 +51,10 @@
"react-error-boundary": "^4.0.10",
"react-helmet": "^6.1.0",
"react-hot-toast": "^2.4.1",
"react-i18next": "^13.0.2",
"react-i18next": "^13.0.3",
"react-redux": "^8.1.2",
"react-refresh": "0.14.0",
"react-router-dom": "^6.14.2",
"react-scripts": "^5.0.1",
"react-syntax-highlighter": "^15.5.0",
"react-textarea-autosize": "^8.5.2",
"react-use-wizard": "^2.2.3",
@@ -78,17 +74,11 @@
"webpack": "^5.88.2",
"webpack-dev-server": "^4.15.1",
"webpack-manifest-plugin": "^5.0.0",
"workbox-background-sync": "^7.0.0",
"workbox-broadcast-update": "^7.0.0",
"workbox-cacheable-response": "^7.0.0",
"workbox-core": "^7.0.0",
"workbox-expiration": "^7.0.0",
"workbox-navigation-preload": "^7.0.0",
"workbox-precaching": "^7.0.0",
"workbox-range-requests": "^7.0.0",
"workbox-routing": "^7.0.0",
"workbox-strategies": "^7.0.0",
"workbox-streams": "^7.0.0",
"workbox-webpack-plugin": "^7.0.0"
},
"scripts": {
@@ -121,19 +111,19 @@
"@ianvs/prettier-plugin-sort-imports": "^4.1.0",
"@types/emoji-mart": "^3.0.9",
"@types/masonry-layout": "^4.2.5",
"@types/react-helmet": "^6.1.6",
"@types/node": "^20.4.5",
"@types/react": "^18.2.17",
"@types/node": "^20.4.7",
"@types/react": "^18.2.18",
"@types/react-dom": "^18.2.7",
"@types/react-helmet": "^6.1.6",
"@types/react-syntax-highlighter": "^15.5.7",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0",
"@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^6.2.1",
"@welldone-software/why-did-you-render": "^7.0.1",
"autoprefixer": "^10.4.14",
"babel-loader": "^9.1.3",
"babel-plugin-named-asset-import": "^0.3.8",
"babel-preset-react-app": "^10.0.1",
"eslint-config-prettier": "^8.9.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.1",
@@ -144,7 +134,7 @@
"postcss": "^8.4.27",
"postcss-loader": "^7.3.3",
"postinstall-postinstall": "^2.1.0",
"prettier": "^3.0.0",
"prettier": "^3.0.1",
"tailwindcss": "^3.3.3"
}
}
-4
View File
@@ -29,10 +29,6 @@ const openBrowser = require("react-dev-utils/openBrowser");
const paths = require("../config/paths");
const configFactory = require("../config/webpack.config");
const createDevServerConfig = require("../config/webpackDevServer.config");
const getClientEnvironment = require("../config/env");
const react = require(require.resolve("react", { paths: [paths.appPath] }));
const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1));
const useYarn = fs.existsSync(paths.yarnLockFile);
const isInteractive = process.stdout.isTTY;
+106 -3264
View File
File diff suppressed because it is too large Load Diff