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

Preview build POC (step 1: local) #794

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Preview build POC (step 1: local) #794

wants to merge 6 commits into from

Conversation

osfameron
Copy link
Collaborator

@osfameron osfameron commented Oct 3, 2024

Step 1: a command preview to build locally

SCREENCAST: https://drive.google.com/file/d/1ec4WXk77TYtQcJFjJDWMydf2gyhXLs9p/view?usp=sharing

NB: you'll want to add something like alias preview='node ~/couchbase/docs-site/scripts/preview/preview.js' to your .zshrc (correct the path for your case)

Roadmap:
Step 2: build remotely when branch is pushed
Step 3: niceties for VSCode etc.?

@osfameron osfameron requested a review from a team October 3, 2024 17:25
Copy link
Contributor

@RayOffiah RayOffiah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What can I say? This is great!

I can get a local build for one module up and running in a few seconds, as opposed to half an hour!

How does this work?

import {findUp, pathExists} from 'find-up'
import { promisify } from 'node:util'
import child_process from 'node:child_process'
import deepmerge from '@fastify/deepmerge'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to be listed in the package.json file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks - I think I added it in the wrong directory, I'll tidy up...

clean: true
asciidoc:
attributes:
kroki-server-url: null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this does, to be honest, but doesn't it need a setting?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null gets set to ~ in YAML, which I think is the same as being unset.
(At any rate, the builds I tried didn't hang while trying to speak to our firewalled server, so I think it's OK)

@osfameron
Copy link
Collaborator Author

How does this work?

It figures out url, branch, start_path from the current directory,
then looks for docs_site to find the template antora-playbook.yml
then munges them all together (plus any config from the antora.yml, and a local.yml override file) to create a temporary playbook.

Happy to talk through it if you want to know the gory details 👍

Streamline the step for aliasing `preview` to your docsSite location
(assuming docs team standard MacOS)
"remote" build intended to be used on Github runner, based on payload passed in
via Github Actions
@mojavelinux
Copy link
Contributor

mojavelinux commented Oct 10, 2024

I just want you to know that this is exactly what the Gradle Antora plugin and Antora Maven plugin were designed to do, without having to mess with JavaScript.

See https://docs.antora.org/gradle-plugin/latest/playbook-provider/ and https://docs.antora.org/maven-plugin/latest/playbook-provider/

The playbook file is managed centrally in any repository you want. It then sets up a playbook to build just the content branch.

Even if you don't end up using Maven or Gradle, you might be able to draw ideas from the design of the playbook provider capability in the plugins.

NOTE: We envision adding this capability to the antora command, but we have not yet had the opportunity to explore it yet.

@osfameron
Copy link
Collaborator Author

Thanks @mojavelinux !
I will have a look - usually a bit wary of adding maven/gradle dependencies (only because I don't understand them and have had bad experience trying to maintain some bitrotted ones) but as you say, lots to learn from them, thanks.

At the very least, it sense-checks the requirement 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants