Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

angular & language generators combined in a blueprint throws error during unit testing #25444

Closed
1 task done
dwarakaprasad opened this issue Mar 8, 2024 · 0 comments · Fixed by #25445
Closed
1 task done

Comments

@dwarakaprasad
Copy link
Contributor

Overview of the issue

When a blueprint include both angular & language generators, the unit testing throws the following error,

FAIL  generators/angular/generator.spec.js > SubGenerator angular of lnfix JHipster blueprint > run
TypeError: getWebappTranslation is not a function
❯ getTranslationValue ../../generator-jhipster/dist/generators/languages/support/translate.js:21:12

❯ replaceTranslationKeysWithText ../../generator-jhipster/dist/generators/languages/support/translate.js:56:29
❯ ../../generator-jhipster/dist/generators/languages/support/translate.js:75:106
❯ replaceAngularTranslations ../../generator-jhipster/dist/generators/angular/support/translate-angular.js:108:23
❯ ../../generator-jhipster/dist/generators/angular/support/translate-angular.js:127:37
❯ Transform.<anonymous> ../../generator-jhipster/node_modules/@yeoman/transform/src/transform.ts:78:13
❯ Transform.transform [as _transform] ../../generator-jhipster/node_modules/@yeoman/transform/src/transform.ts:41:29

Bu the same works fine while generating application.

Motivation for or Use Case

It should be possible to create a blueprint combining angular & language generators.

Reproduce the error

Use the attached .yo-rc.json

Related issues

None

Suggest a Fix

This issue is caused because, the blueprint:angular gets higher priority than the blueprint:language. Based on the hierarchy language is required before the frontend generators. Change the compose with in the language generator for blueprint to set the schedule property to false.

JHipster Version(s)

8.1.0

JHipster configuration
.yo-rc.json file
{
  "generator-jhipster": {
    "additionalSubGenerators": "",
    "baseName": "lnfix",
    "cli": true,
    "entities": [],
    "generators": {
      "angular": {
        "command": true,
        "priorities": [
          "initializing",
          "prompting",
          "configuring",
          "composing",
          "loading",
          "preparing",
          "configuringEachEntity",
          "loadingEntities",
          "preparingEachEntity",
          "preparingEachEntityField",
          "preparingEachEntityRelationship",
          "postPreparingEachEntity",
          "default",
          "writing",
          "writingEntities",
          "postWriting",
          "postWritingEntities",
          "loadingTranslations",
          "install",
          "postInstall",
          "end"
        ],
        "sbs": false,
        "written": true
      },
      "languages": {
        "command": true,
        "priorities": [
          "initializing",
          "prompting",
          "configuring",
          "composing",
          "loading",
          "preparing",
          "configuringEachEntity",
          "loadingEntities",
          "preparingEachEntity",
          "preparingEachEntityField",
          "preparingEachEntityRelationship",
          "postPreparingEachEntity",
          "default",
          "writing",
          "writingEntities",
          "postWriting",
          "postWritingEntities",
          "loadingTranslations",
          "install",
          "postInstall",
          "end"
        ],
        "sbs": false,
        "written": true
      }
    },
    "jhipsterVersion": "8.1.0",
    "localBlueprint": false,
    "sampleWritten": true,
    "subGenerators": [
      "angular",
      "languages"
    ]
  }
}
Environment and Tools

openjdk version "17.0.8" 2023-07-18
OpenJDK Runtime Environment Temurin-17.0.8+7 (build 17.0.8+7)
OpenJDK 64-Bit Server VM Temurin-17.0.8+7 (build 17.0.8+7, mixed mode, sharing)

git version 2.34.1

node: v18.19.0
npm: 10.2.3

Docker version 25.0.3, build 4debf41

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions

Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
  • Checking this box is mandatory (this is just to show you read everything)
@dwarakaprasad dwarakaprasad changed the title angular & language generators combined in blueprint throw error during unit testing angular & language generators combined in a blueprint throws error during unit testing Mar 8, 2024
dwarakaprasad added a commit to dwarakaprasad/generator-jhipster that referenced this issue Mar 8, 2024
dwarakaprasad added a commit to dwarakaprasad/generator-jhipster that referenced this issue Mar 9, 2024
@deepu105 deepu105 added this to the 8.2.0 milestone Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants