texlite 0.7.8 → 0.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/DESIGN.md +460 -0
- package/NPM_TESTING.md +130 -0
- package/OPERATIONS.md +246 -0
- package/README.md +78 -306
- package/README.zh-CN.md +61 -330
- package/dist/client/assets/{GitDialog-CqGyUxfP.js → GitDialog-DdLrbz_H.js} +1 -1
- package/dist/client/assets/{HistoryDialog-BMl2zxBa.js → HistoryDialog-AlF9iozX.js} +1 -1
- package/dist/client/assets/{LatexEditor-C4bFVwJZ.js → LatexEditor-DH9v1wgS.js} +1 -1
- package/dist/client/assets/{PdfPreview-BpP2LnX7.js → PdfPreview-CanYnyfJ.js} +1 -1
- package/dist/client/assets/{ProjectNavigationDialogs-B7mxG8Fz.js → ProjectNavigationDialogs-DiXtkTj1.js} +1 -1
- package/dist/client/assets/{SystemMetricsDialog-BK_K3ah8.js → SystemMetricsDialog-DimBI7er.js} +1 -1
- package/dist/client/assets/index-CdiutUgf.css +1 -0
- package/dist/client/assets/index-vpWlpUOr.js +64 -0
- package/dist/client/assets/{minus-BwzSZenU.js → minus-DR-ttrx3.js} +1 -1
- package/dist/client/assets/spellCheck-Wn7_eF9j.js +1 -0
- package/dist/client/index.html +2 -2
- package/dist/server/app.js +3 -3
- package/dist/server/harper.js +210 -119
- package/dist/server/latexSpellMask.js +257 -0
- package/dist/server/projects.js +0 -12
- package/dist/server/routes/projectShared.js +1 -1
- package/dist/server/routes/projects.js +20 -19
- package/package.json +4 -2
- package/dist/client/assets/index-B9n8hfV0.js +0 -64
- package/dist/client/assets/index-BhyTKMoO.css +0 -1
- package/dist/client/assets/spellCheck-CvOAlLWp.js +0 -4
package/OPERATIONS.md
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# Operating TexLite
|
|
2
|
+
|
|
3
|
+
This guide covers installation, configuration, service operation, and backups.
|
|
4
|
+
For the product's intended use and editor comparison, start with the
|
|
5
|
+
[README](README.md). For implementation details and trade-offs, see
|
|
6
|
+
[DESIGN.md](DESIGN.md).
|
|
7
|
+
|
|
8
|
+
## Requirements
|
|
9
|
+
|
|
10
|
+
- Node.js 24 or newer and npm
|
|
11
|
+
- `latexmk`
|
|
12
|
+
- At least one configured engine: `pdflatex`, `xelatex`, or `lualatex`
|
|
13
|
+
- `git` only when a project owner uses the optional Git/GitHub integration
|
|
14
|
+
|
|
15
|
+
Check a host before initialization:
|
|
16
|
+
|
|
17
|
+
~~~bash
|
|
18
|
+
node --version
|
|
19
|
+
npm --version
|
|
20
|
+
latexmk --version
|
|
21
|
+
xelatex --version
|
|
22
|
+
# Optional, for Git/GitHub integration:
|
|
23
|
+
git --version
|
|
24
|
+
~~~
|
|
25
|
+
|
|
26
|
+
`texlite init`, `texlite start`, and `texlite doctor` validate `latexmk` and
|
|
27
|
+
every engine named in `latex.allowedEngines`. Git is intentionally excluded
|
|
28
|
+
from the core check, so a host without Git can run TexLite normally; use
|
|
29
|
+
`texlite doctor --git` to check it explicitly.
|
|
30
|
+
|
|
31
|
+
Formatting does not require a host binary. The browser uses bundled `tex-fmt`
|
|
32
|
+
WASM for `.tex`, `.cls`, and `.sty`, and browser-side `bibtex-tidy` for `.bib`.
|
|
33
|
+
|
|
34
|
+
### Optional writing checks
|
|
35
|
+
|
|
36
|
+
TexLite does not bundle Harper. To enable its spelling and grammar diagnostics,
|
|
37
|
+
install a Harper distribution that provides `harper-cli` (the same host package
|
|
38
|
+
normally also provides `harper-ls`) and make it available on the TexLite service
|
|
39
|
+
`PATH`:
|
|
40
|
+
|
|
41
|
+
~~~bash
|
|
42
|
+
harper-cli --version
|
|
43
|
+
~~~
|
|
44
|
+
|
|
45
|
+
The command is optional: if it is absent or temporarily fails, TexLite remains
|
|
46
|
+
usable and the browser's native English spellchecker is enabled instead. Native
|
|
47
|
+
browser spellchecking does not provide Harper grammar diagnostics or suggested
|
|
48
|
+
replacements.
|
|
49
|
+
|
|
50
|
+
## Install and initialize
|
|
51
|
+
|
|
52
|
+
### Global npm installation
|
|
53
|
+
|
|
54
|
+
The published package provides the `texlite` executable. Configuration and
|
|
55
|
+
project data are outside the global npm installation:
|
|
56
|
+
|
|
57
|
+
~~~bash
|
|
58
|
+
npm install --global texlite
|
|
59
|
+
texlite init
|
|
60
|
+
texlite start
|
|
61
|
+
texlite status
|
|
62
|
+
~~~
|
|
63
|
+
|
|
64
|
+
Open <http://127.0.0.1:3000>. `init` creates the configuration if absent,
|
|
65
|
+
validates the environment, initializes storage, and creates the first
|
|
66
|
+
administrator. The server will not start without an active administrator.
|
|
67
|
+
|
|
68
|
+
The normal lifecycle commands can be run from any directory:
|
|
69
|
+
|
|
70
|
+
~~~bash
|
|
71
|
+
texlite stop
|
|
72
|
+
texlite restart
|
|
73
|
+
texlite logs
|
|
74
|
+
~~~
|
|
75
|
+
|
|
76
|
+
For a clean upgrade, restart after npm has installed the new version:
|
|
77
|
+
|
|
78
|
+
~~~bash
|
|
79
|
+
npm update --global texlite
|
|
80
|
+
texlite restart
|
|
81
|
+
~~~
|
|
82
|
+
|
|
83
|
+
Uninstalling the package does not remove configuration or data:
|
|
84
|
+
|
|
85
|
+
~~~bash
|
|
86
|
+
npm uninstall --global texlite
|
|
87
|
+
~~~
|
|
88
|
+
|
|
89
|
+
### Source installation
|
|
90
|
+
|
|
91
|
+
~~~bash
|
|
92
|
+
npm ci
|
|
93
|
+
cp texlite.config.example.json texlite.config.json
|
|
94
|
+
export TEXLITE_CONFIG="$PWD/texlite.config.json"
|
|
95
|
+
# Edit texlite.config.json if needed.
|
|
96
|
+
npm run init
|
|
97
|
+
npm run build
|
|
98
|
+
npm start
|
|
99
|
+
~~~
|
|
100
|
+
|
|
101
|
+
For non-interactive initialization, supply these environment variables only to
|
|
102
|
+
the initialization command:
|
|
103
|
+
|
|
104
|
+
~~~bash
|
|
105
|
+
TEXLITE_INIT_USERNAME=admin \
|
|
106
|
+
TEXLITE_INIT_DISPLAY_NAME=Administrator \
|
|
107
|
+
TEXLITE_INIT_PASSWORD='use-a-password-of-at-least-8-characters' \
|
|
108
|
+
npm run init
|
|
109
|
+
~~~
|
|
110
|
+
|
|
111
|
+
Avoid putting a password into shell history on a shared host.
|
|
112
|
+
|
|
113
|
+
## Command reference
|
|
114
|
+
|
|
115
|
+
| Command | Purpose |
|
|
116
|
+
| --- | --- |
|
|
117
|
+
| `texlite init` | Create configuration and the initial administrator. |
|
|
118
|
+
| `texlite serve` | Run in the foreground; suitable for debugging, Docker, or systemd. |
|
|
119
|
+
| `texlite start` / `stop` / `restart` | Manage the bundled-PM2 service. |
|
|
120
|
+
| `texlite status` | Show a colored, systemctl-style status view; add `--json` for scripts. |
|
|
121
|
+
| `texlite logs` | Stream PM2-managed logs. |
|
|
122
|
+
| `texlite doctor` | Validate configuration, paths, LaTeX, and administrator state; add `--git` for optional Git. |
|
|
123
|
+
| `texlite config` | Print effective configuration and paths without changing them. |
|
|
124
|
+
|
|
125
|
+
`start`, `stop`, `restart`, `status`, and `logs` use the PM2 runtime bundled
|
|
126
|
+
with the global npm package—no separate global PM2 install is necessary.
|
|
127
|
+
Managed startup waits for the HTTP health endpoint, and `restart` recreates the
|
|
128
|
+
managed process so it uses paths from the newly installed npm version.
|
|
129
|
+
|
|
130
|
+
For a source checkout, `ecosystem.config.cjs` and the `npm run pm2:*` scripts
|
|
131
|
+
remain available. Run exactly one forked instance: cluster mode and multiple
|
|
132
|
+
TexLite processes sharing one data directory are unsupported because
|
|
133
|
+
collaboration state, the compile queue, SQLite, and project files are local to
|
|
134
|
+
one process.
|
|
135
|
+
|
|
136
|
+
## Configuration
|
|
137
|
+
|
|
138
|
+
### Where configuration and data live
|
|
139
|
+
|
|
140
|
+
Configuration path precedence:
|
|
141
|
+
|
|
142
|
+
1. `--config PATH` passed to `texlite`;
|
|
143
|
+
2. `TEXLITE_CONFIG`;
|
|
144
|
+
3. `$XDG_CONFIG_HOME/texlite/texlite.config.json`;
|
|
145
|
+
4. `~/.config/texlite/texlite.config.json`.
|
|
146
|
+
|
|
147
|
+
Relative paths are resolved from the configuration file. The default data
|
|
148
|
+
directory is `$XDG_DATA_HOME/texlite`, or `~/.local/share/texlite` when
|
|
149
|
+
`XDG_DATA_HOME` is unset. Set `storage.dataDir` or `TEXLITE_DATA_DIR` to move
|
|
150
|
+
it. The data directory contains the SQLite database, project sources, compiled
|
|
151
|
+
output, history objects, and Git-token encryption key.
|
|
152
|
+
|
|
153
|
+
Use [texlite.config.example.json](texlite.config.example.json) as a complete
|
|
154
|
+
starting point. It intentionally uses `.texlite` for repository development;
|
|
155
|
+
`texlite init` instead writes the XDG data-directory default.
|
|
156
|
+
|
|
157
|
+
### Important settings and effective defaults
|
|
158
|
+
|
|
159
|
+
| Setting | Default | Notes |
|
|
160
|
+
| --- | --- | --- |
|
|
161
|
+
| `siteName` | `TexLite` | Site title. |
|
|
162
|
+
| `adminEmail` | empty | Optional administrator contact address. |
|
|
163
|
+
| `server.host` / `server.port` | `127.0.0.1` / `3000` | Keep localhost unless the deployment is separately secured. |
|
|
164
|
+
| `storage.dataDir` | XDG data directory | Stores all persistent project data. |
|
|
165
|
+
| `clientDir` | Installed package's `dist/client` | Normally changed only for development or a custom deployment. |
|
|
166
|
+
| `sessionDays` | `14` | Login-session lifetime. |
|
|
167
|
+
| `uploads.maxFileSizeMB` | `50` MB | Limit for uploads, ZIP entries, and attachments. |
|
|
168
|
+
| `pdf.loadingStrategy` / `pdf.rangeThresholdMB` | `auto` / `5` MB | Chooses full transfer for small PDFs and byte ranges for larger ones. |
|
|
169
|
+
| `history.maxVersions` / `history.maxStorageMB` | `200` / `128` MB | Per-project ordinary-version count and soft storage limit. |
|
|
170
|
+
| `latex.latexmk` | `latexmk` | Host command. |
|
|
171
|
+
| `latex.defaultEngine` | `xelatex` | Must appear in the allowed list. |
|
|
172
|
+
| `latex.allowedEngines` | `pdflatex`, `xelatex`, `lualatex` | Engines available in the UI. |
|
|
173
|
+
| `latex.extraArgs` | `[]` | Additional configured compiler arguments. |
|
|
174
|
+
| `latex.compileTimeoutSeconds` | `600` | Per-job time limit. |
|
|
175
|
+
| `latex.maxCompileJobs` | `10` | Global concurrent LaTeX-process limit. |
|
|
176
|
+
| `latex.allowProjectLatexmkrc` | `true` | Enables an owner-configured, multi-line `latexmkrc`. |
|
|
177
|
+
| `git.binary` / `git.operationTimeoutSeconds` | `git` / `120` seconds | Used only by optional Git integration. |
|
|
178
|
+
| `git.githubApiBaseUrl` | `https://api.github.com` | GitHub REST API endpoint. |
|
|
179
|
+
|
|
180
|
+
The current environment-variable overrides are:
|
|
181
|
+
|
|
182
|
+
~~~text
|
|
183
|
+
TEXLITE_CONFIG
|
|
184
|
+
XDG_CONFIG_HOME XDG_DATA_HOME
|
|
185
|
+
TEXLITE_SITE_NAME TEXLITE_ADMIN_EMAIL
|
|
186
|
+
TEXLITE_HOST TEXLITE_PORT
|
|
187
|
+
TEXLITE_DATA_DIR TEXLITE_CLIENT_DIR
|
|
188
|
+
TEXLITE_SESSION_DAYS TEXLITE_MAX_UPLOAD_SIZE_MB
|
|
189
|
+
TEXLITE_PDF_LOADING_STRATEGY TEXLITE_PDF_RANGE_THRESHOLD_MB
|
|
190
|
+
TEXLITE_HISTORY_MAX_VERSIONS TEXLITE_HISTORY_MAX_STORAGE_MB
|
|
191
|
+
TEXLITE_LATEXMK TEXLITE_DEFAULT_ENGINE
|
|
192
|
+
TEXLITE_COMPILE_TIMEOUT TEXLITE_MAX_COMPILE_JOBS
|
|
193
|
+
TEXLITE_GIT TEXLITE_GIT_TIMEOUT
|
|
194
|
+
TEXLITE_GITHUB_API_URL
|
|
195
|
+
~~~
|
|
196
|
+
|
|
197
|
+
Configuration is validated before TexLite opens the database or binds the HTTP
|
|
198
|
+
listener. Invalid JSON types, paths, limits, URLs, engine lists, timeout/queue
|
|
199
|
+
values, and cross-field combinations stop startup with a setting-specific,
|
|
200
|
+
actionable error. Explicit invalid values are never silently replaced with a
|
|
201
|
+
default. `texlite init` applies the same validation.
|
|
202
|
+
|
|
203
|
+
Accepted limits are: port `1–65535`, sessions `1–3650` days, upload size
|
|
204
|
+
`1–2048` MB, history count `10–5000`, history size `16–102400` MB, PDF range
|
|
205
|
+
threshold `1–2048` MB, compile timeout `1–3600` seconds, compile jobs `1–32`,
|
|
206
|
+
and Git timeout `1–3600` seconds.
|
|
207
|
+
|
|
208
|
+
Before every compile TexLite passes `-norc` to `latexmk`. A `.latexmkrc` found
|
|
209
|
+
in a ZIP upload, Git checkout, or project file tree is ignored. It is used only
|
|
210
|
+
when the owner explicitly saves it through Project Settings, which passes it
|
|
211
|
+
with `-r`. An `latexmkrc` is executable Perl configuration and should remain
|
|
212
|
+
disabled for users you do not trust.
|
|
213
|
+
|
|
214
|
+
TexLite never runs `tlmgr` or installs TeX packages. Updating the host TeX
|
|
215
|
+
distribution changes the environment used by subsequent compiles.
|
|
216
|
+
|
|
217
|
+
## Development and verification
|
|
218
|
+
|
|
219
|
+
Run the API/server watcher and Vite in separate terminals:
|
|
220
|
+
|
|
221
|
+
~~~bash
|
|
222
|
+
npm run dev # API/server: http://127.0.0.1:3000
|
|
223
|
+
npm run dev:web # Vite UI: http://127.0.0.1:5173
|
|
224
|
+
~~~
|
|
225
|
+
|
|
226
|
+
Vite proxies `/api` requests to the server. Validate a production-style build
|
|
227
|
+
with:
|
|
228
|
+
|
|
229
|
+
~~~bash
|
|
230
|
+
npm run typecheck
|
|
231
|
+
npm test
|
|
232
|
+
npm run build
|
|
233
|
+
npm start
|
|
234
|
+
~~~
|
|
235
|
+
|
|
236
|
+
## Backup and security
|
|
237
|
+
|
|
238
|
+
Back up the entire configured data directory, including `texlite.db`, its WAL
|
|
239
|
+
files, `git-token.key`, and `projects/`. Restoring saved GitHub tokens requires
|
|
240
|
+
the same encryption key. For an online copy of SQLite, include WAL files or use
|
|
241
|
+
a SQLite-aware backup method.
|
|
242
|
+
|
|
243
|
+
TexLite is designed for trusted users on localhost. Shell escape is disabled by
|
|
244
|
+
default and compile jobs have timeouts and concurrency limits, but LaTeX itself
|
|
245
|
+
is not a security boundary. Before exposing it to an untrusted network, add an
|
|
246
|
+
isolated compiler sandbox plus appropriate authentication and network controls.
|
package/README.md
CHANGED
|
@@ -1,49 +1,68 @@
|
|
|
1
|
-
#
|
|
1
|
+
# TexLite
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
**Documentation:** English (this file) · [Design](DESIGN.md) · [简体中文](README.zh-CN.md)
|
|
6
|
-
|
|
7
|
-
**Website:** [TexLite GitHub Pages](https://swufe-db-group.github.io/TexLite/)
|
|
3
|
+
A lightweight self-hosted alternative to Overleaf for *small, trusted* research
|
|
4
|
+
teams. Use your existing LaTeX distribution, with no heavyweight service stack.
|
|
8
5
|
|
|
9
6
|
[](https://github.com/SWUFE-DB-Group/TexLite/actions/workflows/ci.yml)
|
|
10
7
|
[](https://www.npmjs.com/package/texlite)
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
For design goals, architecture, collaboration and compilation behavior, history,
|
|
15
|
-
navigation and diagnostics, GitHub backup, and data-management decisions, see
|
|
16
|
-
[DESIGN.md](DESIGN.md).
|
|
17
|
-
|
|
18
|
-
## Requirements
|
|
19
|
-
|
|
20
|
-
- Node.js 24 or newer
|
|
21
|
-
- npm
|
|
22
|
-
- git (optional; required only for the project-owner Git/GitHub integration)
|
|
23
|
-
- latexmk
|
|
24
|
-
- At least one configured engine: pdflatex, xelatex, or lualatex
|
|
9
|
+
**Documentation:** English (this file) · [Operations](OPERATIONS.md) · [Design](DESIGN.md) · [简体中文](README.zh-CN.md)
|
|
25
10
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
~~~bash
|
|
29
|
-
node --version
|
|
30
|
-
npm --version
|
|
31
|
-
latexmk --version
|
|
32
|
-
xelatex --version
|
|
33
|
-
# Optional, when Git/GitHub integration is needed:
|
|
34
|
-
git --version
|
|
35
|
-
~~~
|
|
36
|
-
|
|
37
|
-
npm run init and application startup check latexmk and every engine in latex.allowedEngines. Git is deliberately excluded from this core check, so a host without Git can initialize and run TexLite normally. When a project owner opens the Git panel or invokes a Git/GitHub operation, TexLite checks git.binary on demand and shows an actionable error if Git is unavailable.
|
|
11
|
+
**Website:** [TexLite GitHub Pages](https://swufe-db-group.github.io/TexLite/)
|
|
38
12
|
|
|
39
|
-
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
## Why TexLite
|
|
16
|
+
|
|
17
|
+
- **Own the writing environment.** Use the host's TeX installation and keep
|
|
18
|
+
sources, history, and compiled output in one local data directory.
|
|
19
|
+
- **Collaborate without a large stack.** The default deployment is one Node.js
|
|
20
|
+
process, SQLite, and local files—plus real-time editing and source-level
|
|
21
|
+
comments for a small trusted team.
|
|
22
|
+
|
|
23
|
+
## A practical distinction from Overleaf
|
|
24
|
+
|
|
25
|
+
[Overleaf](https://www.overleaf.com/about/features-overview) is a strong choice
|
|
26
|
+
when its hosted product or broader ecosystem is the right fit. TexLite addresses
|
|
27
|
+
a narrower self-hosted use case:
|
|
28
|
+
|
|
29
|
+
- A shared hosted service can queue, slow down, or time out at usage peaks.
|
|
30
|
+
- Overleaf's open-source [Community Edition](https://github.com/overleaf/overleaf)
|
|
31
|
+
follows a more involved [Docker deployment path](https://docs.overleaf.com/on-premises/getting-started/what-is-the-overleaf-toolkit), and
|
|
32
|
+
[source comments are a Server Pro feature](https://docs.overleaf.com/on-premises/user-and-project-management/roles-and-permissions).
|
|
33
|
+
- TexLite uses the server's existing TeX environment, runs as a small
|
|
34
|
+
single-host stack, and includes real-time source comments and replies.
|
|
35
|
+
|
|
36
|
+
Self-hosting does not make every document compile faster: that still depends on
|
|
37
|
+
the host and the document. It does give the team control over capacity, TeX
|
|
38
|
+
updates, data location, and the collaboration workflow.
|
|
39
|
+
|
|
40
|
+
For a desktop-first, individual workflow, start with
|
|
41
|
+
[VS Code + LaTeX Workshop](https://github.com/James-Yu/LaTeX-Workshop) or
|
|
42
|
+
[TeXstudio](https://texstudio.org/) instead. TexLite is purpose-built for
|
|
43
|
+
shared browser writing, not a replacement for a personal IDE.
|
|
44
|
+
|
|
45
|
+
## What the writing workflow includes
|
|
46
|
+
|
|
47
|
+
- Projects with folders, ZIP import/export, tags, sharing, ownership transfer,
|
|
48
|
+
archiving, and a private per-user citation library.
|
|
49
|
+
- CodeMirror editing with LaTeX/BibTeX highlighting, folding, completion,
|
|
50
|
+
optional Vim mode, formatting, spelling/grammar assistance, search/replace,
|
|
51
|
+
and source/PDF SyncTeX navigation.
|
|
52
|
+
- Yjs-based collaborative source editing, active-session presence, comments
|
|
53
|
+
anchored to source text, replies, resolution, and permissions that let
|
|
54
|
+
reviewers comment without changing source.
|
|
55
|
+
- `latexmk` compilation with selectable engines, project settings, structured
|
|
56
|
+
diagnostics, cached successful PDFs, downloadable artifacts, and optional
|
|
57
|
+
project-level `latexmkrc`.
|
|
58
|
+
- Per-project history and owner-only Git/GitHub backup. Git is optional and is
|
|
59
|
+
checked only when its integration is used.
|
|
40
60
|
|
|
41
61
|
## Quick start
|
|
42
62
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
and project data outside the global npm installation:
|
|
63
|
+
Install Node.js 24 or newer, `latexmk`, and at least one TeX engine such as
|
|
64
|
+
`pdflatex`, `xelatex`, or `lualatex`. Git is needed only for the optional
|
|
65
|
+
Git/GitHub integration.
|
|
47
66
|
|
|
48
67
|
~~~bash
|
|
49
68
|
npm install --global texlite
|
|
@@ -52,287 +71,40 @@ texlite start
|
|
|
52
71
|
texlite status
|
|
53
72
|
~~~
|
|
54
73
|
|
|
55
|
-
Open http://127.0.0.1:3000
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
~~~bash
|
|
59
|
-
texlite stop
|
|
60
|
-
texlite restart
|
|
61
|
-
texlite logs
|
|
62
|
-
~~~
|
|
74
|
+
Open <http://127.0.0.1:3000>. `texlite init` creates the configuration and the
|
|
75
|
+
first administrator; public registration is deliberately unavailable.
|
|
63
76
|
|
|
64
|
-
|
|
65
|
-
`$XDG_CONFIG_HOME/texlite/texlite.config.json`, or
|
|
66
|
-
`~/.config/texlite/texlite.config.json` when `XDG_CONFIG_HOME` is not set. The
|
|
67
|
-
default data directory is `$XDG_DATA_HOME/texlite`, or
|
|
68
|
-
`~/.local/share/texlite`. Use `--config PATH` or `TEXLITE_CONFIG` to select a
|
|
69
|
-
different configuration file.
|
|
70
|
-
|
|
71
|
-
`texlite serve` runs the server in the foreground and is suitable for Docker,
|
|
72
|
-
systemd, and debugging. `start`, `status`, `stop`, `restart`, and `logs` use the
|
|
73
|
-
PM2 dependency bundled with the package. Managed startup waits until the HTTP
|
|
74
|
-
health endpoint is ready; `status` reports `unhealthy` if PM2 is running but the
|
|
75
|
-
managed process is not actually serving TexLite. `restart` recreates the PM2
|
|
76
|
-
entry so npm upgrades always use the current package paths and environment.
|
|
77
|
-
Failed startup attempts are bounded instead of entering an unlimited restart
|
|
78
|
-
loop.
|
|
79
|
-
|
|
80
|
-
For a clean upgrade:
|
|
77
|
+
For upgrades and routine management:
|
|
81
78
|
|
|
82
79
|
~~~bash
|
|
83
80
|
npm update --global texlite
|
|
84
81
|
texlite restart
|
|
85
|
-
~~~
|
|
86
|
-
|
|
87
|
-
Uninstalling the npm package does not remove the configuration or project data:
|
|
88
|
-
|
|
89
|
-
~~~bash
|
|
90
|
-
npm uninstall --global texlite
|
|
91
|
-
~~~
|
|
92
|
-
|
|
93
|
-
### Repository/source installation
|
|
94
|
-
|
|
95
|
-
~~~bash
|
|
96
|
-
npm ci
|
|
97
|
-
cp texlite.config.example.json texlite.config.json
|
|
98
|
-
export TEXLITE_CONFIG="$PWD/texlite.config.json"
|
|
99
|
-
# Edit texlite.config.json if needed.
|
|
100
|
-
npm run init
|
|
101
|
-
npm run build
|
|
102
|
-
npm start
|
|
103
|
-
~~~
|
|
104
|
-
|
|
105
|
-
The default server binds to localhost and does not expose public registration.
|
|
106
|
-
The initialization command asks for the first administrator account; the server
|
|
107
|
-
refuses to start until at least one active administrator exists.
|
|
108
|
-
|
|
109
|
-
For a non-interactive initialization, set the following environment variables for that command only:
|
|
110
|
-
|
|
111
|
-
~~~bash
|
|
112
|
-
TEXLITE_INIT_USERNAME=admin \
|
|
113
|
-
TEXLITE_INIT_DISPLAY_NAME=Administrator \
|
|
114
|
-
TEXLITE_INIT_PASSWORD='use-a-password-of-at-least-8-characters' \
|
|
115
|
-
npm run init
|
|
116
|
-
~~~
|
|
117
|
-
|
|
118
|
-
Avoid putting the password in shell history on a shared machine.
|
|
119
|
-
|
|
120
|
-
## Development and verification
|
|
121
|
-
|
|
122
|
-
Run the API/server watcher and Vite in separate terminals:
|
|
123
|
-
|
|
124
|
-
~~~bash
|
|
125
|
-
npm run dev # API and server at http://127.0.0.1:3000
|
|
126
|
-
npm run dev:web # Vite UI at http://127.0.0.1:5173
|
|
127
|
-
~~~
|
|
128
|
-
|
|
129
|
-
Vite proxies /api requests to the server. Before a production-style run, use:
|
|
130
|
-
|
|
131
|
-
~~~bash
|
|
132
|
-
npm run typecheck
|
|
133
|
-
npm test
|
|
134
|
-
npm run build
|
|
135
|
-
npm start
|
|
136
|
-
~~~
|
|
137
|
-
|
|
138
|
-
## Configuration
|
|
139
|
-
|
|
140
|
-
Configuration path precedence is:
|
|
141
|
-
|
|
142
|
-
1. `--config PATH` passed to the `texlite` executable;
|
|
143
|
-
2. `TEXLITE_CONFIG`;
|
|
144
|
-
3. `$XDG_CONFIG_HOME/texlite/texlite.config.json`;
|
|
145
|
-
4. `~/.config/texlite/texlite.config.json`.
|
|
146
|
-
|
|
147
|
-
Relative paths in the configuration are resolved relative to that configuration
|
|
148
|
-
file. `storage.dataDir` defaults to `$XDG_DATA_HOME/texlite`, or
|
|
149
|
-
`~/.local/share/texlite`. Set `storage.dataDir` in the configuration, or use
|
|
150
|
-
`TEXLITE_DATA_DIR`, to choose another data directory. The production client
|
|
151
|
-
bundle defaults to the `dist/client` directory inside the installed package;
|
|
152
|
-
`TEXLITE_CLIENT_DIR` can override it for development or custom deployments.
|
|
153
|
-
|
|
154
|
-
The example configuration is intentionally complete:
|
|
155
|
-
|
|
156
|
-
~~~json
|
|
157
|
-
{
|
|
158
|
-
"siteName": "TexLite",
|
|
159
|
-
"adminEmail": "admin@example.com",
|
|
160
|
-
"sessionDays": 14,
|
|
161
|
-
"server": { "host": "127.0.0.1", "port": 3000 },
|
|
162
|
-
"storage": { "dataDir": ".texlite" },
|
|
163
|
-
"uploads": { "maxFileSizeMB": 50 },
|
|
164
|
-
"pdf": { "loadingStrategy": "auto", "rangeThresholdMB": 5 },
|
|
165
|
-
"history": { "maxVersions": 200, "maxStorageMB": 128 },
|
|
166
|
-
"git": {
|
|
167
|
-
"binary": "git",
|
|
168
|
-
"operationTimeoutSeconds": 120,
|
|
169
|
-
"githubApiBaseUrl": "https://api.github.com"
|
|
170
|
-
},
|
|
171
|
-
"latex": {
|
|
172
|
-
"latexmk": "latexmk",
|
|
173
|
-
"defaultEngine": "xelatex",
|
|
174
|
-
"allowedEngines": ["pdflatex", "xelatex", "lualatex"],
|
|
175
|
-
"extraArgs": [],
|
|
176
|
-
"allowProjectLatexmkrc": true,
|
|
177
|
-
"compileTimeoutSeconds": 600,
|
|
178
|
-
"maxCompileJobs": 10
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
~~~
|
|
182
|
-
|
|
183
|
-
The checked-in example uses `.texlite` as an explicit repository-development
|
|
184
|
-
path. A configuration generated by `texlite init` uses the XDG data directory
|
|
185
|
-
default described above instead.
|
|
186
|
-
|
|
187
|
-
Important settings:
|
|
188
|
-
|
|
189
|
-
- server.host and server.port: network bind address and port. Keep the host at 127.0.0.1 unless a separately secured deployment is intended.
|
|
190
|
-
- storage.dataDir: SQLite database, project sources, compile output, and the Git token encryption key.
|
|
191
|
-
- uploads.maxFileSizeMB: maximum size for a project upload, a ZIP entry, project files, and attachments. The default is 50 MB.
|
|
192
|
-
- pdf.loadingStrategy: PDF.js transfer mode: `auto`, `full`, or `range`. In `auto` mode, PDFs at or below `pdf.rangeThresholdMB` use one cache-friendly response; larger PDFs use byte-range requests.
|
|
193
|
-
- pdf.rangeThresholdMB: automatic Range threshold, defaulting to 5 MB. This is a deployment-level preview setting, not a project compiler option.
|
|
194
|
-
- history.maxVersions: maximum number of ordinary, unlabeled versions retained per project. Initial and labeled versions are protected.
|
|
195
|
-
- history.maxStorageMB: soft per-project limit for deduplicated history objects. The oldest ordinary versions are removed first; protected versions and the current internal baseline can exceed this limit.
|
|
196
|
-
- latex.defaultEngine, latex.allowedEngines, latex.extraArgs: compile choices available in the UI.
|
|
197
|
-
- latex.compileTimeoutSeconds: timeout for one compile job.
|
|
198
|
-
- latex.maxCompileJobs: global number of concurrent LaTeX processes. Jobs for the same project and root document are serialized; newer source versions supersede older queued requests. Different root documents use independent workspaces and may compile concurrently within this global limit.
|
|
199
|
-
- Compilation copies a short-lived immutable source snapshot, then runs `latexmk` outside the ordinary project-operation queue. Editing and retained-PDF reads can continue; Git checkout, history restore, deletion, and compile-cache cleanup wait for active compilation to finish.
|
|
200
|
-
- latex.allowProjectLatexmkrc: allow a project to supply a multi-line latexmkrc. A project rc file is executable Perl configuration and should only be enabled for trusted users.
|
|
201
|
-
|
|
202
|
-
Before every compile TexLite passes `-norc` to latexmk. Therefore a `.latexmkrc`
|
|
203
|
-
included directly in an uploaded ZIP, Git checkout, or project source is ignored.
|
|
204
|
-
The file is read only when the owner explicitly selects it in Project Settings,
|
|
205
|
-
where TexLite passes it with `-r`.
|
|
206
|
-
|
|
207
|
-
### Effective defaults and startup validation
|
|
208
|
-
|
|
209
|
-
When a setting is omitted, texLite uses the following built-in defaults (the
|
|
210
|
-
generated example file may choose to show an explicit value such as an admin
|
|
211
|
-
email):
|
|
212
|
-
|
|
213
|
-
| Setting | Effective default |
|
|
214
|
-
| --- | --- |
|
|
215
|
-
| `siteName` | `TexLite` |
|
|
216
|
-
| `adminEmail` | empty |
|
|
217
|
-
| `server.host` / `server.port` | `127.0.0.1` / `3000` |
|
|
218
|
-
| `storage.dataDir` | `$XDG_DATA_HOME/texlite` or `~/.local/share/texlite` |
|
|
219
|
-
| `clientDir` | `dist/client` inside the installed package |
|
|
220
|
-
| `sessionDays` | `14` |
|
|
221
|
-
| `uploads.maxFileSizeMB` | `50` MB |
|
|
222
|
-
| `pdf.loadingStrategy` | `auto` |
|
|
223
|
-
| `pdf.rangeThresholdMB` | `5` MB |
|
|
224
|
-
| `history.maxVersions` | `200` ordinary versions per project |
|
|
225
|
-
| `history.maxStorageMB` | `128` MB per project (soft limit) |
|
|
226
|
-
| `latex.latexmk` | `latexmk` |
|
|
227
|
-
| `latex.defaultEngine` | `xelatex` |
|
|
228
|
-
| `latex.allowedEngines` | `pdflatex`, `xelatex`, `lualatex` |
|
|
229
|
-
| `latex.extraArgs` | `[]` |
|
|
230
|
-
| `latex.allowProjectLatexmkrc` | `true` |
|
|
231
|
-
| `latex.compileTimeoutSeconds` | `600` seconds |
|
|
232
|
-
| `latex.maxCompileJobs` | `10` |
|
|
233
|
-
| `git.binary` / `git.operationTimeoutSeconds` | `git` / `120` seconds |
|
|
234
|
-
| `git.githubApiBaseUrl` | `https://api.github.com` |
|
|
235
|
-
|
|
236
|
-
Configuration is validated before environment checks, database opening, or
|
|
237
|
-
the HTTP listener starts. Explicit values are never silently replaced by a
|
|
238
|
-
default. The accepted ranges are: port `1–65535`, sessions `1–3650` days,
|
|
239
|
-
upload size `1–2048` MB, history versions `10–5000`, history storage
|
|
240
|
-
`16–102400` MB, PDF Range threshold `1–2048` MB, compile timeout `1–3600` seconds, compile jobs `1–32`,
|
|
241
|
-
and Git timeout `1–3600` seconds. Engine names must be supported, unique, and
|
|
242
|
-
the allowed-engine list must include the selected default engine. Data and
|
|
243
|
-
project paths must not point at files (the data directory cannot be the
|
|
244
|
-
filesystem root); a missing data directory must have an existing writable
|
|
245
|
-
parent. The GitHub API endpoint must be an `http://` or `https://` URL.
|
|
246
|
-
|
|
247
|
-
Invalid JSON types, empty required strings, malformed integers (including
|
|
248
|
-
decimal or non-numeric environment overrides), unsupported engines, invalid
|
|
249
|
-
URLs, and unusable paths stop startup with the setting name, expected value,
|
|
250
|
-
and a remediation hint. The same validation runs during `npm run init`, so a
|
|
251
|
-
configuration can be checked before creating the first administrator.
|
|
252
|
-
|
|
253
|
-
Environment variables override the corresponding file values:
|
|
254
|
-
|
|
255
|
-
~~~text
|
|
256
|
-
TEXLITE_CONFIG
|
|
257
|
-
XDG_CONFIG_HOME XDG_DATA_HOME
|
|
258
|
-
TEXLITE_SITE_NAME TEXLITE_ADMIN_EMAIL
|
|
259
|
-
TEXLITE_HOST TEXLITE_PORT
|
|
260
|
-
TEXLITE_DATA_DIR TEXLITE_CLIENT_DIR
|
|
261
|
-
TEXLITE_SESSION_DAYS TEXLITE_MAX_UPLOAD_SIZE_MB
|
|
262
|
-
TEXLITE_PDF_LOADING_STRATEGY TEXLITE_PDF_RANGE_THRESHOLD_MB
|
|
263
|
-
TEXLITE_HISTORY_MAX_VERSIONS TEXLITE_HISTORY_MAX_STORAGE_MB
|
|
264
|
-
TEXLITE_LATEXMK TEXLITE_DEFAULT_ENGINE
|
|
265
|
-
TEXLITE_COMPILE_TIMEOUT TEXLITE_MAX_COMPILE_JOBS
|
|
266
|
-
TEXLITE_GIT TEXLITE_GIT_TIMEOUT
|
|
267
|
-
TEXLITE_GITHUB_API_URL
|
|
268
|
-
~~~
|
|
269
|
-
|
|
270
|
-
texLite does not run tlmgr or install missing packages. Updating TeX Live on the host changes the environment used by the next compile.
|
|
271
|
-
|
|
272
|
-
## Service management
|
|
273
|
-
|
|
274
|
-
For a global npm installation, the lifecycle commands use the bundled PM2
|
|
275
|
-
runtime. No separate global PM2 installation is needed:
|
|
276
|
-
|
|
277
|
-
~~~bash
|
|
278
|
-
texlite start
|
|
279
|
-
texlite status
|
|
280
82
|
texlite logs
|
|
281
|
-
texlite restart
|
|
282
|
-
texlite stop
|
|
283
|
-
~~~
|
|
284
|
-
|
|
285
|
-
`texlite status` uses a colored, systemctl-style terminal view. Use
|
|
286
|
-
`texlite status --json` for scripts and monitoring integrations.
|
|
287
|
-
|
|
288
|
-
`texlite doctor` validates configuration, paths, LaTeX, and the administrator;
|
|
289
|
-
add `--git` to check the optional Git integration. `texlite config` prints the
|
|
290
|
-
effective paths and values. `texlite serve` keeps the process in the foreground
|
|
291
|
-
and does not start PM2.
|
|
292
|
-
|
|
293
|
-
<details>
|
|
294
|
-
<summary>Repository deployment with a separately installed PM2</summary>
|
|
295
|
-
|
|
296
|
-
For repository deployments, `ecosystem.config.cjs` and the npm PM2 wrappers are
|
|
297
|
-
also available. It deliberately runs one forked instance (`instances: 1`);
|
|
298
|
-
cluster mode is not supported because collaboration state, the compile queue,
|
|
299
|
-
SQLite, and the project filesystem are local to one process.
|
|
300
|
-
|
|
301
|
-
~~~bash
|
|
302
|
-
npm install --global pm2
|
|
303
|
-
npm run build
|
|
304
|
-
pm2 start ecosystem.config.cjs
|
|
305
|
-
pm2 status
|
|
306
|
-
pm2 logs texlite
|
|
307
83
|
~~~
|
|
308
84
|
|
|
309
|
-
|
|
310
|
-
`
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
After deploying new code:
|
|
314
|
-
|
|
315
|
-
~~~bash
|
|
316
|
-
npm run build
|
|
317
|
-
pm2 restart texlite --update-env
|
|
318
|
-
~~~
|
|
85
|
+
`texlite serve` runs in the foreground for debugging, Docker, or systemd.
|
|
86
|
+
`start`, `stop`, `restart`, `status`, and `logs` use the PM2 runtime bundled
|
|
87
|
+
with the npm package. Run `texlite help` for the complete command list.
|
|
319
88
|
|
|
320
|
-
|
|
89
|
+
## Documentation map
|
|
321
90
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
</details>
|
|
329
|
-
|
|
330
|
-
## Security boundaries
|
|
91
|
+
| Need | Read |
|
|
92
|
+
| --- | --- |
|
|
93
|
+
| Installation, configuration paths, effective defaults, environment overrides, service management, backups, and security boundaries | [Operations guide](OPERATIONS.md) |
|
|
94
|
+
| Collaboration, source persistence, compilation isolation, history, and design trade-offs | [Design](DESIGN.md) |
|
|
95
|
+
| Testing an npm package before publication | [NPM testing guide](NPM_TESTING.md) |
|
|
96
|
+
| Complete configuration starting point | [texlite.config.example.json](texlite.config.example.json) |
|
|
331
97
|
|
|
332
|
-
|
|
98
|
+
## Scope and security
|
|
333
99
|
|
|
334
|
-
|
|
100
|
+
TexLite is a single-host application for trusted users. It is not a compiler
|
|
101
|
+
sandbox: LaTeX and an enabled project `latexmkrc` can execute powerful local
|
|
102
|
+
behaviour. Keep the default `127.0.0.1` bind unless you add the authentication,
|
|
103
|
+
network controls, and isolated compiler environment appropriate for an
|
|
104
|
+
untrusted deployment.
|
|
335
105
|
|
|
336
|
-
|
|
106
|
+
## License
|
|
337
107
|
|
|
338
|
-
|
|
108
|
+
TexLite is licensed under the GNU Affero General Public License v3.0; see
|
|
109
|
+
[LICENSE](LICENSE). For proprietary modifications or commercial terms that
|
|
110
|
+
differ from AGPL-3.0, contact the copyright holder.
|