How to use the generator-jhipster/generators/generator-constants.SERVER_MAIN_SRC_DIR function in generator-jhipster

To help you get started, we’ve selected a few generator-jhipster examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github geraldhumphries / generator-jhipster-elasticsearch-reindexer / generators / app / index.js View on Github external
// this variable is used in templates
      if (this.clientFramework === 'angularX') {
        this.angularXAppName = this.getAngularXAppName ? this.getAngularXAppName() : config.angularXAppName;
      } else if (this.clientFramework === 'angular1') {
        this.angularAppName = this.getAngularAppName ? this.getAngularAppName() : config.angularAppName;
      }

      if (this.jhipsterMajorVersion > 2) {
        this.appFolder = 'app/admin/elasticsearch-reindex/';
        this.serviceFolder = this.appFolder;
      } else {
        this.appFolder = 'scripts/app/admin/elasticsearch-reindex/';
        this.serviceFolder = 'scripts/components/admin/';
      }
      jhipsterVar.javaDir = `${jhipsterConstants.SERVER_MAIN_SRC_DIR + this.packageFolder}/`;
      jhipsterVar.resourceDir = jhipsterConstants.SERVER_MAIN_RES_DIR;
      jhipsterVar.webappDir = jhipsterConstants.CLIENT_MAIN_SRC_DIR;

      function getConfig(context) {
        if (context.getJhipsterAppConfig) {
          return context.getJhipsterAppConfig();
        }

        var fromPath = '.yo-rc.json';

        if (shelljs.test('-f', fromPath)) {
          var fileData = fse.readJsonSync(fromPath);
          if (fileData && fileData['generator-jhipster']) {
            return fileData['generator-jhipster'];
          }
        }
github jhipster / generator-jhipster-micronaut / generators / server / files.js View on Github external
*      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const mkdirp = require('mkdirp');
const cleanup = require('generator-jhipster/generators/cleanup');
const constants = require('generator-jhipster/generators/generator-constants');
const baseServerFiles = require('generator-jhipster/generators/server/files').serverFiles;

/* Constants use throughout */
const INTERPOLATE_REGEX = constants.INTERPOLATE_REGEX;
const SERVER_MAIN_SRC_DIR = constants.SERVER_MAIN_SRC_DIR;
const SERVER_MAIN_RES_DIR = constants.SERVER_MAIN_RES_DIR;
const SERVER_TEST_SRC_DIR = constants.SERVER_TEST_SRC_DIR;
const SERVER_TEST_RES_DIR = constants.SERVER_TEST_RES_DIR;

/* TODO: Do a PR in the parent JHipster project to export and re-use here as well in order to have a single source of truth!!!
const TEST_DIR = constants.TEST_DIR;
const shouldSkipUserManagement = generator =>
    generator.skipUserManagement && (generator.applicationType !== 'monolith' || generator.authenticationType !== 'oauth2');
*/

/**
 * The default is to use a file path string. It implies use of the template method.
 * For any other config an object { file:.., method:.., template:.. } can be used
 */
const serverFiles = {
    ...baseServerFiles,
github hipster-labs / generator-jhipster-spring-cloud-stream / generators / app / index.js View on Github external
this.packageName = this.jhipsterAppConfig.packageName;
        this.packageFolder = this.jhipsterAppConfig.packageFolder;
        this.clientFramework = this.jhipsterAppConfig.clientFramework;
        this.clientPackageManager = this.jhipsterAppConfig.clientPackageManager;
        this.buildTool = this.jhipsterAppConfig.buildTool;

        // use function in generator-base.js from generator-jhipster
        this.angularAppName = this.getAngularAppName();

        // const webappDir = jhipsterConstants.CLIENT_MAIN_SRC_DIR;
        this.log(`\nmessage broker type = ${this.messageBrokerType}`);
        this.log(`\nmessage broker type = ${this.rabbitMqNameOfMessage}`);
        this.log('------\n');

        // use constants from generator-constants.js
        const javaDir = `${jhipsterConstants.SERVER_MAIN_SRC_DIR + this.packageFolder}/`;
        const resourceDir = jhipsterConstants.SERVER_MAIN_RES_DIR;
        // add dependencies
        if (this.buildTool === 'maven') {
            if (typeof this.addMavenDependencyManagement === 'function') {
                this.addMavenDependencyManagement('org.springframework.cloud', 'spring-cloud-stream-dependencies', STREAM_CLOUD_DEPENDENCY_VERSION, 'pom', 'import');
                this.addMavenDependency('org.springframework.cloud', 'spring-cloud-stream');
                this.addMavenDependency('org.springframework.cloud', 'spring-cloud-starter-stream-rabbit');
            } else {
                this.addMavenDependency('org.springframework.cloud', 'spring-cloud-stream', STREAM_CLOUD_STREAM_VERSION);
                this.addMavenDependency('org.springframework.cloud', 'spring-cloud-starter-stream-rabbit', STREAM_RABBIT_VERSION);
            }
        } else if (this.buildTool === 'gradle') {
            if (typeof this.addGradleDependencyManagement === 'function') {
                this.addGradleDependencyManagement('mavenBom', 'org.springframework.cloud', 'spring-cloud-stream-dependencies', STREAM_CLOUD_DEPENDENCY_VERSION);
                this.addGradleDependency('compile', 'org.springframework.cloud', 'spring-cloud-stream');
                this.addGradleDependency('compile', 'org.springframework.cloud', 'spring-cloud-starter-stream-rabbit');
github sonalake / generator-jhipster-multitenancy / generators / server / files.js View on Github external
// User database changes
            {
                path: jhipsterConstants.SERVER_MAIN_RES_DIR,
                templates: [
                    {
                        file: 'config/liquibase/changelog/_user_tenant_constraints.xml',
                        renameTo: generator =>
                            `config/liquibase/changelog/${this.changelogDate}__user_${this.tenantNameUpperFirst}_constraints.xml`
                    }
                ]
            }
        ],
        aop: [
            // copy over aspect
            {
                path: jhipsterConstants.SERVER_MAIN_SRC_DIR,
                templates: [
                    {
                        file: 'package/domain/_TenantParameter.java',
                        renameTo: generator => `${this.packageFolder}/domain/${this.tenantNameUpperFirst}Parameter.java`
                    },
                    {
                        file: 'package/aop/_tenant/_TenantAspect.java',
                        renameTo: generator =>
                            `${this.packageFolder}/aop/${this.tenantNameLowerFirst}/${this.tenantNameUpperFirst}Aspect.java`
                    },
                    {
                        file: 'package/aop/_tenant/_UserAspect.java',
                        renameTo: generator => `${this.packageFolder}/aop/${this.tenantNameLowerFirst}/UserAspect.java`
                    }
                ]
            }
github cbornet / generator-jhipster-grpc / generators / entity / index.js View on Github external
writeFiles: function () {
                if (!this.grpcService) {
                    return;
                }
                // function to use directly template
                this.template = function (source, destination, context) {
                    this.fs.copyTpl(
                        this.templatePath(source),
                        this.destinationPath(destination),
                        this,
                        context
                    );
                };
                const grpcEntityDir = jhipsterConstants.SERVER_MAIN_SRC_DIR + this.packageFolder + '/grpc/entity/' + this.entityUnderscoredName ;
                const grpcEntityTestDir = jhipsterConstants.SERVER_TEST_SRC_DIR + this.packageFolder + '/grpc/entity/' + this.entityUnderscoredName ;
                this.log(grpcEntityDir);
                this.template('_entity.proto', 'src/main/proto/' + this.packageFolder + '/entity/' + this.entityUnderscoredName + '.proto');
                this.template('_entityProtoMapper.java', grpcEntityDir + '/'+ this.entityClass + 'ProtoMapper.java');
                this.template('_entityGrpcService.java', grpcEntityDir + '/'+ this.entityClass + 'GrpcService.java');
                this.template('_entityGrpcServiceIntTest.java', grpcEntityTestDir + '/'+ this.entityClass + 'GrpcServiceIntTest.java', { context: { randexp, _, chalkRed: chalk.red, fs, SERVER_TEST_SRC_DIR: grpcEntityTestDir } });
            },
github contribution-jhipster-uga / generator-jhipster-stripe-payment / generators / app / index.js View on Github external
install() {
        if (this.jhipsterAppConfig.buildTool === 'maven' && (this.jhipsterAppConfig.clientFramework === 'angularX' || this.jhipsterAppConfig.clientFramework === 'angular2')) {
            var fs = require('fs');
            // read config from .yo-rc.json
            this.baseName = this.jhipsterAppConfig.baseName;
            this.packageName = this.jhipsterAppConfig.packageName;
            this.packageFolder = this.jhipsterAppConfig.packageFolder;
            this.clientFramework = this.jhipsterAppConfig.clientFramework;
            this.clientPackageManager = this.jhipsterAppConfig.clientPackageManager;
            this.buildTool = this.jhipsterAppConfig.buildTool;

            // use function in generator-base.js from generator-jhipster
            this.angularAppName = this.getAngularAppName();

            // use constants from generator-constants.js
            const javaDir = `${jhipsterConstants.SERVER_MAIN_SRC_DIR + this.packageFolder}/`;
            const javaTestDir = `${jhipsterConstants.SERVER_TEST_SRC_DIR + this.packageFolder}/`;
            const resourceDir = jhipsterConstants.SERVER_MAIN_RES_DIR;
            const webappDir = jhipsterConstants.CLIENT_MAIN_SRC_DIR;

            // variable from questions
            this.pubStripeKey = this.props.pubStripeKey;
            this.priStripeKey = this.props.priStripeKey
            //******************************************
            //
            // Adding a new payment entity
            //
            //******************************************

            var shell = require('shelljs');
            //adding ngx-stripe dependency
            if (shell.exec('npm install ngx-stripe').code !== 0) {
github sonalake / generator-jhipster-multitenancy / generators / entity-server / index.js View on Github external
setUpVariables() {
                this.SERVER_MAIN_SRC_DIR = jhipsterConstants.SERVER_MAIN_SRC_DIR;

                // template variables
                mtUtils.tenantVariables(this.config.get('tenantName'), this);
            },
            // make the necessary server code changes
github bhangun / generator-jhipster-fx / generators / app / index.js View on Github external
this.fs.copyTpl(
                this.templatePath(source),
                this.destinationPath(destination),
                this
            );
        };

        this.message = this.props.message;
        this.baseName = this.props.fxName;
        this.packageName = this.props.packageName;
        this.path = this.props.path;
        this.packageFolder = `${this.props.path}${this.props.fxName}`;
        this.buildTool = this.props.buildTool;

        // use constants from generator-constants.js
        const javaDir = `${jhipsterConstants.SERVER_MAIN_SRC_DIR + this.path}/`;
        const resourceDir = jhipsterConstants.SERVER_MAIN_RES_DIR;
        // variable from questions
        // show all variables
        this.log('\n--- some config read from config ---');
        this.log(`baseName=${this.baseName}`);
        this.log(`packageName=${this.packageName}`);
        this.log(`path=${this.path}`);
        this.log(`packageFolder=${this.packageFolder}`);
        this.log(`buildTool=${this.buildTool}`);

        this.log('\n--- some const ---');
        this.log(`javaDir=${javaDir}`);
        this.log(`resourceDir=${resourceDir}`);

        this.composeWith(require.resolve('../kotlin'));
github contribution-jhipster-uga / generator-jhipster-angular-material-integration / generators / app / index.js View on Github external
);
        };

        // read config from .yo-rc.json
        this.baseName = this.jhipsterAppConfig.baseName;
        this.packageName = this.jhipsterAppConfig.packageName;
        this.packageFolder = this.jhipsterAppConfig.packageFolder;
        this.clientFramework = this.jhipsterAppConfig.clientFramework;
        this.clientPackageManager = this.jhipsterAppConfig.clientPackageManager;
        this.buildTool = this.jhipsterAppConfig.buildTool;

        // use function in generator-base.js from generator-jhipster
        this.angularAppName = this.getAngularAppName();

        // use constants from generator-constants.js
        const javaDir = `${jhipsterConstants.SERVER_MAIN_SRC_DIR + this.packageFolder}/`;
        const resourceDir = jhipsterConstants.SERVER_MAIN_RES_DIR;
        const webappDir = jhipsterConstants.CLIENT_MAIN_SRC_DIR;


        // // show all variables
        // this.log('\n--- some config read from config ---');
        // this.log(`baseName=${this.baseName}`);
        // this.log(`packageName=${this.packageName}`);
        // this.log(`clientFramework=${this.clientFramework}`);
        // this.log(`clientPackageManager=${this.clientPackageManager}`);
        // this.log(`buildTool=${this.buildTool}`);
        //
        // this.log('\n--- some function ---');
        // this.log(`angularAppName=${this.angularAppName}`);
        //
        // this.log('\n--- some const ---');
github cbornet / generator-jhipster-grpc / generators / app / index.js View on Github external
this.packageFolder = this.jhipsterAppConfig.packageFolder;
                this.packageName = this.jhipsterAppConfig.packageName;
                this.applicationType = this.jhipsterAppConfig.applicationType;
                this.authenticationType = this.jhipsterAppConfig.authenticationType;
                this.databaseType = this.jhipsterAppConfig.databaseType;
                this.searchEngine = this.jhipsterAppConfig.searchEngine;
                this.skipUserManagement = this.jhipsterAppConfig.skipUserManagement;
                if (this.applicationType === 'gateway' && this.authenticationType === 'uaa') {
                    this.skipUserManagement = true;
                }
                this.buildTool = this.jhipsterAppConfig.buildTool;
                this.cacheManagerIsAvailable = ['ehcache', 'caffeine', 'hazelcast', 'infinispan', 'memcached', 'redis'].includes(this.jhipsterAppConfig.cacheProvider) || this.applicationType === 'gateway';
                this.cacheProvider = this.jhipsterAppConfig.cacheProvider || this.jhipsterAppConfig.hibernateCache || 'no';
                this.messageBroker = this.jhipsterAppConfig.messageBroker;

                const javaDir = `${jhipsterConstants.SERVER_MAIN_SRC_DIR + this.packageFolder}/`;
                const testDir = `${jhipsterConstants.SERVER_TEST_SRC_DIR + this.packageFolder}/`;
                const protoDir = jhipsterConstants.MAIN_DIR + 'proto/';
                const protoPackageDir = protoDir + this.packageFolder + '/';

                if (this.databaseType === 'sql' && this.authenticationType !== 'oauth2') {
                    this.idProtoType = 'int64';
                    this.idProtoWrappedType = 'Int64Value';
                } else {
                    this.idProtoType = 'string';
                    this.idProtoWrappedType = 'StringValue';
                }

                this.template('_date.proto', protoDir + 'util/date.proto');
                this.template('_decimal.proto', protoDir + 'util/decimal.proto');
                this.template('_pagination.proto', protoDir + 'util/pagination.proto');
                this.template('_queryfilters.proto', protoDir + 'util/queryfilters.proto');

generator-jhipster

Spring Boot + Angular/React/Vue in one handy generator

Apache-2.0
Latest version published 23 days ago

Package Health Score

98 / 100
Full package analysis