├── .prettierignore ├── tests ├── client │ ├── cl_test00.lua │ ├── cl_test01_globalstate.lua │ ├── cl_test03_nui.lua │ ├── cl_test99_vendor.lua │ └── cl_test02_3dnames.lua ├── server │ ├── sv_test01_globalstate.lua │ ├── sv_test99_vendor.lua │ └── sv_test00.lua ├── shared.lua └── fxmanifest.lua ├── .gitignore ├── .dockerignore ├── .github ├── docs │ └── fancy_example.png └── workflows │ └── ci.yml ├── .prettierrc.json ├── Dockerfile ├── tsconfig.json ├── package.json ├── action.yml ├── LICENSE.md ├── .docker └── entrypoint.sh ├── README.md ├── .luacheckrc.template ├── generate-rc.ts └── yarn.lock /.prettierignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/client/cl_test00.lua: -------------------------------------------------------------------------------- 1 | TriggerServerEvent('', 1) -------------------------------------------------------------------------------- /tests/client/cl_test01_globalstate.lua: -------------------------------------------------------------------------------- 1 | print(GlobalState.a) 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | *.idea/ 3 | node_modules/ 4 | .luacheckrc 5 | **/*.js -------------------------------------------------------------------------------- /tests/client/cl_test03_nui.lua: -------------------------------------------------------------------------------- 1 | RegisterNUICallback('', function() end) 2 | SendNUIMessage('', function() end) 3 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | **/* 2 | !.docker 3 | !package.json 4 | !yarn.lock 5 | !generate-rc.ts 6 | !tsconfig.json 7 | !.luacheckrc.template -------------------------------------------------------------------------------- /.github/docs/fancy_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GoatG33k/fivem-lua-lint-action/HEAD/.github/docs/fancy_example.png -------------------------------------------------------------------------------- /tests/server/sv_test01_globalstate.lua: -------------------------------------------------------------------------------- 1 | GlobalState.a = true 2 | print(GlobalState.a) 3 | 4 | GlobalState['b'] = true 5 | print(GlobalState['b']) 6 | -------------------------------------------------------------------------------- /tests/client/cl_test99_vendor.lua: -------------------------------------------------------------------------------- 1 | -- json 2 | json.encode({}) 3 | json.decode('') 4 | -- types 5 | quat() 6 | vec() 7 | vector2() 8 | vec2() 9 | vector3() 10 | vec3() 11 | vector4() 12 | vec4() 13 | -------------------------------------------------------------------------------- /tests/server/sv_test99_vendor.lua: -------------------------------------------------------------------------------- 1 | -- json 2 | json.encode({}) 3 | json.decode('') 4 | -- types 5 | quat() 6 | vec() 7 | vector2() 8 | vec2() 9 | vector3() 10 | vec3() 11 | vector4() 12 | vec4() 13 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "avoid", 3 | "endOfLine": "lf", 4 | "useTabs": false, 5 | "tabWidth": 2, 6 | "jsxSingleQuote": true, 7 | "jsxBracketSameLine": false, 8 | "trailingComma": "none", 9 | "semi": false 10 | } 11 | -------------------------------------------------------------------------------- /tests/client/cl_test02_3dnames.lua: -------------------------------------------------------------------------------- 1 | -- ensure that natives beginning with numbers work 2 | DrawScaleformMovie_3d() 3 | DrawScaleformMovie_3dSolid() 4 | GetGroundZAndNormalFor_3dCoord() 5 | GetGroundZFor_3dCoord() 6 | GetGroundZFor_3dCoord_2() 7 | IsCopPedInArea_3d() 8 | IsCopVehicleInArea_3d() 9 | -------------------------------------------------------------------------------- /tests/server/sv_test00.lua: -------------------------------------------------------------------------------- 1 | TriggerClientEvent('', -1) 2 | TriggerLatentClientEvent('', -1, 1000) 3 | RegisterServerEvent(function() 4 | local s = source 5 | GetPlayerIdentifiers(1) 6 | GetPlayers() 7 | PerformHttpRequest('', function() end) 8 | print(s) 9 | end) 10 | CreateVehicle() -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM evandarwin/lua:latest 2 | RUN luarocks install argparse && \ 3 | luarocks install luafilesystem && \ 4 | luarocks install luacheck 5 | RUN mkdir -p /luacheck-fivem 6 | ADD . /luacheck-fivem/ 7 | RUN apk add --no-cache yarn nodejs && \ 8 | cd /luacheck-fivem/ && \ 9 | yarn --prod --frozen-lockfile && yarn build && \ 10 | chmod +x /luacheck-fivem/.docker/entrypoint.sh 11 | ENTRYPOINT ["/luacheck-fivem/.docker/entrypoint.sh"] -------------------------------------------------------------------------------- /tests/shared.lua: -------------------------------------------------------------------------------- 1 | -- shared 2 | CreateThread(function() end) 3 | Citizen.CreateThread(function() end) 4 | SetTimeout(0, function() end) 5 | Citizen.SetTimeout(0, function() end) 6 | Await(function() end) 7 | Citizen.Await(function() end) 8 | Wait(0) 9 | Citizen.Wait(0) 10 | Trace() 11 | Citizen.Trace() 12 | Citizen.InvokeNative(0x000000) 13 | -- events 14 | AddEventHandler('', function() end) 15 | RegisterNetEvent('', function() end) 16 | TriggerEvent('') 17 | RemoveEventHandler(function() end) 18 | -- exports 19 | exports.example:test() -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "strict": true, 4 | "target": "ES6", 5 | "moduleResolution": "node", 6 | "module": "CommonJS", 7 | "keyofStringsOnly": false, 8 | "strictFunctionTypes": true, 9 | "strictNullChecks": true, 10 | "noImplicitAny": true, 11 | "noImplicitReturns": true, 12 | "noImplicitThis": true, 13 | "noEmitOnError": true, 14 | "noUnusedLocals": true, 15 | "noUncheckedIndexedAccess": true, 16 | "noFallthroughCasesInSwitch": true, 17 | "noUnusedParameters": true, 18 | "pretty": true 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fivem-lua-lint-action", 3 | "version": "0.0.0", 4 | "author": { 5 | "name": "GoatGeek", 6 | "email": "goatgeek@relta.net" 7 | }, 8 | "license": "MIT", 9 | "scripts": { 10 | "install": "tsc -b", 11 | "build": "node ./generate-rc.js", 12 | "format": "prettier --write ." 13 | }, 14 | "devDependencies": { 15 | "prettier": "^2.3.0", 16 | "ts-node": "^10.0.0" 17 | }, 18 | "dependencies": { 19 | "typescript": "^4.3.2", 20 | "@types/node": "^15.9.0", 21 | "@types/node-fetch": "^2.5.10", 22 | "ansi-colors": "^4.1.1", 23 | "node-fetch": "^2.6.1" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/fxmanifest.lua: -------------------------------------------------------------------------------- 1 | fx_version 'cerulean' 2 | games { 'gta5' } 3 | game 'gta5' 4 | 5 | author 'Billy Bob' 6 | description 'Description' 7 | version '1.0.0' 8 | 9 | client_scripts {} 10 | client_script '' 11 | 12 | server_scripts {} 13 | server_script '' 14 | 15 | shared_scripts {} 16 | shared_script '' 17 | 18 | export '' 19 | exports {} 20 | 21 | replace_level_meta '' 22 | 23 | data_file 'DATA_FILE' '' 24 | this_is_a_map 'yes' 25 | server_only 'yes' 26 | 27 | loadscreen '' 28 | ui_page '' 29 | file '' 30 | files {} 31 | 32 | my_data 'abc' { field = true } 33 | my_data('nine')({ field = true }) 34 | 35 | dependency '' 36 | dependencies {} 37 | provide '' 38 | 39 | lua54 'yes' 40 | 41 | -- less common 42 | disable_lazy_natives 'yes' 43 | clr_disable_task_scheduler 'yes' 44 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | # action.yml 2 | name: "luacheck for FiveM" 3 | description: "Runs luacheck on a project with FiveM natives" 4 | inputs: 5 | args: 6 | description: "luacheck arguments to pass" 7 | required: false 8 | default: "-t" 9 | paths: 10 | description: "the path name to lint lua in" 11 | required: false 12 | default: "." 13 | capture: 14 | description: "capture output into a file" 15 | required: false 16 | default: "" 17 | extra_libs: 18 | description: "extra definitions to use, in the format of a+b+c" 19 | required: false 20 | default: "" 21 | runs: 22 | using: "docker" 23 | image: "Dockerfile" 24 | args: 25 | - ${{ inputs.args }} 26 | - ${{ inputs.paths }} 27 | - ${{ inputs.capture }} 28 | - ${{ inputs.extra_libs }} 29 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright © 2021 GoatGeek 2 | 3 | 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: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | 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. 8 | -------------------------------------------------------------------------------- /.docker/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -l 2 | LUACHECK_ARGS="--config /luacheck-fivem/.luacheckrc $1" 3 | LUACHECK_PATH="$2" 4 | LUACHECK_CAPTURE_OUTFILE="$GITHUB_WORKSPACE/$3" 5 | 6 | # extra luacheck definitions 7 | if [[ ! -z "$4" ]]; then 8 | OLD_DIR=$(pwd) 9 | # regenerate with extras 10 | cd /luacheck-fivem/ 11 | yarn build "$4" 12 | # go back 13 | cd $OLD_DIR 14 | fi 15 | 16 | EXIT_CODE=0 17 | 18 | cd $GITHUB_WORKSPACE 19 | 20 | echo "outfile => $LUACHECK_CAPTURE_OUTFILE" 21 | 22 | if [[ ! -z "$LUACHECK_CAPTURE_OUTFILE" ]]; then 23 | echo "exec => luacheck $LUACHECK_ARGS $LUACHECK_PATH 2>>$LUACHECK_CAPTURE_OUTFILE" 24 | luacheck $LUACHECK_ARGS $LUACHECK_PATH >$LUACHECK_CAPTURE_OUTFILE 2>&1 || true 25 | 26 | echo "exec => luacheck $LUACHECK_ARGS --formatter default $LUACHECK_PATH" 27 | luacheck $LUACHECK_ARGS --formatter default $LUACHECK_PATH || EXIT_CODE=$? 28 | else 29 | echo "exec => luacheck $LUACHECK_ARGS $LUACHECK_PATH" 30 | luacheck $LUACHECK_ARGS $LUACHECK_PATH || EXIT_CODE=$? 31 | fi 32 | 33 | echo "exit => $EXIT_CODE" 34 | if [ $EXIT_CODE -ge 2 ]; then 35 | exit $EXIT_CODE 36 | fi -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | on: [push, pull_request] 2 | jobs: 3 | build: 4 | runs-on: ubuntu-latest 5 | name: Build Docker Image 6 | steps: 7 | - uses: actions/checkout@v2 8 | - name: Set up QEMU 9 | uses: docker/setup-qemu-action@v1 10 | - name: Set up Docker Buildx 11 | uses: docker/setup-buildx-action@v1 12 | - name: Build image 13 | id: docker_build 14 | uses: docker/build-push-action@v2 15 | with: 16 | push: false 17 | tags: goatg33k/fivem-lualint:dev 18 | - name: Image digest 19 | run: echo ${{ steps.docker_build.outputs.digest }} 20 | test: 21 | runs-on: ubuntu-latest 22 | name: Run Tests 23 | container: 24 | image: evandarwin/lua:latest 25 | steps: 26 | - uses: actions/checkout@v2 27 | - name: Run tests 28 | uses: docker://evandarwin/lua:latest 29 | with: 30 | args: | 31 | /bin/sh -c " \ 32 | apk add nodejs yarn && yarn && \ 33 | node -r ts-node/register ./generate-rc.ts && \ 34 | luarocks install luacheck && \ 35 | luacheck --config /github/workspace/.luacheckrc -t /github/workspace/tests" 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # fivem-lua-lint-action 2 | 3 | This GitHub Action runs `luacheck` on your Lua codebase against known FiveM natives for any GitHub repository! 4 | 5 | > Note: The FiveM Lua backtick syntax is **NOT** supported, please use `GetHashKey()` instead. 6 | 7 | --- 8 | 9 | ## Using 10 | 11 | To use this in your GitHub repository, create the following file: 12 | 13 | > **.github/workflows/lint.yml** 14 | 15 | ```yml 16 | name: CI 17 | on: [push, pull_request] 18 | jobs: 19 | lint: 20 | name: Lint Lua Scripts 21 | runs-on: ubuntu-latest 22 | steps: 23 | - name: Checkout 24 | uses: actions/checkout@v2 25 | - name: Lint 26 | uses: GoatG33k/fivem-lua-lint-action@v1 27 | ``` 28 | 29 | This will automatically run `luacheck` for both commits and pull requests! 30 | 31 | --- 32 | 33 | ## JUnit Reporting (Getting Fancy) 34 | 35 | If you would like to display fancy results in the GitHub action job, you can try the following configuration, 36 | which outputs a JUnit results file: 37 | 38 | ![Fancy JUnit Reporting in GitHub Actions Example](.github/docs/fancy_example.png) 39 | 40 | > **.github/workflows/lint.yml** 41 | 42 | ```yml 43 | name: CI 44 | on: [push, pull_request] 45 | jobs: 46 | lint: 47 | name: Lint Lua Scripts 48 | runs-on: ubuntu-latest 49 | steps: 50 | - name: Checkout 51 | uses: actions/checkout@v2 52 | - name: Lint 53 | uses: GoatG33k/fivem-lua-lint-action@v1 54 | with: 55 | capture: "junit.xml" 56 | args: "-t --formatter JUnit" 57 | - name: Publish Test Report 58 | uses: mikepenz/action-junit-report@v2 59 | with: 60 | report_paths: "**/junit.xml" 61 | fail_on_failure: 0 62 | ``` 63 | -------------------------------------------------------------------------------- /.luacheckrc.template: -------------------------------------------------------------------------------- 1 | stds.cfx = { 2 | read_globals = { 3 | Citizen = { 4 | fields = { 5 | "Wait", "CreateThread", "SetTimeout", "Await", "Trace", 6 | "InvokeNative" 7 | } 8 | }, 9 | exports = { other_fields = true }, 10 | GlobalState = { other_fields = true }, 11 | "Player", 12 | "Vehicle", 13 | "Wait", 14 | "CreateThread", 15 | "SetTimeout", 16 | "Await", 17 | "Trace", 18 | "quat", 19 | "vec", 20 | "vector2", "vec2", 21 | "vector3", "vec3", 22 | "vector4", "vec4", 23 | "AddEventHandler", 24 | "RegisterNetEvent", 25 | "TriggerEvent", 26 | "RemoveEventHandler", 27 | json = { fields = {"encode", "decode"} }, 28 | %%SHARED_GLOBALS%% 29 | } 30 | } 31 | 32 | stds.cfx_sv = { 33 | globals = {"GlobalState"}, 34 | read_globals = { 35 | "source", 36 | "TriggerClientEvent", 37 | "TriggerLatentClientEvent", 38 | "RegisterServerEvent", 39 | "GetPlayerIdentifiers", 40 | "GetPlayers", 41 | "PerformHttpRequest", 42 | "CreateVehicle", 43 | %%SERVER_GLOBALS%% 44 | } 45 | } 46 | 47 | stds.cfx_cl = { 48 | read_globals = { 49 | "TriggerServerEvent", 50 | "RegisterNUICallback", 51 | "SendNUIMessage", 52 | "GlobalState", 53 | %%CLIENT_GLOBALS%% 54 | } 55 | } 56 | 57 | stds.cfx_manifest = { 58 | read_globals = { 59 | "author", "description", "repository", "version", 60 | "rdr3_warning", "fx_version", 61 | "games", "game", "authors", "author", 62 | "server_scripts", "server_script", 63 | "client_scripts", "client_script", 64 | "shared_scripts", "shared_script", 65 | "ui_page", "files", "file", 66 | "export", "exports", "replace_level_meta", 67 | "data_file", "this_is_a_map", "server_only", 68 | "loadscreen", "dependency", "dependencies", 69 | "provide", "lua54", "disable_lazy_natives", 70 | "clr_disable_task_scheduler", "my_data", 71 | "ui_page_preload", "loadscreen_manual_shutdown", 72 | }, 73 | } 74 | 75 | stds.esx_legacy = { 76 | read_globals = { 77 | MySQL = { 78 | fields = { 79 | "ready", 80 | "insert", 81 | "update", 82 | "scalar", 83 | "single", 84 | "prepare", 85 | "query", 86 | } 87 | } 88 | } 89 | } 90 | 91 | -- manifest 92 | files["**/fxmanifest.lua"].std = "max+cfx_manifest" 93 | files["**/__resource.lua"].std = "max+cfx_manifest" 94 | files["**/fxmanifest.lua"].ignore = {'113', '611', '111', '614'} 95 | files["**/__resource.lua"].ignore = {'113', '611', '111', '614'} 96 | -- clients 97 | files["**/client.lua"].std = "max+cfx+cfx_cl%%EXTRA%%" 98 | files["**/cl_*.lua"].std = "max+cfx+cfx_cl%%EXTRA%%" 99 | files["**/client/**/*.lua"].std = "max+cfx+cfx_cl%%EXTRA%%" 100 | -- server 101 | files["**/server.lua"].std = "max+cfx+cfx_sv%%EXTRA%%" 102 | files["**/sv_*.lua"].std = "max+cfx+cfx_sv%%EXTRA%%" 103 | files["**/server/**/*.lua"].std = "max+cfx+cfx_sv%%EXTRA%%" 104 | -- shared 105 | files["**/shared.lua"].std="max+cfx+cfx_sv+cfx_cl%%EXTRA%%" 106 | files["**/shared/**/*.lua"].std="max+cfx+cfx_sv+cfx_cl%%EXTRA%%" 107 | -- default 108 | max_line_length = 140 109 | max_cyclomatic_complexity = 100 110 | color = true 111 | ignore = {'611', '111', '614'} 112 | std = "max+cfx+cfx_sv+cfx_cl%%EXTRA%%" -------------------------------------------------------------------------------- /generate-rc.ts: -------------------------------------------------------------------------------- 1 | import fetch from "node-fetch" 2 | import * as fs from "fs" 3 | import * as path from "path" 4 | import * as ansi from "ansi-colors" 5 | 6 | interface CfxNative { 7 | name: string 8 | params: { 9 | name: string 10 | type: string 11 | description: string 12 | }[] 13 | results: "int" | "void" | "long" | "BOOL" | string 14 | description: string 15 | examples: { 16 | lang: "lua" | string 17 | code: string 18 | }[] 19 | hash: string 20 | ns: string 21 | aliases?: string[] 22 | apiset: "client" | "server" | "shared" 23 | game: "gta5" | "rdr3" | "ny" 24 | } 25 | 26 | type CfxNativesResponse = { 27 | [group: string]: { [native: string]: CfxNative } 28 | } 29 | 30 | const macroCaseToSnake = (s: string): string => { 31 | return s 32 | .split("_") 33 | .map(str => 34 | str 35 | .split("") 36 | .map((c, i) => { 37 | if (+c > 0) return `_${c}` 38 | return i === 0 ? c.toUpperCase() : c.toLowerCase() 39 | }) 40 | .join("") 41 | ) 42 | .join("") 43 | } 44 | 45 | const uniqueArray = (a: T[]): T[] => { 46 | const b: T[] = [] 47 | a.forEach(item => { 48 | if (b.includes(item)) return 49 | b.push(item) 50 | }) 51 | return b 52 | } 53 | 54 | const reduceNativesToNames = (results: string[], item: CfxNative): string[] => { 55 | let name = item.name || `N_${item.hash}` 56 | name = macroCaseToSnake(name) 57 | results.push(name) 58 | ;(item.aliases || []).forEach(a => { 59 | if (a.slice(0, 1) === "_") { 60 | let aliasName = macroCaseToSnake(a.slice(1)) 61 | if (aliasName === "GetGroundZFor3dCoord") { 62 | aliasName = "GetGroundZFor_3dCoord" 63 | } 64 | results.push(aliasName) 65 | } 66 | }) 67 | return results 68 | } 69 | 70 | interface MappedNativeResponse { 71 | shared: string[] 72 | client: string[] 73 | server: string[] 74 | } 75 | 76 | async function fetchAllNatives(): Promise { 77 | const clientNatives: string[] = [] 78 | const serverNatives: string[] = [] 79 | const sharedNatives: string[] = [] 80 | const urls = [ 81 | "https://runtime.fivem.net/doc/natives_cfx.json", 82 | "https://runtime.fivem.net/doc/natives.json" 83 | ] 84 | 85 | for (const url of urls) { 86 | console.log(ansi.cyan(`fetch => ${ansi.blueBright(url)}...`)) 87 | await fetch(url) 88 | .then(r => r.json()) 89 | .then(data => { 90 | const nativesList: CfxNative[] = Object.entries(data) 91 | .reduce((natives: CfxNative[], [_, list]) => { 92 | natives.push(...Object.values(list)) 93 | return natives 94 | }, []) 95 | .filter(n => !!n.name) 96 | 97 | clientNatives.push( 98 | ...nativesList 99 | .filter(n => !n.apiset || n.apiset === "client") 100 | .reduce(reduceNativesToNames, []) 101 | ) 102 | serverNatives.push( 103 | ...nativesList 104 | .filter(n => n.apiset === "server") 105 | .reduce(reduceNativesToNames, []) 106 | ) 107 | sharedNatives.push( 108 | ...nativesList 109 | .filter(n => n.apiset === "shared") 110 | .reduce(reduceNativesToNames, []) 111 | ) 112 | }) 113 | } 114 | 115 | return { 116 | shared: uniqueArray(sharedNatives), 117 | client: uniqueArray(clientNatives), 118 | server: uniqueArray(serverNatives) 119 | } 120 | } 121 | 122 | fetchAllNatives().then(natives => { 123 | let template = fs.readFileSync( 124 | path.join(__dirname, ".luacheckrc.template"), 125 | "utf-8" 126 | ) 127 | template = template 128 | .replace("%%SHARED_GLOBALS%%", natives.shared.map(s => `'${s}'`).join(", ")) 129 | .replace("%%SERVER_GLOBALS%%", natives.server.map(s => `'${s}'`).join(", ")) 130 | .replace("%%CLIENT_GLOBALS%%", natives.client.map(s => `'${s}'`).join(", ")) 131 | 132 | let extraLibs = "" 133 | const extraLibUserArg = process.argv[3] 134 | if (extraLibUserArg?.length) { 135 | extraLibs = `+${extraLibUserArg}` 136 | } 137 | 138 | if (extraLibs.length) { 139 | console.log( 140 | ansi.gray( 141 | `${ansi.yellow(`extra`)} ${ansi.cyan(`=>`)} ${ansi.magentaBright( 142 | extraLibs 143 | )}` 144 | ) 145 | ) 146 | } 147 | 148 | template = template.replace(/%%EXTRA%%/g, extraLibs) 149 | 150 | fs.writeFileSync(path.join(__dirname, ".luacheckrc"), template) 151 | console.log(ansi.gray(`=`.repeat(29))) 152 | console.log( 153 | ansi.gray( 154 | `=== ${ansi.yellow( 155 | natives.shared.length.toString() 156 | )} ${ansi.magentaBright("shared")} generated`.padEnd(45, " ") + " ===" 157 | ) 158 | ) 159 | console.log( 160 | ansi.gray( 161 | `=== ${ansi.blue(natives.server.length.toString())} ${ansi.magentaBright( 162 | "server" 163 | )} generated`.padEnd(45, " ") + " ===" 164 | ) 165 | ) 166 | console.log( 167 | ansi.gray( 168 | `=== ${ansi.green(natives.client.length.toString())} ${ansi.magentaBright( 169 | "client" 170 | )} generated`.padEnd(45, " ") + " ===" 171 | ) 172 | ) 173 | console.log(ansi.gray(`========[ ${ansi.greenBright("COMPLETED")} ]========`)) 174 | }) 175 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | "@tsconfig/node10@^1.0.7": 6 | version "1.0.7" 7 | resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.7.tgz#1eb1de36c73478a2479cc661ef5af1c16d86d606" 8 | integrity sha512-aBvUmXLQbayM4w3A8TrjwrXs4DZ8iduJnuJLLRGdkWlyakCf1q6uHZJBzXoRA/huAEknG5tcUyQxN3A+In5euQ== 9 | 10 | "@tsconfig/node12@^1.0.7": 11 | version "1.0.7" 12 | resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.7.tgz#677bd9117e8164dc319987dd6ff5fc1ba6fbf18b" 13 | integrity sha512-dgasobK/Y0wVMswcipr3k0HpevxFJLijN03A8mYfEPvWvOs14v0ZlYTR4kIgMx8g4+fTyTFv8/jLCIfRqLDJ4A== 14 | 15 | "@tsconfig/node14@^1.0.0": 16 | version "1.0.0" 17 | resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.0.tgz#5bd046e508b1ee90bc091766758838741fdefd6e" 18 | integrity sha512-RKkL8eTdPv6t5EHgFKIVQgsDapugbuOptNd9OOunN/HAkzmmTnZELx1kNCK0rSdUYGmiFMM3rRQMAWiyp023LQ== 19 | 20 | "@tsconfig/node16@^1.0.1": 21 | version "1.0.1" 22 | resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.1.tgz#a6ca6a9a0ff366af433f42f5f0e124794ff6b8f1" 23 | integrity sha512-FTgBI767POY/lKNDNbIzgAX6miIDBs6NTCbdlDb8TrWovHsSvaVIZDlTqym29C6UqhzwcJx4CYr+AlrMywA0cA== 24 | 25 | "@types/node-fetch@^2.5.10": 26 | version "2.5.10" 27 | resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.10.tgz#9b4d4a0425562f9fcea70b12cb3fcdd946ca8132" 28 | integrity sha512-IpkX0AasN44hgEad0gEF/V6EgR5n69VEqPEgnmoM8GsIGro3PowbWs4tR6IhxUTyPLpOn+fiGG6nrQhcmoCuIQ== 29 | dependencies: 30 | "@types/node" "*" 31 | form-data "^3.0.0" 32 | 33 | "@types/node@*", "@types/node@^15.9.0": 34 | version "15.9.0" 35 | resolved "https://registry.yarnpkg.com/@types/node/-/node-15.9.0.tgz#0b7f6c33ca5618fe329a9d832b478b4964d325a8" 36 | integrity sha512-AR1Vq1Ei1GaA5FjKL5PBqblTZsL5M+monvGSZwe6sSIdGiuu7Xr/pNwWJY+0ZQuN8AapD/XMB5IzBAyYRFbocA== 37 | 38 | ansi-colors@^4.1.1: 39 | version "4.1.1" 40 | resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" 41 | integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== 42 | 43 | arg@^4.1.0: 44 | version "4.1.3" 45 | resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" 46 | integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== 47 | 48 | asynckit@^0.4.0: 49 | version "0.4.0" 50 | resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" 51 | integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= 52 | 53 | buffer-from@^1.0.0: 54 | version "1.1.1" 55 | resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" 56 | integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== 57 | 58 | combined-stream@^1.0.8: 59 | version "1.0.8" 60 | resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" 61 | integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== 62 | dependencies: 63 | delayed-stream "~1.0.0" 64 | 65 | create-require@^1.1.0: 66 | version "1.1.1" 67 | resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" 68 | integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== 69 | 70 | delayed-stream@~1.0.0: 71 | version "1.0.0" 72 | resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" 73 | integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= 74 | 75 | diff@^4.0.1: 76 | version "4.0.2" 77 | resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" 78 | integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== 79 | 80 | form-data@^3.0.0: 81 | version "3.0.1" 82 | resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" 83 | integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== 84 | dependencies: 85 | asynckit "^0.4.0" 86 | combined-stream "^1.0.8" 87 | mime-types "^2.1.12" 88 | 89 | make-error@^1.1.1: 90 | version "1.3.6" 91 | resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" 92 | integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== 93 | 94 | mime-db@1.48.0: 95 | version "1.48.0" 96 | resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.48.0.tgz#e35b31045dd7eada3aaad537ed88a33afbef2d1d" 97 | integrity sha512-FM3QwxV+TnZYQ2aRqhlKBMHxk10lTbMt3bBkMAp54ddrNeVSfcQYOOKuGuy3Ddrm38I04If834fOUSq1yzslJQ== 98 | 99 | mime-types@^2.1.12: 100 | version "2.1.31" 101 | resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.31.tgz#a00d76b74317c61f9c2db2218b8e9f8e9c5c9e6b" 102 | integrity sha512-XGZnNzm3QvgKxa8dpzyhFTHmpP3l5YNusmne07VUOXxou9CqUqYa/HBy124RqtVh/O2pECas/MOcsDgpilPOPg== 103 | dependencies: 104 | mime-db "1.48.0" 105 | 106 | node-fetch@^2.6.1: 107 | version "2.6.1" 108 | resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" 109 | integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== 110 | 111 | prettier@^2.3.0: 112 | version "2.3.0" 113 | resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.0.tgz#b6a5bf1284026ae640f17f7ff5658a7567fc0d18" 114 | integrity sha512-kXtO4s0Lz/DW/IJ9QdWhAf7/NmPWQXkFr/r/WkR3vyI+0v8amTDxiaQSLzs8NBlytfLWX/7uQUMIW677yLKl4w== 115 | 116 | source-map-support@^0.5.17: 117 | version "0.5.19" 118 | resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" 119 | integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw== 120 | dependencies: 121 | buffer-from "^1.0.0" 122 | source-map "^0.6.0" 123 | 124 | source-map@^0.6.0: 125 | version "0.6.1" 126 | resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" 127 | integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== 128 | 129 | ts-node@^10.0.0: 130 | version "10.0.0" 131 | resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.0.0.tgz#05f10b9a716b0b624129ad44f0ea05dac84ba3be" 132 | integrity sha512-ROWeOIUvfFbPZkoDis0L/55Fk+6gFQNZwwKPLinacRl6tsxstTF1DbAcLKkovwnpKMVvOMHP1TIbnwXwtLg1gg== 133 | dependencies: 134 | "@tsconfig/node10" "^1.0.7" 135 | "@tsconfig/node12" "^1.0.7" 136 | "@tsconfig/node14" "^1.0.0" 137 | "@tsconfig/node16" "^1.0.1" 138 | arg "^4.1.0" 139 | create-require "^1.1.0" 140 | diff "^4.0.1" 141 | make-error "^1.1.1" 142 | source-map-support "^0.5.17" 143 | yn "3.1.1" 144 | 145 | typescript@^4.3.2: 146 | version "4.3.2" 147 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.2.tgz#399ab18aac45802d6f2498de5054fcbbe716a805" 148 | integrity sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw== 149 | 150 | yn@3.1.1: 151 | version "3.1.1" 152 | resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" 153 | integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== 154 | --------------------------------------------------------------------------------