0.1.8 • Published 2 years ago

@thumbsmith/cli v0.1.8

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

@thumbsmith/cli

Command line interface for creating and managing Thumbsmith thumbnails.

Features a light weight, live reloading, vite-based development environment for best developer experience.

Installation

npm i @thumbsmith/cli -g

Usage

thumbsmith -h

Commands:
  init [name]      Create a new thumbnail template
  dev <file>       Start the development server on a thumbnail
  deploy <file>    Deploy a thumbnail template to your account
  download <name>  Download a thumbnail template file from your account

Init command

Create a new thumbnail template.

thumbsmith init [name] --starter <starter>

A new template file will be created in the directory where you ran the command.

You can then open and edit this file with your code editor of choice.

Example:

thumbsmith init
# or
thumbsmith init blog

Starter option

You can also specify a starter template to start from via the --starter option.

Example:

thumbsmith init product --starter=e-commerce

Dev command

Start the development server on a thumbnail.

thumbsmith dev <file>

A development server will be open on http://localhost:3000/

Example:

thumbsmith dev blog.thumbnail.html
# or
thumbsmith dev blog.thumbnail.html --open --port=4000

Options

  • --host host: string specify hostname
  • --port <port>: number specify port
  • --open: open browser on startup

Development assets

You can create a public folder that lives next to the thumbnail file to serve images for your thumbnail during development. In production, you can host them on your website or in any way you see fit.

Deploy command

Deploy a thumbnail template to your account. Requires authorization.

thumbsmith deploy <file>

The specified file will be synced to your account and made available on the Thumbsmith CDN.

This can be useful to setup automatic deployment of the thumbnail in your CI/CD workflows.

Example:

thumbsmith deploy blog.thumbnail.html
# or
thumbsmith deploy blog.thumbnail.html --api-token=MY_THUMBSMITH_TOKEN

Download command

Download a thumbnail template file from your account. Requires authorization.

thumbsmith download <name>

A template file with the contents of the specified template will be added in the directory where you ran the command.

Example:

thumbsmith download blog
# or
thumbsmith download blog --api-token=MY_THUMBSMITH_TOKEN

Authorization

Some commands require authorization (via API token) to an account to operate.

Getting an API token

Each account gets an API token on signup. Once you're logged in your account, go in the settings page and scroll to the "API Token" section.

Once there, you can see and copy the token by clicking on the eye icon on the input.

Providing the token to the CLI

There are 2 ways to provide the token to the CLI:

Via the --api-token parameter:

thumbsmith some-action --api-token=MY_THUMBSMITH_TOKEN

Via the THUMBSMITH_API_TOKEN environment variable (recommended):

We recommend this method as passing the token via the command line parameter might log it in your CI/CD's workflow or in other process monitoring tools, which might not be safe.

Depending on your environment, use the appropriate method to set the THUMBSMITH_API_TOKEN environment variable, then run the thumbsmith command.

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.3-rc.1

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.1-rc.1

2 years ago