telerik / mobile-cli-lib

Contains common infrastructure for CLIs - mainly AppBuilder, NativeScript, DDB and Proton.
Apache License 2.0
11 stars 10 forks source link

Recursively look for projectDir when executing hooks #1029

Closed Mitko-Kerezov closed 6 years ago

Mitko-Kerezov commented 6 years ago

Whenever executing a hook we try and pass the projectDir to the hook, however we expect the original method, marked with @hook to either have the actual property projectDir as an argument or at least have an argument, named projectData from which we can get the projectDir. This is incorrect, as the projectDir property may be nested in some argument further down. Recursively traverse all arguments and try and locate the projectDir property.

Skip, however, especially large objects like those starting with $ (dependency-injected classes) or those ending with service (more dependency-injected classes) in order to prevent a maximum callstack exception.

Ping @rosen-vladimirov @PanayotCankov @sis0k0