Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions desktop/renderer-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,21 @@
"@types/webpack-env": "^1.15.2",
"@typescript-eslint/eslint-plugin": "^4.29.1",
"@typescript-eslint/parser": "^4.29.1",
"@vitejs/plugin-react-refresh": "^1.3.3",
"agora-electron-sdk": "3.5.0-rc.4-build.1105",
"copy-webpack-plugin": "^9.0.1",
"cross-env": "^7.0.3",
"css-loader": "^5.2.4",
"dotenv-flow": "^3.2.0",
"dotenv-flow-webpack": "^1.1.0",
"electron": "12.0.15",
"esbuild": "^0.12.20",
"eslint": "^7.26.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.4.0",
"@vitejs/plugin-react-refresh": "^1.3.3",
"esbuild": "^0.12.20",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-app": "^6.2.2",
"eslint-webpack-plugin": "^3.0.1",
Expand All @@ -99,6 +99,7 @@
"react-refresh": "^0.10.0",
"react-resize-detector": "^6.7.5",
"react-transition-group": "^4.4.2",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-visualizer": "^5.5.2",
"style-loader": "^2.0.0",
"terser-webpack-plugin": "^5.1.2",
Expand Down
2 changes: 1 addition & 1 deletion desktop/renderer-app/src/tasks/init-register-apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const initRegisterApps = (): void => {
const getVSPath = (): string => {
let vsPath;
if (process.env.NODE_ENV === "production") {
vsPath = path.join(__dirname, "static", "monaco-editor", "min", "vs");
vsPath = path.join(__dirname, "monaco-editor", "min", "vs");
} else {
const nodeModulesName = "node_modules";
const nodeModulesEndIndexByPath =
Expand Down
37 changes: 34 additions & 3 deletions desktop/renderer-app/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,50 @@
import refresh from "@vitejs/plugin-react-refresh";
import { defineConfig } from "vite";
import eslintPlugin from "vite-plugin-eslint";
import { visualizer } from "rollup-plugin-visualizer";
import copy from "rollup-plugin-copy";
import path from "path";

// TODO: find new place to store vite-plugin-dotenv
import { dotenv } from "../../web/flat-web/scripts/vite-plugin-dotenv";
import { visualizer } from "rollup-plugin-visualizer";
import { electron } from "./scripts/vite-plugin-electron";
import eslintPlugin from "vite-plugin-eslint";
import {
configPath,
typesEntryPath,
i18nEntryPath,
componentsEntryPath,
rootNodeModules,
rendererPath,
} from "../../scripts/constants";

export default defineConfig(() => {
const plugins = [refresh(), dotenv(configPath), electron(), eslintPlugin()];
const plugins = [
refresh(),
dotenv(configPath),
electron(),
eslintPlugin(),
copy({
targets: [
/**
* e.g:
* /Users/black-hole/Code/Job/Agora/flat/node_modules/monaco-editor/min/vs
* to
* /Users/black-hole/Code/Job/Agora/flat/desktop/renderer-app/dist/monaco-editor/min/vs
*/
{
src: path.join(rootNodeModules, "monaco-editor", "min", "vs"),
// don't write "vs". because dist path will is: dist/monaco-editor/min/vs/vs
dest: path.join(rendererPath, "dist", "monaco-editor", "min"),
},
{
src: path.join(rootNodeModules, "monaco-editor", "min-maps", "vs"),
dest: path.join(rendererPath, "dist", "monaco-editor", "min-maps"),
},
],
// see: https://github.com/vitejs/vite/issues/1231#issuecomment-753549857
hook: "writeBundle",
}),
];
if (process.env.ANALYZER) {
plugins.push({
...visualizer(),
Expand Down
4 changes: 4 additions & 0 deletions scripts/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const componentsEntryPath = join(packagesPath, "flat-components", "src");
const rootPackageJSONPath = join(rootPath, "package.json");
const mainPackageJSONPath = join(mainPath, "package.json");

const rootNodeModules = join(rootPath, "node_modules");

const version = require(mainPackageJSONPath).version;

module.exports.rootPath = rootPath;
Expand All @@ -39,3 +41,5 @@ module.exports.rootPackageJSONPath = rootPackageJSONPath;
module.exports.mainPackageJSONPath = mainPackageJSONPath;

module.exports.version = version;

module.exports.rootNodeModules = rootNodeModules;
55 changes: 54 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3114,6 +3114,13 @@
resolved "https://registry.yarnpkg.com/@types/faker/-/faker-5.5.8.tgz#6649adfdfdbb0acf95361fc48f2d0ca6e88bd1cf"
integrity sha512-bsl0rYsaZVHlZkynL5O04q6YXDmVjcid6MbOHWqvtE2WWs/EKhp0qchDDhVWlWyQXUffX1G83X9LnMxRl8S/Mw==

"@types/fs-extra@^8.0.1":
version "8.1.2"
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.1.2.tgz#7125cc2e4bdd9bd2fc83005ffdb1d0ba00cca61f"
integrity sha512-SvSrYXfWSc7R4eqnOzbQF4TZmfpNSM9FrSWLU3EUnWBuyZqNBOrv1B1JA3byUDPUl9z4Ab3jeZG2eDdySlgNMg==
dependencies:
"@types/node" "*"

"@types/fs-extra@^9.0.11":
version "9.0.12"
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-9.0.12.tgz#9b8f27973df8a7a3920e8461517ebf8a7d4fdfaf"
Expand Down Expand Up @@ -5906,6 +5913,11 @@ color@^3.1.0:
color-convert "^1.9.3"
color-string "^1.6.0"

colorette@^1.1.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.4.0.tgz#5190fbb87276259a86ad700bff2c6d6faa3fca40"
integrity sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==

colorette@^1.2.1, colorette@^1.2.2:
version "1.3.0"
resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.3.0.tgz#ff45d2f0edb244069d3b772adeb04fed38d0a0af"
Expand Down Expand Up @@ -8129,6 +8141,17 @@ fast-glob@^2.2.6:
merge2 "^1.2.3"
micromatch "^3.1.10"

fast-glob@^3.0.3:
version "3.2.11"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.11.tgz#a1172ad95ceb8a16e20caa5c5e56480e5129c1d9"
integrity sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==
dependencies:
"@nodelib/fs.stat" "^2.0.2"
"@nodelib/fs.walk" "^1.2.3"
glob-parent "^5.1.2"
merge2 "^1.3.0"
micromatch "^4.0.4"

fast-glob@^3.1.1, fast-glob@^3.2.5:
version "3.2.7"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.7.tgz#fd6cb7a2d7e9aa7a7846111e85a196d6b2f766a1"
Expand Down Expand Up @@ -8987,6 +9010,20 @@ globalthis@^1.0.0, globalthis@^1.0.1:
dependencies:
define-properties "^1.1.3"

[email protected]:
version "10.0.1"
resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.1.tgz#4782c34cb75dd683351335c5829cc3420e606b22"
integrity sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A==
dependencies:
"@types/glob" "^7.1.1"
array-union "^2.1.0"
dir-glob "^3.0.1"
fast-glob "^3.0.3"
glob "^7.1.3"
ignore "^5.1.1"
merge2 "^1.2.3"
slash "^3.0.0"

[email protected]:
version "11.0.1"
resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.1.tgz#9a2bf107a068f3ffeabc49ad702c79ede8cfd357"
Expand Down Expand Up @@ -9651,6 +9688,11 @@ ignore@^5.0.5:
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.9.tgz#9ec1a5cbe8e1446ec60d4420060d43aa6e7382fb"
integrity sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==

ignore@^5.1.1:
version "5.2.0"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a"
integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==

ignore@^5.1.4:
version "5.1.8"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57"
Expand Down Expand Up @@ -10205,7 +10247,7 @@ is-plain-obj@^2.0.0:
resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287"
integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==

[email protected]:
[email protected], is-plain-object@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-3.0.1.tgz#662d92d24c0aa4302407b0d45d21f2251c85f85b"
integrity sha512-Xnpx182SBMrr/aBik8y+GuR4U1L9FqMSojwDQwPMmxyC6bvEqly9UBCxhauBF5vNh2gwWJNX6oDV7O+OM4z34g==
Expand Down Expand Up @@ -14683,6 +14725,17 @@ roarr@^2.15.3:
semver-compare "^1.0.0"
sprintf-js "^1.1.2"

rollup-plugin-copy@^3.4.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/rollup-plugin-copy/-/rollup-plugin-copy-3.4.0.tgz#f1228a3ffb66ffad8606e2f3fb7ff23141ed3286"
integrity sha512-rGUmYYsYsceRJRqLVlE9FivJMxJ7X6jDlP79fmFkL8sJs7VVMSVyA2yfyL+PGyO/vJs4A87hwhgVfz61njI+uQ==
dependencies:
"@types/fs-extra" "^8.0.1"
colorette "^1.1.0"
fs-extra "^8.1.0"
globby "10.0.1"
is-plain-object "^3.0.0"

rollup-plugin-visualizer@^5.5.2:
version "5.5.2"
resolved "https://registry.yarnpkg.com/rollup-plugin-visualizer/-/rollup-plugin-visualizer-5.5.2.tgz#ae2130ee5ae4a2d901e764e492b71357cb95eed7"
Expand Down