Skip to content

Commit

Permalink
Update doc preview infrastructure (#2444)
Browse files Browse the repository at this point in the history
* Update doc preview infrastructure

Align the used NodeJS and Ruby versions and scripts with the website build.
Also upgrade caniuse-lite DB.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>

* Add NodeJS/Ruby install instructions

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>

* switch sentence with local preview sentence

Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>

---------

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>
Co-authored-by: Stefan Höhn <mail@stefanhoehn.com>
  • Loading branch information
florian-h05 and stefan-hoehn authored Jan 6, 2025
1 parent a27d468 commit 82a24a4
Show file tree
Hide file tree
Showing 9 changed files with 509 additions and 537 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
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.

58 changes: 32 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,37 +81,43 @@ 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
```

The local preview is available under the following options
If `nvm` and/or `rvm` complain about the required versions not being installed, you can install them as following:

- [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)
```shell script
nvm install 16.20.1
rvm install ruby-3.3.2
```

![local preview](images/local-docu-preview.png)
Next, you can build & serve the documentation preview:

This will also allow you to preview how the page renders on different devices using the respective browser tools.
```shell script
npm run serve-preview
```

The local preview is available under the following URLs:

- <http://0.0.0.0:8080/docs>
- <http://localhost:8080/docs>

This will also allow you to preview how the page renders on different devices using the respective browser tools:

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

## Documentation Versioning

Expand Down
Loading

0 comments on commit 82a24a4

Please sign in to comment.