@nocobase/utils 2.0.0-alpha.41 → 2.0.0-alpha.43

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 (2) hide show
  1. package/package.json +2 -2
  2. package/plugin-symlink.js +14 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/utils",
3
- "version": "2.0.0-alpha.41",
3
+ "version": "2.0.0-alpha.43",
4
4
  "main": "lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "license": "AGPL-3.0",
@@ -17,5 +17,5 @@
17
17
  "multer": "^1.4.5-lts.2",
18
18
  "object-path": "^0.11.8"
19
19
  },
20
- "gitHead": "889e81eef0280c2e45571bd0a4b2db6aa004f8c1"
20
+ "gitHead": "5e1b7446db50446b80427240a38a9417f3742c05"
21
21
  }
package/plugin-symlink.js CHANGED
@@ -48,11 +48,20 @@ async function createStoragePluginSymLink(pluginName) {
48
48
  }
49
49
  const link = resolve(nodeModulesPath, pluginName);
50
50
  if (await fsExists(link)) {
51
+ const realPath = await realpath(link);
52
+ if (realPath !== resolve(storagePluginsPath, pluginName)) {
53
+ return;
54
+ }
55
+ }
56
+ try {
51
57
  await unlink(link);
58
+ } catch (error) {
59
+ console.error(`Failed to remove existing symlink for storage plugin: ${pluginName}`);
52
60
  }
53
61
  await symlink(resolve(storagePluginsPath, pluginName), link, 'dir');
62
+ // console.log(`Created symlink for storage plugin: ${pluginName}`);
54
63
  } catch (error) {
55
- console.error(error);
64
+ console.error(`Failed to create symlink for storage plugin: ${pluginName}`);
56
65
  }
57
66
  }
58
67
 
@@ -80,16 +89,14 @@ async function createDevPluginSymLink(pluginName) {
80
89
  }
81
90
  }
82
91
  const link = resolve(nodeModulesPath, pluginName);
83
- if (await fsExists(link)) {
84
- const real = await realpath(link);
85
- if (real === resolve(packagePluginsPath, pluginName)) {
86
- return;
87
- }
92
+ try {
88
93
  await unlink(link);
94
+ } catch (error) {
95
+ console.error(`Failed to remove existing symlink for dev plugin: ${pluginName}`);
89
96
  }
90
97
  await symlink(resolve(packagePluginsPath, pluginName), link, 'dir');
91
98
  } catch (error) {
92
- console.error(error);
99
+ console.error(`Failed to create symlink for dev plugin: ${pluginName}`);
93
100
  }
94
101
  }
95
102