YAMLResume

CLI

YAMLResume mengadopsi struktur mono-repo, yang berarti semua paket berada dalam satu repository. Berkat pnpm workspace, pendekatan ini menyederhanakan manajemen dependensi dan versioning di seluruh paket.

Pada saat penulisan, repo YAMLResume memiliki dua paket:

Build yamlresume/core

yamlresume/cli bergantung pada yamlresume/core untuk berfungsi dengan baik. Jadi ketika Anda ingin menguji yamlresume/cli, Anda perlu memastikan bahwa yamlresume/core juga di-build dan tersedia.

Anda dapat melakukan ini dengan perintah berikut:

# build untuk tujuan dev
pnpm core build

# build untuk produksi, yang akan minifikasi output dan menghasilkan file
# definisi TypeScript `.d.ts`
pnpm core build:prod

# pantau perubahan file dan build secara otomatis
pnpm core build:watch

Build yamlresume/cli

Setelah yamlresume/core di-build, Anda dapat menjalankan perintah CLI dengan dua cara:

  1. build yamlresume/cli secara lokal dan jalankan node.js dengan dist/cli.js:
pnpm cli build
node packages/cli/dist/cli.js <command> [options]
  1. jalankan yamlresume/cli langsung dengan bantuan tsx:
pnpm cli dev <command> [options]

# perintah ini akan diterjemahkan ke
# tsx src/cli.ts

Demo

Build yamlresume/core:

$ pnpm core build

> @yamlresume/yamlresume@0.7.1 core /Users/hanyu/work/yamlresume/yamlresume
> pnpm --filter @yamlresume/core build

> @yamlresume/core@0.7.1 build /Users/hanyu/work/yamlresume/yamlresume/packages/core
> tsup

CLI Building entry: src/index.ts
CLI Using tsconfig: tsconfig.json
CLI tsup v8.4.0
CLI Using tsup config: /Users/hanyu/work/yamlresume/yamlresume/packages/core/tsup.config.ts
CLI Target: esnext
CLI Cleaning output folder
ESM Build start
ESM dist/index.js 160.91 KB
ESM ⚡️ Build success in 111ms

Build yamlresume/cli:

$ pnpm cli build

> @yamlresume/yamlresume@0.7.1 cli /Users/hanyu/work/yamlresume/yamlresume
> pnpm --filter yamlresume build

> yamlresume@0.7.1 build /Users/hanyu/work/yamlresume/yamlresume/packages/cli
> tsup

CLI Building entry: src/cli.ts
CLI Using tsconfig: tsconfig.json
CLI tsup v8.4.0
CLI Using tsup config: /Users/hanyu/work/yamlresume/yamlresume/packages/cli/tsup.config.ts
CLI Target: esnext
CLI Cleaning output folder
ESM Build start
ESM dist/cli.js 11.36 KB
ESM ⚡️ Build success in 42ms

Tes yamlresume/cli dengan tsx melalui pnpm cli dev:

$ pnpm cli dev help

> @yamlresume/yamlresume@0.7.1 cli /Users/hanyu/work/yamlresume/yamlresume
> pnpm --filter yamlresume dev help

> yamlresume@0.7.1 dev /Users/hanyu/work/yamlresume/yamlresume/packages/cli
> tsx src/cli.ts help

Usage: yamlresume [options] [command]

YAMLResume — Resume as Code in YAML

 __   __ _    __  __ _     ____
 \ \ / // \  |  \/  | |   |  _ \ ___  ___ _   _ ___  ___
  \ V // _ \ | |\/| | |   | |_) / _ \/ __| | | / _ \/ _ \ / _ \
   | |/ ___ \| |  | | |___|  _ <  __/\__ \ |_| | | | | |  __/
   |_/_/   \_\_|  |_|_____|_| \_\___||___/\____|_| |_| |_|\___|


Options:
  -V, --version                  output the version number
  -v, --verbose                  verbose output
  -h, --help                     display help for command

Commands:
  new [filename]                 create a new resume
  build [options] <resume-path>  build a resume to LaTeX and PDF
  dev [options] <resume-path>    build on file changes (watch mode)
  languages                      i18n and l10n support
  templates                      manage resume templates
  validate <resume-path>         validate a resume against the YAMLResume schema
  help [command]                 display help for command

Tes yamlresume/cli dengan Node.js:

$ node packages/cli/dist/cli.js -V
0.7.1
Edit on GitHub

Last updated on