Check that we got package.json and it was updated correctly
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);
    }
150278
function checkName(name, cb) {
  request(`https://registry.npmjs.org/${name}/latest`, {}, function(err, res, msg) {
    if (err) return cb(err);

    if (typeof msg === 'string' && msg === 'Package not found') {
      cb(null, false);
      return;
    }

    if (res && res.statusCode === 404) {
      return cb(null, false);
    }

    cb(null, true);
  });
}
824294
function processResult(result) {
    return {
        whenErrorIs: (errorCode) => {
            if (
                errorCode === EAUDITNOLOCK &&
                packageLockHasNotBeenFound(result)
            ) {
                const summary = result.error.summary || '';
                result.error.summary = `package.json file is missing or is badly formatted. ${summary}`;
                return result;
            }
            return result;
        },
    };
}
558159
function done(err, content) {
            if (err) return cb(err);

            var code = JSON.parse(self.square.package.source)
              , current = bundle.version || self.version(bundle.meta.content)
              , source;

            code.bundle[key].version = version;
            bundle.version = version;
            bundle.content = content;

            // now that we have updated the shizzle, we can write a new file
            // also update the old source with the new version
            source = JSON.stringify(code, null, 2);
            self.square.package.source = source;

            try {
              async.parallel([
                  async.apply(fs.writeFile, self.square.package.location, source)
                , async.apply(fs.writeFile, bundle.meta.location, content)
              ], function (err, results) {
                self.square.logger.notice(
                    'sucessfully updated %s from version %s to %s'
                  , key
                  , current.grey
                  , version.green
                );

                cb(err);
              });
            } catch (e) { err = e; }
          }
504249
async function writeUpdatedPackageFiles(config) {
  logger.trace({ config }, 'writeUpdatedPackageFiles');
  logger.debug('Writing any updated package files');
  if (!config.updatedPackageFiles) {
    logger.debug('No files found');
    return;
  }
  for (const packageFile of config.updatedPackageFiles) {
    if (!packageFile.name.endsWith('package.json')) {
      continue; // eslint-disable-line
    }
    logger.debug(`Writing ${packageFile.name}`);
    const massagedFile = JSON.parse(packageFile.contents);
    if (massagedFile.name) {
      massagedFile.name = massagedFile.name.replace(/[{}]/g, '');
    }
    delete massagedFile.engines;
    delete massagedFile.scripts;
    try {
      const { token } = hostRules.find({ platform: config.platform });
      for (const upgrade of config.upgrades) {
        if (upgrade.gitRef && upgrade.packageFile === packageFile.name) {
          massagedFile[upgrade.depType][upgrade.depName] = massagedFile[
            upgrade.depType
          ][upgrade.depName].replace(
            'git+https://github.com',
            `git+https://${token}@github.com`
          );
        }
      }
    } catch (err) {
      logger.warn({ err }, 'Error adding token to package files');
    }
    await fs.outputFile(
      upath.join(config.localDir, packageFile.name),
      JSON.stringify(massagedFile)
    );
  }
}
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);
    }
636620
def check_rollout(edits_service, package_name, days):
    """"""
    edit = edits_service.insert(body={}, packageName=package_name).execute()
    response = edits_service.tracks().get(editId=edit['id'], track='production', packageName=package_name).execute()
    releases = response['releases']
    for release in releases:
        if release['status'] == 'inProgress':
            url = 'https://archive.mozilla.org/pub/mobile/releases/{}/SHA512SUMS'.format(release['name'])
            resp = requests.head(url)
            if resp.status_code != 200:
                if resp.status_code != 404:  # 404 is expected for release candidates
                    logger.warning("Could not check %s: %s", url, resp.status_code)
                continue
            age = time.time() - calendar.timegm(eu.parsedate(resp.headers['Last-Modified']))
            if age >= days * DAY:
                yield release, age
84702
function updatePacks(packs) {
  var didUpdate = false;
  var updated = packs.map(function(pack) {
    var mtime_ = readMTime(pack.id);
    if (pack.mtime !== mtime_) {
      didUpdate = true;
      return {
        id: pack.id,
        source: readFile(pack.id),
        mtime: mtime_
      };
    } else {
      return pack;
    }
  });
  return didUpdate ? updated : packs;
}
271417
def update_check(package_name, package_version, bypass_cache=False, url=None,
                 **extra_data):
    """"""
    checker = UpdateChecker(url)
    checker.bypass_cache = bypass_cache
    result = checker.check(package_name, package_version, **extra_data)
    if result:
        print(result)
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');
  }
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!`));
        }); 
    }

}
720370
def update_install_json():
        """"""
        if not os.path.isfile('install.json'):
            return

        with open('install.json', 'r') as f:
            install_json = json.load(f)

        if install_json.get('programMain'):
            install_json['programMain'] = 'run'

        # update features
        install_json['features'] = ['aotExecutionEnabled', 'appBuilderCompliant', 'secureParams']

        with open('install.json', 'w') as f:
            json.dump(install_json, f, indent=2, sort_keys=True)
1330085
function updateMaster () {
    pushCmds.push(
        comment('update package.json in master'),
        'git checkout master',
        `git pull --rebase ${origin} master --strategy=theirs`,
        `git checkout release/${newVersion} -- CHANGELOG.md`,
        `node -e "const newVersion = '${newVersion}'; ${stringifyFunction(buildCommand)}"`,
        'git add CHANGELOG.md',
        'git add package.json',
        `git commit -m "update version number in package.json to ${newVersion}"`,
        `git push ${origin} master`
    );

    function buildCommand () {
      require('fs').writeFileSync('package.json', JSON.stringify(getUpdatedJson(), null, 2));
      function getUpdatedJson () {
        const json = require('./package.json');
        json.version = newVersion;
        return json;
      }
    }

    function stringifyFunction (method) {
      return method
          .toString()
          .split('\n')
          .slice(1, -1)
          .map(function (line) { return line.trim(); })
          .join(' ')
          .replace(/"/g, '\\"');
    }
  }
883838
function checkPackageJson(pth, cb) {
  var p = path.join(pth, 'package.json');
  checkStatFile(p, function(err, pack){
    if (err) return cb(err);
    if (!pack || !pack.strider) return cb(null, false);
    if (!pack.strider.id) {
      pack.strider.id = pack.name;
    }
    return cb(null, pack.strider);
  });
}
360556
def verify():
    """"""
    verbose = True
    log(
        "Verifying current directory as a Dallinger experiment...",
        delay=0,
        verbose=verbose,
    )
    ok = verify_package(verbose=verbose)
    if ok:
        log("✓ Everything looks good!", delay=0, verbose=verbose)
    else:
        log("☹ Some problems were found.", delay=0, verbose=verbose)
991497
public boolean checkAndMaybeUpdate() throws IOException {
    try {
      File nativeLibDir = soSource.soDirectory;
      Context updatedContext =
          applicationContext.createPackageContext(applicationContext.getPackageName(), 0);
      File updatedNativeLibDir = new File(updatedContext.getApplicationInfo().nativeLibraryDir);
      if (!nativeLibDir.equals(updatedNativeLibDir)) {
        Log.d(
            SoLoader.TAG,
            "Native library directory updated from " + nativeLibDir + " to " + updatedNativeLibDir);
        // update flags to resolve dependencies since the system does not properly resolve
        // dependencies when the location has moved
        flags |= DirectorySoSource.RESOLVE_DEPENDENCIES;
        soSource = new DirectorySoSource(updatedNativeLibDir, flags);
        soSource.prepare(flags);
        applicationContext = updatedContext;
        return true;
      }
      return false;
    } catch (PackageManager.NameNotFoundException e) {
      throw new RuntimeException(e);
    }
  }
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;
}