JSPM

@schemacompany/cli

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q24974F
  • License MIT

CLI for injecting JSON-LD schemas into HTML files

Package Exports

  • @schemacompany/cli
  • @schemacompany/cli/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@schemacompany/cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@schemacompany/cli

CLI for injecting JSON-LD schemas into static HTML files at build time.

Installation

npm install -D @schemacompany/cli

Usage

Using a Configuration File

Create a schemas.json file:

{
  "baseUrl": "https://assets.theschemacompany.com",
  "pages": [
    { "path": "index.html", "hash": "your-64-char-hash..." },
    { "path": "about/index.html", "hash": "another-hash..." },
    { "glob": "products/**/*.html", "hash": "product-schema-hash..." }
  ],
  "options": {
    "position": "head-end",
    "pretty": true
  }
}

Run the inject command:

npx schemacompany inject ./dist --config schemas.json

Using CLI Options

npx schemacompany inject ./dist --hash abc123... --pages "index.html,about.html"

Validate Configuration

npx schemacompany validate --config schemas.json

Commands

inject <directory>

Inject schemas into HTML files.

Option Description Default
-c, --config <path> Config file path schemas.json
-h, --hash <hash> Single hash to inject -
-p, --pages <pages> Comma-separated page paths -
--base-url <url> Override base URL Production
--position <pos> Injection position head-end
--dry-run Show changes without writing false
-v, --verbose Verbose output false

Position options: head-start, head-end, body-end

validate

Validate a configuration file.

Option Description Default
-c, --config <path> Config file path schemas.json

Configuration Schema

interface Config {
  baseUrl?: string;
  pages: Array<
    | { path: string; hash: string }
    | { glob: string; hash: string }
  >;
  options?: {
    position?: "head-start" | "head-end" | "body-end";
    pretty?: boolean;
  };
}

License

MIT