code: def bundles(self, build=None):  # pylint:disable=too-many-locals
      if not os.path.exists(self.deps_folder):
          try:
              os.makedirs(self.deps_folder)
          except OSError:
              logger.exception(
                  "🚨 having issues manipulating %s", self.deps_folder
              )
              sys.exit(1)
  
      self._parse_package(self.package_lock)
  
      getattr(self, "_bundles_extra", lambda: None)()
  
      versions = {
          "version": self.version,
          "package": self.name.replace(" ", "_").replace("-", "_"),
      }
  
      for scope, name, subfolder, filename, extras in self.deps_info:
          version = self.deps["/".join(filter(None, [scope, name]))][
              "version"
          ]
          name_squashed = name.replace("-", "").replace(".", "")
          versions[name_squashed] = version
  
          logger.info("copy npm dependency => %s", filename)
          ext = "min.js" if "min" in filename.split(".") else "js"
          target = f"{name}@{version}.{ext}"
  
          shutil.copyfile(
              self._concat(
                  self.npm_modules, scope, name, subfolder, filename
              ),
              self._concat(self.deps_folder, target),
          )
  
          if extras:
              extras_str = '", "'.join(extras)
              versions[
                  f"extra_{name_squashed}_versions"
              ] = f'"{extras_str}"'
  
              for extra_version in extras:
                  url = f"https://unpkg.com/{name}@{extra_version}/umd/{filename}"
                  res = requests.get(url)
                  extra_target = f"{name}@{extra_version}.{ext}"
                  extra_path = self._concat(
                      self.deps_folder, extra_target
                  )
                  with open(extra_path, "wb") as fp:
                      fp.write(res.content)
  
      _script = "build:dev" if build == "local" else "build:js"
      logger.info("run `npm run %s`", _script)
      os.chdir(self.main)
      run_command_with_process(f"npm run {_script}")
  
      logger.info(
          "generate the `__init__.py` from template and versions"
      )
      with open(
          self._concat(self.main, "init.template"), encoding="utf-8"
      ) as fp:
          t = string.Template(fp.read())
  
      renderer_init = self._concat(
          self.deps_folder, os.pardir, "_dash_renderer.py"
      )
      with open(renderer_init, "w", encoding="utf-8") as fp:
          fp.write(t.safe_substitute(versions))
  
imports: import os
  import sys
  import json
  import string
  import shutil
  import logging
  import coloredlogs
  import fire
  import requests
  from .._utils import run_command_with_process, compute_md5, job
label_desc: Use image node_id 10 for calling the BuildProcess obj's underlying member method code with example usage: obj.bundles(build) without return types