Skip to content

Commit

Permalink
replaced docs build script with a get-lua-ls script
Browse files Browse the repository at this point in the history
  • Loading branch information
emuell committed Dec 10, 2024
1 parent 5809937 commit 4c26f05
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 33 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Deploy mdBook
name: Build & Deploy Docs

on:
# automatically update docs when pushing to master
Expand All @@ -19,11 +19,17 @@ jobs:
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Build the book
- name: Generate API
run: |
cd docs
./generate/build.sh "3.9.3"
cargo install mdbook mdbook-linkcheck mdbook-toc mdbook-alerts
./generate/get-lua-ls.sh
cargo run -- "../types/nerdo/library" "./src"
- name: Build
run: |
cd docs
cargo install mdbook --no-default-features --features search --vers "^0.4" --locked
cargo install mdbook-linkcheck mdbook-toc mdbook-alerts
mdbook build
- name: Upload
Expand Down
8 changes: 3 additions & 5 deletions docs/generate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ It is based on [matt-allan's](https://github.com/matt-allan) [mdbook-luacat](htt
- [rust](https://www.rust-lang.org/tools/install) v1.56 or higher
- [LuaLS](https://github.com/luals/lua-language-server) installation

Note: The LuaLS installation must be placed into the folder [./lua-language-server](./lua-language-server) folder and **must be patched**.

See [build.sh](./build.sh) for details.
Note: The LuaLS installation must be placed into the folder [./lua-language-server](./lua-language-server) folder and **must be patched**. Use [get-lua-ls.sh](./get-lua-ls.sh) to do so before building!

### Building

Expand All @@ -31,7 +29,7 @@ mdbook serve

---

Alternatively, if you have vscode installed, open the XRNX repository folder and use the provided build task to build the API and the book:
Alternatively, if you have vscode installed, open the afseq `./docs` folder and use the provided build task to build the API and the book:

- `build: API Docs`: compiles and runs the API docs generator
- `build: book`: compiles the mdbook
Expand All @@ -40,6 +38,6 @@ Alternatively, if you have vscode installed, open the XRNX repository folder and

## Debugging

If you have vscode installed, open the XRNX root repository folder in vscode and use the `Debug: 'Generate API'` launch action.
If you have vscode installed, open the afseq `./docs` folder in vscode and use the `Debug: 'Generate API'` launch action.

To debug and build the full API definition, change the launch arguments in the file [.vscode/launch.json](../.vscode/launch.json).
21 changes: 0 additions & 21 deletions docs/generate/build.sh

This file was deleted.

33 changes: 33 additions & 0 deletions docs/generate/get-lua-ls.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
set -e -o pipefail

pushd "$(dirname "$0")"

LUA_LS_VERSION="3.9.3"
LUA_LS_RELEASES_URL="https://github.com/LuaLS/lua-language-server/releases/download"

echo "downloading lua-language-server-${LUA_LS_VERSION}..."
rm -rf lua-language-server && mkdir lua-language-server

pushd lua-language-server

# windows (wsl)
if [[ $(grep -i Microsoft /proc/version) ]]; then
wget -q "${LUA_LS_RELEASES_URL}/${LUA_LS_VERSION}/lua-language-server-${LUA_LS_VERSION}-win32-x64.zip" -O temp.zip
unzip temp.zip && rm temp.zip
# macOS
elif [ "$(uname)" = 'Darwin' ]; then
wget -q -O - "${LUA_LS_RELEASES_URL}/${LUA_LS_VERSION}/lua-language-server-${LUA_LS_VERSION}-darwin-arm64.tar.gz" | tar xz
# linux
else
wget -q -O - "${LUA_LS_RELEASES_URL}/${LUA_LS_VERSION}/lua-language-server-${LUA_LS_VERSION}-linux-x64.tar.gz" | tar xz
fi

echo "patching files..."
sed -i.bak "s/\(\['Lua.hover.enumsLimit'\]\s*=\s*Type.Integer\s*>>\s*\)5\(,\)/\1100\2/" "script/config/template.lua"
sed -i.bak -e "s/\(\['Lua.hover.expandAlias'\]\s*=\s*Type.Boolean\s*>>\s*\)true\(,\)/\1false\2/" "script/config/template.lua"
sed -i.bak -e '/if \#view > 200 then/,/end/s/^/-- /' "script/vm/infer.lua"

popd # lua-language-server

popd # docs
5 changes: 2 additions & 3 deletions docs/src/API/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ You can also use the LuaLS type definitions directly for autocompletion and to v

First install the [sumneko.lua vscode extension](https://luals.github.io/#vscode-install).

Then download a copy of the afseq type definitions folder and configure your workspace to use the files in your project. To do this, add the following to your project's `/.vscode/settings.json` file
Then download a copy of the afseq type definitions folder (`./types/nerdo`) and configure your workspace to use the files in your project. To do this, add the following to your project's `/.vscode/settings.json` file

```json
{
"Lua.workspace.library": ["PATH/TO/RENOISE_DEFINITION_FOLDER"],
"Lua.runtime.plugin": "PATH/TO/RENOISE_DEFINITION_FOLDER/plugin.lua"
"Lua.workspace.library": ["PATH/TO/NERDO_DEFINITION_FOLDER"]
}
```

0 comments on commit 4c26f05

Please sign in to comment.