How to use generator-jhipster - 10 common examples

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 jhipster / jhipster-vuejs / test / languages.spec.js View on Github external
const path = require('path');
const assert = require('yeoman-assert');
const helpers = require('yeoman-test');
const constants = require('generator-jhipster/generators/generator-constants');

const CLIENT_MAIN_SRC_DIR = constants.CLIENT_MAIN_SRC_DIR;
const SERVER_MAIN_RES_DIR = constants.SERVER_MAIN_RES_DIR;
const CLIENT_WEBPACK_DIR = constants.CLIENT_WEBPACK_DIR;

describe('Subgenerator languages of Vue.js JHipster blueprint', () => {
    context('Creates default i18n files', () => {
        before((done) => {
            helpers
                .run('generator-jhipster/generators/app')
                .withOptions({
                    'from-cli': true,
                    skipInstall: true,
                    blueprint: 'vuejs',
                    skipChecks: true
                })
                .withGenerators([
                    [
                        require('../generators/client/index.js'), // eslint-disable-line global-require
github jhipster / jhipster-vuejs / test / languages.spec.js View on Github external
const path = require('path');
const assert = require('yeoman-assert');
const helpers = require('yeoman-test');
const constants = require('generator-jhipster/generators/generator-constants');

const CLIENT_MAIN_SRC_DIR = constants.CLIENT_MAIN_SRC_DIR;
const SERVER_MAIN_RES_DIR = constants.SERVER_MAIN_RES_DIR;
const CLIENT_WEBPACK_DIR = constants.CLIENT_WEBPACK_DIR;

describe('Subgenerator languages of Vue.js JHipster blueprint', () => {
    context('Creates default i18n files', () => {
        before((done) => {
            helpers
                .run('generator-jhipster/generators/app')
                .withOptions({
                    'from-cli': true,
                    skipInstall: true,
                    blueprint: 'vuejs',
                    skipChecks: true
                })
                .withGenerators([
                    [
                        require('../generators/client/index.js'), // eslint-disable-line global-require
                        'jhipster-vuejs:client',
github contribution-jhipster-uga / generator-jhipster-stripe-payment / 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 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;

            this.template('payment.jh', 'payment.jh');

        } else {
            this.warning(`\n Your JHipster configuration is not supported yet ! :( Please use Maven and AngularX...`);
            console.log(this.jhipsterAppConfig.clientFramework);
            console.log(this.jhipsterAppConfig.buildTool);
        }
    }
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 contribution-jhipster-uga / generator-jhipster-stripe-payment / generators / app / index.js View on Github external
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) {
                shell.echo('Error: ngx-stripe installation failed');
                shell.exit(1);
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'];
          }
        }
        return false;
github jhipster / jhipster-vuejs / generators / utils.js View on Github external
function addEntityServiceToMain(generator, entityName, className) {
    jhipsterUtils.rewriteFile(
        {
            file: `${CLIENT_MAIN_SRC_DIR}/app/main.ts`,
            needle: 'jhipster-needle-add-entity-service-to-main',
            splicable: [generator.stripMargin(
                // prettier-ignore
                `|    ${entityName}Service: () => new ${className}Service(),`
            )]
        },
        generator
    );
}
github jhipster / jhipster-vuejs / generators / utils.js View on Github external
function addPageToRouter(generator, pageName, pageFolderName) {
    jhipsterUtils.rewriteFile(
        {
            file: `${CLIENT_MAIN_SRC_DIR}/app/router/index.ts`,
            needle: 'jhipster-needle-add-entity-to-router',
            splicable: [generator.stripMargin(
                // prettier-ignore
                `|,
                |    {
                |      path: '/pages/${pageFolderName}',
                |      name: '${pageName}',
                |      component: ${pageName},
                |      meta: { authorities: ['ROLE_USER'] }
                |    }`
            )]
        },
        generator
    );
github bhangun / generator-jhipster-fx / generators / entity-client / index.js View on Github external
addEntityToDrawer(entityInstance, entityClass, entityAngularName, entityFolderName, entityFileName, enableTranslation) {
        // workaround method being called on initialization
        if (!entityClass) {
            return;
        }
        const entityPagePath = 'lib/widgets/drawer.dart';
        try {
            const page2 = `list.add(_listTitle("${entityClass}", context,"/${entityInstance}"));`;
            utils.rewriteFile({
                file: entityPagePath,
                needle: 'kutilang-needle-add-drawer',
                splicable: [
                    this.stripMargin(page2)
                ]
            }, this);
        } catch (e) {
            this.log(`${chalk.yellow('\nUnable to find ') + entityPagePath + chalk.yellow(' or missing required jhipster-needle. Reference to ') + entityClass} ${chalk.yellow(`not added to ${entityPagePath}.\n`)}`);
            this.debug('Error:', e);
        }
    }
github jhipster / jhipster-vuejs / generators / entity-client / utils.js View on Github external
function addEntityServiceToMainImport(generator, className, fileName, folderName) {
    jhipsterUtils.rewriteFile(
        {
            file: `${CLIENT_MAIN_SRC_DIR}/app/main.ts`,
            needle: 'jhipster-needle-add-entity-service-to-main-import',
            splicable: [generator.stripMargin(
                // prettier-ignore
                `|import ${className}Service from '@/entities/${folderName}/${fileName}.service';`
            )]
        },
        generator
    );
}

generator-jhipster

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

Apache-2.0
Latest version published 9 days ago

Package Health Score

89 / 100
Full package analysis