npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@guardian/grid-cli

v1.4.0

Published

Helpful commands for interacting with Grid, The Guardian's image management tool.

Downloads

21

Readme

@guardian/grid-cli

Helpful commands for interacting with Grid, The Guardian's image management tool.

oclif Version Downloads/week License

Installing

grid-cli can be installed using either NPM or Brew

NPM

npm install -g @guardian/grid-cli

Usage

$ npm install -g @guardian/grid-cli
$ grid COMMAND
running command...
$ grid (-v|--version|version)
@guardian/grid-cli/1.4.0 darwin-x64 node-v15.3.0
$ grid --help [COMMAND]
USAGE
  $ grid COMMAND
...

Developing

There are a few handy scripts in the ./script directory.

  • new-command.sh which creates new commands, ./scripts/new-command.sh a/b to create a:b
  • update-readme.sh which you should run before committing.

To run the development build of the script, you can run npm run local.

Commands

grid autocomplete [SHELL]

display autocomplete installation instructions

USAGE
  $ grid autocomplete [SHELL]

ARGUMENTS
  SHELL  shell type

OPTIONS
  -r, --refresh-cache  Refresh cache (ignores displaying instructions)

EXAMPLES
  $ grid autocomplete
  $ grid autocomplete bash
  $ grid autocomplete zsh
  $ grid autocomplete --refresh-cache

See code: @oclif/plugin-autocomplete

grid bulk:rights INPUT RIGHTS OUTPUT FAILURES

Reads a text file containing image ids, and sets their usage rights.

USAGE
  $ grid bulk:rights INPUT RIGHTS OUTPUT FAILURES

ARGUMENTS
  INPUT     file to read, containing one grid id per line
  RIGHTS    (noRights|chargeable) usageRights to set
  OUTPUT    file to output results to
  FAILURES  file to write bad ids to

OPTIONS
  -f, --field=field      key or link name to print from each returned image, if none given then image will be output as
                         json

  -h, --help             show CLI help

  -p, --profile=profile  [default: default] Profile name

  -t, --thumbnail        show a thumbnail

See code: src/commands/bulk/rights.ts

grid collection:add-root NAME

Add a root collection

USAGE
  $ grid collection:add-root NAME

ARGUMENTS
  NAME  Root collection to add

OPTIONS
  -h, --help             show CLI help
  -p, --profile=profile  [default: default] Profile name

See code: src/commands/collection/add-root.ts

grid collection:move-images FROM TO

Move images from one collection to another

USAGE
  $ grid collection:move-images FROM TO

ARGUMENTS
  FROM  Collection to rename
  TO    Name of new collection

OPTIONS
  -h, --help             show CLI help
  -p, --profile=profile  [default: default] Profile name

See code: src/commands/collection/move-images.ts

grid configuration:add

Add a configuration profile

USAGE
  $ grid configuration:add

OPTIONS
  -h, --help                       show CLI help
  -k, --apiKey=apiKey              API key
  -m, --mediaApiHost=mediaApiHost  Hostname for media-api
  -p, --profile=profile            [default: default] Profile name

See code: src/commands/configuration/add.ts

grid configuration:read

Echos current config

USAGE
  $ grid configuration:read

OPTIONS
  -a, --all              show all profiles
  -h, --help             show CLI help
  -p, --profile=profile  [default: default] Profile name

See code: src/commands/configuration/read.ts

grid help [COMMAND]

display help for grid

USAGE
  $ grid help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

grid image:delete ID

Delete an image from Grid

USAGE
  $ grid image:delete ID

ARGUMENTS
  ID  ID of image

OPTIONS
  -h, --help             show CLI help
  -p, --profile=profile  [default: default] Profile name

See code: src/commands/image/delete.ts

grid image:download ID

describe the command here

USAGE
  $ grid image:download ID

ARGUMENTS
  ID  ID of image

OPTIONS
  -d, --directory=directory  [default: /tmp] directory to download to
  -h, --help                 show CLI help
  -p, --profile=profile      [default: default] Profile name

See code: src/commands/image/download.ts

grid image:get [ID]

Get an Image from the API

USAGE
  $ grid image:get [ID]

ARGUMENTS
  ID  ID of image

OPTIONS
  -f, --field=field      key or link name to print from each returned image, if none given then image will be output as
                         json

  -h, --help             show CLI help

  -p, --profile=profile  [default: default] Profile name

  -t, --thumbnail        show a thumbnail

  --hydrate              Gets fields which are returned as uris.

See code: src/commands/image/get.ts

grid image:reingest ID

Reingest an image already present in the images bucket

USAGE
  $ grid image:reingest ID

ARGUMENTS
  ID  ID of image

OPTIONS
  -c, --compare          Do a dry run, and display the difference between the result and the data returned for this
                         image from media-api

  -d, --dryRun           Display the result of the reingestion only

  -f, --field=field      key or link name to print from each returned image, if none given then image will be output as
                         json

  -f, --force            Force reingestion if the image is already present in the Grid

  -h, --help             show CLI help

  -p, --profile=profile  [default: default] Profile name

  -t, --thumbnail        show a thumbnail

See code: src/commands/image/reingest.ts

grid image:search [Q]

Search for an Image from the API

USAGE
  $ grid image:search [Q]

ARGUMENTS
  Q  Search query

OPTIONS
  -f, --field=field      key or link name to print from each returned image, if none given then image will be output as
                         json

  -h, --help             show CLI help

  -p, --profile=profile  [default: default] Profile name

  -t, --thumbnail        show a thumbnail

See code: src/commands/image/search.ts

grid image:upload IMAGE

Upload an image to Grid. Can be a local file or a publicly accessible URL

USAGE
  $ grid image:upload IMAGE

ARGUMENTS
  IMAGE  Image to upload. If a URL, it must be publicly accessible

OPTIONS
  -h, --help             show CLI help
  -p, --profile=profile  [default: default] Profile name

See code: src/commands/image/upload.ts

grid image:visit ID

View image in the browser

USAGE
  $ grid image:visit ID

ARGUMENTS
  ID  ID of image

OPTIONS
  -h, --help             show CLI help
  -p, --profile=profile  [default: default] Profile name

See code: src/commands/image/visit.ts

grid util:curl URL

Make an authenticated request to a Grid URL. Assumes response is JSON.

USAGE
  $ grid util:curl URL

ARGUMENTS
  URL  The URL to request

OPTIONS
  -d, --data=data                         The body of the request
  -h, --help                              show CLI help
  -p, --profile=profile                   [default: default] Profile name
  -x, --method=GET|POST|PUT|PATCH|DELETE  [default: GET] The HTTP verb to use

See code: src/commands/util/curl.ts

grid util:id-file FILE

Print the ID a file would get if uploaded to Grid

USAGE
  $ grid util:id-file FILE

ARGUMENTS
  FILE  Path to file to upload

OPTIONS
  -h, --help  show CLI help

See code: src/commands/util/id-file.ts