nanos-lint 2.6.1 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -9
- package/action.yml +15 -6
- package/dist/{cli-5LLXRlN7.js → cli-DGez8MSI.js} +1056 -270
- package/dist/cli-DGez8MSI.js.map +1 -0
- package/dist/cli-r8LDolDk.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +172 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/templates/.luarc.json +15 -21
- package/dist/cli-5LLXRlN7.js.map +0 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/nanos-lint)
|
|
5
5
|
[](https://nodejs.org/)
|
|
6
6
|
[](https://www.lua.org/manual/5.4/)
|
|
7
|
-
[](https://github.com/LuaLS/lua-language-server)
|
|
8
8
|
[](LICENSE)
|
|
9
9
|
|
|
10
10
|
A dedicated, fast linter and type-checker for **[nanos world](https://nanos-world.com/)** Lua scripts powered by the **[Lua Language Server (LuaLS)](https://github.com/LuaLS/lua-language-server)**.
|
|
@@ -17,7 +17,7 @@ A dedicated, fast linter and type-checker for **[nanos world](https://nanos-worl
|
|
|
17
17
|
- **Zero-Install Local CLI**: Run directly via `npx nanos-lint [path]` without installing anything.
|
|
18
18
|
- **Native GitHub Action**: Use `vugi99/nanos-lint` directly in CI workflows with inline GitHub PR annotations.
|
|
19
19
|
- **Workspace Config Merging**: Fully respects local `.luarc.json` files, merging your project globals and disabled diagnostics on top of the nanos API.
|
|
20
|
-
- **Cross-Platform**: Works on **Windows x64** and **
|
|
20
|
+
- **Cross-Platform**: Works on **Windows x64**, **Linux (x64, arm64)**, and **macOS (Apple Silicon arm64, Intel x64)**. Automatically downloads and caches platform LuaLS binaries, defaulting to the latest LuaLS release and falling back to 3.19.1 when offline.
|
|
21
21
|
- **Modern Node.js Runtime**: Built targeting Node.js (>= 24) with zero runtime dependencies.
|
|
22
22
|
|
|
23
23
|
---
|
|
@@ -60,6 +60,13 @@ npx nanos-lint init
|
|
|
60
60
|
```
|
|
61
61
|
This generates a `.luarc.json` file in your workspace pointing to the nanos world definitions and schemas.
|
|
62
62
|
|
|
63
|
+
### 4. Pre-warm Cache for Offline / Docker Environments
|
|
64
|
+
|
|
65
|
+
To pre-populate all required assets (both LuaLS binary and nanos world annotations) for air-gapped CI or container builds:
|
|
66
|
+
```bash
|
|
67
|
+
npx nanos-lint warmup
|
|
68
|
+
```
|
|
69
|
+
|
|
63
70
|
---
|
|
64
71
|
|
|
65
72
|
## GitHub Actions Integration
|
|
@@ -103,6 +110,8 @@ jobs:
|
|
|
103
110
|
| `quiet` | Suppress progress messages | `false` |
|
|
104
111
|
| `cache` | Whether to cache the LuaLS binary and annotations across workflow runs | `true` |
|
|
105
112
|
|
|
113
|
+
When caching is enabled, the cache key rolls over each ISO week, so a freshly downloaded LuaLS binary is actually persisted under the new week's key; in the meantime the previous week's entry is restored from the cache.
|
|
114
|
+
|
|
106
115
|
When running inside GitHub Actions, `nanos-lint` automatically outputs **workflow annotations** (`::error` / `::warning`) that appear inline on PR diffs.
|
|
107
116
|
|
|
108
117
|
---
|
|
@@ -114,22 +123,30 @@ nanos-lint [command] [options] [path]
|
|
|
114
123
|
|
|
115
124
|
COMMANDS:
|
|
116
125
|
check [path] Check a workspace or Lua file (default)
|
|
117
|
-
init [path] Scaffold a .luarc.json configuration in the workspace (copies definitions to .nanos-lint
|
|
118
|
-
download-
|
|
126
|
+
init [path] Scaffold a .luarc.json configuration in the workspace (copies definitions to .nanos-lint/; supports --annotations <path>)
|
|
127
|
+
warmup, download Pre-fetch and cache both LuaLS binary and annotations for offline execution
|
|
128
|
+
cache status, cache info Show cache status, installed versions, and disk usage (supports --json)
|
|
129
|
+
cache clean Clear the nanos-lint cache directory
|
|
130
|
+
cache-status Alias for cache status
|
|
131
|
+
download-luals [version] Download and cache the LuaLS binary (the version can also be passed via --luals-version <ver>)
|
|
119
132
|
clean-cache, clean Clear the nanos-lint cache directory
|
|
120
133
|
help, --help, -h Show help message
|
|
121
134
|
version, --version, -v Show version information
|
|
122
135
|
|
|
123
136
|
OPTIONS:
|
|
124
137
|
-i, --ignore <pattern> Files or directories to ignore (supports globs, repeatable, comma/newline-separated)
|
|
138
|
+
-l, --log-level <level> Logging level: error, warn, info, debug, silent (default: warn)
|
|
139
|
+
silent suppresses all output, including the final report (only the exit code remains)
|
|
140
|
+
error and warn (the default) suppress progress messages but still print the report
|
|
141
|
+
debug adds diagnostic tracing
|
|
125
142
|
--checklevel=<level> Minimum diagnostic level: Error, Warning, Information, Hint (default: Warning)
|
|
126
143
|
--config=<path> Path to custom .luarc.json configuration file
|
|
127
|
-
--annotations=<path> Path to custom annotations.lua file
|
|
144
|
+
--annotations=<path> Path to custom annotations.lua file (applies to both check and init)
|
|
128
145
|
--format=<format> Output format: pretty, json, github (default: pretty)
|
|
129
146
|
--github Output in GitHub Actions format (shortcut for --format=github)
|
|
130
|
-
--luals-version=<ver> Version of LuaLS to use (default: latest)
|
|
147
|
+
--luals-version=<ver> Version of LuaLS to use (default: latest, falling back to 3.19.1 when offline)
|
|
131
148
|
--no-fail Do not exit with code 1 if diagnostics are found
|
|
132
|
-
--quiet Suppress progress output
|
|
149
|
+
--quiet Suppress progress output only (equivalent to --log-level=error; the report is still printed)
|
|
133
150
|
-f, --force (init command only) Overwrite existing .luarc.json
|
|
134
151
|
```
|
|
135
152
|
|
|
@@ -139,10 +156,15 @@ OPTIONS:
|
|
|
139
156
|
| :--- | :--- |
|
|
140
157
|
| `LUALS_BIN` | Explicit path to a pre-installed `lua-language-server` binary |
|
|
141
158
|
| `NANOS_ANNOTATIONS_PATH`, `NANOS_ANNOTATIONS` | Explicit path to a custom `annotations.lua` file |
|
|
159
|
+
| `NANOS_LOG_LEVEL` | Default logging level: `error`, `warn`, `info`, `debug`, `silent` (default: `warn`) |
|
|
142
160
|
| `GITHUB_TOKEN` | GitHub personal access token used for authenticated GitHub API requests (avoids unauthenticated rate limits) |
|
|
143
161
|
| `NO_COLOR` | Disables ANSI color output when set to any non-empty value |
|
|
144
162
|
| `FORCE_COLOR` | Forces ANSI color output even in non-TTY environments |
|
|
145
163
|
|
|
164
|
+
Only `NANOS_LOG_LEVEL` controls the logging level; a generic `LOG_LEVEL` environment variable is intentionally not read, because CI images commonly set it.
|
|
165
|
+
|
|
166
|
+
`NANOS_LIVE_TESTS` and `NANOS_TEST_CACHE_ROOT` only affect this repository's test suite and are documented under [Test Suite Environment Variables](#test-suite-environment-variables).
|
|
167
|
+
|
|
146
168
|
---
|
|
147
169
|
|
|
148
170
|
## Workspace Configuration (`.luarc.json`)
|
|
@@ -151,7 +173,7 @@ If your project already has a `.luarc.json`, `nanos-lint` automatically merges i
|
|
|
151
173
|
|
|
152
174
|
```json
|
|
153
175
|
{
|
|
154
|
-
"$schema": "https://raw.githubusercontent.com/LuaLS/lua
|
|
176
|
+
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
|
|
155
177
|
"diagnostics": {
|
|
156
178
|
"disable": [
|
|
157
179
|
"lowercase-global"
|
|
@@ -178,8 +200,11 @@ Pre-packaged release bundles containing the platform's `lua-language-server` bin
|
|
|
178
200
|
|
|
179
201
|
- `nanos-lint-<version>-windows-x64.zip`
|
|
180
202
|
- `nanos-lint-<version>-linux-x64.tar.gz`
|
|
203
|
+
- `nanos-lint-<version>-linux-arm64.tar.gz`
|
|
204
|
+
- `nanos-lint-<version>-macos-arm64.tar.gz` (Apple Silicon)
|
|
205
|
+
- `nanos-lint-<version>-macos-x64.tar.gz` (Intel)
|
|
181
206
|
|
|
182
|
-
These bundles are fully self-contained and ready for offline CI/CD environments with Node.js installed, eliminating the need to download LuaLS or annotations at runtime. Simply extract the archive and run `./nanos-lint` (Linux) or `nanos-lint.cmd` (Windows).
|
|
207
|
+
These bundles are fully self-contained and ready for offline CI/CD environments with Node.js installed, eliminating the need to download LuaLS or annotations at runtime. Simply extract the archive and run `./nanos-lint` (Linux & macOS) or `nanos-lint.cmd` (Windows).
|
|
183
208
|
|
|
184
209
|
---
|
|
185
210
|
|
|
@@ -204,6 +229,23 @@ npm run build
|
|
|
204
229
|
|
|
205
230
|
# Run Vitest test suite with coverage (unit + live LuaLS integration tests)
|
|
206
231
|
npm run test:coverage
|
|
232
|
+
|
|
233
|
+
# Offline: skip live LuaLS tests, perform no network access, disable coverage thresholds
|
|
234
|
+
NANOS_LIVE_TESTS=0 npm run test:coverage
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Test Suite Environment Variables
|
|
238
|
+
|
|
239
|
+
`tests/global-setup.ts` downloads the LuaLS binary and annotations **once per run** into an isolated temporary cache, so the real `~/.cache/nanos-lint` is never touched; the run fails if anything downloads LuaLS a second time.
|
|
240
|
+
|
|
241
|
+
| Variable | Description |
|
|
242
|
+
| :--- | :--- |
|
|
243
|
+
| `NANOS_LIVE_TESTS` | `0` (or `false`/`no`/`off`) skips the live LuaLS/annotations tests, performs no network access, and does not enforce the coverage thresholds. Any other value or unset requires the shared fixtures; if they cannot be resolved the run fails. |
|
|
244
|
+
| `NANOS_TEST_CACHE_ROOT` | Reuses the given directory as the isolated test cache instead of a fresh one, avoiding a re-download on repeat runs. |
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
NANOS_LIVE_TESTS=0 npm run test:coverage # fully offline
|
|
248
|
+
NANOS_TEST_CACHE_ROOT=/tmp/nanos-tests npm run test:coverage # reuse a warm cache
|
|
207
249
|
```
|
|
208
250
|
|
|
209
251
|
See [AGENTS.md](AGENTS.md) for development philosophy and quality gate requirements.
|
package/action.yml
CHANGED
|
@@ -51,6 +51,13 @@ runs:
|
|
|
51
51
|
with:
|
|
52
52
|
node-version: '24'
|
|
53
53
|
|
|
54
|
+
# The ISO week refreshes the cache entry (a static key would never be saved
|
|
55
|
+
# again); restore-keys fall back to previous weeks. Cheap: one `date` call.
|
|
56
|
+
- name: Compute cache week
|
|
57
|
+
id: cacheweek
|
|
58
|
+
shell: bash
|
|
59
|
+
run: echo "week=$(date -u +%G-W%V)" >> "$GITHUB_OUTPUT"
|
|
60
|
+
|
|
54
61
|
- name: Cache LuaLS binary and annotations
|
|
55
62
|
if: ${{ inputs.cache != 'false' }}
|
|
56
63
|
uses: actions/cache@v6
|
|
@@ -59,10 +66,10 @@ runs:
|
|
|
59
66
|
~/.cache/nanos-lint
|
|
60
67
|
~/AppData/Local/nanos-lint
|
|
61
68
|
~/Library/Caches/nanos-lint
|
|
62
|
-
key: nanos-lint-${{ runner.os }}-${{ inputs.luals-version }}
|
|
69
|
+
key: nanos-lint-${{ runner.os }}-${{ runner.arch }}-${{ inputs.luals-version }}-${{ steps.cacheweek.outputs.week }}
|
|
63
70
|
restore-keys: |
|
|
64
|
-
nanos-lint-${{ runner.os }}-${{ inputs.luals-version }}-
|
|
65
|
-
nanos-lint-${{ runner.os }}-
|
|
71
|
+
nanos-lint-${{ runner.os }}-${{ runner.arch }}-${{ inputs.luals-version }}-
|
|
72
|
+
nanos-lint-${{ runner.os }}-${{ runner.arch }}-
|
|
66
73
|
|
|
67
74
|
- name: Run nanos-lint
|
|
68
75
|
shell: bash
|
|
@@ -104,10 +111,12 @@ runs:
|
|
|
104
111
|
ARGS+=("--quiet")
|
|
105
112
|
fi
|
|
106
113
|
|
|
114
|
+
# dist/ is gitignored, so `uses: vugi99/nanos-lint@<ref>` consumers always
|
|
115
|
+
# take the npx branch; the first one is for local `uses: ./` checkouts.
|
|
107
116
|
if [ -f "$ACTION_PATH/dist/cli.js" ]; then
|
|
108
117
|
node "$ACTION_PATH/dist/cli.js" "${ARGS[@]}"
|
|
109
118
|
else
|
|
110
|
-
|
|
119
|
+
# Exact version: a range could run a different release than the pinned
|
|
120
|
+
# tag. Bump together with "version" in package.json.
|
|
121
|
+
npx --yes nanos-lint@2.8.0 "${ARGS[@]}"
|
|
111
122
|
fi
|
|
112
|
-
|
|
113
|
-
|