react/node_modules/@webpack-cli/utils/lib/run-prettier.js
/**
 *
 * Runs prettier and later prints the output configuration
 *
 * @param {String} outputPath - Path to write the config to
 * @param {Node} source - AST to write at the given path
 * @returns {Void} Writes a file at given location
 */
Runs prettier and later prints the output configuration
@param {String} outputPath - Path to write the config to
@param {Node} source - AST to write at the given path
@returns {Void} Writes a file at given location
Runs prettier and later prints the output configuration @param { String } outputPath - Path to write the config to @param { Node } source - AST to write at the given path @returns { Void } Writes a file at given location
function runPrettier(outputPath, source) {
    let prettySource = source;
    let prettier;
    try {
        prettier = require('prettier');
    }
    catch (err) {
        logger_1.default.warn("File is not properly formatted because you don't have prettier installed, you can either install it or format it manually");
        return fs_1.default.writeFileSync(outputPath, source, 'utf8');
    }
    try {
        prettySource = prettier.format(source, {
            filepath: outputPath,
            parser: 'babel',
            singleQuote: true,
            tabWidth: 1,
            useTabs: true,
        });
    }
    catch (err) {
        logger_1.default.warn(`\nWARNING: Could not apply prettier to ${outputPath} due to validation error, but the file has been created`);
        prettySource = source;
    }
    return fs_1.default.writeFileSync(outputPath, prettySource, 'utf8');
}
function runPrettier ( outputPath , source ) { let prettySource = source ; let prettier ; try { prettier = require ( 'prettier' ) ; } catch ( err ) { logger_1 . default . warn ( "File is not properly formatted because you don't have prettier installed, you can either install it or format it manually" ) ; return fs_1 . default . writeFileSync ( outputPath , source , 'utf8' ) ; } try { prettySource = prettier . format ( source , { filepath : outputPath , parser : 'babel' , singleQuote : true , tabWidth : 1 , useTabs : true , } ) ; } catch ( err ) { logger_1 . default . warn ( ` \n ${ outputPath } ` ) ; prettySource = source ; } return fs_1 . default . writeFileSync ( outputPath , prettySource , 'utf8' ) ; }
Runs prettier and later prints the output configuration
 @param {String} outputPath - Path to write the config to
 @param {Node} source - AST to write at the given path
 @returns {Void} Writes a file at given location
Runs prettier and later prints the output configuration @param { String } outputPath - Path to write the config to @param { Node } source - AST to write at the given path @returns { Void } Writes a file at given location
// eslint-disable-next-line node/no-extraneous-require