This template project uses TypeScriptToLua to create a neovim lua plugin.
There are many differences between Typescript for JavaScript and TypeScriptToLua for Lua:
- Features from languages(JavaScript and Lua): Caveats | TypeScriptToLua
- To support JavaScript's function behavior in Lua: The Self Parameter | TypeScriptToLua
- Using other modules: you can use external Lua code but not TypeScript files from npm packages. External Lua Code | TypeScriptToLua
- Publish TSToLua modules: with the previous item, the good news is you can use TypeScriptToLua to publish this Lua module with types and can be used in other TSToLua projects. Publishing Modules | TypeScriptToLua
- Extend TypeScript to support features in Lua: Language Extensions | TypeScriptToLua
First change the project name and related path.
- In
package.json
:
- Update meta data
name
,repository.url
,author
, etc. - Update project name path in
main
,types
- In
tsconfig.json
:
- Update project name path in
compilerOptions.outDir
This project favors yarn
and use yarn
to install dependencies, use
yarn build
to generate lua code. The output files will be in ./lua/<project name>/
.
Finally, use yarn dev
to build in realtime
as source files change.
- Examples to use GitHub CI to automatically build code on git push.
- Provide Neovim API type declarations (how to automatically generate them?) as a npm package.