Write uglified file
@param {string} prettyfile
@param {object} options
424778
function uglyfile(prettyfile, sourcecode, options) {
		var mintarget = prettyfile.replace('.js', '.min.js');
		var maptarget = prettyfile.replace('.js', '.js.map');
		var uglycodes = uglify(options.max ? prettyfile : sourcecode);
		writefile(mintarget, uglycodes.code, options);
		if (options.map) {
			writefile(maptarget, uglycodes.map, options);
		}
	}
802876
function format(source) {

        var ast = UglifyJS.parse(source);

        return ast.print_to_string({
            beautify: true,
            comments: 'all'
        });

    }
680626
function (source, fileExtension, globalOptions, beautify) {
  var path = rcFile.for(this.resourcePath)
    , options = globalOptions || {};

  if (globalOptions === null && typeof path === "string") {
    this.addDependency(path);
    options = JSON.parse(stripJsonComments(fs.readFileSync(path, "utf8")));
  }

  return beautify(source, getOptionsForExtension(options, fileExtension));
}
1307073
function(path, options) {

        var errors = hintFiles([path],
                               {options: options.jshintOptions,
                                withDefaults: options.withDefaults,
                                globals: options.globals},
                               false);
        var flattened_errors = [].concat.apply([], errors);
        var formatted_errors = flattened_errors.map(function(error) {
            return '' + path + ': ' + error.line + ":" + error.character + " " + error.reason;
        });

        return formatted_errors.join('\n');
    }
305279
function writeFile(filename, content) {
  fs.writeFileSync(filename, JSON.stringify(content, null, 2));
}
1244210
function writefile(filepath, filetext, options) {
		var version = '-1.0.0';
		var packag = filename('package.json', options);
		var banner = filename('BANNER.txt', options);
		if (grunt.file.exists(banner)) {
			filetext = grunt.file.read(banner) + '\n' + filetext;
		}
		if (grunt.file.exists(packag)) {
			var json = grunt.file.readJSON(packag);
			version = json.version;
		}
		grunt.file.write(
			filepath,
			grunt.template.process(filetext, {
				data: {
					version: version
				}
			})
		);
		grunt.log.writeln('File "' + chalk.cyan(filepath) + '" created.');
	}
125347
function copyAndUncommentSync(src, dest) {
  const data = fs.readFileSync(src).toString();
  const regexp = /\/\*(\s*:\s+[a-zA-Z0-9._]+)\s+\*\//g;
  const uncommentedData = data.replace(regexp, '$1');
  fs.writeFileSync(dest, uncommentedData);
}
1097737
function condenseify(file, options) {
  if (/\.json$/.test(file)) return through();

  var appendNewLine = true
    , regex = /^[ \t]+$/
    , isBlank = false
    , eol ='\n';

  options = options || {};

  function transform(line, encoding, next) {
    if (!line.length) {
      isBlank = true;
      return next();
    }

    line = line.toString();
    if (!options['keep-non-empty'] && regex.test(line)) return next();

    if (isBlank) {
      isBlank = false;
      this.push(eol);
    }
    appendNewLine = false;
    this.push(line + eol);
    next();
  }

  function flush(done) {
    if (appendNewLine) this.push(eol);
    done();
  }

  return pumpify(split(), through(transform, flush));
}
1209522
function writeFile(pathToFile, content, verbose) {
  var directory = _path2.default.dirname(pathToFile);

  // Create directory if it doesn't exist
  if (!_fs2.default.existsSync(directory)) {
    _fs2.default.mkdirSync(directory);
  }

  // Try to write file to disk to the given location
  _fs2.default.writeFile(pathToFile, content, { flag: 'w' }, function (error) {
    if (error) {
      throw new Error(error);
    }

    // Log success message to the console if in verbose mode only
    if (verbose) {
      var successMessage = '\nVersion file written to ' + _chalk2.default.green(pathToFile);

      console.log(successMessage);
    }
  });
}
628804
def beautify_file(self, path):
        """"""
        error = False
        if(path == '-'):
            data = sys.stdin.read()
            result, error = self.beautify_string(data, '(stdin)')
            sys.stdout.write(result)
        else:  # named file
            data = self.read_file(path)
            result, error = self.beautify_string(data, path)
            if(data != result):
                if(self.check_only):
                    if not error:
                        # we want to return 0 (success) only if the given file is already
                        # well formatted:
                        error = (result != data)
                else:
                    if(self.backup):
                        self.write_file(path+'.bak', data)
                    self.write_file(path, result)
        return error
833097
function (fileContents, fileName) {
            //Uglify's ast generation removes comments, so just convert to ast,
            //then back to source code to get rid of comments.
            return uglify.uglify.gen_code(uglify.parser.parse(fileContents), true);
        }
554538
function(json, options) {
	var indent = options.asText == 'pretty' ? '\t' : null;
	if (options.javascript) {
		return util.js.stringify(json, indent);
	}
	else {
		return JSON.stringify(json, null, indent);
	}
}
615687
function writeFile(config, format) {

    // default is .js
    let extname = ".js";

    if (format === "YAML") {
        extname = ".yml";
    } else if (format === "JSON") {
        extname = ".json";
    }

    const installedESLint = config.installedESLint;

    delete config.installedESLint;

    ConfigFile.write(config, `./.eslintrc${extname}`);
    log.info(`Successfully created .eslintrc${extname} file in ${process.cwd()}`);

    if (installedESLint) {
        log.info("ESLint was installed locally. We recommend using this local copy instead of your globally-installed copy.");
    }
}
688540
function writeHTMLFile(options) {
  return new Promise(function(resolve, reject) {
    var templateFile = path.join(__dirname, '../template/cli.html');
     // read our template file
     fs.readFile(templateFile, 'utf8', function (err,data) {
      if (err) {
        reject(err);
      }
      // insert the generated json data
      var result = data.replace('{{ insertJSONHere }}', 'var embeddedJsonData = '+ options.json + ';');

      // write file to directory
      fs.writeFile(path.join(options.directory, 'index.html'), result, 'utf8', function (err) {
         if (err) {
          reject(err);
         }
         resolve(options.directory);
      });
    });
  });
}
513190
function (filePatterns, destination, options) {
  try {
    var fse = require('fs-extra')
  } catch (e) {
    console.error('This method can only be used in server applications.\n' +
      'Consider using the alternative method "i18nCompile.fromString()" instead.')
  }

  options = options || {};
  var matchedFiles = _.map(filePatterns, function (pattern) {
    return glob.sync(pattern);
  });

  var files = _.uniq(_.flatten(matchedFiles));

  var srcList = files.filter(function (filepath) {
    // Warn on and remove invalid source files (if nonull was set).
    try {
      fse.accessSync(filepath);
      return true;
    } catch (e) {
      console.warn('Source file "' + filepath + '" not found.');
      return false;
    }
  }).map(function (filepath) {
    // Read YAML file.
    var content = yaml.safeLoad(fse.readFileSync(filepath, 'utf8'), {
      filename: filepath,
      schema: yaml.JSON_SCHEMA
    });

    return new SrcItem(filepath, content);
  });

  var compiled = compileTranslations(srcList);

  // Handle options.
  if (options.merge) {
    // Write the destination file(with all languages merged in the same file).
    fse.outputFileSync(destination, JSON.stringify(compiled));

    // Print a success message.
    console.log('File "' + destination + '" created.');

    return;
  }

  // Write the destination files.
  for (var lang in compiled) {
    var fileDest = langFileDest(destination, lang, options.langPlace);
    fse.outputFileSync(fileDest, JSON.stringify(compiled[lang]));

    // Print a success message.
    console.log('File "' + fileDest + '" created.');
  }
}
944324
function pretty (msg, obj) {
  console.log(`<------ ${msg} ------>\n` + JSON.stringify(obj, null, ' '))
  console.log(`<------- END -------->\n`)
}
142941
function buildToFile(compileOptions, startTime) {
  utils.header()
  utils.log()
  utils.log(emoji.go, 'Building...', chalk.bold.cyan(compileOptions.inputFile))

  return compile(compileOptions).then(result => {
    utils.writeFile(compileOptions.outputFile, result.css)

    const prettyTime = prettyHrtime(process.hrtime(startTime))

    utils.log()
    utils.log(emoji.yes, 'Finished in', chalk.bold.magenta(prettyTime))
    utils.log(emoji.pack, 'Size:', chalk.bold.magenta(bytes(result.css.length)))
    utils.log(emoji.disk, 'Saved to', chalk.bold.cyan(compileOptions.outputFile))
    utils.footer()
  })
}