def process_npm_assets():
 def copy_vendor_library(library, skip_if_missing=False):
  '\n        Copies a vendor library to the shared vendor directory.\n        '
  library_path = 'node_modules/{library}'.format(library=library)
  if os.path.exists(library_path):
   sh('/bin/cp -rf {library_path} {vendor_dir}'.format(library_path=library_path, vendor_dir=NPM_VENDOR_DIRECTORY))
  elif (not skip_if_missing):
   raise Exception('Missing vendor file {library_path}'.format(library_path=library_path))
 if tasks.environment.dry_run:
  tasks.environment.info('install npm_assets')
  return
 NPM_VENDOR_DIRECTORY.mkdir_p()
 print('Copying vendor files into static directory')
 for library in NPM_INSTALLED_LIBRARIES:
  copy_vendor_library(library)
 print('Copying developer vendor files into static directory')
 for library in NPM_INSTALLED_DEVELOPER_LIBRARIES:
  copy_vendor_library(library, skip_if_missing=True)

def process_npm_assets ( ) : def copy_vendor_library ( library , skip_if_missing = False ) : library_path = 'node_modules/{library}' . format ( library = library ) if os . path . exists ( library_path ) : sh ( '/bin/cp -rf {library_path} {vendor_dir}' . format ( library_path = library_path , vendor_dir = NPM_VENDOR_DIRECTORY ) ) elif ( not skip_if_missing ) : raise Exception ( 'Missing vendor file {library_path}' . format ( library_path = library_path ) ) if tasks . environment . dry_run : tasks . environment . info ( 'install npm_assets' ) return NPM_VENDOR_DIRECTORY . mkdir_p ( ) print ( 'Copying vendor files into static directory' ) for library in NPM_INSTALLED_LIBRARIES : copy_vendor_library ( library ) print ( 'Copying developer vendor files into static directory' ) for library in NPM_INSTALLED_DEVELOPER_LIBRARIES : copy_vendor_library ( library , skip_if_missing = True )
process vendor libraries installed via npm .