generators/utils.js
function getAllJhipsterConfig(generator, force) {
    let configuration = generator && generator.config ? generator.config.getAll() || {} : {};
    if ((force || !configuration.baseName) && jhiCore.FileUtils.doesFileExist('.yo-rc.json')) {
        const yoRc = JSON.parse(fs.readFileSync('.yo-rc.json', { encoding: 'utf-8' }));
        configuration = yoRc['generator-jhipster'];
        // merge the blueprint config if available
        if (configuration.blueprint) {
            configuration = { ...configuration, ...yoRc[configuration.blueprint] };
        }
    }
    if (!configuration.get || typeof configuration.get !== 'function') {
        configuration = {
            ...configuration,
            getAll: () => configuration,
            get: key => configuration[key],
            set: (key, value) => {
                configuration[key] = value;
            }
        };
    }
    return configuration;
}
function getAllJhipsterConfig(generator, force) {
    let configuration = generator && generator.config ? generator.config.getAll() || {} : {};
    if ((force || !configuration.baseName) && jhiCore.FileUtils.doesFileExist('.yo-rc.json')) {
        const yoRc = JSON.parse(fs.readFileSync('.yo-rc.json', { encoding: 'utf-8' }));
        configuration = yoRc['generator-jhipster'];
        // merge the blueprint config if available
        if (configuration.blueprint) {
            configuration = { ...configuration, ...yoRc[configuration.blueprint] };
        }
    }
    if (!configuration.get || typeof configuration.get !== 'function') {
        configuration = {
            ...configuration,
            getAll: () => configuration,
            get: key => configuration[key],
            set: (key, value) => {
                configuration[key] = value;
            }
        };
    }
    return configuration;
}
function getAllJhipsterConfig ( generator , force ) { let configuration = generator && generator . config ? generator . config . getAll ( ) || { } : { } ; if ( ( force || ! configuration . baseName ) && jhiCore . FileUtils . doesFileExist ( '.yo-rc.json' ) ) { const yoRc = JSON . parse ( fs . readFileSync ( '.yo-rc.json' , { encoding : 'utf-8' } ) ) ; configuration = yoRc [ 'generator-jhipster' ] ; // merge the blueprint config if available if ( configuration . blueprint ) { configuration = { ... configuration , ... yoRc [ configuration . blueprint ] } ; } } if ( ! configuration . get || typeof configuration . get !== 'function' ) { configuration = { ... configuration , getAll : ( ) => configuration , get : key => configuration [ key ] , set : ( key , value ) => { configuration [ key ] = value ; } } ; } return configuration ; }
Get all the generator configuration from the .yo-rc.json file
@param {Generator} generator the generator instance to use
@param {boolean} force force getting direct from file
Get all the generator configuration from the . yo - rc . json file