react/node_modules/@webpack-cli/utils/lib/resolve-packages.js
/**
 *
 * Resolves and installs the packages, later sending them to @creator
 *
 * @param {String[]} pkg - The dependencies to be installed
 * @returns {Function|Error} creator - Builds
 * a webpack configuration through yeoman or throws an error
 */
Resolves and installs the packages, later sending them to @creator
@param {String[]} pkg - The dependencies to be installed
@returns {Function|Error} creator - Builds
a webpack configuration through yeoman or throws an error
Resolves and installs the packages later sending them to @creator @param { String [] } pkg - The dependencies to be installed @returns { Function|Error } creator - Builds a webpack configuration through yeoman or throws an error
function resolvePackages(pkg) {
    Error.stackTraceLimit = 30;
    const packageLocations = [];
    function invokeGeneratorIfReady() {
        if (packageLocations.length === pkg.length) {
            modify_config_helper_1.modifyHelperUtil('init', null, null, packageLocations);
        }
    }
    pkg.forEach((scaffold) => {
        if (path_utils_1.isLocalPath(scaffold)) {
            let absolutePath = scaffold;
            try {
                absolutePath = path_1.default.resolve(process.cwd(), scaffold);
                require.resolve(absolutePath);
                packageLocations.push(absolutePath);
            }
            catch (err) {
                logger_1.default.error(`Cannot find a generator at ${absolutePath}.\n`);
                logger_1.default.error('Reason:\n');
                logger_1.default.error(colorette_1.bold(err));
                process.exitCode = 1;
            }
            invokeGeneratorIfReady();
            return;
        }
        processPromise(spawn_child_1.spawnChild(scaffold))
            .then(() => {
            try {
                const globalPath = global_packages_path_1.getPathToGlobalPackages();
                packageLocations.push(path_1.default.resolve(globalPath, scaffold));
            }
            catch (err) {
                logger_1.default.error("Package wasn't validated correctly...");
                logger_1.default.error(`Submit an issue for ${pkg} if this persists\n`);
                logger_1.default.error('Reason:\n');
                logger_1.default.error(colorette_1.bold(err));
                process.exitCode = 1;
            }
        })
            .catch((err) => {
            logger_1.default.error("Package couldn't be installed, aborting...\n");
            logger_1.default.error('Reason:\n');
            logger_1.default.error(colorette_1.bold(err));
            process.exitCode = 1;
        })
            .then(invokeGeneratorIfReady);
    });
}
function resolvePackages ( pkg ) { Error . stackTraceLimit = 30 ; const packageLocations = [ ] ; function invokeGeneratorIfReady ( ) { if ( packageLocations . length === pkg . length ) { modify_config_helper_1 . modifyHelperUtil ( 'init' , null , null , packageLocations ) ; } } pkg . forEach ( ( scaffold ) => { if ( path_utils_1 . isLocalPath ( scaffold ) ) { let absolutePath = scaffold ; try { absolutePath = path_1 . default . resolve ( process . cwd ( ) , scaffold ) ; require . resolve ( absolutePath ) ; packageLocations . push ( absolutePath ) ; } catch ( err ) { logger_1 . default . error ( ` ${ absolutePath } \n ` ) ; logger_1 . default . error ( 'Reason:\n' ) ; logger_1 . default . error ( colorette_1 . bold ( err ) ) ; process . exitCode = 1 ; } invokeGeneratorIfReady ( ) ; return ; } processPromise ( spawn_child_1 . spawnChild ( scaffold ) ) . then ( ( ) => { try { const globalPath = global_packages_path_1 . getPathToGlobalPackages ( ) ; packageLocations . push ( path_1 . default . resolve ( globalPath , scaffold ) ) ; } catch ( err ) { logger_1 . default . error ( "Package wasn't validated correctly..." ) ; logger_1 . default . error ( ` ${ pkg } \n ` ) ; logger_1 . default . error ( 'Reason:\n' ) ; logger_1 . default . error ( colorette_1 . bold ( err ) ) ; process . exitCode = 1 ; } } ) . catch ( ( err ) => { logger_1 . default . error ( "Package couldn't be installed, aborting...\n" ) ; logger_1 . default . error ( 'Reason:\n' ) ; logger_1 . default . error ( colorette_1 . bold ( err ) ) ; process . exitCode = 1 ; } ) . then ( invokeGeneratorIfReady ) ; } ) ; }
Resolves and installs the packages, later sending them to @creator
 @param {String[]} pkg - The dependencies to be installed
 @returns {Function|Error} creator - Builds
 a webpack configuration through yeoman or throws an error
Resolves and installs the packages later sending them to @creator @param { String [] } pkg - The dependencies to be installed @returns { Function|Error } creator - Builds a webpack configuration through yeoman or throws an error
// Resolve paths to modules on local filesystem // Resolve modules on npm registry