code: function addModuleToDependencies(cwd, name, version) {
    version = version || 'latest';
    let pkgFile = { dependencies: {} };
    const pkgPath = path.join(cwd, 'package.json');
    if (fs.existsSync(pkgPath)) {
      pkgFile = fs.readJsonSync(pkgPath);
    }
    pkgFile.dependencies[name] = version;
    fs.outputJsonSync(pkgPath, pkgFile);
  }
docs: 解决npminstall不存在package.json时依赖无法正常安装的问题
  @param cwd
  @param name
  @param version