filecat 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +59 -0
  3. package/build/dist/0c35d18bf06992036b69.woff2 +0 -0
  4. package/build/dist/0ced56d7af066edf067f.woff2 +0 -0
  5. package/build/dist/181.bundle.js +2 -0
  6. package/build/dist/181.bundle.js.LICENSE.txt +1 -0
  7. package/build/dist/23410236ad91e1e9a940.woff2 +0 -0
  8. package/build/dist/257.bundle.js +2 -0
  9. package/build/dist/257.bundle.js.LICENSE.txt +283 -0
  10. package/build/dist/2795d24f8fef954689ca.woff2 +0 -0
  11. package/build/dist/2993b11d5847a9fb2206.woff2 +0 -0
  12. package/build/dist/2f6b8a5d7bad83cb7306.woff2 +0 -0
  13. package/build/dist/30415dda763747a5c156.woff2 +0 -0
  14. package/build/dist/308.bundle.js +2 -0
  15. package/build/dist/308.bundle.js.LICENSE.txt +1 -0
  16. package/build/dist/313.bundle.js +2 -0
  17. package/build/dist/313.bundle.js.LICENSE.txt +1 -0
  18. package/build/dist/327.bundle.js +2 -0
  19. package/build/dist/327.bundle.js.LICENSE.txt +1 -0
  20. package/build/dist/34.bundle.js +2 -0
  21. package/build/dist/34.bundle.js.LICENSE.txt +1 -0
  22. package/build/dist/35edb8fac003ba8b66d0.woff2 +0 -0
  23. package/build/dist/3ca90e818569ea30b7a5.woff2 +0 -0
  24. package/build/dist/414.bundle.js +1 -0
  25. package/build/dist/421.bundle.js +1 -0
  26. package/build/dist/467.bundle.js +2 -0
  27. package/build/dist/467.bundle.js.LICENSE.txt +1 -0
  28. package/build/dist/470.bundle.js +2 -0
  29. package/build/dist/470.bundle.js.LICENSE.txt +7 -0
  30. package/build/dist/489.bundle.js +2 -0
  31. package/build/dist/489.bundle.js.LICENSE.txt +1 -0
  32. package/build/dist/4d73cb90e394b34b7670.woff +0 -0
  33. package/build/dist/530.bundle.js +2 -0
  34. package/build/dist/530.bundle.js.LICENSE.txt +1 -0
  35. package/build/dist/543.bundle.js +2 -0
  36. package/build/dist/543.bundle.js.LICENSE.txt +8 -0
  37. package/build/dist/5543cfc79252c151e079.woff2 +0 -0
  38. package/build/dist/654.bundle.js +2 -0
  39. package/build/dist/654.bundle.js.LICENSE.txt +1 -0
  40. package/build/dist/665.bundle.js +2 -0
  41. package/build/dist/665.bundle.js.LICENSE.txt +1 -0
  42. package/build/dist/674.bundle.js +2 -0
  43. package/build/dist/674.bundle.js.LICENSE.txt +1 -0
  44. package/build/dist/6c5df20c745597569166.woff2 +0 -0
  45. package/build/dist/6f687c7363244fec0ae1.woff2 +0 -0
  46. package/build/dist/734.bundle.js +2 -0
  47. package/build/dist/734.bundle.js.LICENSE.txt +1 -0
  48. package/build/dist/811.bundle.js +2 -0
  49. package/build/dist/811.bundle.js.LICENSE.txt +1 -0
  50. package/build/dist/826.bundle.js +1 -0
  51. package/build/dist/859.bundle.js +2 -0
  52. package/build/dist/859.bundle.js.LICENSE.txt +17 -0
  53. package/build/dist/868.bundle.js +2 -0
  54. package/build/dist/868.bundle.js.LICENSE.txt +13 -0
  55. package/build/dist/892.bundle.js +2 -0
  56. package/build/dist/892.bundle.js.LICENSE.txt +1 -0
  57. package/build/dist/916.bundle.js +1 -0
  58. package/build/dist/943.bundle.js +2 -0
  59. package/build/dist/943.bundle.js.LICENSE.txt +9 -0
  60. package/build/dist/94a1c1fbd1ede0265cb3.woff2 +0 -0
  61. package/build/dist/977.bundle.js +2 -0
  62. package/build/dist/977.bundle.js.LICENSE.txt +1 -0
  63. package/build/dist/b53c2ca8a0a0b98bcad3.woff2 +0 -0
  64. package/build/dist/bundle.js +2 -0
  65. package/build/dist/bundle.js.LICENSE.txt +91 -0
  66. package/build/dist/c2ffb3d0547a697b8970.woff2 +0 -0
  67. package/build/dist/c6551f210d256bc0a53c.woff2 +0 -0
  68. package/build/dist/ca740f15a15ff2af815e.woff2 +0 -0
  69. package/build/dist/ce059a8f6e004979ba05.woff2 +0 -0
  70. package/build/dist/e46177b21b27cd6643c5.woff2 +0 -0
  71. package/build/dist/e9080da0210884549ea6.woff2 +0 -0
  72. package/build/dist/excalidraw-assets/Assistant-Bold.woff2 +0 -0
  73. package/build/dist/excalidraw-assets/Assistant-Medium.woff2 +0 -0
  74. package/build/dist/excalidraw-assets/Assistant-Regular.woff2 +0 -0
  75. package/build/dist/excalidraw-assets/Assistant-SemiBold.woff2 +0 -0
  76. package/build/dist/excalidraw-assets/Cascadia.woff2 +0 -0
  77. package/build/dist/excalidraw-assets/Virgil.woff2 +0 -0
  78. package/build/dist/excalidraw-assets/locales/zh-CN-json-069c304b5011429be615.js +1 -0
  79. package/build/dist/excalidraw-assets/vendor-677e88ca78c86bddf13d.js +2 -0
  80. package/build/dist/f188ce0f3c3beb3248d1.woff2 +0 -0
  81. package/build/dist/favicon-16x16.png +0 -0
  82. package/build/dist/favicon-32x32.png +0 -0
  83. package/build/dist/ffc9a5b3669b37cb45d1.woff2 +0 -0
  84. package/build/dist/filerobot-image-editor.min.js +42445 -0
  85. package/build/dist/index.html +1 -0
  86. package/build/dist/rle.js +17868 -0
  87. package/build/main.js +1 -0
  88. package/env +12 -0
  89. package/package.json +134 -0
  90. package/shell/build.js +68 -0
  91. package/shell/config/.babelrc +10 -0
  92. package/shell/config/webpack.config.js +71 -0
  93. package/shell/config/webpack.server.config.js +52 -0
  94. package/shell/dev.js +51 -0
  95. package/shell/filecat.js +2 -0
  96. package/shell/install.js +48 -0
  97. package/shell/restart.sh +29 -0
package/env ADDED
@@ -0,0 +1,12 @@
1
+
2
+ #服务器端口
3
+ port=5567
4
+ # 文件夹起始地址
5
+ #base_folder=D:\
6
+
7
+ # 本地账号密码
8
+ username=123
9
+ password=123
10
+
11
+ #work_dir=D:\data
12
+
package/package.json ADDED
@@ -0,0 +1,134 @@
1
+ {
2
+ "name": "filecat",
3
+ "version": "1.0.1",
4
+ "description": "filecat 文件管理器",
5
+ "author": "xiaobaidadada",
6
+ "scripts": {
7
+ "dev": "node --require ts-node/register ./shell/dev.js --env ./env",
8
+ "dev-debug": "node --inspect=0.0.0.0:9001 --require ts-node/register ./shell/dev.js --env ./env",
9
+ "server-dev": "node --require ts-node/register ./src/main/server.ts --env ./env",
10
+ "webpack-dev": "npx webpack serve --mode development --config shell/config/webpack.config.js",
11
+ "generate-proto": "node --require ts-node/register ./src/common/proto/proto.generate.ts",
12
+ "hot-server-dev": "node --require ts-node/register ./src/main/piping.main.ts ",
13
+ "webpack-build": "npx webpack --config shell/config/webpack.config.js",
14
+ "build": "tsc && node shell/build.js",
15
+ "start": "node build/main.js",
16
+ "pkg-win-amd64": "npm run build && pkg . --targets node18-win-x64 --output filecat-win.exe",
17
+ "pkg-linux-amd64": "npm run build && pkg . --targets node18-linux-x64 --output filecat-linux"
18
+ },
19
+ "pkg": {
20
+ "assets": [
21
+ "build/dist/**/**",
22
+ "node_modules/@xiaobaidadada/node-tuntap2-wintun/wintun_dll/*.dll"
23
+ ]
24
+ },
25
+ "bin": {
26
+ "filecat": "shell/filecat.js"
27
+ },
28
+ "keywords": [
29
+ "administrator",
30
+ "filemanager",
31
+ "cpu",
32
+ "docker",
33
+ "linux",
34
+ "文件服务器",
35
+ "运维面板",
36
+ "react",
37
+ "ssh",
38
+ "ftp",
39
+ "systeminfo",
40
+ "vpn",
41
+ "docker",
42
+ "ddns"
43
+ ],
44
+ "files": [
45
+ "build/**/*",
46
+ "shell",
47
+ "env",
48
+ "LICENSE.txt",
49
+ "README.md",
50
+ "package.json"
51
+ ],
52
+ "dependencies": {
53
+ "@homebridge/node-pty-prebuilt-multiarch": "^0.11.14",
54
+ "@koa/cors": "^5.0.0",
55
+ "@xiaobaidadada/node-tuntap2-wintun": "^1.0.6",
56
+ "archiver": "^7.0.1",
57
+ "fluent-ffmpeg": "^2.1.3",
58
+ "fs-extra": "^11.2.0",
59
+ "jmespath": "^0.16.0",
60
+ "koa": "^2.15.2",
61
+ "koa-body": "^6.0.1",
62
+ "koa-proxies": "^0.12.4",
63
+ "koa-router": "^12.0.1",
64
+ "mime-types": "^2.1.35",
65
+ "multer": "^1.4.5-lts.1",
66
+ "needle": "^3.3.1",
67
+ "node-forge": "^1.3.1",
68
+ "node-process-watcher": "^1.0.2",
69
+ "node-unrar-js": "^2.0.2",
70
+ "reflect-metadata": "^0.2.1",
71
+ "rimraf": "^5.0.5",
72
+ "routing-controllers": "^0.10.4",
73
+ "serialize-javascript": "^6.0.2",
74
+ "socket.io-parser": "^4.2.4",
75
+ "ssh2": "^1.15.0",
76
+ "sshpk": "^1.18.0",
77
+ "systeminformation": "^5.22.11",
78
+ "tar": "^7.4.3",
79
+ "tencentcloud-sdk-nodejs": "^4.0.858",
80
+ "tldts": "^6.1.20",
81
+ "typedi": "^0.10.0",
82
+ "unzipper": "^0.12.2",
83
+ "ws": "^8.16.0"
84
+ },
85
+ "devDependencies": {
86
+ "@babel/core": "^7.24.3",
87
+ "@babel/plugin-proposal-decorators": "^7.24.1",
88
+ "@babel/preset-env": "^7.24.3",
89
+ "@babel/preset-react": "^7.24.1",
90
+ "@babel/preset-typescript": "^7.24.1",
91
+ "@excalidraw/excalidraw": "^0.17.6",
92
+ "@xterm/addon-fit": "^0.10.0",
93
+ "@xterm/xterm": "^5.5.0",
94
+ "ace-builds": "^1.32.9",
95
+ "axios": "^1.6.8",
96
+ "babel-loader": "^9.1.3",
97
+ "chart.js": "^4.4.2",
98
+ "css-loader": "^6.10.0",
99
+ "flv.js": "^1.6.2",
100
+ "github-markdown-css": "^5.6.1",
101
+ "html-webpack-plugin": "^5.6.0",
102
+ "i18next": "^23.12.2",
103
+ "listr2": "^8.2.1",
104
+ "lodash": "^4.17.21",
105
+ "markdown-it": "^14.1.0",
106
+ "markdown-it-emoji": "^3.0.0",
107
+ "markdown-it-footnote": "^4.0.0",
108
+ "markdown-it-sub": "^2.0.0",
109
+ "markdown-it-sup": "^2.0.0",
110
+ "markdown-it-task-lists": "^2.1.1",
111
+ "material-icons": "^1.13.12",
112
+ "normalize.css": "^8.0.1",
113
+ "noty": "^3.2.0-beta-deprecated",
114
+ "piping": "^1.0.0-rc.4",
115
+ "pkg": "^5.8.1",
116
+ "protobufjs-cli": "^1.1.3",
117
+ "react": "^18.3.1",
118
+ "react-ace": "^12.0.0",
119
+ "react-dom": "^18.3.1",
120
+ "react-i18next": "^15.0.0",
121
+ "react-router-dom": "^6.26.2",
122
+ "recoil": "^0.7.7",
123
+ "style-loader": "^3.3.4",
124
+ "ts-node": "^10.9.2",
125
+ "typescript": "^5.5.2",
126
+ "video.js": "^8.17.2",
127
+ "videojs-hotkeys": "^0.2.28",
128
+ "webpack": "^5.91.0",
129
+ "webpack-bundle-analyzer": "^4.10.2",
130
+ "webpack-cli": "^5.1.4",
131
+ "webpack-dev-server": "^5.0.4",
132
+ "webpack-node-externals": "^3.0.0"
133
+ }
134
+ }
package/shell/build.js ADDED
@@ -0,0 +1,68 @@
1
+ const {Listr} = require("listr2");
2
+ const webpack = require('webpack');
3
+ const config = require('./config/webpack.config.js');
4
+ const serverConfig = require('./config/webpack.server.config.js');
5
+ const {copyFileSync} = require("fs");
6
+ const path = require("path");
7
+ const {rimraf} = require("rimraf");
8
+ const fse = require("fs-extra");
9
+
10
+
11
+ const tasksLister = new Listr(
12
+ [
13
+ {
14
+ title: "构建服务端",
15
+ task: async () => {
16
+ return new Promise((res, rej) => {
17
+ webpack(serverConfig, (err, stats) => {
18
+ if (err || stats.hasErrors()) {
19
+ console.error(err || stats.toString());
20
+ rej(false);
21
+ return;
22
+ }
23
+ // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "bin", "win-process.node"), path.join(__dirname, "..", "build", "win-process.node"))
24
+ // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "bin", "linux-process.node"), path.join(__dirname, "..", "build", "linux-process.node"))
25
+ // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "tun","ts","linux","linuxtun.node"), path.join(__dirname, "..", "build", "linuxtun.node"))
26
+ // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "tun","ts","win","wintun.node"), path.join(__dirname, "..", "build", "wintun.node"))
27
+ // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "wintun-amd64.dll"), path.join(__dirname, "..", "build", "wintun-amd64.dll"))
28
+ // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "wintun-arm.dll"), path.join(__dirname, "..", "build", "wintun-arm.dll"))
29
+ // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "wintun-arm64.dll"), path.join(__dirname, "..", "build", "wintun-arm64.dll"))
30
+ // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "wintun-x86.dll"), path.join(__dirname, "..", "build", "wintun-x86.dll"))
31
+ // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "bin", "ffmpeg"), path.join(__dirname, "..", "build", "ffmpeg"))
32
+ // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "bin", "ffmpeg.exe"), path.join(__dirname, "..", "build", "ffmpeg.exe"))
33
+ rimraf(path.join(__dirname,"..","build","server"));
34
+ res(true);
35
+ });
36
+
37
+ })
38
+
39
+ },
40
+ },
41
+ {
42
+ title: "构建web",
43
+ task: async () => {
44
+ return new Promise((res, rej) => {
45
+ webpack(config, (err, stats) => {
46
+ if (err || stats.hasErrors()) {
47
+ console.error(err || stats.toString());
48
+ rej(false);
49
+ return;
50
+ }
51
+ fse.copySync(path.join(__dirname, "..", "src", "web", "meta", 'resources',"assets","excalidraw-assets"),path.join(__dirname, "..", "build", "dist","excalidraw-assets"));
52
+ copyFileSync(path.join(__dirname, "..", "src", "web", "project", 'component',"file","component","image","js","filerobot-image-editor.min.js"), path.join(__dirname, "..", "build", "dist","filerobot-image-editor.min.js"));
53
+ copyFileSync(path.join(__dirname, "..", "src", "web", "project", "component","toolbox","rdp","client","js","rle.js"), path.join(__dirname, "..", "build", "dist","rle.js"));
54
+ copyFileSync(path.join(__dirname, "..", "src", "web", "meta","resources","img","favicon-16x16.png"), path.join(__dirname, "..", "build", "dist","favicon-16x16.png"));
55
+ copyFileSync(path.join(__dirname, "..", "src", "web", "meta", "resources","img","favicon-32x32.png"), path.join(__dirname, "..", "build", "dist","favicon-32x32.png"));
56
+ // copyFileSync(path.join(__dirname, "..", "src", "web", "meta", "component","resources","img","svg.png"), path.join(__dirname, "..", "build", "dist","svg.png"))
57
+ res(true);
58
+ });
59
+ })
60
+ },
61
+ options: {persistentOutput: true},
62
+ },
63
+ ],
64
+ {
65
+ exitOnError: false,
66
+ }
67
+ );
68
+ tasksLister.run();
@@ -0,0 +1,10 @@
1
+ {
2
+ "presets": [
3
+ "@babel/preset-env",
4
+ "@babel/preset-typescript",
5
+ "@babel/preset-react"
6
+ ],
7
+ "plugins": [
8
+ ["@babel/plugin-proposal-decorators", { "legacy": true }]
9
+ ]
10
+ }
@@ -0,0 +1,71 @@
1
+ const path = require('path');
2
+ const HtmlWebpackPlugin = require('html-webpack-plugin');
3
+ const webpack = require('webpack');
4
+ const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
5
+ const package_data = require("../../package.json")
6
+ module.exports = {
7
+ mode: 'production',
8
+ entry: path.join(__dirname, "..", "..", "src", "web", "project", 'index.js'),
9
+ output: {
10
+ // path: path.resolve(__dirname, '..','..','dist'),
11
+ filename: 'bundle.js',
12
+ path: path.resolve(__dirname, '..', "..", 'build', 'dist'),
13
+ },
14
+ module: {
15
+ rules: [
16
+ {
17
+ test: /\.(js|jsx|tsx|ts)$/,
18
+ exclude: /node_modules/,
19
+ use: {
20
+ loader: 'babel-loader',
21
+ options: {
22
+ configFile: path.resolve(__dirname, '.babelrc'), // 指定 .babelrc 文件路径
23
+ },
24
+ },
25
+ },
26
+ {
27
+ test: /\.css$/, // 匹配所有以.css结尾的文件
28
+ use: ['style-loader', 'css-loader'] // 使用style-loader和css-loader处理匹配到的文件
29
+ },
30
+ {
31
+ test: /\.svg/,
32
+ type: 'asset/inline'
33
+ }
34
+ ],
35
+ },
36
+ resolve: {
37
+ extensions: ['.tsx', '.ts', '.js', '.jsx'],
38
+ },
39
+ plugins: [
40
+ new HtmlWebpackPlugin({
41
+ template: path.join(__dirname, "..", "..", "src", "web", "project", 'index.html'),
42
+ }),
43
+ new webpack.DefinePlugin({
44
+ 'process.env': JSON.stringify(process.env),
45
+ }),
46
+ new webpack.DefinePlugin({
47
+ 'process.env.version': JSON.stringify(package_data.version),
48
+ })
49
+ // new BundleAnalyzerPlugin()
50
+ ],
51
+ devServer: {
52
+ static: [
53
+ {directory: path.join(__dirname, "..", "..", "node_modules", "@excalidraw", "excalidraw", "dist","excalidraw-assets-dev"),},
54
+ {directory: path.join(__dirname, "..", "..", "node_modules", "@excalidraw", "excalidraw", "dist","excalidraw-assets-dev","locales"),},
55
+ {directory: path.join(__dirname, "..", "..", "src", "web", "project", './'),},
56
+ {directory: path.join(__dirname, "..", "..", "src", "web", "project", 'component', "file", "component", "image", "js")},
57
+ {directory: path.join(__dirname, "..", "..", "src", "web", "project", 'component', "toolbox", "rdp", "client", "js")},
58
+ {directory: path.join(__dirname, "..", "..", "src", "web", "meta", 'resources', "img", "./",)}
59
+ ],
60
+ port: 3301,
61
+ open: false,
62
+ // onListening: function (devServer) {
63
+ // if (!devServer) {
64
+ // throw new Error('webpack-dev-server is not defined');
65
+ // }
66
+ // // const port = devServer.server.address().port;
67
+ // console.log('Listening on port:', port);
68
+ // },
69
+ allowedHosts: "all", // 新增该配置项
70
+ },
71
+ };
@@ -0,0 +1,52 @@
1
+ const path = require('path');
2
+ const nodeExternals = require('webpack-node-externals');
3
+ const webpack = require('webpack');
4
+ const TerserPlugin = require("terser-webpack-plugin");
5
+
6
+ module.exports = {
7
+ target: 'node', // 指定打包结果运行在node环境下
8
+ mode: 'production', // 或者 'production'
9
+ entry: path.join(__dirname,"..","..","build","server","main","server.js"), // 你的TypeScript入口文件路径
10
+ output: {
11
+ path: path.resolve(__dirname, "..","..","build"), // 输出目录
12
+ filename: 'main.js', // 输出文件名
13
+ },
14
+ resolve: {
15
+ extensions: ['.ts','.js'] // 解析文件时自动补全的文件扩展名
16
+ },
17
+ module: {
18
+ rules: [
19
+ {
20
+ test: /\.(ts|js)$/,
21
+ exclude: /node_modules/,
22
+ use: {
23
+ loader: 'babel-loader',
24
+ options: {
25
+ presets: [
26
+ "@babel/preset-env",
27
+ ]
28
+ }
29
+ },
30
+ },
31
+ ]
32
+ },
33
+ externals: [nodeExternals()], // 将所有的外部模块视为外部依赖
34
+ plugins: [
35
+ new webpack.DefinePlugin({
36
+ 'process.env.NODE_ENV': JSON.stringify('production'),
37
+ }),
38
+ new webpack.IgnorePlugin({
39
+ resourceRegExp: /^\.\/.*?\.node$/
40
+ // contextRegExp: /moment$/,
41
+ })
42
+ ],
43
+ optimization: {
44
+ minimize: true,
45
+ minimizer: [
46
+ new TerserPlugin({
47
+ extractComments: false,//不将注释提取到单独的文件中
48
+ }),
49
+ ],
50
+ }
51
+
52
+ };
package/shell/dev.js ADDED
@@ -0,0 +1,51 @@
1
+
2
+ const { spawn } = require('child_process');
3
+ const path = require("path");
4
+ const Webpack = require('webpack');
5
+ const WebpackDevServer = require('webpack-dev-server');
6
+ const webpackConfig = require('./config/webpack.config.js');
7
+ const {findAvailablePort} = require("../src/common/findPort");
8
+
9
+ // const temLog = console.log;
10
+
11
+ // const child = spawn('npm', ['run', 'server-dev'], {
12
+ // shell: true, // 在某些系统上可能需要设置 shell 为 true 以正确执行命令
13
+ // stdio: 'inherit', // 使子进程的输入、输出和错误流与父进程共享
14
+ // });
15
+
16
+ // child.stdout.on('data', (data) => {
17
+ //
18
+ // console.log(data.toString());
19
+ // })
20
+ // child.stderr.on('data', (data) => {
21
+ // console.log = temLog;
22
+ // console.error(data.toString());
23
+ // });
24
+
25
+
26
+ const runServer = async () => {
27
+ const port = await findAvailablePort(49152, 65535);
28
+ process.env.webpack_port = port;
29
+ webpackConfig['mode'] = 'development';
30
+ webpackConfig['devServer']['port'] = port;
31
+ webpackConfig['devServer']['onListening'] = function (devServer) {
32
+ if (!devServer) {
33
+ throw new Error('webpack-dev-server is not defined');
34
+ }
35
+ console.log('\x1b[31m请用后端端口访问网页\x1b[0m');
36
+ };
37
+ const compiler = Webpack(webpackConfig);
38
+
39
+ // webpackConfig['mode'] = 'production';
40
+ const devServerOptions = { ...webpackConfig.devServer, open: false };
41
+ const server = new WebpackDevServer(devServerOptions, compiler);
42
+ server.start();
43
+ require("../src/main/server")
44
+ };
45
+
46
+ runServer();
47
+ // console.log = function (...args) {
48
+ // }
49
+
50
+
51
+
@@ -0,0 +1,2 @@
1
+
2
+ require("../build/main.js");
@@ -0,0 +1,48 @@
1
+ const path = require("path");
2
+ const { exec } = require('child_process');
3
+
4
+ function isModuleInstalled(moduleName) {
5
+ try {
6
+ require.resolve(moduleName);
7
+ return true;
8
+ } catch (error) {
9
+ return false;
10
+ }
11
+ }
12
+ function installModule(moduleName) {
13
+ return new Promise((resolve, reject) => {
14
+ const command = `npm install ${moduleName}`;
15
+ console.log(`Installing ${moduleName}...`);
16
+ exec(command, (error, stdout, stderr) => {
17
+ if (error) {
18
+ console.error(`Error installing ${moduleName}:`, stderr);
19
+ reject(error);
20
+ } else {
21
+ console.log(`${moduleName} installed successfully.`);
22
+ resolve(stdout);
23
+ }
24
+ });
25
+ });
26
+ }
27
+ const package = require(path.join(process.cwd(), 'package.json'));
28
+
29
+ const devDependencies = package.devDependencies;
30
+ const dependencies = package.dependencies;
31
+
32
+ async function run () {
33
+ for (const p of Object.keys(dependencies)) {
34
+ if (!isModuleInstalled(p)) {
35
+ installModule(`${p}@${dependencies[p].split('^')[1]}`);
36
+ }
37
+ }
38
+ for (const p of Object.keys(devDependencies)) {
39
+ if (!isModuleInstalled(p)) {
40
+ installModule(`${p}@${devDependencies[p].split('^')[1]}`);
41
+ }
42
+ }
43
+ }
44
+ run();
45
+
46
+
47
+
48
+
@@ -0,0 +1,29 @@
1
+ #!/bin/bash
2
+
3
+
4
+ # 读取参数
5
+ PORT1=5567
6
+ PORT2=3301
7
+
8
+ # 查找并关闭第一个端口的程序
9
+ find_and_kill_process() {
10
+ local PORT=$1
11
+ local PID=$(lsof -t -i:$PORT)
12
+ if [ -n "$PID" ]; then
13
+ echo "Found process with PID $PID using port $PORT. Killing process..."
14
+ kill $PID
15
+ echo "Process killed."
16
+ else
17
+ echo "No process found using port $PORT."
18
+ fi
19
+ }
20
+
21
+ # 查找并关闭第一个端口的程序
22
+ find_and_kill_process $PORT1
23
+
24
+ # 查找并关闭第二个端口的程序
25
+ find_and_kill_process $PORT2
26
+
27
+ npm install
28
+
29
+ nohup npm run dev >./nohup.out 2>&1 &