filecat 1.0.12 → 1.0.13

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.
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
+
package/shell/restart.sh CHANGED
@@ -1,29 +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 &
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 &