<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Anthony Viard on Medium]]></title>
        <description><![CDATA[Stories by Anthony Viard on Medium]]></description>
        <link>https://medium.com/@anth.viard?source=rss-b447a5a7156a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xjFU6d7c7_d-DncpPZ73rg.png</url>
            <title>Stories by Anthony Viard on Medium</title>
            <link>https://medium.com/@anth.viard?source=rss-b447a5a7156a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 15:50:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anth.viard/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Build your own JHipster with modules and blueprints]]></title>
            <link>https://medium.com/@anth.viard/build-your-own-jhipster-with-modules-and-blueprints-dd7a2833a388?source=rss-b447a5a7156a------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd7a2833a388</guid>
            <dc:creator><![CDATA[Anthony Viard]]></dc:creator>
            <pubDate>Tue, 16 Jun 2020 15:50:34 GMT</pubDate>
            <atom:updated>2020-06-16T15:50:34.527Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi my fellow hipsters,<br>if JHipster is still as much popular it’s probably because many of us are able to do what we want with. If the main generator seems to be enough to the standard case, for advanced purpose, we will want to personalize this behavior.<br>Modules and blueprints are the right tools for this job, but it’s always difficult to choose between and to understand how it works. This article will help you to understand this mechanic and to go further into the JHipster development.</p><h3>JHipster is not a generator (not only one)</h3><p>When we start dealing with JHipster, we are uses to thinking that it’s a one big generator that manage all the phases from the initialization to writing the files. As expected, it’s not true :D. This is a set from many generators that each has a dedicated domain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*NwkVifkBrrYRbCI3zCI6Tw.png" /></figure><p>We also can define two kinds of generators, the “core” one and the “on demand” one.<br>The firsts are called during you launch the <em>jhipster </em>command according to the options passed. Each generator handles its own prompts, files and rules to generate files.</p><p>Nb: The <em>app</em> generator has a specific role because it is handling the whole generators orchestration, it’s the entry point and the finisher.</p><p>The “on demand” generators are called manually, for specifics need e.g <em>heroku generator</em> if you want to deploy your application on your cloud.</p><h3>Introduction to modules and blueprints</h3><p>If you want to personalize JHipster generated applications, both modules and blueprints can be used. The main question people ask about this is “should I use a module or a blueprint?”. We will try to answer clearly to this.</p><h4>Definitions</h4><p>Official <a href="https://www.jhipster.tech/modules/creating-a-module/">JHipster website</a> <strong>module</strong> definition</p><blockquote>A JHipster module is a Yeoman generator that is composed with a specific JHipster sub-generator to <strong>inherit</strong> some of the common functionality from JHipster.</blockquote><p>Official <a href="https://www.jhipster.tech/modules/creating-a-blueprint/">JHipster website</a> <strong>blueprint</strong> definition</p><blockquote>A JHipster blueprint is a Yeoman generator that is <a href="http://yeoman.io/authoring/composability.html">composed</a> from a specific JHipster sub-generator to <strong>extend</strong> the functionality of that sub-generator.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*u4vh1eoy98bLYybg.jpg" /></figure><h4>But IRL, what does it mean?</h4><p>If you let me use video game metaphors, I would say that :</p><p>- A module is like an add-on to improve your gaming experience. In such games like World of Warcraft (an MMORPG from Blizzard) you can improve the User Interface by adding add-ons. For example, you can display the player position by adding a third party application. The add-on is used to improve an existing solid base.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/239/0*DMhL3-r7dAuIsvgW.jpg" /><figcaption>The SimpleCoord add-on display the player GPS coordinates in the game.</figcaption></figure><p>- meanwhile a blueprint is like a mod in video games. You can create unique games from an existing code/game. Counter strike is, probably, one of the well-known <em>mod</em>. Counter strike is basically a Half-life (Valve) <em>mod</em> that completely change the game and let you play another kind of video game.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*iynmq2OjPArO88rT.jpg" /><figcaption>Counter strike is a well known video game mod.</figcaption></figure><p>Now let’s dive with more precisions into modules and blueprints development.</p><h3>Modules</h3><h4>Mechanism</h4><p>A module has to extend the JHipster BaseGenerator. As a Yeoman generator it has several steps defined by method name such as “prompting” or “writing”. I suggest you to read the <a href="https://yeoman.io/authoring/index.html">Yeoman doc</a>.</p><p>Sample from the Kafka module - <a href="https://github.com/fdelbrayelle/generator-jhipster-kafka/blob/master/generators/app/index.js">index.js</a>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c62698c84c8daa0a287e09800f7d04d2/href">https://medium.com/media/c62698c84c8daa0a287e09800f7d04d2/href</a></iframe><p>Hooks allow you to execute code before or after an entity is created by registering a callBack method.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2a0138bcfaae454b6cc740d729f0976b/href">https://medium.com/media/2a0138bcfaae454b6cc740d729f0976b/href</a></iframe><p>Learn more on <a href="https://www.jhipster.tech/modules/creating-a-module/">JHipster official website</a>.</p><h4>How to create your own module?</h4><p>The JHipster community has built a module generator that allows you to create your own module:<br><a href="https://github.com/jhipster/generator-jhipster-module">https://github.com/jhipster/generator-jhipster-module</a></p><p>Install the generator:</p><blockquote>npm install -g generator-jhipster-module</blockquote><p>Run it and answer to prompts:</p><blockquote>yo jhipster-module</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*1jQy0SpqkbBJ6RefbOc6Og.png" /></figure><h4>Run and use a module</h4><p>When you want to use a module, you have to install it:</p><blockquote>npm install -g generator-jhipster-kafka</blockquote><p>Run JHipster (or put your terminal in an existing JHipster folder) and run the module:</p><blockquote>jhipster</blockquote><blockquote>yo jhipster-kafka</blockquote><p>Because the JHipster community rocks, the last question asked(when you generate an application) allow you to automatically add a module from the marketplace, easy 8).</p><h4>To sum up</h4><p>A module is a Yeoman generator that acts like a JHipster “on-demand” sub-generator (see schema above).</p><ul><li>It inherit from JHipster core APIs</li><li>Used on generated applications</li><li>Hooks can be used to call the module before and/or after entities generation</li><li>It match well to add missing features, improve existing ones</li></ul><p>Examples of modules: <a href="https://www.jhipster.tech/modules/marketplace/#/details/generator-jhipster-kafka">Kafka</a>, <a href="https://www.jhipster.tech/modules/marketplace/#/details/generator-jhipster-ionic">Ionic</a>, <a href="https://www.jhipster.tech/modules/marketplace/#/details/generator-jhipster-testcontainers">TestContainers</a></p><h3>Blueprints</h3><h4>Mechanism</h4><p>We can define two kinds of blueprints, the first I call “merged blueprint” because it merge both JHipster and your writing phase and the second I call “redefinition blueprint” that redefine a whole part of one of several sub-generators.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*jAVIh16wtUtbG73kUGHWVQ.png" /></figure><p>Below an example of what kind of writing phase, we have with merge a blueprint. We call explicitly both steps and return the merge result. The writing phase is now composed from JHipster and our code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2619ee9e22162d2c8dd577e2894914f6/href">https://medium.com/media/2619ee9e22162d2c8dd577e2894914f6/href</a></iframe><p>On the other side, when we redefine a whole sub generator we will not call the JHipster code anymore and only return the result of our step.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a93648b62d4152c6755ff3af480d9994/href">https://medium.com/media/a93648b62d4152c6755ff3af480d9994/href</a></iframe><h4>How to create your own blueprint?</h4><p>The JHipster community as built a blueprint generator that allows you to create your own blueprint:<br><a href="https://github.com/jhipster/generator-jhipster-blueprint">https://github.com/jhipster/generator-jhipster-blueprint</a></p><p>Install the generator:</p><blockquote>npm install -g generator-jhipster-blueprint</blockquote><p>Run it and answer to prompts:</p><blockquote>yo jhipster-blueprint</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*DbuXzgq8_VzZWbnj0Bw_yQ.png" /></figure><h4>Run and use a blueprint</h4><p>The main difference when using a blueprint is that you have to run both JHipster and the blueprint at the same time to generate your application.</p><p>Install the blueprint:</p><blockquote>npm install -g generator-jhipster-vuejs</blockquote><p>An then run JHipster with the “blueprints” flag:</p><blockquote>jhipster --blueprints vuejs</blockquote><h4>To sum up</h4><p>A blueprint is a Yeoman generator that acts on JHipster core generators “ on the fly” (see schema above).</p><ul><li>It extends JHipster core generators (one or many)</li><li>Used to generate applications</li><li>Can extends those generators: <em>App, Client, Server, Common, Language, Entity, Entity-client, Entity-server, Entity-i18n, Spring-controller, Spring-service</em></li><li>It matches well to add a new framework, to personalize the generation step by merging both JHipster core templates and yours.</li></ul><p>Examples of blueprints: <a href="https://www.jhipster.tech/modules/marketplace/#/details/generator-jhipster-vuejs">VueJS</a>, <a href="https://www.jhipster.tech/modules/marketplace/#/details/generator-jhipster-kotlin">Kotlin</a>, <a href="https://www.jhipster.tech/modules/marketplace/#/details/generator-jhipster-quarkus">Quarkus</a></p><h3>Which one should I choose ?</h3><p>In most cases, both technologies can do what you want. This is maybe the reason why people don’t know which one to choose.</p><p>In my opinion, a module is easier to take in charge for beginners, you don’t need to redefine a whole part of JHipster or learn how to optimize the balancing between the main generator templates and yours.</p><p>A module is called on existing applications, so if you already several applications and you want to customize them, it’s better than using or developing a blueprint, regenerating the whole application and putting the code back.</p><p>On the other side, I think blueprints are mostly for advanced usages and will take more time to master. By the way, it will allow you to go further and develop the more advanced generators. It’s surely most powerful than a module.</p><p>Blueprints can also bring sub-generators for on demand calls, but it’s an advanced feature that we would need to explain in another article.</p><h3>Bonus</h3><p>Below is a video from JHipster conf 2019 — <strong>JHipster Carrefour blueprint</strong><br>sorry the video is only available in french.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FOlbfgXjw5g0%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DOlbfgXjw5g0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FOlbfgXjw5g0%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b03f674ced34363ed4cc7d77dfcc29aa/href">https://medium.com/media/b03f674ced34363ed4cc7d77dfcc29aa/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd7a2833a388" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cache your JHipster with Caffeine]]></title>
            <link>https://medium.com/jhipster/cache-your-jhipster-with-caffeine-fcee25bd9939?source=rss-b447a5a7156a------2</link>
            <guid isPermaLink="false">https://medium.com/p/fcee25bd9939</guid>
            <category><![CDATA[jhipster]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[caffeine]]></category>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Anthony Viard]]></dc:creator>
            <pubDate>Sun, 15 Sep 2019 21:58:36 GMT</pubDate>
            <atom:updated>2019-09-15T21:59:28.453Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*rNn9FhFZGEeyWqYPL0GB2A.jpeg" /></figure><p>Hi my fellow hipsters, <br>JHipster could not be hype if we don’t add frequently top features. Today I would like to introduce you a new cache option in JHipster, named Caffeine. I understand how you can be impatient to know all about this, but keep calm, take a coffee and enjoy.</p><h3>CaffeWho ?</h3><p>Caffeine is a cache solution for boosting your application performances. According to the official Github project :</p><blockquote>Caffeine provides an in-memory cache using a Google Guava inspired API. The improvements draw on our experience designing <a href="https://github.com/google/guava/wiki/CachesExplained">Guava’s cache</a> and <a href="https://code.google.com/p/concurrentlinkedhashmap">ConcurrentLinkedHashMap</a>.</blockquote><p>The project counts 27 contributors and more than 6k stars on Github. The first version was released on march 2015.</p><p>Fortunately for us a <a href="https://docs.spring.io/spring/docs/current/spring-framework-reference/integration.html#cache-store-configuration-caffeine">Spring cache</a> implementation is available.</p><p>Learn more at <a href="https://github.com/ben-manes/caffeine">https://github.com/ben-manes/caffeine</a></p><h3>Why using a cache ?</h3><p>Using a cache is a must have for me. With JHipster we always give importance to this kind of <a href="https://www.jhipster.tech/using-cache/">solutions</a>. Using efficiently a cache will improve a lot your performances, especially when you have need to retrieve data that are not updated so frequently.</p><h3>How using Caffeine with JHipster</h3><p>As usual, we have made it easy to use for you. You just need to update your JHipster to the last version and start generating a project. At the spring cache abstraction question, a new answer is available:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LOCgq81cfB5KVN7XWprlVw.png" /></figure><p>As you can see Caffeine is for local cache with a single node, this mean you should not choose it if you need to scale up your application, especially with microservices. Caffeine is an alternative to Ehcache, that’s why the code generated with both options are quite close.</p><h4>How do you like your coffee?</h4><p>Just like other caches with JHipster you can easily configure it.<br>The cache configuration is available in the following class: <em>your_package.config.CacheConfiguration.</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/af5296d456ea222286a670bebfb05507/href">https://medium.com/media/af5296d456ea222286a670bebfb05507/href</a></iframe><p>As we can see, we can tune both maximum_size and expire_after_write options. This two option values are loaded from JHipster properties.<br>You can change these values by accessing to <em>application-dev.yml</em> or <em>application-prod.yml.</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1556aec1049731d5ccbfaae044d56940/href">https://medium.com/media/1556aec1049731d5ccbfaae044d56940/href</a></iframe><h4>More Caffeine pleaaaaase</h4><p>If you want to create more caches for your items in cache configuration, you have two ways: DIY (do it yourself) or using the great entities generation with the JDL.<br>For this article I choose the second way (of course you did the same).</p><p>This part is not really related to Caffeine, Spring Cache offers a great abstraction layer, that’s why you can have similar part with the EhCache (for example).</p><p>There is my simple JDL configuration:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/70c71f6575b865e624e131d49c5ea71e/href">https://medium.com/media/70c71f6575b865e624e131d49c5ea71e/href</a></iframe><p>Let’s import it to our application: <em>jhipster import-jdl my_jdl.jh</em></p><p>Our new classes are now created. Let’s take a look to the cache config:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8ad1a798702201aa50188101cc8deaa1/href">https://medium.com/media/8ad1a798702201aa50188101cc8deaa1/href</a></iframe><p>Here, JHipster add a new cache, defined by the entity name, in the Spring cacheManager. The only thing we have to do, is to tell to Spring where we want to use the cache.<br>Let’s create a new query in the country repository:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca0299a7b9f18e6460042475a3a15f13/href">https://medium.com/media/ca0299a7b9f18e6460042475a3a15f13/href</a></iframe><p>So, every time I will call this method with the same parameter, from my repository, I will get values from the cache if values have already been retrieved before. Our cache is successfully configured and used.</p><h3>Conclusion</h3><p>Using a cache is a real way to improving performances and avoiding overload your database. With JHipster we always focus on performance issues and that’s why we want the best caches solutions for our users.<br>Caffeine is now offered by JHipster as a solution cache.</p><p>Special thanks to <a href="https://www.linkedin.com/in/sudharakap/">Sudharaka Palamakumbura</a> who did the PR to integrate Caffeine. If you want to, like Sudharaka, help the project to grow up, come on the <a href="https://github.com/jhipster/generator-jhipster">Github project</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fcee25bd9939" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jhipster/cache-your-jhipster-with-caffeine-fcee25bd9939">Cache your JHipster with Caffeine</a> was originally published in <a href="https://medium.com/jhipster">JHipster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Add a CLI to your JHipster blueprint]]></title>
            <link>https://medium.com/jhipster/add-a-cli-to-your-jhipster-blueprint-748c4eaf6160?source=rss-b447a5a7156a------2</link>
            <guid isPermaLink="false">https://medium.com/p/748c4eaf6160</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Anthony Viard]]></dc:creator>
            <pubDate>Thu, 27 Jun 2019 05:53:53 GMT</pubDate>
            <atom:updated>2019-06-27T05:53:53.167Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello my fellow hipsters. Who has never dreamt to have his own CLI for his blueprint? This is what I want to show you today.</p><h3>JHipster versions and your blueprint</h3><p>If like me, you like to play with many JHipster versions, switching between your fork and official JHipster releases you probably struggle with version management. How to be sure my JHipster command will launch the version I need? And how I’ll be sure my users will not have bad experiences when using my blueprint?</p><h3>How a CLI can improve your blueprint experience</h3><p>When you generate a project with the JHipster command line with your blueprint you type that:</p><blockquote>jhipster --blueprint myBlueprint</blockquote><p>This means you want to launch JHipster with a blueprint called “myBlueprint” using a global JHipster installation, or the local one. In both cases you can’t be sure the good version will be used and your blueprint as compatibility with a specific version.</p><h3>Create your blueprint and its CLI</h3><p>First, you need to start by creating your own blueprint, you can use the blueprint generator here : <a href="https://github.com/jhipster/generator-jhipster-blueprint">https://github.com/jhipster/generator-jhipster-blueprint</a></p><p>Then we need to add a cli folder that will contain the node.js code. I split it into two files, the app.js (which will launch JHipster for us) and the utils.js (which will contain some functions).</p><ul><li>app.js</li></ul><pre>#!/usr/bin/env node<br><br><strong>const </strong>fork = require(&#39;child_process&#39;).fork;<br><strong>const </strong>utils = require(&#39;./utils&#39;);<br><br><strong>const </strong>jhipsterPath = utils.generateJHipsterPath(&#39;../node_modules/generator-jhipster/cli/jhipster&#39;);<br><strong>const </strong>args = utils.initArguments(&#39;--blueprint&#39;, &#39;myBlueprint&#39;);<br><br>utils.printBanner();<br>fork(jhipsterPath, args);</pre><ul><li>utils.js</li></ul><pre>#!/usr/bin/env node<br><br><strong>const </strong>p = require(&#39;path&#39;);<br><strong>const </strong>chalk = require(&#39;chalk&#39;);<br><br><strong>function </strong>generateJHipsterPath(relativePath) {<br>    <strong>const </strong>absolutePath = p.join(__dirname, relativePath);<br>    <strong>return </strong>p.normalize(absolutePath);<br>}<br><br><strong>function </strong>initArguments(...args) {<br>    <strong>const </strong>inputArgs = _removeNodeArgsInProcessArgv();<br><br>    <strong>return </strong>args.concat(inputArgs);<br>}<br><br><strong>function </strong>_removeNodeArgsInProcessArgv() {<br>    <strong>return </strong>process.argv ? process.argv.slice(2) : [];<br>}<br><br><strong>function </strong>printBanner() {<br>    /* eslint-disable no-console */<br>    console.log(&#39;\n&#39;);<br>    console.log(`${chalk.yellow(&#39;Welcome to myBlueprint JHipster Generator&#39;)}\n`);<br><br>    console.log(&#39;This CLI will call JHipster with myBlueprint blueprint for you. You could use all JHipster CLI options.\n&#39;);<br><br>    console.log(`${chalk.redBright(&#39;Ready ?... &#39;)}${chalk.blueBright(&quot;Let&#39;s go!&quot;)}\n`);<br><br>    console.log(<br>        chalk.green(&#39; _______________________________________________________________________________________________________________\n&#39;)<br>    );<br>    /* eslint-enable no-console */<br>}<br><br>module.exports = {<br>    generateJHipsterPath,<br>    initArguments,<br>    printBanner<br>};</pre><p>This code will generate the right JHipster path (from our node_modules) and launch it with the follow argument (and print a personal header before the JHipster’s one):</p><blockquote>-- blueprint myBlueprint</blockquote><p>When this is done, we just need to register the node.js code as “bin” in our package.json :</p><pre>&quot;bin&quot;: {<br>  &quot;myBlueprint&quot;: &quot;./cli/app.js&quot;<br>}</pre><p>And add the cli folder in the “files” entry (to add it when doing a npm publish):</p><pre>&quot;files&quot;: [<br>  &quot;generators&quot;,<br>  &quot;cli&quot;<br>]</pre><h3>Link your blueprint</h3><p>As long as your blueprint is not published in the npm registry you need to link it.</p><blockquote>npm link</blockquote><p>for yours final users a simple install is necessary</p><blockquote>npm i -g generator-jhipster-myBlueprint</blockquote><h3>Use your CLI</h3><p>In a terminal, create a new folder and type your blueprint command</p><blockquote>myBlueprint</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jgNFpO8u19yXqhdghTgb2g.png" /><figcaption>We can see that the JHipster version used is 5.4.0, same as our package.json</figcaption></figure><p>You can, of course, add options like we used to do with the original JHipster CLI:</p><blockquote>myBlueprint --skip-client --skip-git --skip-checks</blockquote><h3>Conclusion</h3><p>I hope this article will help you, you can find all the source code in my github repository here:<br><a href="https://github.com/avdev4j/myBlueprint">https://github.com/avdev4j/myBlueprint</a></p><p>Feel free to use it and contribute to jhipster.tech and <a href="https://github.com/jhipster">https://github.com/jhipster</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=748c4eaf6160" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jhipster/add-a-cli-to-your-jhipster-blueprint-748c4eaf6160">Add a CLI to your JHipster blueprint</a> was originally published in <a href="https://medium.com/jhipster">JHipster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to: Debug JHipster Blueprints with VSCode]]></title>
            <link>https://medium.com/jhipster/how-to-debug-jhipster-blueprints-with-vscode-d596d6be0707?source=rss-b447a5a7156a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d596d6be0707</guid>
            <category><![CDATA[jhipster]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[yeoman]]></category>
            <dc:creator><![CDATA[Anthony Viard]]></dc:creator>
            <pubDate>Fri, 05 Apr 2019 06:55:24 GMT</pubDate>
            <atom:updated>2019-04-09T10:41:14.531Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome my fellow hipsters!<br>In my <a href="https://medium.com/@anth.viard/how-to-debug-jhipster-generators-with-vscode-6f7c508a93ed">previous story</a>, we saw how to debug the JHipster generators (If you don’t already <a href="https://medium.com/@anth.viard/how-to-debug-jhipster-generators-with-vscode-6f7c508a93ed">read it</a>. It could be useful for understanding the debugging with VSCode).</p><p>But sometimes it’s not enough, especially if you want to deal with <a href="https://www.jhipster.tech/modules/creating-a-blueprint/">JHipster blueprints</a>.</p><p>Let me introduce what blueprints are and how to efficiently develop them when using the VSCode debugger.</p><p>Enjoy!</p><h3>Introduction to Blueprint</h3><blockquote>A JHipster blueprint is a Yeoman generator that is <a href="http://yeoman.io/authoring/composability.html">composed</a> from a specific JHipster sub-generator to extend the functionality of that sub-generator. The blueprint can override any defined getter of the sub generator and provide its own templates and functionality.</blockquote><p><a href="https://www.jhipster.tech/modules/creating-a-blueprint/"><em>https://www.jhipster.tech/modules/creating-a-blueprint/</em></a></p><p>In other words, a blueprint is a way to make your own version of JHipster. For example, <a href="https://github.com/jhipster/jhipster-vuejs">JHipster-vuejs</a> is a popular blueprint which redefined the whole client part to add VueJs as client framework.</p><p>I wrote a <a href="https://github.com/avdev4j/samSuffit">sample blueprint </a>which only extends JHipster generators and adds some specific features to match with a company needs like:<br>- Use the company logo and CSS<br>- Personalize some config stuff<br>- Update POM.xml</p><h3>Why debugging a blueprint</h3><p>When you start creating a blueprint, it’s always difficult to understand what your code really does. Does this behavior come from JHipster? From yeoman? Do I write something wrong? etc…</p><p>Debugging is the best way to master what your application does.</p><p>Of course, even if you debug your application a lot, I always suggest you to keep writing <a href="https://yeoman.io/authoring/testing.html">unit tests</a>.</p><h3>Configure your VSCode</h3><h4>Add a new task</h4><p><a href="https://code.visualstudio.com/docs/editor/tasks">Tasks</a> allow you to define a routine which can be launch before a debug session. It’s important for us because dealing with npm package in dev mode can be very annoying: you need to <a href="https://docs.npmjs.com/cli/link.html">link</a> your blueprint once before using it.</p><p>In your <strong><em>.vscode/tasks.json</em></strong> please add this configuration where <strong>debugVcCodeFolder</strong> is where you will generate your future JHipster application and <strong>generator-jhipster-myBlueprint</strong> is your blueprint name.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6df954d820e889d41083d964c61a7e86/href">https://medium.com/media/6df954d820e889d41083d964c61a7e86/href</a></iframe><h4>Add a new debug config</h4><p>If you followed my last story you probably know what I’m talking about. Otherwise create a new <strong><em>launch.json</em></strong> file in the <strong><em>.vscode</em></strong><em> </em>folder, like this.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b8c7453903fcbeacbd8f7800d55b83a8/href">https://medium.com/media/b8c7453903fcbeacbd8f7800d55b83a8/href</a></iframe><p>“<strong>preLaunchTask</strong>” refer to our previous task added. Before each debug launch, we play this task. Obviously, it can be optimized to avoid doing a link if the folder already exists.</p><p>“<strong>program</strong>” is the JHipster version from our blueprint node_module. Be sure to do an npm install before.</p><p>“<strong>cwd</strong>” is our working folder, put the same value as we set in the <strong><em>tasks.json</em></strong>.</p><h3>Let the debug shine!</h3><p>Add breakpoints, launch our debug configuration (in the debug panel) and let the magic works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*osqlDB78tj0XwuXe-X0Uew.gif" /></figure><p>Congratulations! You have just debugged your own JHipster blueprint.</p><h3>Conclusion</h3><p>We saw how to add a task to link our blueprint and how to debug it.<br>I hope this article will help you with your blueprint development. <br>Don’t hesitate to follow me on twitter @avdev4j and see us on Github: <a href="https://github.com/jhipster">https://github.com/jhipster</a>.</p><p>Have fun with JHipster!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d596d6be0707" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jhipster/how-to-debug-jhipster-blueprints-with-vscode-d596d6be0707">How to: Debug JHipster Blueprints with VSCode</a> was originally published in <a href="https://medium.com/jhipster">JHipster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to: Debug JHipster generators with VSCode]]></title>
            <link>https://medium.com/jhipster/how-to-debug-jhipster-generators-with-vscode-6f7c508a93ed?source=rss-b447a5a7156a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f7c508a93ed</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[jhipster]]></category>
            <dc:creator><![CDATA[Anthony Viard]]></dc:creator>
            <pubDate>Thu, 28 Mar 2019 10:58:58 GMT</pubDate>
            <atom:updated>2019-04-09T10:37:46.752Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to: Debug JHipster generator with VSCode</h3><p>Hi, my fellow hipsters!<br>As a contributor, reviewer or simply a curious user of JHipster you probably wondered how to efficiently debug the JHipster generators.</p><p>Debugging an application is mandatory when you implement some new code or when you need to understand internal mechanisms.</p><p>I introduce you a quick introduction to the VSCode debug mode with JHipster.</p><p>Enjoy!</p><h3>Prepare your environment</h3><p>First, you need to <a href="https://code.visualstudio.com/">download VSCode</a>. VSCode is a lightweight source code editor, developed by Microsoft, which work especially well with core JHipster generator development.</p><p>Then clone the <a href="https://github.com/jhipster/generator-jhipster">generator-jhipster</a> project.</p><blockquote>git clone <a href="https://github.com/jhipster/generator-jhipster.git">https://github.com/jhipster/generator-jhipster.git</a></blockquote><p>Open the project in VSCode.</p><h3>JHipster debug configurations</h3><p>VSCode brings a <a href="https://code.visualstudio.com/docs/editor/debugging">lot of features</a> to debug your own application. As usual, JHipster makes your job easier.</p><p>Open the launch.json file in the .vscode folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CVLdmSciW2H7tlDSJ9ukow.gif" /></figure><p>We can see a lot of configs here. In fact, every object in the “<strong>configurations</strong>” array is a specific debug configuration.</p><p>For example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aee6c4f58464af770c39709eb24bb1dd/href">https://medium.com/media/aee6c4f58464af770c39709eb24bb1dd/href</a></iframe><p>Focus one second on the “<strong>program</strong>” field. It’s the node program launched with this debug profile.<br>“<strong>args</strong>” contains all arguments you want to add when launching the program. “<strong>console</strong>” means which console will be used, here the integrated one to VSCode. “<strong>cwd</strong>” is the current working directory, in other words, the directory where we will launch JHipster and generate an application.</p><p>If you check this directory you will see a <strong><em>.yo-rc.json</em></strong> with much information about a JHipster project. On launching, JHipster will detect this file and load parameters from it, no need to fill the questions step.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/180cda76dd14ccd4391555afe1d22541/href">https://medium.com/media/180cda76dd14ccd4391555afe1d22541/href</a></iframe><h3>Start our first debug session</h3><p>Open <strong><em>generators/app/index.js</em></strong> and add a breakpoint in the constructor (click in the editor at the left to the line numbers. A red dot appears when a breakpoint is activated).<br>For example here:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/717e7d57bebaf3bd71d9c6d799fbf7fb/href">https://medium.com/media/717e7d57bebaf3bd71d9c6d799fbf7fb/href</a></iframe><p>Please open the debug menu and choose the “<strong>jhipster generate sample-dev</strong>” configuration. Run it!<br>The debugger should stop at our breakpoint and we are able to navigate through “variables” and the “call stack”. We also can add “watch” elements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RV0IXWit4YpId8iivUuvQQ.gif" /></figure><p>Congratulations, you have just run your first JHipster in debug mode!</p><h3>Going further</h3><p>The next step could be: define your own debug configuration. It will be, probably, pretty close to those from JHipster. You can change the “<strong>cwd</strong>” value to target your own folder (e.g. <strong><em>/tmp/my_debug_folder</em></strong>). If you target a folder without a <strong><em>.yo-rc.json</em></strong> inside, you will be able to answer to the generator questions. It could be useful if you want to test many scenarios.</p><p>The “<strong>args</strong>” values could be modified to add some specific options like “<strong> — skip-server</strong>” if you want to generate a front application.</p><h3>Conclusion</h3><p>We have seen that VSCode is “debug ready” and have some features to easily debug applications. JHipster brings his own debug profiles and we’ve seen how to handle them.<br>JHipster will not have secrets for you, anymore.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f7c508a93ed" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jhipster/how-to-debug-jhipster-generators-with-vscode-6f7c508a93ed">How to: Debug JHipster generators with VSCode</a> was originally published in <a href="https://medium.com/jhipster">JHipster</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>