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

dns-namecheap-cli

v0.0.3

Published

## Introduction Once upon a time, I naively thought to myself:

Downloads

9

Readme

Namecheap CLI

Introduction

Once upon a time, I naively thought to myself:

Wouldn't it be nice if I could modify my DNS records from the CLI with a quick command, rather than needing to open the browser, log in, navigate to what I needed, make the changes only to then close all of those things again?

To some extent - I agree with that old, more naive version of me. Only with the added twist of knowing that I'd be insane to try such a thing with the horrible API provided by Namecheap, and what appears to be a lack of intent to do anything about it. People have been asking for fairly simple improvements for many moons. It's "with the product team". Who knows, maybe they'll improve it soon. Will I have finished migrating to a new DNS by then? Probably.

Installation

Install using npm i -g dns-namecheap-cli.

Configuration

The configuration is stored in a file called .namecheap-cli in the users home directory. The home directory is found using require('os').homedir(), so it should be fairly reliable.

A configuration file is created when you try to use a command that requires it. You can update the config manually by editing the json, or use the config commands.

# namecheap-cli config set username J4Wx
# namecheap-cli config set apiKey someApiKeyStringHere

Should do the trick!

Commands!

There are currently only a handful of commands. It's unlikely I'll add any more, but I'm open to it. And PRs are welcome.

Config

Config has two subcommands; get and set.

config get

You can check a config file entry using:

# namecheap-cli config:get <field>

For example:

# namecheap-cli config:get username
The current config setting for username is J4Wx

config set

You can update a config file entry using:

# namecheap-cli config:set <field> <value>

For example:

# namecheap-cli config:set username J4Wx

Domains

You can interact with your domains, well... list them ¯\(ツ)/¯.

domains:list

This command will return a list of the domains on your account. Each page will return 20 results.

# namecheap-cli domains:list <page = 1>

Hosts

You can interact with your domains hosts! This is where it gets useful. At least a little bit.

hosts:list

This command will return a list of the hosts for a domain.

# namecheap-cli domains:list <domain>

For example:

# namecheap-cli domains:list github.com

hosts:set

This command will update the specified host with the params you provide. Technically it will actually update all of your hosts thanks to the fact the setHosts method deletes and adds every single host. A list of your current hosts is retrieved (and updated if required) and sent back. So your hosts shouldn't change.

Don't ask why.

# namecheap-cli hosts:set <domain> <hostname> <type> <address> <ttl = 1800>

So to add add/update an entry at demo.github.com to point to 1.1.1.1 with type A and a TTL of 30000, you would execute:

# namecheap-cli hosts:set github.com demo a 1.1.1.1 30000