Skip to content

Commit

Permalink
Update doc preview infrastructure
Browse files Browse the repository at this point in the history
Align the used NodeJS and Ruby versions and scripts with the website build.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
  • Loading branch information
florian-h05 committed Jan 4, 2025
1 parent b99531d commit 425d9ca
Show file tree
Hide file tree
Showing 10 changed files with 497 additions and 533 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.20.1
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.3.2
4 changes: 2 additions & 2 deletions .vuepress/add_placeholders.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This function will add placeholders for pages that are out of scope of the docs preview

def add_placeholder_pages()
puts ">>> Adding placeholder pages for preview"
puts "➡️ Adding placeholder pages for preview"
[
"addons/integrations/homekit",
"addons/integrations/openhabcloud",
Expand All @@ -19,7 +19,7 @@ def add_placeholder_pages()
"docs/ecosystem/mycroft",
"docs/installation/openhabian.md"
].each { |path|
puts " -> #{path}"
puts " ➡️ #{path}"
page = path
if (!(path =~ /\.md/)) then
FileUtils.mkdir_p(path)
Expand Down
2 changes: 1 addition & 1 deletion .vuepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const base = process.env.OH_DOCS_VERSION
: '/'

const config: UserConfig<DefaultThemeConfig> = {
title: 'v4 Documentation Preview',
title: 'Documentation Preview',
description: 'This is a preview of the main parts of the documentation, found in the openhab/openhab-docs repository',
dest: 'vuepress',
host: 'localhost',
Expand Down
364 changes: 163 additions & 201 deletions .vuepress/process_file.rb

Large diffs are not rendered by default.

157 changes: 0 additions & 157 deletions .vuepress/process_main_docs.rb

This file was deleted.

47 changes: 23 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,33 +81,32 @@ The new build will include all the latest changes in the code repository and in

### How to build the documentation locally

It is possible to build a preview version of the documentation on your local machine. The following software is required:

- [`node =16.20.1`](https://nodejs.org/en)
- [`ruby >=3.0.2`](https://www.ruby-lang.org/en/)
- [`Python >= 3.10.12`](https://www.python.org)

If you work on multiple node projects [Node Version Manager](https://github.com/nvm-sh/nvm) is recommended in case they use a different version of node.

Example:

```bash
$ nvm install 16
# ...
$ nvm use 16
Now using node v16.20.2 (npm v8.19.4)
$ npm install
# ...
$ npm run serve
# ...
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/)
It is possible to build a preview version of the documentation on your local machine.
The following software is required:

- [`NodeJS = 16.20.1`](https://nodejs.org/en)
- [`Ruby >= 3.3.2`](https://www.ruby-lang.org/en/)

We recommend to use [Node Version Manager](https://github.com/nvm-sh/nvm) as well as [Ruby Version Manager](https://rvm.io/) to easily allow using multiple versions of NodeJS and Ruby for multiple projects.
If you don't do that, you can simply start by only installing the above mentioned versions.

When using `nvm` and/or `rvm`, setup the NodeJS and/or Ruby version:

```shell script
nvm use
rvm use
```

Next, you can build & serve the documentation preview:

```shell script
npm run serve-preview
```

The local preview is available under the following options
The local preview is available under the following URLs:

- [http://0.0.0.0:8000/docs](http://0.0.0.0:8000/docs)
- [http://localhost:8000/docs](http://localhost:8000/docs)
- [http://[::]/:8000/docs](http://[::]:8000/docs)
- <http://0.0.0.0:8080/docs>
- <http://localhost:8080/docs>

![local preview](images/local-docu-preview.png)

Expand Down
Loading

0 comments on commit 425d9ca

Please sign in to comment.