@lark-apaas/express-datapaas 0.0.2 → 0.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/express-datapaas",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Drizzle ORM + PostgreSQL with RLS support for Express",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -55,6 +55,13 @@ console.log(`[patch] host root : ${hostRoot}`);
55
55
  console.log(`[patch] patch-package : ${patchBin}`);
56
56
  console.log(`[patch] patch dir : ${patchDir} (relative: ${relativePatchDir})`);
57
57
 
58
+ // pnpm 的虚拟目录下可能没有 package.json,patch-package 需要它才能工作
59
+ const hostPkgPath = path.join(hostRoot, "package.json");
60
+ const needsTempPkg = !fs.existsSync(hostPkgPath);
61
+ if (needsTempPkg) {
62
+ fs.writeFileSync(hostPkgPath, JSON.stringify({ private: true }));
63
+ }
64
+
58
65
  try {
59
66
  execSync(`node "${patchBin}" --patch-dir "${relativePatchDir}"`, {
60
67
  stdio: "inherit",
@@ -64,4 +71,8 @@ try {
64
71
  } catch (err) {
65
72
  console.error("[patch] Failed to apply drizzle-orm patch ❌", err);
66
73
  process.exit(1);
74
+ } finally {
75
+ if (needsTempPkg) {
76
+ try { fs.unlinkSync(hostPkgPath); } catch { /* ignore */ }
77
+ }
67
78
  }