dsh-lark-bot 0.9.0 → 0.9.2

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/dist/plugin.js CHANGED
@@ -145,7 +145,9 @@ function findOwnPackageRoot(startDir) {
145
145
  try {
146
146
  const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
147
147
  if (typeof pkg.name === "string" && isOwnPackageName(pkg.name)) {
148
- return { name: pkg.name, root: dir };
148
+ const info = { name: pkg.name, root: dir };
149
+ if (typeof pkg.version === "string") info.version = pkg.version;
150
+ return info;
149
151
  }
150
152
  } catch {
151
153
  }
@@ -246,14 +248,14 @@ function acpPluginInstalled(profileRoot) {
246
248
  }
247
249
  function isAcpProfileReady(profileRoot) {
248
250
  const own = ownPackageInfo();
249
- return existsSync4(join4(profileRoot, "package.json")) && existsSync4(join4(profileRoot, "cordis.yml")) && existsSync4(join4(profileRoot, "cordis.patch.yml")) && acpPluginInstalled(profileRoot) && ownPackageLinked2(profileRoot, own.name);
251
+ return existsSync4(join4(profileRoot, "package.json")) && existsSync4(join4(profileRoot, "cordis.yml")) && existsSync4(join4(profileRoot, "cordis.patch.yml")) && acpPluginInstalled(profileRoot) && ownPackageLinked2(profileRoot, own);
250
252
  }
251
- function ownPackageLinked2(profileRoot, ownName) {
252
- const linkPath = join4(profileRoot, "node_modules", ownName);
253
+ function ownPackageLinked2(profileRoot, own) {
254
+ const linkPath = join4(profileRoot, "node_modules", own.name);
253
255
  try {
254
256
  const real = realpathSync2(linkPath);
255
257
  const pkg = JSON.parse(readFileSync3(join4(real, "package.json"), "utf8"));
256
- return pkg.name === ownName && pkg.dsh?.bundle?.patch !== void 0;
258
+ return pkg.name === own.name && pkg.dsh?.bundle?.patch !== void 0 && real === realpathSync2(own.root);
257
259
  } catch {
258
260
  return false;
259
261
  }
@@ -1350,14 +1352,14 @@ function sdkServerInstalled(profileRoot) {
1350
1352
  }
1351
1353
  function isSdkProfileReady(profileRoot) {
1352
1354
  const own = ownPackageInfo();
1353
- return existsSync3(join3(profileRoot, "package.json")) && existsSync3(join3(profileRoot, "cordis.yml")) && existsSync3(join3(profileRoot, "cordis.patch.yml")) && sdkServerInstalled(profileRoot) && ownPackageLinked(profileRoot, own.name);
1355
+ return existsSync3(join3(profileRoot, "package.json")) && existsSync3(join3(profileRoot, "cordis.yml")) && existsSync3(join3(profileRoot, "cordis.patch.yml")) && sdkServerInstalled(profileRoot) && ownPackageLinked(profileRoot, own);
1354
1356
  }
1355
- function ownPackageLinked(profileRoot, ownName) {
1356
- const linkPath = join3(profileRoot, "node_modules", ownName);
1357
+ function ownPackageLinked(profileRoot, own) {
1358
+ const linkPath = join3(profileRoot, "node_modules", own.name);
1357
1359
  try {
1358
1360
  const real = realpathSync(linkPath);
1359
1361
  const pkg = JSON.parse(readFileSync2(join3(real, "package.json"), "utf8"));
1360
- return pkg.name === ownName && pkg.dsh?.bundle?.patch !== void 0;
1362
+ return pkg.name === own.name && pkg.dsh?.bundle?.patch !== void 0 && real === realpathSync(own.root);
1361
1363
  } catch {
1362
1364
  return false;
1363
1365
  }