@@ -52,6 +52,32 @@ Both Nx and Turborepo support all three package managers:
5252-  ` .WithYarnPackageInstaller() `  - uses yarn
5353-  ` .WithPnpmPackageInstaller() `  - uses pnpm
5454
55+ ### Configuring Package Manager for App Execution  
56+ 
57+ Use ` RunWithPackageManager() `  to configure which package manager command is used when running individual apps:
58+ 
59+ ``` csharp 
60+ //  Auto-infer from package installer annotation
61+ var  nx  =  builder .AddNxApp (" nx" workingDirectory : " ../frontend" 
62+     .WithYarnPackageInstaller ()
63+     .RunWithPackageManager (); //  Will use 'yarn' command
64+ 
65+ //  Explicitly specify package manager (independent of installer)
66+ var  turbo  =  builder .AddTurborepoApp (" turbo" workingDirectory : " ../frontend" 
67+     .WithNpmPackageInstaller ()
68+     .RunWithPackageManager (" pnpm" //  Uses 'pnpm' despite npm installer
69+ 
70+ //  Without RunWithPackageManager - uses default commands
71+ var  nxDefault  =  builder .AddNxApp (" nx-default" workingDirectory : " ../frontend" 
72+ nxDefault .AddApp (" app1" //  Runs: nx serve app1 (no package manager prefix)
73+ ``` 
74+ 
75+ ** Command Generation Examples:** 
76+ -  ` RunWithPackageManager("npm") `  → ` npx nx serve app1 `  or ` npx turbo run dev --filter app1 ` 
77+ -  ` RunWithPackageManager("yarn") `  → ` yarn nx serve app1 `  or ` yarn turbo run dev --filter app1 `   
78+ -  ` RunWithPackageManager("pnpm") `  → ` pnpm nx serve app1 `  or ` pnpm turbo run dev --filter app1 ` 
79+ -  No ` RunWithPackageManager() `  → ` nx serve app1 `  or ` turbo run dev --filter app1 ` 
80+ 
5581## How It Works  
5682
57831 .  ** Shared Installer** : The top-level resource (` NxResource `  or ` TurborepoResource ` ) manages a single package installation
@@ -89,11 +115,29 @@ You can migrate to:
89115``` csharp 
90116//  New monorepo approach
91117var  nx  =  builder .AddNxApp (" nx" workingDirectory : " ./Frontend" 
92-     .WithYarnPackageInstaller ();
118+     .WithYarnPackageInstaller ()
119+     .RunWithPackageManager (); //  Configure package manager for app execution
93120
94121var  app1  =  nx .AddApp (" app-1" appName : " app1" 
95- var  app2  =  nx .AddApp (" app-2" appName : " app2" 
122+ var  app2  =  nx .AddApp (" app-2" appName : " app2"    
96123var  app3  =  nx .AddApp (" app-3" appName : " app3" 
97124``` 
98125
99- This provides cleaner syntax and automatic dependency management.
126+ This provides cleaner syntax and automatic dependency management.
127+ 
128+ ## Key Configuration Options  
129+ 
130+ ### Package Installation vs App Execution  
131+ 
132+ It's important to understand the difference between package installation and app execution:
133+ 
134+ -  ** Package Installer**  (` .WithNpmPackageInstaller() ` , etc.) - Controls how packages are installed in the workspace
135+ -  ** Package Manager for Apps**  (` .RunWithPackageManager() ` ) - Controls which command is used to run individual apps
136+ 
137+ ``` csharp 
138+ var  nx  =  builder .AddNxApp (" nx" workingDirectory : " ../frontend" 
139+     .WithNpmPackageInstaller ()        //  Install packages with: npm install  
140+ RunWithPackageManager (" yarn" //  Run apps with: yarn nx serve app1
141+ 
142+ //  This is valid - you can install with npm but run apps with yarn
143+ ``` 
0 commit comments