1.8 KiB
1.8 KiB
tswatch Project Hints
Core Architecture
- tswatch is a TypeScript file watcher with multiple operation modes
- Main class
TsWatch
orchestrates different watch modes Watcher
class handles individual file watching and command execution
Available Watch Modes
- npm/node (default): Runs
npm test
on changes - test: Runs
npm run test2
on changes - element: Web component development with dev server on port 3002
- service: Runs
npm run startTs
for service projects - website: Full website mode with bundling and asset processing
- echo: Test mode that runs
npm -v
(for testing)
Key Implementation Details
- Uses
@push.rocks/smartchok
for file watching - Uses
@git.zone/tsbundle
for bundling with esbuild - Uses
@api.global/typedserver
for development server in element mode - Element/website modes watch multiple
ts*/
directories - All modes support both command execution and function callbacks
CLI Entry Points
cli.js
-> Main CLI entry pointts/tswatch.cli.ts
-> CLI implementation with smartcli- Default command triggers npm mode
Project Structure Expectations
ts/
- Backend TypeScript filests_web/
- Frontend TypeScript files (element/website modes)html/
- HTML templates (element/website modes)assets/
- Static assets (website mode only)dist_watch/
- Output for element modedist_serve/
- Output for website mode
Development Server Details
- Port: 3002
- Features: CORS, gzip compression, live reload injection
- Only available in element mode via
typedserver
property
Common Issues to Watch For
- The test mode runs
test2
script, nottest
- Website mode restarts the entire server process on backend changes
- Element mode rebuilds and reloads on any ts* folder change