Move dependency logic inside of npm guard