resume-cli

repository·master·Indexed 26 days ago

https://github.com/jsonresume/resume-cli

The command-line interface for JSON Resume, an open-source standard for creating resumes in JSON format. Version 3.1.2 allows users to initialize, validate, and preview resumes locally, as well as export them to HTML and PDF formats using themes. It supports multiple input formats including JSON and YAML, and includes a local development server with live reloading.

Tokens
1.3K
Snippets
3
Records
14
Agent score
88%

What's inside resume-cli

  1. Configure resume data input sources

    master

    The CLI supports several ways to provide resume data using the --resume flag:

    • --resume <path>: Reads resume data from the specified file path.
    • --resume -: Reads resume data from standard input (STDIN). Defaults --type to application/json.
    • Default: If --resume is unset, the CLI looks for resume.json in the current working directory.
    • Directory (quaff): If --resume points to a directory, the path is passed to quaff to generate JSON from various formats (including JS modules).
  2. Export a resume to HTML or PDF

    master

    Use resume export [fileName] to generate a stylized version of your resume.

    Note: You must npm install any theme you wish to use before attempting to export with it.

    Options:

    • --format <file type>: Specify the output format (e.g., --format pdf).
    • --theme <name>: Specify the theme name (e.g., --theme even).
  3. Serve a resume locally for development

    master

    Run resume serve to start a web server at http://localhost:4000/. This is useful for visualizing changes to your resume.json in real-time via live reloading.

    Options:

    • --port <port>: Specify a custom port.
    • --theme <name>: Specify the theme to use.

    Theme Development: To develop or test a local theme, change into your theme directory and run: resume serve --theme .

  4. Export a resume to HTML or PDF

    master

    The export logic supports generating resumes in .html and .pdf formats.

    • HTML Export: Renders the resume using the specified theme and writes the resulting HTML to the destination file.
    • PDF Export: Uses Puppeteer to render the HTML and generate a PDF. It respects theme-specific configurations for viewport size and media types.

    Supported Formats:

    • .html
    • .pdf

    Environment Variables:

    • RESUME_PUPPETEER_NO_SANDBOX: If set, the --no-sandbox flag is passed to Puppeteer, which can be useful in certain containerized or restricted environments.
  5. Preview resume with the serve command

    master

    The serve functionality (used via the CLI) starts a local web server to preview your rendered resume. It uses browser-sync to watch your resume data file for changes; when the file is saved, the resume is automatically rebuilt and the browser is reloaded.

    Key behaviors:

    • Auto-reload: Watches the resumeFilename and triggers a rebuild/reload on change.
    • Output: Writes the rendered HTML to index.html within the specified dir.
    • Browser behavior: Automatically opens the local browser unless the silent flag is set.
  6. Use the resume CLI global options

    master

    The resume command accepts several global options that can be used across different commands like export, serve, and validate.

    FlagLong FlagDescription
    -F, --force--forceBypasses schema testing (used by publish and export).
    -t, --theme <theme name>--theme <theme name>Specify a theme name (e.g., elegant) or a path starting with . (e.g., ./my-theme). Defaults to jsonresume-theme-elegant.
    -f, --format <ext>--format <ext>Specify the file type extension (used by export).
    -r, --resume <path>--resume <path>Path to the resume JSON file. Use - to read from stdin. Defaults to resume.json.
    -p, --port <port>--port <port>Port for the serve command. Defaults to 4000.
    -s, --silent--silentTells serve whether to auto-open the browser.
    -d, --dir <path>--dir <path>Indicates a public directory path for serve. Defaults to public.
    --schema <path>--schema <path>Path to a custom schema for validate.
  7. Configure PDF rendering via themes

    master

    When exporting to PDF, the process can be customized using options defined within the theme package. The exporter looks for the following properties in the theme's index.js:

    • pdfViewport: An object used to set the Puppeteer page viewport.
    • pdfRenderOptions: An object containing options passed directly to Puppeteer's page.pdf() method.
      • pdfRenderOptions.mediaType: Determines the media type used for emulation (defaults to 'screen' if not provided).
      • Other standard Puppeteer page.pdf() options can be included in this object.