diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 4e63ba1..9e668ca 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -1,4 +1,4 @@ -name: Build and Deploy mdBook +name: Build & Deploy Docs on: # automatically update docs when pushing to master @@ -22,7 +22,8 @@ jobs: - name: Build the book run: | cd docs - ./generate/build.sh "3.9.3" + ./generate/get-lua-ls.sh + cargo run -- "../types/nerdo/library" "./src" cargo install mdbook mdbook-linkcheck mdbook-toc mdbook-alerts mdbook build diff --git a/docs/generate/README.md b/docs/generate/README.md index efb09c9..26c391d 100644 --- a/docs/generate/README.md +++ b/docs/generate/README.md @@ -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 @@ -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 @@ -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). diff --git a/docs/generate/build.sh b/docs/generate/build.sh deleted file mode 100755 index 426a69f..0000000 --- a/docs/generate/build.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -set -e - -LUA_LS_VERSION=$1 - -pushd generate -echo "downloading lua-language-server-${LUA_LS_VERSION}..." -rm -rf lua-language-server && mkdir lua-language-server - -pushd lua-language-server -rm -rf ./* -wget -q -O - "https://github.com/LuaLS/lua-language-server/releases/download/${LUA_LS_VERSION}/lua-language-server-${LUA_LS_VERSION}-linux-x64.tar.gz" | tar xz - -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 - -echo "generating api docs..." -cargo run -- "../../types/nerdo/library" "../src" \ No newline at end of file diff --git a/docs/generate/get-lua-ls.sh b/docs/generate/get-lua-ls.sh new file mode 100755 index 0000000..51d97d7 --- /dev/null +++ b/docs/generate/get-lua-ls.sh @@ -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 diff --git a/docs/src/API/README.md b/docs/src/API/README.md index 47c2437..698da35 100644 --- a/docs/src/API/README.md +++ b/docs/src/API/README.md @@ -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"] } ``` \ No newline at end of file