Application version from the package.json
487178
function(next) {
            var files = [];
            if (core.appPackage && core.packages[core.appPackage]) files.push(core.packages[core.appPackage].path);
            files.push(core.home, core.path.etc + "/..", __dirname + "/..");
            for (var i in files) {
                var pkg = lib.readFileSync(files[i] + "/package.json", { json: 1, logger: "error", missingok: 1 });
                logger.debug("init:", files[i] + "/package.json", pkg.name, pkg.version);
                if (!core.appName && pkg.name) core.appName = pkg.name;
                if (!core.appVersion && pkg.version) core.appVersion = pkg.version;
                if (!core.appDescr && pkg.description) core.appDescr = pkg.description;
                if (!core.version && pkg.name == "backendjs") core.version = pkg.version;
            }
            if (!core.appName) core.appName = core.name;
            if (!core.appVersion) core.appVersion = core.version;
            // Use the app name as salt for consistentcy
            if (!core.salt) core.salt = lib.salt = core.appName;
            next();
        }
416833
function version(program, projectPath) {
	const prog = Object.assign({}, getDefaults(), program || {});

	const projPath = path.resolve(
		process.cwd(),
		projectPath || prog.args[0] || ""
	);

	const programOpts = Object.assign({}, prog, {
		android: path.join(projPath, prog.android),
		ios: path.join(projPath, prog.ios)
	});

	const targets = [].concat(programOpts.target, env.target).filter(Boolean);
	var appPkg;

	try {
		resolveFrom(projPath, "react-native");
		appPkg = require(path.join(projPath, "package.json"));
	} catch (err) {
		if (err.message === "Cannot find module 'react-native'") {
			log({
				style: "red",
				text: `Is this the right folder? ${err.message} in ${projPath}`
			});
		} else {
			log({
				style: "red",
				text: err.message
			});

			log({
				style: "red",
				text:
					"Is this the right folder? Looks like there isn't a package.json here"
			});
		}

		log({
			style: "yellow",
			text: "Pass the project path as an argument, see --help for usage"
		});

		if (program.outputHelp) {
			program.outputHelp();
		}

		process.exit(1);
	}

	var appJSON;
	const appJSONPath = path.join(projPath, "app.json");
	const isExpoApp = isExpoProject(projPath);

	isExpoApp && log({ text: "Expo detected" }, programOpts.quiet);

	try {
		appJSON = require(appJSONPath);

		if (isExpoApp && !programOpts.incrementBuild) {
			appJSON = Object.assign({}, appJSON, {
				expo: Object.assign({}, appJSON.expo, {
					version: appPkg.version
				})
			});
		}
	} catch (err) {}

	var android;
	var ios;

	if (!targets.length || targets.indexOf("android") > -1) {
		android = new Promise(function(resolve, reject) {
			log({ text: "Versioning Android..." }, programOpts.quiet);

			var gradleFile;

			try {
				gradleFile = fs.readFileSync(programOpts.android, "utf8");
			} catch (err) {
				isExpoApp ||
					reject([
						{
							style: "red",
							text: "No gradle file found at " + programOpts.android
						},
						{
							style: "yellow",
							text: 'Use the "--android" option to specify the path manually'
						}
					]);
			}

			if (!programOpts.incrementBuild && !isExpoApp) {
				gradleFile = gradleFile.replace(
					/versionName (["'])(.*)["']/,
					"versionName $1" + appPkg.version + "$1"
				);
			}

			if (!programOpts.neverIncrementBuild) {
				if (isExpoApp) {
					const versionCode = dottie.get(appJSON, "expo.android.versionCode");

					appJSON = Object.assign({}, appJSON, {
						expo: Object.assign({}, appJSON.expo, {
							android: Object.assign({}, appJSON.expo.android, {
								versionCode: programOpts.setBuild
									? programOpts.setBuild
									: versionCode
									? versionCode + 1
									: 1
							})
						})
					});
				} else {
					gradleFile = gradleFile.replace(/versionCode (\d+)/, function(
						match,
						cg1
					) {
						const newVersionCodeNumber = programOpts.setBuild
							? programOpts.setBuild
							: parseInt(cg1, 10) + 1;

						return "versionCode " + newVersionCodeNumber;
					});
				}
			}

			if (isExpoApp) {
				fs.writeFileSync(appJSONPath, JSON.stringify(appJSON, null, 2));
			} else {
				fs.writeFileSync(programOpts.android, gradleFile);
			}

			log({ text: "Android updated" }, programOpts.quiet);
			resolve();
		});
	}

	if (!targets.length || targets.indexOf("ios") > -1) {
		ios = new Promise(function(resolve, reject) {
			log({ text: "Versioning iOS..." }, programOpts.quiet);

			if (isExpoApp) {
				if (!programOpts.neverIncrementBuild) {
					const buildNumber = dottie.get(appJSON, "expo.ios.buildNumber");

					appJSON = Object.assign({}, appJSON, {
						expo: Object.assign({}, appJSON.expo, {
							ios: Object.assign({}, appJSON.expo.ios, {
								buildNumber: programOpts.setBuild
									? programOpts.setBuild.toString()
									: buildNumber && !programOpts.resetBuild
									? `${parseInt(buildNumber, 10) + 1}`
									: "1"
							})
						})
					});
				}

				fs.writeFileSync(appJSONPath, JSON.stringify(appJSON, null, 2));
			} else if (program.legacy) {
				try {
					child.execSync("xcode-select --print-path", {
						stdio: ["ignore", "ignore", "pipe"]
					});
				} catch (err) {
					reject([
						{
							style: "red",
							text: err
						},
						{
							style: "yellow",
							text: "Looks like Xcode Command Line Tools aren't installed"
						},
						{
							text: "\n  Install:\n\n    $ xcode-select --install\n"
						}
					]);

					return;
				}

				const agvtoolOpts = {
					cwd: programOpts.ios
				};

				try {
					child.execSync("agvtool what-version", agvtoolOpts);
				} catch (err) {
					const stdout = err.stdout.toString().trim();

					reject(
						stdout.indexOf("directory") > -1
							? [
									{
										style: "red",
										text: "No project folder found at " + programOpts.ios
									},
									{
										style: "yellow",
										text: 'Use the "--ios" option to specify the path manually'
									}
							  ]
							: [
									{
										style: "red",
										text: stdout
									}
							  ]
					);

					return;
				}

				if (!programOpts.incrementBuild) {
					child.spawnSync(
						"agvtool",
						["new-marketing-version", appPkg.version],
						agvtoolOpts
					);
				}

				if (!programOpts.neverIncrementBuild) {
					if (programOpts.resetBuild) {
						child.execSync("agvtool new-version -all 1", agvtoolOpts);
					} else {
						child.execSync("agvtool next-version -all", agvtoolOpts);
					}

					if (programOpts.setBuild) {
						child.execSync(
							`agvtool new-version -all ${program.setBuild}`,
							agvtoolOpts
						);
					}
				}
			} else {
				// Find any folder ending in .xcodeproj
				const xcodeProjects = fs
					.readdirSync(programOpts.ios)
					.filter(file => /\.xcodeproj$/i.test(file));

				if (xcodeProjects.length < 1) {
					throw new Error(`Xcode project not found in "${programOpts.ios}"`);
				}

				const projectFolder = path.join(programOpts.ios, xcodeProjects[0]);
				const xcode = Xcode.open(path.join(projectFolder, "project.pbxproj"));
				const plistFilenames = getPlistFilenames(xcode);

				xcode.document.projects.forEach(project => {
					!programOpts.neverIncrementBuild &&
						project.targets.filter(Boolean).forEach(target => {
							target.buildConfigurationsList.buildConfigurations.forEach(
								config => {
									if (target.name === appPkg.name) {
										var CURRENT_PROJECT_VERSION = 1;

										if (!programOpts.resetBuild) {
											CURRENT_PROJECT_VERSION =
												parseInt(
													config.ast.value
														.get("buildSettings")
														.get("CURRENT_PROJECT_VERSION").text,
													10
												) + 1;
										}

										if (programOpts.setBuild) {
											CURRENT_PROJECT_VERSION = programOpts.setBuild;
										}

										config.patch({
											buildSettings: {
												CURRENT_PROJECT_VERSION
											}
										});
									}
								}
							);
						});

					const plistFiles = plistFilenames.map(filename => {
						return fs.readFileSync(
							path.join(programOpts.ios, filename),
							"utf8"
						);
					});

					const parsedPlistFiles = plistFiles.map(file => {
						return plist.parse(file);
					});

					parsedPlistFiles.forEach((json, index) => {
						fs.writeFileSync(
							path.join(programOpts.ios, plistFilenames[index]),
							plist.build(
								Object.assign(
									{},
									json,
									!programOpts.incrementBuild
										? {
												CFBundleShortVersionString: appPkg.version
										  }
										: {},
									!programOpts.neverIncrementBuild
										? Object.assign(
												{},
												{
													CFBundleVersion: `${
														programOpts.resetBuild
															? 1
															: parseInt(json.CFBundleVersion, 10) + 1
													}`
												},
												programOpts.setBuild
													? {
															CFBundleVersion: programOpts.setBuild.toString()
													  }
													: {}
										  )
										: {}
								)
							)
						);
					});

					plistFilenames.forEach((filename, index) => {
						const indent = detectIndent(plistFiles[index]);

						fs.writeFileSync(
							path.join(programOpts.ios, filename),
							stripIndents`
							<?xml version="1.0" encoding="UTF-8"?>
							<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
							<plist version="1.0">` +
								"\n" +
								beautify(
									fs
										.readFileSync(path.join(programOpts.ios, filename), "utf8")
										.match(/<dict>[\s\S]*<\/dict>/)[0],
									Object.assign(
										{ end_with_newline: true },
										indent.type === "tab"
											? { indent_with_tabs: true }
											: { indent_size: indent.amount }
									)
								) +
								stripIndents`
							</plist>` +
								"\n"
						);
					});
				});

				xcode.save();
			}

			log({ text: "iOS updated" }, programOpts.quiet);
			resolve();
		});
	}

	return pSettle([android, ios].filter(Boolean))
		.then(function(result) {
			const errs = result
				.filter(function(item) {
					return item.isRejected;
				})
				.map(function(item) {
					return item.reason;
				});

			if (errs.length) {
				errs
					.reduce(function(a, b) {
						return a.concat(b);
					}, [])
					.forEach(function(err) {
						if (program.outputHelp) {
							log(
								Object.assign({ style: "red", text: err.toString() }, err),
								programOpts.quiet
							);
						}
					});

				if (program.outputHelp) {
					program.outputHelp();
				}

				throw errs
					.map(function(errGrp, index) {
						return errGrp
							.map(function(err) {
								return err.text;
							})
							.join(", ");
					})
					.join("; ");
			}

			const gitCmdOpts = {
				cwd: projPath
			};

			if (
				programOpts.amend ||
				(process.env.npm_lifecycle_event &&
					process.env.npm_lifecycle_event.indexOf("version") > -1 &&
					!programOpts.neverAmend)
			) {
				const latestTag =
					(programOpts.amend ||
						process.env.npm_config_git_tag_version ||
						process.env.npm_config_version_git_tag) &&
					!programOpts.skipTag &&
					semver.valid(
						semver.coerce(
							child
								.execSync("git log -1 --pretty=%s", gitCmdOpts)
								.toString()
								.trim()
						)
					) &&
					child
						.execSync("git describe --exact-match HEAD", gitCmdOpts)
						.toString()
						.trim();

				log({ text: "Amending..." }, programOpts.quiet);

				switch (process.env.npm_lifecycle_event) {
					case "version":
						child.spawnSync(
							"git",
							["add"].concat(
								isExpoApp ? appJSONPath : [programOpts.android, programOpts.ios]
							),
							gitCmdOpts
						);

						break;

					case "postversion":
					default:
						child.execSync("git commit -a --amend --no-edit", gitCmdOpts);

						if (latestTag) {
							log({ text: "Adjusting Git tag..." }, programOpts.quiet);

							child.execSync(
								`git tag -af ${latestTag} -m ${latestTag}`,
								gitCmdOpts
							);
						}
				}
			}

			log(
				{
					style: "green",
					text: "Done"
				},
				programOpts.quiet
			);

			if (programOpts.neverAmend) {
				return true;
			}

			return child.execSync("git log -1 --pretty=%H", gitCmdOpts).toString();
		})
		.catch(function(err) {
			if (process.env.RNV_ENV === "ava") {
				console.error(err);
			}

			log({
				style: "red",
				text: "Done, with errors."
			});

			process.exit(1);
		});
}
514234
def version(self):
        
        if self.find:
            return self.meta.sp + split_package(self.find)[1]
        return ""
658535
def _get_version():
    """"""
    with open(os.path.join(os.path.dirname(__file__), PACKAGE_NAME, 'VERSION'), 'rb') as f:
        version = f.read().decode('ascii').strip()
    return version
1194410
function ensureGagarinVersionsMatch(pathToApp, verbose) {

  var pathToMeteorPackages = path.join(pathToApp, '.meteor', 'packages');
  var nodeModuleVersion    = require('../../package.json').version;

  return new Promise(function (resolve, reject) {

    utils.getGagarinPackageVersion(pathToApp).then(function (packageVersion) {

      if (packageVersion === nodeModuleVersion) {
        logs.system("node module and smart package versions match, " + packageVersion);
        return resolve();
      }

      tools.getReleaseVersion(pathToApp).then(function (meteorReleaseVersion) {

        if (meteorReleaseVersion < "0.9.0") {
          // really, we can do nothing about package version
          // without a decent package management system
          logs.system("meteor version is too old to automatically fix package version");
          return resolve();
        }

        logs.system("meteor add anti:gagarin@=" + nodeModuleVersion);

        var meteor = spawn('meteor', [ 'add', 'anti:gagarin@=' + nodeModuleVersion ], {

          stdio: verbose ? 'inherit' : 'ignore', cwd: pathToApp
        });

        /*
        meteor.stdout.on('data', function (data) {
          if (!verbose) {
            return;
          }
          process.stdout.write(chalk.gray(stripAnsi(data)));
        });
        */

        meteor.on('error', reject);

        meteor.on('exit', function (code) {
          if (code > 0) {
            return reject(new Error('meteor exited with code ' + code));
          }
          logs.system("anti:gagarin is now in version " + nodeModuleVersion);
          resolve();
        });

      }).catch(reject);

    }).catch(reject);

  }); // Promise
}
406276
def get_version():
    
    with open(os.path.join(DIR, 'include/libjsonnet.h')) as f:
        for line in f:
            if '#define' in line and 'LIB_JSONNET_VERSION' in line:
                v_code = line.partition('LIB_JSONNET_VERSION')[2].strip('\n "')
                if v_code[0] == "v":
                    v_code = v_code[1:]
                return v_code
269711
def Version():
  """"""

  version_ini = VersionPath()

  config = configparser.SafeConfigParser()
  config.read(version_ini)
  return dict(
      packageversion=config.get("Version", "packageversion"),
      major=config.getint("Version", "major"),
      minor=config.getint("Version", "minor"),
      revision=config.getint("Version", "revision"),
      release=config.getint("Version", "release"))
182429
def get_version(package_name, ignore_cache=False):
    
    if ignore_cache:
        with microcache.temporarily_disabled():
            found = helpers.regex_in_package_file(
                VERSION_SET_REGEX, '_version.py', package_name, return_match=True
            )
    else:
        found = helpers.regex_in_package_file(
            VERSION_SET_REGEX, '_version.py', package_name, return_match=True
        )
    if found is None:
        raise ProjectError('found {}, but __version__ is not defined')
    current_version = found['version']
    return current_version
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))
  ])
}
1338241
function checkUpdate () {
  var pkg = require("./package.json");
  require("update-notifier")({
    packageName:    pkg.name,
    packageVersion: pkg.version
  }).notify();
}
976678
function () {
        var pkgJson = grunt.file.readJSON("package.json");

        if (pkgJson.jspm && pkgJson.jspm.directories && pkgJson.jspm.directories.baseURL) {
            return pkgJson.jspm.directories.baseURL;
        }

        return "";
    }
61457
def npm(package_json, output_file, pinned_file):
    """"""
    amd_build_deprecation_warning()
    try:
        version = get_distribution(current_app.name).version
    except DistributionNotFound:
        version = ''

    output = {
        'name': current_app.name,
        'version': make_semver(version) if version else version,
        'dependencies': {},
    }

    # Load base file
    if package_json:
        output = dict(output, **json.load(package_json))

    # Iterate over bundles
    deps = extract_deps(current_app.extensions['invenio-assets'].env,
                        click.echo)
    output['dependencies'].update(deps)

    # Load pinned dependencies
    if pinned_file:
        output['dependencies'].update(
            json.load(pinned_file).get('dependencies', {}))

    # Write to static folder if output file is not specified
    if output_file is None:
        if not os.path.exists(current_app.static_folder):
            os.makedirs(current_app.static_folder)
        output_file = open(
            os.path.join(current_app.static_folder, 'package.json'),
            'w')

    click.echo('Writing {0}'.format(output_file.name))
    json.dump(output, output_file, indent=4)
    output_file.close()
820381
function getVersionInfo(machineName, versionKey) {
        let route = getVersionInfoRoute(machineName, versionKey);
        return jsonfile.readFileSync(repositoryPath + "/" + route);
    }
1331362
async function markVersions () {
  const packages = JSON.parse(
    (await execa(require.resolve('lerna/cli'), ['list', '--json'])).stdout
  ).filter(p => !p.private)
  const markerPath = path.resolve(__dirname, '../packages/vue-cli-version-marker/package.json')
  const marker = JSON.parse(fs.readFileSync(markerPath))

  const curVersion = marker.version
  const mainVersion = require('../lerna.json').version

  if (semver.prerelease(mainVersion)) {
    marker.version = mainVersion
  } else {
    const releaseType = semver.diff(curVersion, mainVersion) || 'patch'
    marker.version = semver.inc(marker.version, releaseType)
  }

  marker.devDependencies = packages.reduce((prev, pkg) => {
    prev[pkg.name] = pkg.version
    return prev
  }, {})
  fs.writeFileSync(markerPath, JSON.stringify(marker, null, 2))
}
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;
}
195598
function checkPackageJson () {
        const pkg = requireFresh(path.join(project, 'package.json'));
        expect(pkg.name).toEqual(appId);
        expect(pkg.displayName).toEqual(appName);
        expect(pkg.version).toEqual(appVersion);
    }
516839
async function updateVersion(file) {
  const { default: config } = await import(`${CONFIGS_PATH}/${file}`);
  const { packageName } = config;

  const packageInfoFile = `${PACKAGES_PATH}/${packageName}/package.json`;
  const { default: packageInfo } = await import(packageInfoFile);

  if (info.version !== packageInfo.version) {
    const newPackageInfo = {
      ...packageInfo,
      version: info.version,
    };

    writeFileAsync(packageInfoFile, JSON.stringify(newPackageInfo, null, '  '))
      .then(
        () => console.log(`Updated ${packageName} to ${info.version}`),
        error => console.log(error),
      );
  }
}