list specific package version via npm

@param {String} [name] published package name
@param {String} [dir] list directory
@public
342988
function listInstalledVer(name, dir) {
        var _child$spawnSync3 = _child_process2['default'].spawnSync(npmCommand, ['list', name, '--depth', '0', '--json'], { cwd: dir });

        var stdout = _child$spawnSync3.stdout;
        var error = _child$spawnSync3.error;
        var status = _child$spawnSync3.status;

        // the package is invalid or uninstalled
        if (error || 0 !== status) {
            return '';
        }

        return JSON.parse(stdout)['version'];
    }
673288
def find_package_indexes_in_dir(self, simple_dir):
        """"""
        packages = sorted(
            {
                # Filter out all of the "non" normalized names here
                canonicalize_name(x)
                for x in os.listdir(simple_dir)
            }
        )
        # Package indexes must be in directories, so ignore anything else.
        packages = [x for x in packages if os.path.isdir(os.path.join(simple_dir, x))]
        return packages
112196
function(dir) {

        // Load the package.json if it exists (and remove relative refs)
        var pkg;
        dir = Path.resolve(dir);
        try {
          pkg = JSON.parse(FS.readFileSync(dir + '/package.json', 'utf-8'));
        } catch (e) {
          // Report an error if the package.json has a parse problem.  This is
          // good during app development to show why we didn't discover the app.
          if (e.code !== "ENOENT") {
             console.error("Problem parsing " + dir + "/package.json");
          }
          return false;
        }

        // Is this a monitor-dashboard app?
        var isMonitorApp = pkg.dependencies && _.find(_.keys(pkg.dependencies), function(keyword){ return keyword === 'monitor-dashboard'; });
        if (!isMonitorApp) {
          return false;
        }

        // This is a monitor-dashboard app.
        return t.loadApp(dir, pkg);
      }
1012278
function(callback) {
    var packageToVersions = this.packageToVersions;
    var count = Package.versionCount(packageToVersions);
    if (count === 0) {
      return callback && callback();
    }

    var packages = Object.keys(packageToVersions);
    async.parallel(
      packages
        .map(function(package) {
          var versions = Object.keys(packageToVersions[package]);
          return versions.map(function(version) {
            return this.downloadPackageVersion.bind(this, package, version);
          }.bind(this));
        }.bind(this))
        .reduce(function(prev, curr) {
          return prev.concat(curr);
        }),
      function(err) {
        return callback && callback(err);
      }
    );
  }
866452
def list_pkgs(versions_as_list=False, **kwargs):
    '''
    
    '''
    versions_as_list = salt.utils.data.is_true(versions_as_list)
    # 'removed', 'purge_desired' not yet implemented or not applicable
    if any([salt.utils.data.is_true(kwargs.get(x))
            for x in ('removed', 'purge_desired')]):
        return {}

    if 'pkg.list_pkgs' in __context__:
        if versions_as_list:
            return __context__['pkg.list_pkgs']
        else:
            ret = copy.deepcopy(__context__['pkg.list_pkgs'])
            __salt__['pkg_resource.stringify'](ret)
            return ret

    ret = {}
    cmd = ['port', 'installed']
    out = salt.utils.mac_utils.execute_return_result(cmd)
    for line in out.splitlines():
        try:
            name, version_num, active = re.split(r'\s+', line.lstrip())[0:3]
            version_num = version_num[1:]
        except ValueError:
            continue
        if not LIST_ACTIVE_ONLY or active == '(active)':
            __salt__['pkg_resource.add_pkg'](ret, name, version_num)

    __salt__['pkg_resource.sort_pkglist'](ret)
    __context__['pkg.list_pkgs'] = copy.deepcopy(ret)
    if not versions_as_list:
        __salt__['pkg_resource.stringify'](ret)
    return ret
242875
def format_pkg_list(packages, versions_as_list, attr):
    '''
    
    '''
    ret = copy.deepcopy(packages)
    if attr:
        requested_attr = {'epoch', 'version', 'release', 'arch', 'install_date', 'install_date_time_t'}

        if attr != 'all':
            requested_attr &= set(attr + ['version'])

        for name in ret:
            versions = []
            for all_attr in ret[name]:
                filtered_attr = {}
                for key in requested_attr:
                    if all_attr[key]:
                        filtered_attr[key] = all_attr[key]
                versions.append(filtered_attr)
            ret[name] = versions
        return ret

    for name in ret:
        ret[name] = [format_version(d['epoch'], d['version'], d['release'])
                     for d in ret[name]]
    if not versions_as_list:
        stringify(ret)
    return ret
1127680
async function updatePackageJSON (version) {
  ['package.json'].forEach(async fileName => {
    const filePath = path.resolve(__dirname, '..', fileName)
    const file = require(filePath)
    file.version = version
    await writeFile(filePath, JSON.stringify(file, null, 2))
  })
}
654057
def get_package_versions(self, name):
        
        package_data = self._packages.get(name)
        versions = []

        if package_data:
            versions = sort_versions(list(package_data.get('versions', [])))

        return versions
1051288
public function checkPackagesCanBeInstalled($packages_names_list)
    {
        foreach ($packages_names_list as $package_name) {
            $this->checkNoOtherPackageNeedsThisDependencyInALowerVersion($package_name,
                $this->getLatestVersionOfPackage($package_name), $packages_names_list);
        }
    }
856071
function(location) {
  var found = false;

  while(!found) {
    if (exists(location + '/package.json')) {
      found = location;
    } else if (location !== '/') {
      location = path.dirname(location);
    } else {
      return false;
    }
  }

  return location;
}
576587
function bumpVersion(importance){
	return function bump_version (done){
		if (!importance) throw new Error(`
  An importance must be specified for a version bump to occur.
  Valid importances: "--patch", "--minor", "--major"
`);
		// get all the files to bump version in
		return gulp.src('./package.json')
			// bump the version number in those files
			.pipe(bump({type: importance}))
			// save it back to filesystem
			.pipe(gulp.dest('./'))
			//commit the changed version number
			.pipe(git.commit(`${importance} version bump`))
	}
}
1268484
function listDirectories(dirPath) {
    return fs.readdirSync(dirPath).filter(
        /**
         * @param {string} file
         * @returns {boolean}
         * */
        file => fs.statSync(path.join(dirPath, file)).isDirectory(),
    );
}
180742
def version_list(package):
    
    team, owner, pkg = parse_package(package)
    session = _get_session(team)

    response = session.get(
        "{url}/api/version/{owner}/{pkg}/".format(
            url=get_registry_url(team),
            owner=owner,
            pkg=pkg
        )
    )

    for version in response.json()['versions']:
        print("%s: %s" % (version['version'], version['hash']))
1170453
function checkPkg(pkgDir, scopes) {
  var errors;
  try {
    var config = {packageDir: pkgDir};
    if (scopes) {
      config.scopeList = scopes;
    }
    var checked = checkDeps.sync(config);
    if (checked.error.length) {
      errors = checked.error;
    }
  } finally {
    // eslint-disable-next-line no-unsafe-finally
    return errors;
  }
}
335424
def list_pkgs(versions_as_list=False, **kwargs):
    '''
    
    '''
    versions_as_list = salt.utils.data.is_true(versions_as_list)
    # not yet implemented or not applicable
    if any([salt.utils.data.is_true(kwargs.get(x))
            for x in ('removed', 'purge_desired')]):
        return {}

    if 'pkg.list_pkgs' in __context__:
        if versions_as_list:
            return __context__['pkg.list_pkgs']
        else:
            ret = copy.deepcopy(__context__['pkg.list_pkgs'])
            __salt__['pkg_resource.stringify'](ret)
            return ret

    cmd = ['apk', 'info', '-v']
    ret = {}
    out = __salt__['cmd.run'](cmd, output_loglevel='trace', python_shell=False)
    for line in salt.utils.itertools.split(out, '\n'):
        pkg_version = '-'.join(line.split('-')[-2:])
        pkg_name = '-'.join(line.split('-')[:-2])
        __salt__['pkg_resource.add_pkg'](ret, pkg_name, pkg_version)

    __salt__['pkg_resource.sort_pkglist'](ret)
    __context__['pkg.list_pkgs'] = copy.deepcopy(ret)
    if not versions_as_list:
        __salt__['pkg_resource.stringify'](ret)
    return ret
727499
async function _expectPackageVersion(args) {
  const packageVersion = require(
    path.resolve(__dirname, '../../package.json')
  ).version;
  await _expectSuccessMessage(args, `${packageVersion}\n`);
}
757962
def show_updates(self):
        
        dists = Distributions()
        if self.project_name:
            #Check for a single package
            pkg_list = [self.project_name]
        else:
            #Check for every installed package
            pkg_list = get_pkglist()
        found = None
        for pkg in pkg_list:
            for (dist, active) in dists.get_distributions("all", pkg,
                    dists.get_highest_installed(pkg)):
                (project_name, versions) = \
                        self.pypi.query_versions_pypi(dist.project_name)
                if versions:

                    #PyPI returns them in chronological order,
                    #but who knows if its guaranteed in the API?
                    #Make sure we grab the highest version:

                    newest = get_highest_version(versions)
                    if newest != dist.version:

                        #We may have newer than what PyPI knows about

                        if pkg_resources.parse_version(dist.version) < \
                            pkg_resources.parse_version(newest):
                            found = True
                            print(" %s %s (%s)" % (project_name, dist.version,
                                    newest))
        if not found and self.project_name:
            self.logger.info("You have the latest version installed.")
        elif not found:
            self.logger.info("No newer packages found at The Cheese Shop")
        return 0