2222 NodejsNpmPackAction ,
2323 NodejsNpmrcAndLockfileCopyAction ,
2424 NodejsNpmrcCleanUpAction ,
25+ NodejsNpmUpdateAction ,
2526)
2627from aws_lambda_builders .workflows .nodejs_npm .npm import SubprocessNpm
2728from aws_lambda_builders .workflows .nodejs_npm .utils import OSUtils
@@ -119,7 +120,7 @@ def __init__(self, source_dir, artifacts_dir, scratch_dir, manifest_path, runtim
119120 subprocess_npm = subprocess_npm ,
120121 osutils = osutils ,
121122 build_options = self .options ,
122- install_links = is_building_in_source ,
123+ is_building_in_source = is_building_in_source ,
123124 )
124125 )
125126
@@ -211,7 +212,7 @@ def get_install_action(
211212 subprocess_npm : SubprocessNpm ,
212213 osutils : OSUtils ,
213214 build_options : Optional [dict ],
214- install_links : Optional [bool ] = False ,
215+ is_building_in_source : Optional [bool ] = False ,
215216 ):
216217 """
217218 Get the install action used to install dependencies.
@@ -228,8 +229,8 @@ def get_install_action(
228229 An instance of OS Utilities for file manipulation
229230 build_options : Optional[dict]
230231 Object containing build options configurations
231- install_links : Optional[bool]
232- Uses the --install-links npm option if True, by default False
232+ is_building_in_source : Optional[bool]
233+ States whether --build-in-source flag is set or not
233234
234235 Returns
235236 -------
@@ -245,12 +246,13 @@ def get_install_action(
245246
246247 if (osutils .file_exists (lockfile_path ) or osutils .file_exists (shrinkwrap_path )) and npm_ci_option :
247248 return NodejsNpmCIAction (
248- install_dir = install_dir , subprocess_npm = subprocess_npm , install_links = install_links
249+ install_dir = install_dir , subprocess_npm = subprocess_npm , install_links = is_building_in_source
249250 )
250251
251- return NodejsNpmInstallAction (
252- install_dir = install_dir , subprocess_npm = subprocess_npm , install_links = install_links
253- )
252+ if is_building_in_source :
253+ return NodejsNpmUpdateAction (install_dir = install_dir , subprocess_npm = subprocess_npm )
254+
255+ return NodejsNpmInstallAction (install_dir = install_dir , subprocess_npm = subprocess_npm )
254256
255257 @staticmethod
256258 def can_use_install_links (npm_process : SubprocessNpm ) -> bool :
0 commit comments