jhipster / generator-jhipster-blueprint

DEPRECATED: use https://github.com/jhipster/generator-jhipster instead
https://www.jhipster.tech/
Apache License 2.0
35 stars 20 forks source link

TypeError: jhContext.setupServerOptions is not a function #225

Open msingh356-87 opened 3 years ago

msingh356-87 commented 3 years ago

I am getting TypeError: jhContext.setupServerOptions is not a function while trying to override the server and generate the app using my ustm blueprint. TypeError: jhContext.setupClientOptions is not a function when trying to overeide the client.

ruddell commented 3 years ago

We need a new release of this project for JHipster v7.

In the meantime, you can use the ~master~ main branch - clone this repo and run npm link from the project directory. Then use the documented commands in the readme

msingh356-87 commented 3 years ago

Thanks a lot @ruddell

msingh356-87 commented 3 years ago

We need a new release of this project for JHipster v7.

In the meantime, you can use the master branch - clone this repo and run npm link from the project directory. Then use the documented commands in the readme

I did all this and switched to the master branch and installed this locally. It's still giving me the same error. Can you please tell me how to navigate out of this. @ruddell Thanks in advance

ruddell commented 3 years ago

Seems like you are still using an older version somehow - there is no call to setupServerOptions anywhere in the ~master~ main branch. Did you regenerate your blueprint with the master version of the template?

DanielFran commented 3 years ago

@msinghkairos Did you by mistake use master instead of main branch?

msingh356-87 commented 3 years ago

When I am doing a npm install -g generator-jhipster-blueprint

This is in index.js.ejs generator-jhipster-blueprint\generators\app\templates\generators

/ eslint-disable consistent-return / const chalk = require('chalk'); const <%= generators[subGenerator].name %> = require('<%= generators[subGenerator].path %>'); <% if(subGenerator === 'client') {%> const writeFiles = require('./files').writeFiles; <% } %>

module.exports = class extends <%= generators[subGenerator].name %> { constructor(args, opts) { super(args, { fromBlueprint: true, ...opts }); // fromBlueprint variable is important

    <% if (subGenerator.startsWith('entity-')) { %>
    if (!this.jhipsterContext) {
        this.error(`This is a JHipster blueprint and should be used only like ${chalk.yellow('jhipster --blueprint <%= moduleName %>')}`);
    }
    <% } else { %>
    const jhContext = (this.jhipsterContext = this.options.jhipsterContext);

    if (!jhContext) {
        this.error(
            `This is a JHipster blueprint and should be used only like ${chalk.yellow('jhipster --blueprint <%= moduleName %>')}`
        );
    }

    this.configOptions = jhContext.configOptions || {};
    <% } %>

    <% if(subGenerator === 'server') { %>
    // This sets up options for this sub generator and is being reused from JHipster
    jhContext.setupServerOptions(this, jhContext);
    <% } else if(subGenerator === 'client') { %>
    // This sets up options for this sub generator and is being reused from JHipster
    jhContext.setupClientOptions(this, jhContext);
    <% } else if (subGenerator === 'entity') { %>
    // This sets up options for this sub generator and is being reused from JHipster
    jhContext.setupEntityOptions(this, jhContext, this);
    <% } else if (subGenerator === 'common') {%>
    // This sets up options for this sub generator and is being reused from JHipster
    jhContext.setupServerOptions(this, jhContext);
    jhContext.setupClientOptions(this, jhContext);
    <% } %>
}

I cant find this is master branch

msingh356-87 commented 3 years ago

Hey I solved the problem. I cloned the master branch. It works I was using npm install -g generator-jhipster-blueprint This was giving error.

Now there are no errors. But I am still not able to override the client. Any thoughts or comments?