Commands
Reference for all available commands in girok-md.
npm Scripts
| Command | Description |
|---|---|
npm run dev | Start development server on localhost:4321 |
npm run build | Build for production |
npm run preview | Preview production build locally |
npm run sync | Sync posts from source folder |
npm run translate | Translate posts to target languages |
npm run clean | Clean synced posts |
npm test | Run tests |
Development
npm run dev
Starts the Astro development server with hot module replacement.
npm run dev- Default URL: http://localhost:4321
- Hot reloading enabled
- Draft posts visible
npm run preview
Preview the production build locally before deploying.
npm run build && npm run previewBuilding
npm run build
Builds your site for production.
npm run buildThis command:
- Compiles all Astro pages to static HTML
- Bundles and minifies CSS/JS
- Runs Pagefind to generate search index
Output is in the dist/ folder.
Syncing
npm run sync
Syncs markdown files from your source folder to src/content/posts/.
npm run syncBehavior:
- Reads
source_root_pathfromsetting.toml - Scans for
.mdfiles withpublish: true - Copies new/changed files to
src/content/posts/ - Copies images to
public/assets/ - Removes posts that were unpublished or deleted
Options:
# Force full sync (re-sync all files)rm -rf src/content/posts && npm run syncnpm run clean
Removes all synced posts and assets.
npm run cleanThis clears:
src/content/posts/public/assets/(synced images only)
Translation
npm run translate
Translates synced posts to configured target languages.
npm run translateBehavior:
- Reads translation settings from
setting.toml - Detects source language of each post automatically
- Translates to all configured
target_langs - Saves translated posts with language suffix (e.g.,
post_ko.md) - Skips posts that are already translated (incremental)
Options:
# Force re-translate all postsnpm run translate -- --force
# Translate specific post onlynpm run translate -- --slug my-post-title
# Combine optionsnpm run translate -- -f -s my-post-title| Option | Description |
|---|---|
--force, -f | Re-translate all posts, even if already translated |
--slug <slug>, -s <slug> | Translate only a specific post |
See Post Translation for detailed configuration.
Testing
npm test
Runs the test suite with Vitest.
npm testOther test commands:
# Run once (no watch)npx vitest run
# Run specific filenpx vitest run scripts/__tests__/sync.test.ts
# Run by test namenpx vitest -t "should convert"Pagefind
The search index is automatically built during npm run build via the postbuild script.
To manually build the search index:
npx pagefind --site dist