Skip to content

Commit 52e9f82

Browse files
committed
fix: generate .zenstack to the node_modules of the real path of runtime folder
1 parent cef96d4 commit 52e9f82

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/schema/src/plugins/plugin-utils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const RUNTIME_PACKAGE = '@zenstackhq/runtime';
66
export const ALL_OPERATION_KINDS: PolicyOperationKind[] = ['create', 'update', 'postUpdate', 'read', 'delete'];
77

88
/**
9-
* Gets the nearest "node_modules" folder by walking up froma start path.
9+
* Gets the nearest "node_modules" folder by walking up from start path.
1010
*/
1111
export function getNodeModulesFolder(startPath?: string): string | undefined {
1212
startPath = startPath ?? process.cwd();
@@ -25,7 +25,9 @@ export function getNodeModulesFolder(startPath?: string): string | undefined {
2525
* @returns
2626
*/
2727
export function getDefaultOutputFolder() {
28-
const modulesFolder = getNodeModulesFolder();
28+
// Find the real runtime module path, it might be a symlink in pnpm
29+
const runtimeModulePath = require.resolve('@zenstackhq/runtime');
30+
const modulesFolder = getNodeModulesFolder(runtimeModulePath);
2931
return modulesFolder ? path.join(modulesFolder, '.zenstack') : undefined;
3032
}
3133

0 commit comments

Comments
 (0)