Skip to content

Latest commit

 

History

History
115 lines (79 loc) · 3.22 KB

usage.md

File metadata and controls

115 lines (79 loc) · 3.22 KB

Usage

We'll be using npx on this page to run the examples without installing anything.

See installation.md for local install instructions.

Quickstart

npx @scffld/cli github:scffld-dev/cli/examples/simple \
    --name="My Awesome Component" \
    -o ./my-project/src/

Open in StackBlitz

(Windows users will need to remove \ and put everything on one line)

Files will be created in my-project/src

Example of command output

Slightly less-quick start

Use the web-app template without the required name prop:

npx @scffld/cli github:scffld-dev/cli/examples/web-app -o ./my-web-app/src/

A few things to note:

  • It will prompt you for the missing name, and allow you to change the defaults of any other template options
  • Will prompt to overwrite any existing files
  • Displays a custom post install message
  • Prompts you to allow running of custom post install commands

Basic syntax

npx @scffld/cli template [options]

Local templates

  1. Grab one of the example templates & save it locally, or create your own (see templates.md for details)
  2. Run this command, replacing examples/simple with your template name
npx @scffld/cli examples/simple \
    --name="My Awesome Component" \
    -o ./my-project/src/

Files will be created in my-project/src

Show supported options for the template:

npx @scffld/cli examples/simple \
    --help

Try it out with a few options different to the defaults:

npx @scffld/cli examples/simple \
    --name="My Other Component" \
    --includeStyle=false \
    --yeah=false \
    --nah=true \
    -o ./my-project/src/

or leave out all options to be prompted for them:

npx @scffld/cli examples/simple

Remote templates

Templates can be loaded from a remote URL:

npx @scffld/cli https://raw.githubusercontent.com/scffld-dev/cli/develop/examples/simple.md \
    --name="My Remote Component"

or from GitHub:

npx @scffld/cli github:scffld-dev/cli/examples/simple \
    --name="My Remote Component"

and with a specific commit/tag/branch:

npx @scffld/cli github:scffld-dev/cli/examples/[email protected] \
    --name="My Remote Component"

Common options

Option Details
-h --help Show available options for the template
-o --outputDirectory Base directory where files should be written
Defaults to the outputDirectory defined in the template
--overwrite true: overwrite existing files
false: exit instead of overwriting

Other commands

  • show - Outputs the contents of a template
  • generate - Generate template from existing files