code: def run(self):
          
          if self.already_run:
              return
          package = self.distribution.packages[0]
          if os.path.exists("gulpfile.js") or os.path.exists("webpack.config.js"):
              yarn_version = check_output("yarn --version")
              npm_version = check_output("npm -v")
              print("yarn:", yarn_version, "npm: ", npm_version)
              if yarn_version != "":
                  npm_bin = check_output("yarn bin").strip()
              else:
                  assert npm_version != "", "need nodejs and one of npm or yarn installed in current PATH"
                  assert LooseVersion(npm_version) >= LooseVersion(
                      "1.4"), "npm < 1.4 (%s)" % (npm_version)
                  npm_bin = check_output("npm bin").strip()
  
              commands = []
  
              # if we find yarn, then we use it as it is much faster
              if yarn_version != "":
                  commands.append(['yarn', 'install', '--pure-lockfile'])
              else:
                  commands.append(['npm', 'install'])
  
              if os.path.exists("gulpfile.js"):
                  commands.append([os.path.join(npm_bin, "gulp"), 'prod', '--notests'])
              elif os.path.exists("webpack.config.js"):
                  commands.append([os.path.join(npm_bin, "webpack"), '-p'])
  
              shell = bool(os.name == 'nt')
  
              for command in commands:
                  self.announce(
                      'Running command: %s' % str(" ".join(command)),
                      level=distutils.log.INFO)
                  subprocess.check_call(command, shell=shell)
  
          self.copy_tree(os.path.join(package, 'static'), os.path.join(
              "build", "lib", package, "static"))
  
          with open(os.path.join("build", "lib", package, "VERSION"), "w") as f:
              f.write(self.distribution.metadata.version)
  
          with open(os.path.join(package, "VERSION"), "w") as f:
              f.write(self.distribution.metadata.version)
  
          self.already_run = True
docs: Run command.