Skip to content

Commands

Reference for all available commands in girok-md.

npm Scripts

CommandDescription
npm run devStart development server on localhost:4321
npm run buildBuild for production
npm run previewPreview production build locally
npm run syncSync posts from source folder
npm run translateTranslate posts to target languages
npm run cleanClean synced posts
npm testRun tests

Development

npm run dev

Starts the Astro development server with hot module replacement.

Terminal window
npm run dev

npm run preview

Preview the production build locally before deploying.

Terminal window
npm run build && npm run preview

Building

npm run build

Builds your site for production.

Terminal window
npm run build

This command:

  1. Compiles all Astro pages to static HTML
  2. Bundles and minifies CSS/JS
  3. 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/.

Terminal window
npm run sync

Behavior:

  • Reads source_root_path from setting.toml
  • Scans for .md files with publish: true
  • Copies new/changed files to src/content/posts/
  • Copies images to public/assets/
  • Removes posts that were unpublished or deleted

Options:

Terminal window
# Force full sync (re-sync all files)
rm -rf src/content/posts && npm run sync

npm run clean

Removes all synced posts and assets.

Terminal window
npm run clean

This clears:

  • src/content/posts/
  • public/assets/ (synced images only)

Translation

npm run translate

Translates synced posts to configured target languages.

Terminal window
npm run translate

Behavior:

  • 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:

Terminal window
# Force re-translate all posts
npm run translate -- --force
# Translate specific post only
npm run translate -- --slug my-post-title
# Combine options
npm run translate -- -f -s my-post-title
OptionDescription
--force, -fRe-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.

Terminal window
npm test

Other test commands:

Terminal window
# Run once (no watch)
npx vitest run
# Run specific file
npx vitest run scripts/__tests__/sync.test.ts
# Run by test name
npx 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:

Terminal window
npx pagefind --site dist