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

@gb-nx/cli

v5.0.0

Published

This library was generated with [Nx](https://nx.dev).

Downloads

25

Readme

@gb-nx/cli

This library was generated with Nx.

CI npm version

Nx Plugin adding command line applications in your Nx workspace

Features

Here is a list of some of the coolest features of the plugin:

  • ✅ Generation of command line applications
  • ✅ You work with the commands and the plugin manages boilerplate
  • ✅ Building, testing, etc your projects

Prerequisite

If you have not already, create an Nx workspace with the following:

# npm
npx create-nx-workspace@latest

# yarn
yarn create nx-workspace@latest

Getting Started

Then you need to install the plugin in order to generate cli applications later on.

Installing Plugin

# npm
npm install @gb-nx/cli --save-dev

# yarn
yarn add @gb-nx/cli --dev

Generating Project

Simply run the application generator with the following command:

nx g @gb-nx/cli:application my-app

Working with your Project

nx build my-app

Add a command to the project with the command generator

nx g @gb-nx/cli:command <name> --project my-app

See nx g @gb-nx/cli:command --help for examples with command parameters and options.

You'll want to edit the generated cli.config.json file to document your command. The values from the config file are used to generate the boilerplate for your project.

The refresh generator refreshes your project's boilerplate. See the options below. Run this command when you change your cli.config.json file.

nx g @gb-nx/cli:refresh --project my-app --main --ts --markdown --all

or

nx sync my-app

| OPTION | DESCRIPTION | | ------------ | ---------------------------------------------------- | | --main | generate the build target main entry point | | --markdown | generate the commands.md file in your project root | | --ts | generate the typing files for your commands | | --all | generate all the things |

About nx serve

The nx serve command will run the application with no options or parameters resulting in the message ERROR No command specified. To use nx serve, temporarily edit your main.ts to bypass the argv parsing and run the command you want.

Of course, you want to revert such changes before building and distributing your multi-command CLI.

Alternatively, use a command like the following

nx build your-app;node dist/apps/your-app/main.js your-command your-parameter

If your CLI has only one command, consider using the plain @nx/node:application generator

Migrations

This plugin supports Nx migrations and provides necessary version and code updates. So instead of bumping plugin version manually in package.json it's recommended to run nx migrate @gb-nx/cli command, that includes bumping the version of the @gb-nx/cli plugin, related dependencies and running code migrations.

@gb-nx/cli & Nx Compatibility Chart

| @gb-nx/cli version | Nx version | | ------------------ | ---------- | | ^5.0.0 | >=17.0.0 | | ^4.0.0 | ^17.0.0 | | ^3.0.0 | ^16.0.0 | | <3.0.0 | ^15.0.0 |

License

MIT