npm.io
1.0.5 • Published 3 years agoCLI

@blueprint-pdf/cli

Licence
MIT
Version
1.0.5
Deps
4
Size
13 kB
Vulns
12
Weekly
0
Stars
2

  Blueprint CLI

The Blueprint CLI is a command line interface for generating PDFs from schematic templates. It is built on top of the Blueprint library.

Looking for the Blueprint Library? Find it here!

  Installation

Blueprint CLI is available as an npm package for installation.

npm i -g @blueprint-pdf/cli
# or
yarn global add @blueprint-pdf/cli

  Usage

The CLI is a simplifed interface that allows you to interact with Blueprint without needing to spin up a client-side or server application. Simply define a template as shown below and pass it when calling the generate command.

Specification

Schematics are defined using a *.js file that exports a single object. The object must contain a schema property that defines the Blueprint as specified by the Blueprint library. You can also optionally define a data object inside of this file that will be used as the default data source for the template.

Data can also be passed via the --data option when calling the generate command. This can be either a JSON string or a path to a JSON file. For example:

Schematic File:

// Path: examples/schema.js

export default {
  schema: (data) => ({
    // ... BlueprintSchema
  });
  data: {
    // ... Record<string, any>
  },
};

Using Inline Data:

blueprint generate examples/schema.js --data '{ "name": "John Doe" }'

Using a Data File:

blueprint generate examples/schema.js --data examples/data.json

Configuration Options:

blueprint generate examples/schema.js --format A3 --orientation landscape