Skip to content
Permalink
Browse files
CAMEL-11492: update to the latest Antora Default UI
  • Loading branch information
zregvart committed Dec 31, 2018
1 parent 9736c9e commit efa1da1837d54f70671b65535a15dd47ec844bf8
Show file tree
Hide file tree
Showing 32 changed files with 2,797 additions and 2,540 deletions.
@@ -0,0 +1,55 @@
image: node:10.14.2-alpine
stages: [setup, verify, deploy]
yarn:
stage: setup
cache:
paths:
- .yarn-cache/
script:
- &run_yarn
yarn --cache-folder=.yarn-cache --pure-lockfile > /dev/null
lint:
stage: verify
cache: &pull_cache
policy: pull
paths:
- .yarn-cache/
script:
- *run_yarn
- node_modules/.bin/gulp lint
bundle-stable:
stage: deploy
only:
- master@antora/antora-ui-default
cache: *pull_cache
script:
- *run_yarn
- node_modules/.bin/gulp bundle
artifacts:
paths:
- build/ui-bundle.zip
bundle-dev:
stage: deploy
except:
- master
cache: *pull_cache
script:
- *run_yarn
- node_modules/.bin/gulp bundle
artifacts:
expire_in: 1 day # unless marked as keep from job page
paths:
- build/ui-bundle.zip
pages:
stage: deploy
only:
- master@antora/antora-ui-default
cache: *pull_cache
script:
- *run_yarn
- node_modules/.bin/gulp preview:build
# FIXME figure out a way to avoid copying these files to preview site
- rm -rf public/_/{helpers,layouts,partials}
artifacts:
paths:
- public
@@ -0,0 +1,4 @@
{
"description": "Build tasks for the Antora default UI project",
"flags.tasksDepth": 1
}
@@ -1 +1 @@
8
10
@@ -1,6 +1,7 @@
{
"extends": "stylelint-config-standard",
"rules": {
"comment-empty-line-before": null
"comment-empty-line-before": null,
"no-descending-specificity": null,
}
}
@@ -2,26 +2,26 @@
// Settings:
:experimental:
:hide-uri-scheme:
// Project URIs:
:uri-project: https://gitlab.com/antora/antora-ui-default
:uri-preview: https://antora.gitlab.io/antora-ui-default
:uri-ci-pipelines: {uri-project}/pipelines
:img-ci-status: {uri-project}/badges/master/pipeline.svg
// External URIs:
:uri-antora: https://antora.org
:uri-git: https://git-scm.com
:uri-git-dl: {uri-git}/downloads
:uri-gulp: http://gulpjs.com
:uri-opendevise: https://opendevise.com
:uri-node: https://nodejs.org
:uri-nvm: https://github.com/creationix/nvm
:uri-nvm-install: {uri-nvm}#installation
:uri-yarn: https://yarnpkg.com

image:{img-ci-status}[CI Status (GitLab CI), link={uri-ci-pipelines}]

This project is an archetype that demonstrates how to produce a UI bundle for use in a documentation site generated with {uri-antora}[Antora].
You can see a preview of the default UI at {uri-preview}.
// Project URLs:
:url-project: https://gitlab.com/antora/antora-ui-default
:url-preview: https://antora.gitlab.io/antora-ui-default
:url-ci-pipelines: {url-project}/pipelines
:img-ci-status: {url-project}/badges/master/pipeline.svg
// External URLs:
:url-antora: https://antora.org
:url-git: https://git-scm.com
:url-git-dl: {url-git}/downloads
:url-gulp: http://gulpjs.com
:url-opendevise: https://opendevise.com
:url-node: https://nodejs.org
:url-nvm: https://github.com/creationix/nvm
:url-nvm-install: {url-nvm}#installation
:url-yarn: https://yarnpkg.com

image:{img-ci-status}[CI Status (GitLab CI), link={url-ci-pipelines}]

This project is an archetype that demonstrates how to produce a UI bundle for use in a documentation site generated with {url-antora}[Antora].
You can see a preview of the default UI at {url-preview}.

== Use the Default UI

@@ -46,44 +46,44 @@ A more comprehensive tutorial will be made available in the documentation.

To preview and bundle the default UI, you need the following software on your computer:

* {uri-git}[git] (command: `git`)
* {uri-node}[Node 8] (command: `node`)
* {uri-gulp}[Gulp CLI] (command: `gulp`)
* {uri-yarn}[Yarn] (command: `yarn`)
* {url-git}[git] (command: `git`)
* {url-node}[Node] (command: `node`)
* {url-gulp}[Gulp CLI] (command: `gulp`)
* {url-yarn}[Yarn] (command: `yarn`)

==== git

First, make sure you have git installed.

$ git --version

If not, {uri-git-dl}[download and install] the git package for your system.
If not, {url-git-dl}[download and install] the git package for your system.

==== Node 8
==== Node

Next, make sure that you have Node 8 installed.
Next, make sure that you have Node.js (herein "`Node`") installed.

$ node --version

If this command fails with an error, you don't have Node installed.
If the command doesn't report a Node 8 version (e.g., v8.9.4), you don't have a suitable version of Node installed.
If the command doesn't report a Node LTS version (e.g., v10.14.2), you don't have a suitable version of Node installed.

While you can install Node from the official packages, we strongly recommend that you use {uri-nvm}[nvm] (Node Version Manager) to install and manage Node.
Follow the {uri-nvm-install}[nvm installation instructions] to set up nvm on your machine.
While you can install Node from the official packages, we strongly recommend that you use {url-nvm}[nvm] (Node Version Manager) to install and manage Node.
Follow the {url-nvm-install}[nvm installation instructions] to set up nvm on your machine.

Once you've installed nvm, open a new terminal and install Node 8 using the following command:
Once you've installed nvm, open a new terminal and install Node 10 using the following command:

$ nvm install 8
$ nvm install 10

You can switch to this version of Node at any time using the following command:

$ nvm use 8
$ nvm use 10

To make Node 8 the default in new terminals, type:
To make Node 10 the default in new terminals, type:

$ nvm alias default 8
$ nvm alias default 10

Now that you have Node 8 installed, you can proceed with installing the Gulp CLI and Yarn.
Now that you have Node 10 installed, you can proceed with installing the Gulp CLI and Yarn.

==== Gulp CLI

@@ -109,7 +109,7 @@ Now that you have the prerequisites installed, you can fetch and build the defau
Clone the default UI project using git:

[subs=attributes+]
$ git clone {uri-project} &&
$ git clone {url-project} &&
cd "`basename $_`"

The example above clones Antora's default UI project and then switches to the project folder on your filesystem.
@@ -133,33 +133,34 @@ To build the UI and preview it in a local web server, run the `preview` command:

$ gulp preview

You'll see two URLs listed in the output of this command:
You'll see a URL listed in the output of this command:

....
[BS] Access URLs:
----------------------------------
Local: http://localhost:5252
External: http://192.168.1.7:5252
----------------------------------
[BS] Serving files from: build
[BS] Watching files...
[12:59:28] Starting 'preview:serve'...
[12:59:28] Starting server...
[12:59:28] Server started http://localhost:5252
[12:59:28] Running server
....

Navigate to the first URL to see the preview site.
Navigate to that URL to view the preview site.

While this command is running, any changes you make to the source files will be instantly reflected in the browser.
This works by monitoring the project for changes, running the `build` task if a change is detected, and sending the updates to the browser.
This works by monitoring the project for changes, running the `preview:build` task if a change is detected, and sending the updates to the browser.

Press kbd:[Ctrl+C] to stop the preview server and end the continuous build.

=== Package for Use with Antora

If you need to package the UI in order to preview the UI on the real site in local development, run the following command:
If you need to bundle the UI in order to preview the UI on the real site in local development, run the following command:

$ gulp pack
$ gulp bundle

The UI bundle will be available at [.path]_build/ui-bundle.zip_.
You can then point Antora at this bundle using the `--ui-bundle` command-line option.
You can then point Antora at this bundle using the `--ui-bundle-url` command-line option.

If you have the preview running, and you want to bundle without causing the preview to be clobbered, use:

$ gulp bundle:pack

== Copyright and License

@@ -170,4 +171,4 @@ See link:LICENSE[] to find the full license text.

== Authors

Development of Antora is led and sponsored by {uri-opendevise}[OpenDevise Inc].
Development of Antora is led and sponsored by {url-opendevise}[OpenDevise Inc].
@@ -26,45 +26,42 @@ The next two sections explain how to use these modes.

To build the UI once for preview, then stop, execute the `build-preview` task using the following command:

$ gulp build:preview
$ gulp preview:build

This task pre-compiles the UI files into the [.path]_public_ directory.
To view the preview pages, navigate to the HTML pages in the [.path]_public_ directory using your browser (e.g., [.path]_public/index.html_).

=== Build Continuously

To avoid the need to run the `build-preview` task over and over, you can use the `preview` command instead to have it run continuously.
To avoid the need to run the `preview:build` task over and over, you can use the `preview` command instead to have it run continuously.
This task also launches a local HTTP server so updates get synchronized with the browser (i.e., "`live reload`").

To launch the preview server, execute the following command:

$ gulp preview

You'll see two URLs listed in the output of this command:
You'll see a URL listed in the output of this command:

....
[BS] Access URLs:
----------------------------------
Local: http://localhost:5252
External: http://192.168.1.7:5252
----------------------------------
[BS] Serving files from: build
[BS] Watching files...
[12:59:28] Starting 'preview:serve'...
[12:59:28] Starting server...
[12:59:28] Server started http://localhost:5252
[12:59:28] Running server
....

Navigate to the first one to see the preview site.
Navigate to the URL to view the preview site.
While this command is running, any changes you make to the source files will be instantly reflected in the browser.
This works by monitoring the project for changes, running the `build` task if a change is detected, and sending the updates to the browser.
This works by monitoring the project for changes, running the `preview:build` task if a change is detected, and sending the updates to the browser.

Press kbd:[Ctrl+C] to stop the preview server and end the continuous build.

== Package for Previewing

If you need to package the UI in order to preview the UI on the real site in local development, run the following command:
If you need to bundle the UI in order to preview the UI on the real site in local development, run the following command:

$ gulp pack
$ gulp bundle

The `pack` command also invokes the `lint` command to check that the CSS and JavaScript follow the coding standards.
The `bundle` command also invokes the `lint` command to check that the CSS and JavaScript follow the coding standards.

The UI bundle will be available at [.path]_build/ui-bundle.zip_.
You can then point Antora at this bundle using the `--ui-bundle` command-line option.
You can then point Antora at this bundle using the `--ui-bundle-url` command-line option.
@@ -49,7 +49,7 @@ Handlebars (file extension: `.hbs`)::
Templates contain placeholders (i.e., mustache expressions like `+{{{page.title}}}+`) into which content is injected from a model.
They also accommodate simple logic expressions for repeating content or including it conditionally (e.g., `+{{#each navigation}}+`) as well as partials (e.g., `+{{> header}}+`).

Gulp (script file: [.path]_gulpfile.js_)::
Gulp (script file: [.path]_gulpfile.js/index.js_)::
{uri-gulp}[Gulp] is a build tool for JavaScript projects.
It configures a collection of tasks that can be used to perform automated tasks such as compiling files, running a preview server, or publishing a release.

@@ -91,7 +91,9 @@ Here's how the files are structured in the UI project:
[.output]
....
README.adoc
gulpfile.js
gulpfile.js/
index.js
...
package.json
yarn.lock
src/
@@ -123,16 +125,6 @@ src/
preview-site-src/
index.html
ui-model.yml
tasks/
lib/
gulp-prettier-eslint.js
build.js
build-preview.js
format.js
lint-css.js
lint-js.js
pack.js
preview.js
....

A Gulp build is used to compile and assemble the UI project files into a UI bundle.

0 comments on commit efa1da1

Please sign in to comment.