writes the new version to package.json
510459
function updateVersion () {
    start(`Updating ${"package.json".cyan} version from ${oldVersion.cyan} to ${newVersion.cyan}...`);
    pkg.version = newVersion;
    fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2));
    done();
    abortCmds.push('git checkout package.json');
    pushCmds.push('git add package.json');
  }
785460
function() {

			var version = grunt.config(['package', 'version']);

			config.libraries.forEach(function(library) {

				if (library.bower === false) {
					return;
				}

				var bowerFilename = 'tmp/packaged-' + library.name + '/bower.json';

				grunt.log.subhead(library.name);

				var bower = grunt.file.readJSON(bowerFilename);
				var oldVersion = bower.version;

				// update version
				bower.version = version;

				grunt.log.writeln('version: ' + oldVersion + ' => ' + version);

				// check for dependency infos
				if (bower.dependencies) {
					Object.keys(bower.dependencies).forEach(function(dependency) {

						var oldDependencyVersion = bower.dependencies[dependency];
						var oldDependencyVersionParts = oldDependencyVersion.split('#', 1);
						var newDependencyVersion = oldDependencyVersionParts[0] + '#' + version;

						bower.dependencies[dependency] = newDependencyVersion;

						grunt.log.writeln('dependencies.' + dependency + ': ' + oldDependencyVersion + ' => ' + newDependencyVersion);

					});
				}

				grunt.file.write(bowerFilename, JSON.stringify(bower, null, 2));

			});

		}
1165813
function updatePackageInfo(theme, version) {
  const cwd = `.tmp/${version}/${theme}/publish`
  bower.version = `${version}-${theme}`
  pkg.version = `${version}-${theme}`
  return Promise.all([
    fs.writeFile(`${cwd}/bower.json`, JSON.stringify(bower, null, 4)),
    fs.writeFile(`${cwd}/package.json`, JSON.stringify(pkg, null, 4))
  ])
}
117528
function determineVersion(module) {
		var json;

		if (!('version' in module)) {
			json = module.options.path + '/package.json';
			delete require.cache[json];
			json = require(json);

			['dependencies', 'devDependencies', 'optionalDependencies'].forEach(function(dep) {
				if (dep in json && module.name in json[dep]) {
					module.version = json[dep][module.name];
				}
			});
		}
	}
419039
function readPackageVersion(root) {
  let pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
  // use _originalVersion if present if we've already mutated it
  return pkg._originalVersion || pkg.version;
}
894605
def versions_installed(pkg):
    '''
    
    '''

    try:
        # Try to run it, merging stderr into output
        output = subprocess.check_output([SNAP_BINARY_NAME, 'list', pkg], stderr=subprocess.STDOUT)
    except subprocess.CalledProcessError:
        return []

    lines = output.splitlines()[1:]
    ret = []
    for item in lines:
        # If fields contain spaces this will break.
        i = item.split()
        # Ignore 'Notes' field
        ret.append({
            'name':         i[0],
            'version':      i[1],
            'rev':          i[2],
            'tracking':     i[3],
            'publisher':    i[4]
            })

    return ret
133047
function (done) {
      var p = clone(pkg);
      delete p.devDependencies;
      var content = JSON.stringify(p, null, 2);
      write_if_not_exists('package.json', content, done);
    }
106094
function updateInstalledPackage(updatedPackage) {
   var packageIndex = installedPackages.findIndex(function(element) { 
      return (element.packageName === updatedPackage.packageName); 
   });

   if (packageIndex < 0) {
      packageIndex = installedPackages.length;
      installedPackages.push(updatedPackage);
   } else {
      installedPackages[packageIndex] = updatedPackage;
   }

   fs.writeFileSync(installedPackagesDataFileName, JSON.stringify(installedPackages));
}
147417
function backupOriginalPackageJson() {
  var originalContent = JSON.stringify(originalPackageJson, null, 2);
  fs.writeFileSync(tempPackageJsonPath, originalContent);
}
73446
function updatePackageJSONVersion() {
  let packageJSONPath = path.join(__dirname, '..', 'package.json');

  let pkgContents = fs.readFileSync(packageJSONPath, { encoding: 'utf-8' });
  let pkg = JSON.parse(pkgContents);
  if (!pkg._originalVersion) {
    pkg._originalVersion = pkg.version;
  }
  pkg._versionPreviouslyCalculated = true;
  pkg.version = buildInfo.version;
  fs.writeFileSync(packageJSONPath, JSON.stringify(pkg, null, 2), {
    encoding: 'utf-8',
  });
}
1321429
function getPackageVersion() {
  var packageJson = path.join(process.cwd(), 'package.json'),
    version;
  try {
    version = require(packageJson).version;
  } catch (unused) {
    throw new Error('Could not load package.json, please make sure it exists');
  }
  if (!semver.valid(version)) {
    throw new Error('Invalid version number found in package.json, please make sure it is valid');
  }

  return [ semver.major(version), semver.minor(version), semver.patch(version) ].join('.');
}
1351493
function bumpVersion() {
  const versionList = gitVersionInfo(packageJson.version);
  const targetBranch = 'master';
  const repoURL = packageJson.repository.url.replace(/(?:git\+|\.git)/g, '');

  gitPorcelainStatus()
    .then(status => {
      if (status.currentBranch !== targetBranch) {
        log.error(
          `${chalk.bold('Working on the wrong branch!')}`,
          `All tags must be created on ${chalk.bold(targetBranch)} branch. Please push your work and`,
          `create a Pull Request to ${chalk.bold(targetBranch)}. Then you can continue this process.`
        );
      }

      if (!status.clean) {
        log.error(`${chalk.bold('Working dirty!')}`, 'Please commit before trying again!');
      }

      log.info(`Current version in package.json is ${chalk.bold(versionList.current)}\n`);

      return inquirer.prompt([
        {
          type: 'list',
          name: 'newVersion',
          message: 'How would you like to bump it?',
          choices: versionList.prompt
        }
      ]);
    })
    .then(answers => {
      packageJson.version = answers.newVersion;
      packageLock.version = answers.newVersion;

      // Update Package files
      return Promise.all([
        promiseWriteFile(path.join(cwd, 'package.json'), packageJson, 2),
        promiseWriteFile(path.join(cwd, 'package-lock.json'), packageLock, 2)
      ]);
    })
    .then(([rewritePKG, rewritePKGLOCK]) => {
      log.success(
        `Version bumped in the following file:`,
        `${figures.arrowRight} ${rewritePKG.fileName}`,
        `${figures.arrowRight} ${rewritePKGLOCK.fileName}`
      );

      return gitTagsInfo(`v${packageJson.version}`);
    })
    .then(([tagsList, firstCommit]) =>
      changelog(
        // Object with all the tags info.
        tagsList,
        // First commit.
        firstCommit.trim(),
        // URL of the repository.
        repoURL,
        // Name of the repository.
        capitalize(packageJson.name.replace(/-/g, ' '))
      )
    )
    .then(result => {
      var filesToAdd = ['changelog/', 'package.json', 'package-lock.json'];
      var resultLog = result.reduce((prev, { fileName }) => prev.concat(`${figures.arrowRight} ${fileName}`), []);

      log.success(`Changelog:`, ...resultLog);

      log.info(`Pushing new tag to ${chalk.bold('origin')}...`);

      return git(`add ${filesToAdd.join(' ')}`);
    })
    .then(() => {
      var commitMessage = `Bump version to ${packageJson.version}`;

      return git(`commit -m "${commitMessage}"`, gitParseOutput);
    })
    .then(status => {
      log(...status);

      return git(`push origin ${targetBranch}`, gitParseOutput);
    })
    .then(status => {
      log(...status);

      return git(`tag -a -m "Tag version ${packageJson.version}." "v${packageJson.version}"`);
    })
    .then(() => git('git push origin --tags', gitParseOutput))
    .then(status => {
      var publicURL = `${repoURL}/releases/tag/v${packageJson.version}`;

      log(...status);

      log.success(`Release v${packageJson.version} was generated!`);

      log(`Please go to: ${chalk.underline(publicURL)}`, 'to describe the new changes/features added in this release.');

      return opn(publicURL, { wait: false });
    })
    .catch(log.error);
}
832243
def update(self, quiet=False, prefix='[polyglot_data] '):
    
    self.clear_status_cache()
    for pkg in self.packages():
      if self.status(pkg) == self.STALE:
        self.download(pkg, quiet=quiet, prefix=prefix)
1058341
function updateSidebar() {

    var sidebarJSONPath = path.resolve(rootDir, srcSidebar);
    const sidebarText = fs.readFileSync(sidebarJSONPath).toString();
    var sidebarJSON = JSON.parse(sidebarText);
    sidebarJSON.docs.Packages = [];

    sidebarEntries
        .map((entry) => sidebarJSON.docs.Packages.push(entry))

    if (dryRun) {
        console.log("In website/sidebars.json, this script updates...\n" +
            "...the Packages array with the filepath to each package's index file.");
    } else {
        fs.writeFile(sidebarJSONPath, JSON.stringify(sidebarJSON, null, 2), 'utf8', (err) => {
            if (err) throw err;
            console.log(chalk.green(`${srcSidebar} was succesfully updated!`));
        }); 
    }

}
766923
function discoverVersion() {
    // try to understand package name and current version
    // from package.json or bower.json
    let packageFile;
    let packageFileExtension;
    let packageType;
    let results = {
        name: '',
        currentVersion: ''
    };
    let possiblePackageFiles = ['package.json', 'bower.json', 'package.js'];

    for (possiblePackageFile of possiblePackageFiles) {
        if (fs.existsSync(possiblePackageFile)) {
            packageFile = possiblePackageFile;
            break;
        }
    }

    packageFileExtension = packageFile.substr(packageFile.lastIndexOf('.') + 1);

    if (packageFile) {
        let packageData;

        if (packageFileExtension === 'json') {
            packageData = jsonReader(packageFile);
        }
        if (packageFileExtension === 'js') {
            let tmpData = fs.readFileSync(packageFile).toString().split('\n');
            let nameFound = false;
            let versionFound = false;

            packageData = {};

            for (line of tmpData) {
                if (line.indexOf('name:') >= 0) {
                    nameFound = true;
                    packageData.name = line.split(' ').pop().replace(/'/g, '').replace(/,/g, '');
                }
                if (line.indexOf('version:') >= 0) {
                    versionFound = true;
                    packageData.version = line.split(' ').pop().replace(/'/g, '').replace(/,/g, '');
                }

                if (nameFound && versionFound) {
                    break;
                }
            }
        }

        debugLog('Reading packageFile for init:');
        debugLog('Discovered pacakge name: ' + packageData.name + ' - discovered package version ' + packageData.version);

        if (packageData.name) {
            results.name = packageData.name;
        }
        else {
            print('Can\'t discover package name automatically', 'msgWarning', 'spaced22');
        }

        if (packageData.version) {
            results.currentVersion = packageData.version;
        }
        else {
            print('Can\'t discover package\'s currentVersion automatically', 'msgWarning', 'spaced22');
        }
    }
    else {
        print('Can\'t discover package name and/or currentVersion automatically', 'msgWarning', 'spaced22');
        print('Please fill .versionFilesList.json with the missing informations', 'msgWarning', 'spaced22');
    }

    return results;
}
339199
function _copyPackageJson(from, to) {
  return new Promise((resolve, reject) => {
    const origin = path.join(from, 'package.json');
    const destination = path.join(to, 'package.json');
    let data = JSON.parse(fs.readFileSync(origin, 'utf-8'));
    delete data.engines;
    delete data.scripts;
    delete data.devDependencies;
    fs.writeFileSync(destination, JSON.stringify(data, null, 2));
    resolve();
  });
}
927890
function updateNpmVersion(pluginConfig, config, callback) {
    const files = readFilePaths(FILES);
    const version = config.nextRelease.version;
    let git = "";

    for (let i = 0; i < files.length; i++) {
      // update
      const file = files[i];
      const content = readContent(file);
      const updated = updateVersion(file, content, version);

      // save
      git += `git add ${file} && `;
      saveContent(file, updated);
    }
    // publish
    isChange && commitChanges(git, version);
  }