code: function _replacePkgFile(f) {
    const nf = f.replace(_state.relpath + path.sep, '');
    if (_state.settings._filters.ignore.check(nf))
      return _log('Skip file: %s', nf);
  
    _checkPath(nf);
  
    var xdata = null;
    const ispkj = (path.basename(nf) === _constants.PACKAGE_CONFIG);
    if (ispkj && _state.options.patch)
      return _log('Skip overwriting file: %s', nf);
    const exists = fs.existsSync(nf);
    if (exists) {
      if (_state.settings._filters.ignoreOverwrite.check(nf))
        return _log('Skip overwriting file: %s', nf);
      if (ispkj && !_state.options.skipkg) xdata = fs.readFileSync(nf);
    }
    // legge il file
    var data = fs.readFileSync(f);
    if (ispkj) {
      data = _state.managePkg(xdata, data);
    } else if (_.isFunction(_state.manageFile)) {
      data = _state.manageFile(data, nf, exists);
    }
  
    if (!data) return _log('Skip file: %s', nf);
  
    _log('replace file: %s', nf);
    //elimina il file originale se esiste
    if (exists) fs.unlinkSync(nf);
    //scrive il nuovo file
    fs.writeFileSync(nf, data);
    _state.counters.files++;
  }
docs: updates file