generators/aws-containers/aws-client.js
function loadAWS(generator) {
    return new Promise((resolve, reject) => {
        try {
            AWS = require('aws-sdk'); // eslint-disable-line
            ProgressBar = require('progress'); // eslint-disable-line
            ora = require('ora'); // eslint-disable-line
        } catch (e) {
            generator.log('Installing AWS dependencies');
            let installCommand = 'yarn add aws-sdk@2.167.0 progress@2.0.0 ora@1.3.0';
            if (generator.config.get('clientPackageManager') === 'npm') {
                installCommand = 'npm install aws-sdk@2.167.0 progress@2.0.0 ora@1.3.0--save';
            }
            shelljs.exec(installCommand, { silent: false }, code => {
                if (code !== 0) {
                    generator.error('Something went wrong while installing the dependencies\n');
                    reject();
                }
                AWS = require('aws-sdk'); // eslint-disable-line
                ProgressBar = require('progress'); // eslint-disable-line
                ora = require('ora'); // eslint-disable-line
            });
        }
        resolve();
    });
}
function loadAWS(generator) {
    return new Promise((resolve, reject) => {
        try {
            AWS = require('aws-sdk'); // eslint-disable-line
            ProgressBar = require('progress'); // eslint-disable-line
            ora = require('ora'); // eslint-disable-line
        } catch (e) {
            generator.log('Installing AWS dependencies');
            let installCommand = 'yarn add aws-sdk@2.167.0 progress@2.0.0 ora@1.3.0';
            if (generator.config.get('clientPackageManager') === 'npm') {
                installCommand = 'npm install aws-sdk@2.167.0 progress@2.0.0 ora@1.3.0--save';
            }
            shelljs.exec(installCommand, { silent: false }, code => {
                if (code !== 0) {
                    generator.error('Something went wrong while installing the dependencies\n');
                    reject();
                }
                AWS = require('aws-sdk'); // eslint-disable-line
                ProgressBar = require('progress'); // eslint-disable-line
                ora = require('ora'); // eslint-disable-line
            });
        }
        resolve();
    });
}
function loadAWS ( generator ) { return new Promise ( ( resolve , reject ) => { try { AWS = require ( 'aws-sdk' ) ; // eslint-disable-line ProgressBar = require ( 'progress' ) ; // eslint-disable-line ora = require ( 'ora' ) ; // eslint-disable-line } catch ( e ) { generator . log ( 'Installing AWS dependencies' ) ; let installCommand = 'yarn add aws-sdk@2.167.0 progress@2.0.0 ora@1.3.0' ; if ( generator . config . get ( 'clientPackageManager' ) === 'npm' ) { installCommand = 'npm install aws-sdk@2.167.0 progress@2.0.0 ora@1.3.0--save' ; } shelljs . exec ( installCommand , { silent : false } , code => { if ( code !== 0 ) { generator . error ( 'Something went wrong while installing the dependencies\n' ) ; reject ( ) ; } AWS = require ( 'aws-sdk' ) ; // eslint-disable-line ProgressBar = require ( 'progress' ) ; // eslint-disable-line ora = require ( 'ora' ) ; // eslint-disable-line } ) ; } resolve ( ) ; } ) ; }
Will load the aws-sdk npm dependency if it's not already loaded.

@param generator the yeoman generator it'll be loaded in.
@returns {Promise} The promise will succeed if the aws-sdk has been loaded and fails if it couldn't be installed.
Will load the aws - sdk npm dependency if it s not already loaded .