mraible / jhipster-book

The JHipster Mini-Book
http://www.jhipster-book.com
Apache License 2.0
22 stars 6 forks source link
angular asciidoc asciidoctor bootstrap infoq java jhipster

= The JHipster Mini-Book

image::https://github.com/mraible/jhipster-book/workflows/Book%20CI/badge.svg[link="https://github.com/mraible/jhipster-book/actions",alt="Actions Status"]

This is an awesome book. It's written in AsciiDoc and compiles to HTML, PDF, and EPUB using the http://asciidoctor.org/docs/asciidoctor-gradle-plugin/[Asciidoctor Gradle plugin].

== Installing


npm run setup

== Building

To convert this book to HTML and EPUB, run the following command:


npm run build

To generate a static site using Antora, run the following command:

npm run build:site

== Sweet Authoring Experience

If you'd like a very pleasant authoring experience, the project provides build files that make it possible. First of all, you'll need to run gradlew once. After running it once, you can run ./gradlew watch to watch for any changes and recompile files as you save them.

To have a similar awesome experience (watch and auto-reload) in your browser, install https://nodejs.org/[Node.js] on your machine.

After installing Node, you can run the following command to install development tools (like http://www.browsersync.io/[Browsersync]).


npm install

TIP: You will only need to run this command when dependencies change in package.json.

Now you can run the following command:


npm run watch

This will start two daemons:

. Gradle, which will watch the file system and rebuild the HTML version continuously using Asciidoctor . BrowserSync, which will serve the updated HTML version all of the time and make it available over HTTP

Thanks to this, you'll have a constantly up to date HTML version available in your browser while editing.

Similarly, you can run the following command to continuously watch the file system and rebuild the static site:

npm run watch:site

== Update Dependencies

To update the dependencies in build.gradle, run:


./gradlew useLatestVersions

To update the dependencies in package.json, install https://www.npmjs.com/package/npm-check-updates[npm-check-updates] and run it:


npm i -g npm-check-updates ncu

== Releasing/Publishing

This project includes GitHub action workflows to build and publish the book (PDF, EPUB, HTML). To trigger this, you have two options:

Once completed, the publish workflow will attach the generated files to the release page.

The benefit of the release npm script is that the version will be updated automatically in the package.json and version.txt files. The version will be reflected in the generated files because the version in version.txt is used as the Gradle project version when building the book.

Note that in order for the release npm script to work, you'll need to make sure that a GITHUB_TOKEN environment variable is available, as explained in https://github.com/release-it/release-it/blob/master/docs/environment-variables.md[release-it's documentation].

== Deploy to Netlify

To deploy this repository to https://www.netlify.com/[Netlify], create an account and log in.

. Select New site from Git . Select your Git provider . Select your repository . Select the branch to deploy . Build command: npm run build:site . Publish directory: public/ . Click Deploy site

Your site should take less than a minute to deploy, depending on the size of your book.

== Netlify Preview

This repository is using a netlify.toml configuration file to build and publish the static site to Netlify. You can see the result at https://jhipster-mini-book.netlify.app.