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

@nix2/nix-cli

v1.1.3

Published

Command line interface for common tasks for Nix2 Infrastructure

Downloads

17

Readme

Installation

All you need is to install is node

$ npm i -g @nix2/nix-cli

Usage

The basic command is nix-cli which if you are using the zsh plugin you are given an alias of dev. The rest of the documentation uses dev but should be the same for nix-cli.

When running the command with no arguments, it will default to dev info.

Table of Contents

Commands

This CLI is built with commander.js, which generates help screens based off the structure of the application. To get help on any commands, just run dev help.

$ dev help

Usage: nix-cli [options] [command]

Options:
  -v                        output cli version
  -h, --help                display help for command

Commands:
  auth                      authenticate to a user account
  info                      display service context info
  init [options] [dirname]  initialize a service
  make                      make things related to your service
  authors                   manage your authors
  cache                     manage your cache
  help [command]            display help for command

Auth

Authenticate the CLI user.

NOTE This is currently WIP so it is a mock authentication.

Init

Initialize a service.

The init command needs to be provided a service type. If there is no service provided as the agument, it will prompt the user to select all the valid service types from a list.

Here are the two ways you can initialize.


$ dev init
? Select the type
> typescript
  graphql

$ dev init graphql

After selecting the service type, it will prompt you on filling in details for the service. Each service has different initialize data but there are four options that all are asked for, no matter the service type.

| Name | Description | Default | | :-----------: | ---------------------------- | :---------------------------: | | identifier | Service Identifier | Taken from the directory name | | label | Service Label (for humans) | Taken from the service ID | | description | Service Description | "A Nix² Service" | | userLeadDev | Makes the user the leadDev | true |

Info

The info command will give you basic info on your current Service Context.

$ dev info

Nix2 CLI version 1.0.1
local data from service.yaml
|
|  Blog (blog)
|  The blog service
|  v1.0.0  -  1 dev
|

Make

The make command allows a developer to make certain services that are supported by a service. The access to files that can be created with make depends on your plugin configuration. Each service has different files that can be created with make but there are still some files that are avaliable with all plugins.

| Name | File | Description | | :---------: | :----------: | ---------------------- | | readme | README.md | Creates a README file. | | gitignore | .gitignore | Creates a .gitignore |

Database

The database command or db, allows a developer to create, modify, deploy, maintain, and retire a service's database.

Nix2 uses FaunaDB for databases.

Auth

Authenticates yourself with FaunaDB.

List

Lists all the Nix2 databases.

Create

Creates a service database.

Link

Links a service with a database.

Schemas

Functionality for controlling service schemas.

List

Lists basic info for the service's schemas.

A shortcut for this command is dev schemas

$ dev schemas list

Displaying 1 schema
┌──────┬───────┬─────────────┐
│ ID   │ Label │ Description │
├──────┼───────┼─────────────┤
│ user │ User  │ A Serv User │
└──────┴───────┴─────────────┘

Add

Add schemas by their ID.

$ dev schemas add user

⚠  About to write to service.yaml

identifier: 'user'
label: 'User'
pluralName: 'users'
fields:

? Proceed with adding schema? Yes
✔ Schema user added

Remove

Remove schemas by their id.

$ dev schemas remove user

⚠  About to write to service.yaml

identifier: 'user'
label: 'User'
pluralName: 'users'
fields:

? Proceed with removing user? Yes
✔ Schema user removed

You can also use the -y flag to skip the confirmation screen.

Authors

Functionality for controlling service authors.

List

Lists basic info for the service's authors.

A shortcut for this command is dev authors

$ dev authors list

Displaying 2 authors
┌──────────────────────┬──────────┬─────────┐
│ Email                │ Name     │ Flags   │
├──────────────────────┼──────────┼─────────┤
│ [email protected]         │ Max Koon │ leadDev │
├──────────────────────┼──────────┼─────────┤
│ [email protected]      │ Support  │ support │
└──────────────────────┴──────────┴─────────┘

Add

Add authors by their email.

$ dev authors add [email protected]

⚠  About to write to service.yaml

{
  email: '[email protected]',
  name: 'Max',
  publicEmail: null,
  url: null,
  alert: 'none',
  flags: [ 'dev' ]
}

? Proceed with adding author? Yes
✔ Author [email protected] added

To add data to author you can use different parameters which can be listed with help flag.

This will return:

$ dev authors add --help

Usage: nix-cli authors add [options] <email>

Options:
  -n, --authorName [name]          name of the author
  -E, --publicEmail [publicEmail]  email to use for the public
  -u, --url [url]                  author url
  -a, --alert [alert]              alert options
  -p, --public                     set the public flag
  -d, --dev                        developer flag
  -D, --ldev                       lead dev flag
  -s, --support                    support flag
  -y, --yes                        skip the confirmation screen
  -h, --help                       display help for command

NOTE Each author's data is cached for the most recent usage so you don't need to retype all these parameters each time you add an author. To clear cache please read this

Remove

Remove authors by their email.

$ dev authors remove [email protected]

⚠  About to write to service.yaml

{
  email: '[email protected]',
  name: 'Max',
  publicEmail: null,
  url: null,
  alert: 'none',
  flags: [ 'dev' ]
}

? Proceed with removing author? Yes
✔ Author [email protected] removed

You can also use the -y flag to skip the confirmation screen.

Plugins

Plugins were added in version 1.1.0, and enhances the scalability of the CLI, and allow for core functions to be separate from the services.

You can manage plugins with the plugin command.

List

$ dev plugins list

----------
graphql
typescript
----------

Add

$ dev plugins add typescript

✓ Installed typescript

Remove

$ dev plugins remove typescript

✓ Removed typescript

Update

$ dev plugins update *

✓ Updated typescript
✓ Updated graphql

NPR

The Nix Plugin Registry is the container of all plugin information. Information including names, descriptions, and versions.

The NPR runs on the npr repository. It functions completely with github actions.

Environment

There are multiple environments for deployed services such as development and production. With the env command you can manage your selected environment

List

List all the available environments

$ dev env list

------------
 - prod
 - dev  (selected)
------------

Switch Environments

$ dev env prod

✔ switched to env: 'prod'

Version

Service versioning follows Semantic Versioning

To get the current version you can run

$ dev version

The 'example-service' is on version 2.0.1

You can bump the version manually by doing:

$ dev version 2.0.2

Updated version to 2.0.2

You can also bump with patch, minor, or major.

$ dev version minor

Updated version to 2.1.0

Update

Updates the CLI with yarn.


$ dev update

✔ Updated the CLI

Cache

Clear

To clear all the cache use:

$ dev cache clear