generators/docker-prompts.js
function askForPath() {
    if (this.regenerate) return;

    const done = this.async();
    const deploymentApplicationType = this.deploymentApplicationType;
    let messageAskForPath;
    if (deploymentApplicationType === 'monolith') {
        messageAskForPath = 'Enter the root directory where your applications are located';
    } else {
        messageAskForPath = 'Enter the root directory where your gateway(s) and microservices are located';
    }
    const prompts = [
        {
            type: 'input',
            name: 'directoryPath',
            message: messageAskForPath,
            default: this.directoryPath || '../',
            validate: input => {
                const path = this.destinationPath(input);
                if (shelljs.test('-d', path)) {
                    const appsFolders = getAppFolders.call(this, input, deploymentApplicationType);

                    if (appsFolders.length === 0) {
                        return deploymentApplicationType === 'monolith'
                            ? `No monolith found in ${path}`
                            : `No microservice or gateway found in ${path}`;
                    }
                    return true;
                }
                return `${path} is not a directory or doesn't exist`;
            }
        }
    ];

    this.prompt(prompts).then(props => {
        this.directoryPath = props.directoryPath;
        // Patch the path if there is no trailing "/"
        if (!this.directoryPath.endsWith('/')) {
            this.log(chalk.yellow(`The path "${this.directoryPath}" does not end with a trailing "/", adding it anyway.`));
            this.directoryPath += '/';
        }

        this.appsFolders = getAppFolders.call(this, this.directoryPath, deploymentApplicationType);

        // Removing registry from appsFolders, using reverse for loop
        for (let i = this.appsFolders.length - 1; i >= 0; i--) {
            if (this.appsFolders[i] === 'jhipster-registry' || this.appsFolders[i] === 'registry') {
                this.appsFolders.splice(i, 1);
            }
        }

        this.log(chalk.green(`${this.appsFolders.length} applications found at ${this.destinationPath(this.directoryPath)}\n`));

        done();
    });
}
function askForPath() {
    if (this.regenerate) return;

    const done = this.async();
    const deploymentApplicationType = this.deploymentApplicationType;
    let messageAskForPath;
    if (deploymentApplicationType === 'monolith') {
        messageAskForPath = 'Enter the root directory where your applications are located';
    } else {
        messageAskForPath = 'Enter the root directory where your gateway(s) and microservices are located';
    }
    const prompts = [
        {
            type: 'input',
            name: 'directoryPath',
            message: messageAskForPath,
            default: this.directoryPath || '../',
            validate: input => {
                const path = this.destinationPath(input);
                if (shelljs.test('-d', path)) {
                    const appsFolders = getAppFolders.call(this, input, deploymentApplicationType);

                    if (appsFolders.length === 0) {
                        return deploymentApplicationType === 'monolith'
                            ? `No monolith found in ${path}`
                            : `No microservice or gateway found in ${path}`;
                    }
                    return true;
                }
                return `${path} is not a directory or doesn't exist`;
            }
        }
    ];

    this.prompt(prompts).then(props => {
        this.directoryPath = props.directoryPath;
        // Patch the path if there is no trailing "/"
        if (!this.directoryPath.endsWith('/')) {
            this.log(chalk.yellow(`The path "${this.directoryPath}" does not end with a trailing "/", adding it anyway.`));
            this.directoryPath += '/';
        }

        this.appsFolders = getAppFolders.call(this, this.directoryPath, deploymentApplicationType);

        // Removing registry from appsFolders, using reverse for loop
        for (let i = this.appsFolders.length - 1; i >= 0; i--) {
            if (this.appsFolders[i] === 'jhipster-registry' || this.appsFolders[i] === 'registry') {
                this.appsFolders.splice(i, 1);
            }
        }

        this.log(chalk.green(`${this.appsFolders.length} applications found at ${this.destinationPath(this.directoryPath)}\n`));

        done();
    });
}
function askForPath ( ) { if ( this . regenerate ) return ; const done = this . async ( ) ; const deploymentApplicationType = this . deploymentApplicationType ; let messageAskForPath ; if ( deploymentApplicationType === 'monolith' ) { messageAskForPath = 'Enter the root directory where your applications are located' ; } else { messageAskForPath = 'Enter the root directory where your gateway(s) and microservices are located' ; } const prompts = [ { type : 'input' , name : 'directoryPath' , message : messageAskForPath , default : this . directoryPath || '../' , validate : input => { const path = this . destinationPath ( input ) ; if ( shelljs . test ( '-d' , path ) ) { const appsFolders = getAppFolders . call ( this , input , deploymentApplicationType ) ; if ( appsFolders . length === 0 ) { return deploymentApplicationType === 'monolith' ? ` ${ path } ` : ` ${ path } ` ; } return true ; } return ` ${ path } ` ; } } ] ; this . prompt ( prompts ) . then ( props => { this . directoryPath = props . directoryPath ; // Patch the path if there is no trailing "/" if ( ! this . directoryPath . endsWith ( '/' ) ) { this . log ( chalk . yellow ( ` ${ this . directoryPath } ` ) ) ; this . directoryPath += '/' ; } this . appsFolders = getAppFolders . call ( this , this . directoryPath , deploymentApplicationType ) ; // Removing registry from appsFolders, using reverse for loop for ( let i = this . appsFolders . length - 1 ; i >= 0 ; i -- ) { if ( this . appsFolders [ i ] === 'jhipster-registry' || this . appsFolders [ i ] === 'registry' ) { this . appsFolders . splice ( i , 1 ) ; } } this . log ( chalk . green ( ` ${ this . appsFolders . length } ${ this . destinationPath ( this . directoryPath ) } \n ` ) ) ; done ( ) ; } ) ; }
Ask For Path
Ask For Path