返回 Skill 列表
extension
分类: 开发与工程无需 API Key

litestar-assets-cli

使用Litestar资产CLI命令(install、serve、build、generate-types、export-routes、status、doctor)进行开发、生产、测试和诊断;避免直接使用npm或Vite命令。在启动开发服务器、构建资产、生成类型或验证Litestar-Vite集成层时使用这些命令。

person作者: jakexiaohubgithub

Litestar Assets CLI

Overview

Standardize all frontend operations through litestar assets to keep Python and Vite in sync.

Command Map

# Install frontend deps
litestar assets install

# Dev server (managed by Litestar)
litestar assets serve

# Production build
litestar assets build

# SSR production server (framework/ssr modes)
litestar assets serve --production

# Diagnostics
litestar assets status
litestar assets doctor

# Type generation
litestar assets generate-types
litestar assets export-routes

Recommended Flows

Development (single-port)

litestar assets serve
litestar run

Development (two-port)

litestar assets serve
litestar run --reload

Production (static assets)

litestar assets build
litestar run

Production (SSR)

litestar assets build
litestar assets serve --production
litestar run

Testing and E2E Guidance

  • Always use litestar assets commands in tests. Do not call npm run dev or npm run build.
  • Use litestar assets status before E2E tests to validate bridge config.
  • Use litestar assets doctor when diagnosing missing Node executors, port conflicts, or malformed config.

Common Pitfalls

  • Running npm scripts directly (bypasses Litestar integration layer).
  • Starting Vite on a port that does not match .litestar.json.
  • Building assets without litestar assets build and then expecting Litestar to serve them.

Related Files

  • src/py/litestar_vite/cli.py
  • src/py/litestar_vite/commands.py
  • src/py/litestar_vite/executor.py
  • specs/guides/testing.md

Official References

  • https://litestar-org.github.io/litestar-vite/usage/vite.html
  • https://litestar-org.github.io/litestar-vite/usage/types.html
  • https://litestar-org.github.io/litestar-vite/changelog.html
  • https://pypi.org/project/litestar-vite/
  • https://github.com/litestar-org/litestar-vite/blob/main/src/py/litestar_vite/cli.py

Shared Styleguide Baseline

  • Use shared styleguides for generic language/framework rules to reduce duplication in this skill.
  • General Principles
  • Litestar
  • Python
  • TypeScript
  • Keep this skill focused on tool-specific workflows, edge cases, and integration details.