-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
077f80d
commit 58e25cf
Showing
3 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
site: | ||
title: "Cloud Doc Test" | ||
start_page: "cloud4:overview:index.adoc" | ||
|
||
content: | ||
sources: | ||
- url: . | ||
branches: HEAD | ||
start_paths: [modules/cloud4, modules/cloud] | ||
|
||
output: | ||
dir: ./build/site | ||
|
||
ui: | ||
bundle: | ||
url: https://github.com/tigergraph/antora-ui/blob/main/build/ui-bundle.zip?raw=true | ||
snapshot: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
'use strict' | ||
|
||
const connect = require('gulp-connect') | ||
const fs = require('fs') | ||
const generator = require('@antora/site-generator-default') | ||
const { reload: livereload } = process.env.LIVERELOAD === 'true' ? require('gulp-connect') : {} | ||
const { series, src, watch } = require('gulp') | ||
const yaml = require('js-yaml') | ||
|
||
const playbookFilename = 'antora-playbook.yml' | ||
const playbook = yaml.load(fs.readFileSync(playbookFilename, 'utf8')) | ||
const outputDir = (playbook.output || {}).dir || './build/site' | ||
const serverConfig = { name: 'Preview Site', livereload, port: 5000, root: outputDir } | ||
const antoraArgs = ['--playbook', playbookFilename] | ||
const watchPatterns = playbook.content.sources.filter((source) => !source.url.includes(':')).reduce((accum, source) => { | ||
accum.push(`${source.url}/${source.start_path ? source.start_path + '/' : ''}antora.yml`) | ||
accum.push(`${source.url}/${source.start_path ? source.start_path + '/' : ''}**/*.adoc`) | ||
return accum | ||
}, []) | ||
|
||
function generate (done) { | ||
generator(antoraArgs, process.env) | ||
.then(() => done()) | ||
.catch((err) => { | ||
console.log(err) | ||
done() | ||
}) | ||
} | ||
|
||
function serve (done) { | ||
connect.server(serverConfig, function () { | ||
this.server.on('close', done) | ||
watch(watchPatterns, generate) | ||
if (livereload) watch(this.root).on('change', (filepath) => src(filepath, { read: false }).pipe(livereload())) | ||
}) | ||
} | ||
|
||
module.exports = { serve, generate, default: series(generate, serve) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "cloud-docs", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"build": "antora generate --fetch antora-playbook.yml", | ||
"dev": "gulp", | ||
"serve": "http-server build/site -c-1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@antora/cli": "^3.1.1", | ||
"@antora/site-generator-default": "^3.1.1", | ||
"gulp": "^4.0.2", | ||
"gulp-cli": "^2.3.0", | ||
"gulp-connect": "^5.7.0", | ||
"js-yaml": "^4.1.0" | ||
} | ||
} |