# All files / src/deployTools configure.js

27.78% Statements 10/36
0% Branches 0/13
0% Functions 0/2
42.86% Lines 6/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    292x
    2x
    2x
    2x

    2x

    2x

     import Config from '../config';
    import { inquirerPrompt } from '../systemTools/prompt';
    import PlatformSetup from '../setupTools';
    import { commandExistsSync } from '../systemTools/exec';

    const configureDeploymentIfRequired = async (deploymentTarget) => {
        const projectConfig = Config.getProjectConfig();

        if (deploymentTarget === 'docker') {
            if (!projectConfig.package.dependencies['@rnv/deploy-docker']) {
                const { confirm } = await inquirerPrompt({
                    type: 'confirm',
                    message: 'You do not have Docker deployment configured. Do you want to configure it now?'
                });

                if (confirm) {
                    if (!commandExistsSync('docker')) {
                        const setupInstance = PlatformSetup();
                        await setupInstance.askToInstallSDK('docker');
                    }

                    await Config.injectProjectDependency('@rnv/deploy-docker', 'latest'); // @TODO TO BE CHANGED
                }
            }
        }
    };

    export { configureDeploymentIfRequired };