Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 45 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,57 @@
name: CI

on:
pull_request:
branches: [main]
push:
branches: [main]
branches: [main, master]
pull_request:
branches: [main, master]

jobs:
lint:
if: github.repository == 'ranuts/document'
timeout-minutes: 30
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node_version: [20]
include:
# Active LTS + other OS
- os: macos-latest
node_version: 20
- os: windows-latest
node_version: 20
fail-fast: false
name: "Build&Test: node-${{ matrix.node_version }}, ${{ matrix.os }}"
name: Lint and Validate
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-python@v6
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
python-version: "3.10"
node-version: "22"
cache: "npm"

- name: Install dependencies
run: npm ci

- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
- name: Run oxlint and TypeScript checks
run: npm run lint

- name: Validate Docker Compose file
run: docker compose -f docker-compose.yaml config --quiet

- name: Lint Dockerfile with Hadolint
uses: hadolint/hadolint-action@v3.1.0
with:
version: 7
run_install: false
dockerfile: Dockerfile
failure-threshold: error

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
docker-validation:
name: Docker Validation
runs-on: ubuntu-latest

- name: Install deps
run: pnpm install
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Lint
run: pnpm run lint
- name: Validate docker-compose.yaml
run: |
echo "Validating docker-compose.yaml with Docker Compose..."
docker compose -f docker-compose.yaml config --quiet
echo "✓ docker-compose.yaml is valid"

- name: Lint Dockerfile
uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: Dockerfile
failure-threshold: error
17 changes: 17 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"ignorePatterns": [
"**/dist/**",
"**/report/**",
"**/assets/**",
"**/temp/**",
"**/public/**",
"**/cache/**",
"**/*.snap",
"**/node_modules/**"
],
"rules": {
"no-debugger": "error",
"no-console": "off",
"no-empty": "off"
}
}
26 changes: 14 additions & 12 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
nanme: document
name: document
services:
document:
image: ghcr.io/ranui/document:latest
build:
context: .
dockerfile: Dockerfile
container_name: document
ports:
- 8080:80
# 进阶配置
# Advanced configuration
# volumes:
# # 证书
# - 证书路径:/ssl
# # Certificate
# - certificate_path:/ssl
# environment:
# # 账号
# # 格式用户名:密码,必须使用BCrypt密码哈希函数对密码进行编码。
# # 获取BCrypt加密的结果,把加密结果中的$替换成$$转义。
# SERVER_BASIC_AUTH: "用户名:BCrypt加密密码"
# # 证书
# # Account
# # Format username:password, must use BCrypt password hash function to encode the password.
# # Get the BCrypt encrypted result, replace $ in the encrypted result with $$ for escaping.
# SERVER_BASIC_AUTH: "username:BCrypt_encrypted_password"
# # Certificate
# SERVER_HTTP2_TLS: true
# SERVER_HTTP2_TLS_CERT: 证书路径
# SERVER_HTTP2_TLS_KEY: 私钥路径
# SERVER_HTTP2_TLS_CERT: certificate_path
# SERVER_HTTP2_TLS_KEY: private_key_path
204 changes: 0 additions & 204 deletions eslint.config.js

This file was deleted.

3 changes: 2 additions & 1 deletion lib/document-converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ export class X2TConverter {
} else {
console.error('Conversion failed. Parameters XML:', paramsContent);
}
} catch (_e) {
} catch (e) {
console.error('Conversion failed. Parameters XML:', e);
// Ignore if we can't read the params file
}
throw new Error(`Conversion failed with code: ${result}`);
Expand Down
Loading
Loading