mirror of
https://github.com/CompeyDev/lune-luau-template.git
synced 2024-12-12 04:40:41 +00:00
Initial, commit
This commit is contained in:
commit
6edba3d3db
14 changed files with 152 additions and 0 deletions
11
.luaurc
Normal file
11
.luaurc
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"languageMode": "strict",
|
||||||
|
"lint": {
|
||||||
|
"*": true,
|
||||||
|
"FunctionUnused": false
|
||||||
|
},
|
||||||
|
"lintErrors": true,
|
||||||
|
"globals": [
|
||||||
|
"warn"
|
||||||
|
]
|
||||||
|
}
|
6
.lune/fmt.luau
Executable file
6
.lune/fmt.luau
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
--> Formats source code using stylua
|
||||||
|
|
||||||
|
local command = require("util/command")
|
||||||
|
local process = require("@lune/process")
|
||||||
|
|
||||||
|
command.run("stylua", "--verbose", process.args[1] or "src/")
|
7
.lune/lint.luau
Executable file
7
.lune/lint.luau
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
--> Lints source code using selene
|
||||||
|
|
||||||
|
local command = require("util/command")
|
||||||
|
local process = require("@lune/process")
|
||||||
|
|
||||||
|
local args = table.clone(process.args)
|
||||||
|
command.run("selene", table.remove(args, 1) or "src/", table.unpack(args))
|
13
.lune/typecheck.luau
Executable file
13
.lune/typecheck.luau
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
--> Typechecks source code using luau-lsp
|
||||||
|
|
||||||
|
local command = require("util/command")
|
||||||
|
local process = require("@lune/process")
|
||||||
|
|
||||||
|
local args = table.clone(process.args)
|
||||||
|
command.run(
|
||||||
|
"luau-lsp",
|
||||||
|
"analyze",
|
||||||
|
"--settings=.vscode/settings.json",
|
||||||
|
table.remove(args, 1) or "src/",
|
||||||
|
table.unpack(args)
|
||||||
|
)
|
14
.lune/util/command.luau
Normal file
14
.lune/util/command.luau
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
local process = require("@lune/process")
|
||||||
|
|
||||||
|
return {
|
||||||
|
run = function(cmd: string, ...: string)
|
||||||
|
local child = process.spawn(cmd, table.pack(...), {
|
||||||
|
stdio = "forward",
|
||||||
|
shell = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
if not child.ok then
|
||||||
|
process.exit(child.code)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
22
.nvim.lua
Normal file
22
.nvim.lua
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
require("luau-lsp").config({
|
||||||
|
server = {
|
||||||
|
settings = {
|
||||||
|
["luau-lsp"] = {
|
||||||
|
require = {
|
||||||
|
mode = "relativeToFile",
|
||||||
|
directoryAliases = {
|
||||||
|
["@lune"] = "~/.lune/.typedefs/0.8.6/",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
completion = {
|
||||||
|
imports = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
platform = {
|
||||||
|
type = "standard",
|
||||||
|
},
|
||||||
|
})
|
6
.vscode/settings.json
vendored
Normal file
6
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"luau-lsp.require.mode": "relativeToFile",
|
||||||
|
"luau-lsp.require.directoryAliases": {
|
||||||
|
"@lune/": "~/.lune/.typedefs/0.8.6/"
|
||||||
|
}
|
||||||
|
}
|
22
LICENSE.md
Normal file
22
LICENSE.md
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2024 CompeyDev
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
19
README.md
Normal file
19
README.md
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# lune-luau-template
|
||||||
|
|
||||||
|
This is a template for initializing a non-library [Luau](https://luau-lang.org) project with [Lune](https://lune-org.github.io/docs).
|
||||||
|
|
||||||
|
## What is included in this template?
|
||||||
|
|
||||||
|
- A barebones structure for an executable hello world Lune script (src/)
|
||||||
|
- A barebones structure for a library (lib/) -- TODO
|
||||||
|
- Configuration files for various tooling:
|
||||||
|
- aftman for toolchain management (aftman.toml)
|
||||||
|
- stylua for code formatting (stylua.toml, lune.yml)
|
||||||
|
- selene for linting (selene.toml)
|
||||||
|
- luau-lsp for code completion (.vscode/settings.json, .nvim.lua)
|
||||||
|
- Utility lune scripts (.lune/)
|
||||||
|
- Code-formatting
|
||||||
|
- Linting
|
||||||
|
- Typechecking
|
||||||
|
- Unit-testing setup (tests/) -- TODO
|
||||||
|
- GitHub Actions CI configuration to lints and tests (.github) -- TODO
|
5
aftman.toml
Normal file
5
aftman.toml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
[tools]
|
||||||
|
lune = "lune-org/lune@0.8.6"
|
||||||
|
selene = "kampfkarren/selene@0.27.1"
|
||||||
|
stylua = "JohnnyMorganz/stylua@0.20.0"
|
||||||
|
luau-lsp = "JohnnyMorganz/luau-lsp@1.31.0"
|
6
lune.yml
Normal file
6
lune.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
base: luau
|
||||||
|
globals:
|
||||||
|
warn:
|
||||||
|
args:
|
||||||
|
- type: ...
|
2
selene.toml
Normal file
2
selene.toml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
std = "lune"
|
||||||
|
|
8
src/init.luau
Normal file
8
src/init.luau
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
local process = require("@lune/process")
|
||||||
|
|
||||||
|
function main(_args: { string }): number?
|
||||||
|
print("Hello, world!")
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
return process.exit(main(process.args))
|
11
stylua.toml
Normal file
11
stylua.toml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
line_endings = "Unix"
|
||||||
|
quote_style = "AutoPreferDouble"
|
||||||
|
indent_type = "Spaces"
|
||||||
|
call_parentheses = "Always"
|
||||||
|
|
||||||
|
indent_width = 4
|
||||||
|
column_width = 80
|
||||||
|
|
||||||
|
[sort_requires]
|
||||||
|
enabled = true
|
||||||
|
|
Loading…
Reference in a new issue