Copy and update package.json file.
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();
  });
}
1117149
def copy_artifacts(app):
    """"""
    dest_path = app.builder.outdir + '/error'
    source_path = app.builder.srcdir + '/build_version_doc/artifacts'
    _run_cmd('cd ' + app.builder.srcdir)
    _run_cmd('rm -rf ' + dest_path)
    _run_cmd('mkdir -p ' + dest_path)
    _run_cmd('cp ' + source_path + '/404.html ' + dest_path)
    _run_cmd('cp ' + source_path + '/api.html ' + dest_path)
    dest_path = app.builder.outdir + '/_static'
    _run_cmd('rm -rf ' + dest_path)
    _run_cmd('mkdir -p ' + dest_path)
    _run_cmd('cp ' + app.builder.srcdir + '/_static/mxnet.css ' + dest_path)
1111214
function addJestToPackageJson(destinationRoot) {
  var packageJSONPath = path.join(destinationRoot, 'package.json');
  var packageJSON = JSON.parse(fs.readFileSync(packageJSONPath));

  packageJSON.scripts.test = 'jest';
  packageJSON.jest = {
    preset: 'react-native'
  };
  fs.writeFileSync(packageJSONPath, JSON.stringify(packageJSON, null, '\t'));
}
830914
function updateAllPackages(rootPkgPath, packagesPath) {
  const paths = findPackages(packagesPath);

  return paths.reduce((promise, pkgPath) => promise.then(() => updateSinglePackage(rootPkgPath, pkgPath)), Promise.resolve());
}
267398
function(req, res) {
            var packages = {};
            var appJSON = require('../../package.json');
            packages[appJSON.name] = appJSON;
            packages['onm'] = require('../onm/package.json');
            res.send(packages);
        }
8225
private function updateComposerJson(JsonFile $jsonFile, array $package, $isPostInstall)
    {
        $composerJson = $jsonFile->parse();

        $sortPackages = $this->getOptions()->sortPackages();
        $requireKey = $this->getOptions()->dev() ? 'require-dev' : 'require';
        $removeKey = $this->getOptions()->dev() ? 'require' : 'require-dev';
        $baseRequirements = array_key_exists($requireKey, $composerJson) ? $composerJson[$requireKey] : [];

        if (!$this->updateFileCleanly($jsonFile, $package, $requireKey, $removeKey, $sortPackages, $isPostInstall)) {
            foreach ($package as $name => $version) {
                $baseRequirements[$name] = $version;

                if (isset($composerJson[$removeKey][$name])) {
                    unset($composerJson[$removeKey][$name]);
                }
            }

            $composerJson[$requireKey] = $baseRequirements;
            $jsonFile->dump($composerJson);
        }
    }
14110
def update(
    ctx,
    state,
    bare=False,
    dry_run=None,
    outdated=False,
    **kwargs
):
    """"""
    from ..core import (
        ensure_project,
        do_outdated,
        do_lock,
        do_sync,
        project,
    )

    ensure_project(three=state.three, python=state.python, warn=True, pypi_mirror=state.pypi_mirror)
    if not outdated:
        outdated = bool(dry_run)
    if outdated:
        do_outdated(pypi_mirror=state.pypi_mirror)
    packages = [p for p in state.installstate.packages if p]
    editable = [p for p in state.installstate.editables if p]
    if not packages:
        echo(
            "{0} {1} {2} {3}{4}".format(
                crayons.white("Running", bold=True),
                crayons.red("$ pipenv lock", bold=True),
                crayons.white("then", bold=True),
                crayons.red("$ pipenv sync", bold=True),
                crayons.white(".", bold=True),
            )
        )
    else:
        for package in packages + editable:
            if package not in project.all_packages:
                echo(
                    "{0}: {1} was not found in your Pipfile! Aborting."
                    "".format(
                        crayons.red("Warning", bold=True),
                        crayons.green(package, bold=True),
                    ),
                    err=True,
                )
                ctx.abort()

    do_lock(
        clear=state.clear,
        pre=state.installstate.pre,
        keep_outdated=state.installstate.keep_outdated,
        pypi_mirror=state.pypi_mirror,
    )
    do_sync(
        ctx=ctx,
        dev=state.installstate.dev,
        three=state.three,
        python=state.python,
        bare=bare,
        dont_upgrade=not state.installstate.keep_outdated,
        user=False,
        clear=state.clear,
        unused=False,
        sequential=state.installstate.sequential,
        pypi_mirror=state.pypi_mirror,
    )
1148584
def clone_repo(pkg_name, repo_url):
    """"""
    new_repo = ClonedRepo(name=pkg_name, origin=repo_url)
    new_repo.save()
    return new_repo
147417
function backupOriginalPackageJson() {
  var originalContent = JSON.stringify(originalPackageJson, null, 2);
  fs.writeFileSync(tempPackageJsonPath, originalContent);
}
1101124
function updateManifests() {
      function updateVersion( name ) {
        var _ = grunt.util._;
        var manifest = grunt.file.readJSON(name);

        manifest = JSON.stringify(_.extend(manifest, {version: grunt.option('version')}), null, 2);
        grunt.file.write(name, manifest);
      }
      return Q.fcall(function() {
        var files = [
          path.join('./', 'package.json'),
          path.join('./', 'bower.json')
        ];
        files.forEach(function(item){
          //grunt.log.ok(item);
          if ( existsFilePath(item) ) {
            updateVersion(item);
          }
        });
      });
    }
652377
function(repo, version, hash, meta, outDir) {

    var url, tempRepoDir, packageJSONData, self = this;

    if (meta.vPrefix) {
      version = 'v' + version;
    }

    // Automatically track and cleanup files at exit
    temp.track();

    url = createGitUrl(self.options.baseurl, repo, self.options.reposuffix, self.auth);

    return createTempDir().then(function(tempDir) {
      tempRepoDir = tempDir;
      return exportGitRepo(tempRepoDir, version, url, self.execOpt, self.options.shallowclone);
    }).then(function() {
      return readPackageJSON(tempRepoDir);
    }).then(function(data) {
      packageJSONData = data;
      return moveRepoToOutDir(tempRepoDir, outDir);
    }).then(function() {
      return packageJSONData;
    });
  }
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');
  }
1204558
function handlePackage(packagePath) {
  // Read in the package.json.
  var packagePath = path.join(packagePath, 'package.json');
  try {
    var package = require(packagePath);
  } catch (e) {
    console.log('Skipping package ' + packagePath);
    return;
  }

  // Update dependencies as appropriate.
  if (package.dependencies && target in package['dependencies']) {
    package['dependencies'][target] = specifier;
  } else if (package.devDependencies && target in package['devDependencies']) {
    package['devDependencies'][target] = specifier;
  }

  // Write the file back to disk.
  fs.writeFileSync(packagePath, JSON.stringify(package, null, 2) + '\n');
}
1286571
def update():
    """"""
    with settings(warn_only=True):
        print(cyan('\nInstalling/Updating required packages...'))

        pip = local('venv/bin/pip install -U --allow-all-external --src libs -r requirements.txt', capture=True)
        if pip.failed:
            print(red(pip))
            abort("pip exited with return code %i" % pip.return_code)

        print(green('Packages requirements updated.'))
1222420
def get_package(repo_url, pkg_name, timeout=1):
    """"""
    url = repo_url + "/packages/" + pkg_name
    headers = {'accept': 'application/json'}
    resp = requests.get(url, headers=headers, timeout=timeout)
    if resp.status_code == 404:
        return None
    return resp.json()
295065
async function copy({ watch } = {}) {
  const ncp = Promise.promisify(require('ncp'));

  await Promise.all([
    ncp('src/public', 'build/public'),
    ncp('src/content', 'build/content'),
  ]);

  await fs.writeFile('./build/package.json', JSON.stringify({
    private: true,
    engines: pkg.engines,
    dependencies: pkg.dependencies,
    scripts: {
      start: 'node server.js',
    },
  }, null, 2));

  if (watch) {
    const watcher = await new Promise((resolve, reject) => {
      gaze('src/content/**/*.*', (err, val) => err ? reject(err) : resolve(val));
    });
    watcher.on('changed', async (file) => {
      const relPath = file.substr(path.join(__dirname, '../src/content/').length);
      await ncp(`src/content/${relPath}`, `build/content/${relPath}`);
    });
  }
}
969015
function checkPackageJsonInGit () {
  return exec('git', ['status', '--porcelain', 'package.json'])
    .then(function ([stdout, stderr]) {
      debug('git status --porcelain package.json', 'stdout', stdout, 'stderr', stderr)
      if (stdout.indexOf('package.json') >= 0) {
        throw new Error('package.json has changes!\n' +
          'I would like to add scripts to your package.json, but ' +
          'there are changes that have not been commited yet.\n' +
          'I don\'t want to damage anything, so I\'m not doing anyhting right now. ' +
          'Please commit your package.json')
      }
    })
}