filecat 7.9.0 → 7.10.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 (125) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +182 -182
  3. package/build/dist/{4967.3fd3bd40a2b5a3b52428.js → 1060.198d91e2dfc174317c3a.js} +1 -1
  4. package/build/dist/1075.05eed88707339ca32044.js +1 -0
  5. package/build/dist/{1142.121454b1de53689b7367.js → 1142.bc43fae2e5e38d9359df.js} +1 -1
  6. package/build/dist/1384.edbad9c24d883a59724d.js +1 -0
  7. package/build/dist/1417.d390b18dd58ff5c28160.js +1 -0
  8. package/build/dist/1448.4db495e1389c0c8445b3.js +1 -0
  9. package/build/dist/{3324.22efcb1c431177b1cf5f.js → 1455.26a021eb94e5bdd5bec2.js} +1 -1
  10. package/build/dist/{1636.b6a17252dfd0d22f09a7.js → 1636.b80b1883358e132d3424.js} +1 -1
  11. package/build/dist/{1832.8ea5c3e8288df0b7fd5c.js → 1832.a01933ba5df99576ecc2.js} +1 -1
  12. package/build/dist/2300.c99b1dd4e752cdfd5e32.js +2 -0
  13. package/build/dist/{2300.9e1baa1c0368abe53d96.js.LICENSE.txt → 2300.c99b1dd4e752cdfd5e32.js.LICENSE.txt} +1 -1
  14. package/build/dist/239.f570f06d4b9c020f1013.js +1 -0
  15. package/build/dist/{2479.dcc88b3370f0f1d66e02.js → 2479.294792ef5d360ad64abc.js} +1 -1
  16. package/build/dist/2542.26cb302b60de23166227.js +1 -0
  17. package/build/dist/{259.81bb9e049e5ef587a96f.js → 259.3c0eb22e9b43ffb63c9c.js} +1 -1
  18. package/build/dist/2626.3bcfe1f26d9cb796a925.js +1 -0
  19. package/build/dist/{2674.7fd28dae86ccdb247851.js → 2674.15ca3c6ac911cf6e6e2f.js} +1 -1
  20. package/build/dist/3233.43bdd7c12ca829d56116.js +1 -0
  21. package/build/dist/3299.6ab0d94f02171cd762cc.js +1 -0
  22. package/build/dist/{6992.f6a07311a638794c24f7.js → 3471.ef3b5dcfe37963034187.js} +1 -1
  23. package/build/dist/{3528.56eeefab6fca5884e2a6.js → 3528.0f8f34028d92fa87c518.js} +1 -1
  24. package/build/dist/{3659.8a31495bb8f38c0ffa7c.js → 3659.dd03dc2ac52a3ff19105.js} +1 -1
  25. package/build/dist/4004.f0193c43fb891fdfb0e4.js +1 -0
  26. package/build/dist/{4560.8ef2e4b60cc86d019dd6.js → 4560.fd9f8cf2d6022b1d3a94.js} +1 -1
  27. package/build/dist/{4903.b5451ed0802b3f7c07b2.js → 4903.070aaa53a243baf05133.js} +1 -1
  28. package/build/dist/{4946.c95d4f426146e0180172.js → 4946.d578f6ba367a742d80bf.js} +2 -2
  29. package/build/dist/4986.f244efce9cf6be21f846.js +1 -0
  30. package/build/dist/5272.1f0dfac07ba202e7d323.js +1 -0
  31. package/build/dist/{5308.052f45c15785487b3766.js → 5308.d1e5ccb49396fc1b026d.js} +1 -1
  32. package/build/dist/{5516.645e4a900df9bdc1806c.js → 5516.88521f3a3c7101c46df3.js} +1 -1
  33. package/build/dist/5614.43bdd7c12ca829d56116.js +1 -0
  34. package/build/dist/{5139.adf9574d9b54a216e041.js → 5709.81f43e3c021fafdfe36f.js} +1 -1
  35. package/build/dist/{5744.e9f1efb88a617b05b709.js → 5744.0f8a0432b73b2eb0a7ff.js} +1 -1
  36. package/build/dist/{5877.ca081c4798194230243c.js → 5877.98d0475aaf4058b9a715.js} +1 -1
  37. package/build/dist/{6247.917e3fbef5dc5fbaf937.js → 6247.525b0b68872036ac2fa6.js} +1 -1
  38. package/build/dist/{7520.fbb0bc2a05cf94e15418.js → 6322.552511b5cb12cd0c821c.js} +1 -1
  39. package/build/dist/6492.17ecd8515fa512ce9306.js +1 -0
  40. package/build/dist/{676.a75318a8b598d8daadf0.js → 676.356039ef6f28f96b8c8b.js} +1 -1
  41. package/build/dist/{6805.bf0c964ab84f0fcc78be.js → 6805.373ac0e7d6555e4a6459.js} +1 -1
  42. package/build/dist/{6919.8cf13c01184b7148b28e.js → 6919.c7cc8617b658198d4924.js} +1 -1
  43. package/build/dist/{7038.4e4fc8e405c56d3080e2.js → 7038.166f915547d27e4dc5e4.js} +1 -1
  44. package/build/dist/{7759.0b68912ff9ef10869f59.js → 7759.7cd3fe8e5d37df25804c.js} +1 -1
  45. package/build/dist/7873.e3098bc6f510e5bea55f.js +1 -0
  46. package/build/dist/7923.d44556578af4d3d7cea3.js +2 -0
  47. package/build/dist/{7943.19d2de387eeb7f513d8e.js → 7943.acf25a5e98dd13290985.js} +1 -1
  48. package/build/dist/8090.8977224618a14ae42159.js +2 -0
  49. package/build/dist/8302.ce97557b7cf7c8387942.js +1 -0
  50. package/build/dist/8319.6a6b9651c87a1bb4cbb9.js +1 -0
  51. package/build/dist/{8603.4142ce42c1635f493eca.js → 8603.f1cbcfd64cde885f9809.js} +1 -1
  52. package/build/dist/8649.d6055ad75975b803bbc1.js +1 -0
  53. package/build/dist/{8727.3628c746061aed7a4077.js → 8727.8658835acb7e0b6e5acc.js} +1 -1
  54. package/build/dist/{8765.a5633d054abb67142fc3.js → 8765.8758c290a6b132f2ce7f.js} +1 -1
  55. package/build/dist/8772.2c35012c25ac9eb5f74d.js +2 -0
  56. package/build/dist/{8772.e8f9731c1c061f1cdf56.js.LICENSE.txt → 8772.2c35012c25ac9eb5f74d.js.LICENSE.txt} +1 -1
  57. package/build/dist/8781.6bd14487d172e004e3d3.js +1 -0
  58. package/build/dist/{9299.6c06dad1abe098b61766.js → 9299.7358ccf05b1415ed7959.js} +1 -1
  59. package/build/dist/9334.a25983aafdcbde63ae5e.js +1 -0
  60. package/build/dist/{9546.e7206c968e92371ae2b1.js → 9546.2cecad04cf676a6616cd.js} +1 -1
  61. package/build/dist/dark.css +839 -839
  62. package/build/dist/filerobot-image-editor.min.js +42445 -42445
  63. package/build/dist/google-dark.css +2032 -2032
  64. package/build/dist/google.css +1719 -1719
  65. package/build/dist/index.html +1 -1
  66. package/build/dist/main.ab3398f34c41e61310ae.js +2 -0
  67. package/build/dist/{main.3a12152528aff6ae213a.js.LICENSE.txt → main.ab3398f34c41e61310ae.js.LICENSE.txt} +1 -1
  68. package/build/dist/rle.js +17867 -17867
  69. package/build/main.js +1 -1
  70. package/build/plugin/core.type.d.ts +62 -0
  71. package/build/threads.work.filecat.js +1 -1
  72. package/env +26 -26
  73. package/package.json +211 -211
  74. package/shell/build.js +161 -161
  75. package/shell/config/.babelrc +14 -14
  76. package/shell/config/base.webpack.config.js +78 -78
  77. package/shell/config/common-bin.config.js +44 -44
  78. package/shell/config/env.js +10 -10
  79. package/shell/config/prebuild-file-path.js +17 -17
  80. package/shell/config/webpack.exe.config.js +36 -36
  81. package/shell/config/webpack.npm.config.js +44 -44
  82. package/shell/config/webpack.web.config.js +152 -152
  83. package/shell/dev.js +51 -51
  84. package/shell/docker-build.sh +2 -2
  85. package/shell/filecat +1 -1
  86. package/shell/filecat-watch +1 -1
  87. package/shell/install.js +48 -48
  88. package/shell/net-agent/git-clone.bat +23 -23
  89. package/shell/net-agent/git-pull.bat +17 -17
  90. package/shell/net-agent/git-push.bat +17 -17
  91. package/shell/pkg.ts +50 -50
  92. package/shell/postinstall-optional.js +29 -29
  93. package/shell/start/filecat-install.sh +22 -22
  94. package/shell/start/filecat-run.sh +2 -2
  95. package/shell/start/windows-install.js +178 -178
  96. package/shell/start/windows-uninstall.js +131 -131
  97. package/shell/util/file.js +46 -46
  98. package/build/dist/1075.40103ec059c6b23b056e.js +0 -1
  99. package/build/dist/1384.0d0fc5faa899c9eddcbe.js +0 -1
  100. package/build/dist/1417.7e511043474084a2a65b.js +0 -1
  101. package/build/dist/1448.0710f04bed1c52e6a5db.js +0 -1
  102. package/build/dist/2300.9e1baa1c0368abe53d96.js +0 -2
  103. package/build/dist/2542.23fb13b1623c9f7c3fc1.js +0 -1
  104. package/build/dist/2626.05d1faa293e0a3318b9b.js +0 -1
  105. package/build/dist/2851.2195b5906b2c224c7bf7.js +0 -1
  106. package/build/dist/3140.794a212da633caf38b3a.js +0 -2
  107. package/build/dist/3233.fb6bffd5e097e4ac9423.js +0 -1
  108. package/build/dist/3299.f37767d30b6999df4014.js +0 -1
  109. package/build/dist/4004.5d68418ad5c2321cb11f.js +0 -1
  110. package/build/dist/4986.78047106f3a0d2d71199.js +0 -1
  111. package/build/dist/5272.0b70ee8ec5f083fb9f5b.js +0 -1
  112. package/build/dist/5614.fb6bffd5e097e4ac9423.js +0 -1
  113. package/build/dist/6492.3ee4060598de873d8e8f.js +0 -1
  114. package/build/dist/7756.2f851693ba030c42dde8.js +0 -1
  115. package/build/dist/7873.11d04b741d2b499d9cb9.js +0 -1
  116. package/build/dist/7923.861345fd55941e8089a1.js +0 -2
  117. package/build/dist/8014.28b5cf8c3787dc829aa4.js +0 -1
  118. package/build/dist/8302.5ae5bfe8baa0084204bb.js +0 -1
  119. package/build/dist/8319.c15a3674ec7abc493595.js +0 -1
  120. package/build/dist/8772.e8f9731c1c061f1cdf56.js +0 -2
  121. package/build/dist/8781.58f0c51870d3dd2689d7.js +0 -1
  122. package/build/dist/main.3a12152528aff6ae213a.js +0 -2
  123. /package/build/dist/{4946.c95d4f426146e0180172.js.LICENSE.txt → 4946.d578f6ba367a742d80bf.js.LICENSE.txt} +0 -0
  124. /package/build/dist/{7923.861345fd55941e8089a1.js.LICENSE.txt → 7923.d44556578af4d3d7cea3.js.LICENSE.txt} +0 -0
  125. /package/build/dist/{3140.794a212da633caf38b3a.js.LICENSE.txt → 8090.8977224618a14ae42159.js.LICENSE.txt} +0 -0
package/shell/install.js CHANGED
@@ -1,48 +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
-
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
+
@@ -1,23 +1,23 @@
1
- @echo off
2
- SETLOCAL ENABLEDELAYEDEXPANSION
3
-
4
- REM 检查是否传递了参数
5
- if "%1"=="" (
6
- echo Please provide a repository URL for cloning.
7
- exit /b 1
8
- )
9
-
10
- REM 设置 Git 代理
11
- echo Setting Git proxy...
12
- git config --global http.proxy 127.0.0.1:3067
13
-
14
-
15
- REM 执行 Git 命令(替换为你需要的 Git 命令)
16
- echo Cloning repository...
17
- git clone %1
18
-
19
- REM 取消 Git 代理
20
- echo Unsetting Git proxy...
21
- git config --global --unset http.proxy
22
- git config --global --unset https.proxy
23
-
1
+ @echo off
2
+ SETLOCAL ENABLEDELAYEDEXPANSION
3
+
4
+ REM 检查是否传递了参数
5
+ if "%1"=="" (
6
+ echo Please provide a repository URL for cloning.
7
+ exit /b 1
8
+ )
9
+
10
+ REM 设置 Git 代理
11
+ echo Setting Git proxy...
12
+ git config --global http.proxy 127.0.0.1:3067
13
+
14
+
15
+ REM 执行 Git 命令(替换为你需要的 Git 命令)
16
+ echo Cloning repository...
17
+ git clone %1
18
+
19
+ REM 取消 Git 代理
20
+ echo Unsetting Git proxy...
21
+ git config --global --unset http.proxy
22
+ git config --global --unset https.proxy
23
+
@@ -1,17 +1,17 @@
1
- @echo off
2
- SETLOCAL ENABLEDELAYEDEXPANSION
3
-
4
- REM 设置 Git 代理
5
- echo Setting Git proxy...
6
- git config --global http.proxy 127.0.0.1:3067
7
-
8
-
9
- REM 执行 Git 命令(替换为你需要的 Git 命令)
10
- echo Executing Git command...
11
- git pull
12
-
13
- REM 取消 Git 代理
14
- echo Unsetting Git proxy...
15
- git config --global --unset http.proxy
16
- git config --global --unset https.proxy
17
-
1
+ @echo off
2
+ SETLOCAL ENABLEDELAYEDEXPANSION
3
+
4
+ REM 设置 Git 代理
5
+ echo Setting Git proxy...
6
+ git config --global http.proxy 127.0.0.1:3067
7
+
8
+
9
+ REM 执行 Git 命令(替换为你需要的 Git 命令)
10
+ echo Executing Git command...
11
+ git pull
12
+
13
+ REM 取消 Git 代理
14
+ echo Unsetting Git proxy...
15
+ git config --global --unset http.proxy
16
+ git config --global --unset https.proxy
17
+
@@ -1,17 +1,17 @@
1
- @echo off
2
- SETLOCAL ENABLEDELAYEDEXPANSION
3
-
4
- REM 设置 Git 代理
5
- echo Setting Git proxy...
6
- git config --global http.proxy 127.0.0.1:3067
7
-
8
-
9
- REM 执行 Git 命令(替换为你需要的 Git 命令)
10
- echo Executing Git command...
11
- git push
12
-
13
- REM 取消 Git 代理
14
- echo Unsetting Git proxy...
15
- git config --global --unset http.proxy
16
- git config --global --unset https.proxy
17
-
1
+ @echo off
2
+ SETLOCAL ENABLEDELAYEDEXPANSION
3
+
4
+ REM 设置 Git 代理
5
+ echo Setting Git proxy...
6
+ git config --global http.proxy 127.0.0.1:3067
7
+
8
+
9
+ REM 执行 Git 命令(替换为你需要的 Git 命令)
10
+ echo Executing Git command...
11
+ git push
12
+
13
+ REM 取消 Git 代理
14
+ echo Unsetting Git proxy...
15
+ git config --global --unset http.proxy
16
+ git config --global --unset https.proxy
17
+
package/shell/pkg.ts CHANGED
@@ -1,51 +1,51 @@
1
- import {FileCompressType} from "../src/common/file.pojo";
2
- import {FileService} from "../src/main/domain/file/file.service";
3
- import {fileCompress} from "../src/main/domain/file/file.compress";
4
- import {download_ripgrep} from "../src/main/domain/bin/download-ripgrep";
5
-
6
-
7
- const fs = require('fs');
8
- const path = require('path');
9
- const {copy_auto} = require('./util/file');
10
-
11
- // 复制 node
12
- fs.copyFileSync(process.execPath, path.join(__dirname, "..", "build", path.basename(process.execPath)));
13
-
14
- const FileServiceImpl = new FileService();
15
- const args = process.argv.slice(2);
16
-
17
- if(args[0].includes("win")) {
18
- fs.copyFileSync(path.join(__dirname,"start","filecat-run.cmd"), path.join(__dirname, "..", "build", "filecat-run.cmd"));
19
- fs.copyFileSync(path.join(__dirname,"start","filecat-install.cmd"), path.join(__dirname, "..", "build", "filecat-install.cmd"));
20
- fs.copyFileSync(path.join(__dirname,"start","filecat-uninstall.cmd"), path.join(__dirname, "..", "build", "filecat-uninstall.cmd"));
21
- fs.copyFileSync(path.join(__dirname,"start","windows-install.js"), path.join(__dirname, "..", "build", "windows-install.js"));
22
- fs.copyFileSync(path.join(__dirname,"start","windows-uninstall.js"), path.join(__dirname, "..", "build", "windows-uninstall.js"));
23
- copy_auto(path.join(process.cwd(),"node_modules","windows-shortcuts"), path.join(__dirname, "..", "build", "node_modules","windows-shortcuts"))
24
- } else {
25
- fs.copyFileSync(path.join(__dirname,"start","filecat-run.sh"), path.join(__dirname, "..", "build", "filecat-run.sh"));
26
- fs.copyFileSync(path.join(__dirname,"start","filecat-install.sh"), path.join(__dirname, "..", "build", "filecat-install.sh"));
27
- }
28
-
29
- const filePaths: string[] = [], directorys: string[] = [];
30
- const root_path = path.join(__dirname, "..", "build");
31
- for (const file of fs.readdirSync(root_path)) {
32
- const name = path.join(root_path, decodeURIComponent(file));
33
- try {
34
- const stats = fs.statSync(name);
35
- if (stats.isFile()) {
36
- filePaths.push(name);
37
- } else {
38
- directorys.push(name);
39
- }
40
- } catch (e) {
41
- }
42
- }
43
-
44
- async function run() {
45
- await download_ripgrep()
46
- // args[0] 会在 package.json 所在目录下
47
- await fileCompress.compress("tar",9,args[0], filePaths, directorys,(v)=>{
48
- console.log(`压缩进度:${v.toFixed(2)}`)
49
- },true)
50
- }
1
+ import {FileCompressType} from "../src/common/file.pojo";
2
+ import {FileService} from "../src/main/domain/file/file.service";
3
+ import {fileCompress} from "../src/main/domain/file/file.compress";
4
+ import {download_ripgrep} from "../src/main/domain/bin/download-ripgrep";
5
+
6
+
7
+ const fs = require('fs');
8
+ const path = require('path');
9
+ const {copy_auto} = require('./util/file');
10
+
11
+ // 复制 node
12
+ fs.copyFileSync(process.execPath, path.join(__dirname, "..", "build", path.basename(process.execPath)));
13
+
14
+ const FileServiceImpl = new FileService();
15
+ const args = process.argv.slice(2);
16
+
17
+ if(args[0].includes("win")) {
18
+ fs.copyFileSync(path.join(__dirname,"start","filecat-run.cmd"), path.join(__dirname, "..", "build", "filecat-run.cmd"));
19
+ fs.copyFileSync(path.join(__dirname,"start","filecat-install.cmd"), path.join(__dirname, "..", "build", "filecat-install.cmd"));
20
+ fs.copyFileSync(path.join(__dirname,"start","filecat-uninstall.cmd"), path.join(__dirname, "..", "build", "filecat-uninstall.cmd"));
21
+ fs.copyFileSync(path.join(__dirname,"start","windows-install.js"), path.join(__dirname, "..", "build", "windows-install.js"));
22
+ fs.copyFileSync(path.join(__dirname,"start","windows-uninstall.js"), path.join(__dirname, "..", "build", "windows-uninstall.js"));
23
+ copy_auto(path.join(process.cwd(),"node_modules","windows-shortcuts"), path.join(__dirname, "..", "build", "node_modules","windows-shortcuts"))
24
+ } else {
25
+ fs.copyFileSync(path.join(__dirname,"start","filecat-run.sh"), path.join(__dirname, "..", "build", "filecat-run.sh"));
26
+ fs.copyFileSync(path.join(__dirname,"start","filecat-install.sh"), path.join(__dirname, "..", "build", "filecat-install.sh"));
27
+ }
28
+
29
+ const filePaths: string[] = [], directorys: string[] = [];
30
+ const root_path = path.join(__dirname, "..", "build");
31
+ for (const file of fs.readdirSync(root_path)) {
32
+ const name = path.join(root_path, decodeURIComponent(file));
33
+ try {
34
+ const stats = fs.statSync(name);
35
+ if (stats.isFile()) {
36
+ filePaths.push(name);
37
+ } else {
38
+ directorys.push(name);
39
+ }
40
+ } catch (e) {
41
+ }
42
+ }
43
+
44
+ async function run() {
45
+ await download_ripgrep()
46
+ // args[0] 会在 package.json 所在目录下
47
+ await fileCompress.compress("tar",9,args[0], filePaths, directorys,(v)=>{
48
+ console.log(`压缩进度:${v.toFixed(2)}`)
49
+ },true)
50
+ }
51
51
  run()
@@ -1,29 +1,29 @@
1
- const { execSync } = require('child_process');
2
- const fs = require('fs');
3
- const path = require('path');
4
-
5
- // 获取当前 package.json 路径
6
- const pkgPath = path.resolve(__dirname, '..', 'package.json');
7
- const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
8
-
9
- const optionalDeps = pkg.optionalDependencies || {};
10
-
11
- console.log('Checking optional dependencies...');
12
-
13
- for (const dep of Object.keys(optionalDeps)) {
14
- try {
15
- require.resolve(dep);
16
- console.log(`✅ ${dep} is already installed`);
17
- } catch (err) {
18
- console.log(`⚠️ ${dep} is missing, installing...`);
19
- try {
20
- // 使用 npm install 安装缺失依赖
21
- // 如果是全局安装,则安装到全局
22
- const globalFlag = process.env.npm_config_global ? '-g' : '';
23
- execSync(`npm install ${dep}@${optionalDeps[dep]} ${globalFlag}`, { stdio: 'inherit' });
24
- console.log(`✅ ${dep} installed successfully`);
25
- } catch (installErr) {
26
- console.error(`❌ Failed to install ${dep}:`, installErr.message);
27
- }
28
- }
29
- }
1
+ const { execSync } = require('child_process');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+
5
+ // 获取当前 package.json 路径
6
+ const pkgPath = path.resolve(__dirname, '..', 'package.json');
7
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
8
+
9
+ const optionalDeps = pkg.optionalDependencies || {};
10
+
11
+ console.log('Checking optional dependencies...');
12
+
13
+ for (const dep of Object.keys(optionalDeps)) {
14
+ try {
15
+ require.resolve(dep);
16
+ console.log(`✅ ${dep} is already installed`);
17
+ } catch (err) {
18
+ console.log(`⚠️ ${dep} is missing, installing...`);
19
+ try {
20
+ // 使用 npm install 安装缺失依赖
21
+ // 如果是全局安装,则安装到全局
22
+ const globalFlag = process.env.npm_config_global ? '-g' : '';
23
+ execSync(`npm install ${dep}@${optionalDeps[dep]} ${globalFlag}`, { stdio: 'inherit' });
24
+ console.log(`✅ ${dep} installed successfully`);
25
+ } catch (installErr) {
26
+ console.error(`❌ Failed to install ${dep}:`, installErr.message);
27
+ }
28
+ }
29
+ }
@@ -1,23 +1,23 @@
1
- #!/usr/bin/env bash
2
-
3
- set -e
4
-
5
- echo "🚀 start filecat..."
6
-
7
- DIR="$(cd "$(dirname "$0")" && pwd)"
8
- cd "$DIR"
9
-
10
- echo "📁 cwd: $DIR"
11
-
12
- # node 可执行
13
- if [ -f "./node" ]; then
14
- chmod +x ./node
15
- fi
16
-
17
- # 执行
18
- if [ -f "./node" ]; then
19
- ./node main.js --install
20
- else
21
- echo "❌ node not found"
22
- exit 1
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ echo "🚀 start filecat..."
6
+
7
+ DIR="$(cd "$(dirname "$0")" && pwd)"
8
+ cd "$DIR"
9
+
10
+ echo "📁 cwd: $DIR"
11
+
12
+ # node 可执行
13
+ if [ -f "./node" ]; then
14
+ chmod +x ./node
15
+ fi
16
+
17
+ # 执行
18
+ if [ -f "./node" ]; then
19
+ ./node main.js --install
20
+ else
21
+ echo "❌ node not found"
22
+ exit 1
23
23
  fi
@@ -1,2 +1,2 @@
1
- #!/bin/bash
2
- ./node main.js "$@"
1
+ #!/bin/bash
2
+ ./node main.js "$@"