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

@mathieudutour/gatsby-cli

v2.4.20

Published

Gatsby command-line interface for creating new sites and running Gatsby commands

Downloads

13

Readme

gatsby-cli

The Gatsby command line interface (CLI). It is used to perform common functionality, such as creating a Gatsby application based on a starter, spinning up a hot-reloading local development server, and more!

Let's you create new Gatsby apps using Gatsby starters.

The Gatsby CLI (gatsby-cli) is packaged as an executable that can be used globally--in fact, this was previously how we recommended using the CLI.

However, global installs of the Gatsby CLI can sometimes lead to subtle bugs in behavior and functionality if the version of the globally installed executable does not match the version of Gatsby in your application. To avoid this, we highly recommend using the package.json script variant of these commands, typically exposed for you with most starters.

For example, if we want to make the gatsby develop command available in our application, we would open up package.json and add a script like so:

{
  "scripts": {
    "develop": "gatsby develop"
  }
}

We can now use the develop script tied to our app's version of Gatsby, rather than a globally installed version. This script can be invoked by using the name of the script, e.g. npm run develop in this case. Feel free to read more about NPM scripts if you're interested!

How to use

The Gatsby CLI is available via npm and should be installed globally by running npm install -g gatsby-cli to use it locally.

Run gatsby --help for full help.

Commands

new

gatsby new gatsby-site

See the Gatsby starters docs for more.

develop

At the root of a Gatsby app run gatsby develop to start the Gatsby development server.

Options

| Option | Description | Default | | :-------------: | ----------------------------------------------- | :---------: | | -H, --host | Set host. | localhost | | -p, --port | Set port. | 8000 | | -o, --open | Open the site in your (default) browser for you | | | -S, --https | Use HTTPS | |

Follow the Local HTTPS guide to find out how you can set up an HTTPS development server using Gatsby.

build

At the root of a Gatsby app run gatsby build to do a production build of a site.

Options

| Option | Description | Default | | :--------------------------: | ----------------------------------------------------------------------------------------------------------- | :-----: | | --prefix-paths | Build site with link paths prefixed (set pathPrefix in your config) | false | | --no-uglify | Build site without uglifying JS bundles (for debugging) | false | | --open-tracing-config-file | Tracer configuration file (open tracing compatible). See https://www.gatsbyjs.org/docs/performance-tracing/ | |

serve

At the root of a Gatsby app run gatsby serve to serve the production build of the site

Options

| Option | Description | | :--------------: | ---------------------------------------------------------------------------------------- | | -H, --host | Set host. Defaults to localhost | | -p, --port | Set port. Defaults to 9000 | | -o, --open | Open the site in your (default) browser for you | | --prefix-paths | Serve site with link paths prefixed (if built with pathPrefix in your gatsby-config.js). |

clean

At the root of a Gatsby app run gatsby clean to wipe out the cache (.cache folder) and public directories. This is useful as a last resort when your local project seems to have issues or content does not seem to be refreshing. Issues this may fix commonly include:

  • Stale data, e.g. this file/resource/etc. isn't appearing
  • GraphQL error, e.g. this GraphQL resource should be present but is not
  • Dependency issues, e.g. invalid version, cryptic errors in console, etc.
  • Plugin issues, e.g. developing a local plugin and changes don't seem to be taking effect

info

At the root of a Gatsby site run gatsby info to get helpful environment information which will be required when reporting a bug.

Options

| Option | Description | Default | | :-----------------: | ------------------------------------------------------- | :-----: | | -C, --clipboard | Automagically copy environment information to clipboard | false |

repl

Get a node repl with context of Gatsby environment