• Stars
    star
    312
  • Rank 133,700 (Top 3 %)
  • Language
    TypeScript
  • License
    BSD 3-Clause "New...
  • Created almost 5 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

njt (npm jump to): a quick navigation tool for npm packages

🐸 njt 🐸

🐸 npm jump to 🐸
njt.vercel.app

Do you type package names in your search engine and then navigate to their source, homepage, changelog and so on? πŸ•πŸ•‘πŸ•’πŸ•“πŸ•”

Save five seconds thousands of times by quickly jumping to the right URL:

🐸✨🐸✨🐸
njt <package> [destination]
🐸✨🐸✨🐸

Available destinations

  • b β†’ package cost estimation on bundlephobia.com
  • c β†’ changelog
  • g β†’ github (gitlab, etc.) repository root
  • h β†’ homepage (aliased as w for website or d for docs)
  • i β†’ issues
  • n β†’ package info on npmjs.com
  • p β†’ pull requests (aliased as m for merge requests)
  • r β†’ list of github releases
  • s β†’ source (often same as repository root, but can be its subdirectory in case of a monorepo)
  • t β†’ list of git tags
  • u β†’ package contents preview on unpkg.com
  • v β†’ list of package versions with dates on npmjs.com
  • y β†’ package page on yarnpkg.com (mirror registry for npmjs.com)
  • . β†’ browse GitHub / GitLab code

Omitting the destination or entering an non-existing one takes you to the package page on npmjs.com as if you used n.

Examples

njt prettier (no specified destination)
🐸 β†’ https://www.npmjs.com/package/prettier

njt prettier h (homepage)
🐸 β†’ https://prettier.io

njt prettier s (source)
🐸 β†’ https://github.com/prettier/prettier

njt prettier r (releases)
🐸 β†’ https://github.com/prettier/prettier/releases

njt prettier y (yarn)
🐸 β†’ https://yarnpkg.com/package/prettier

Getting njt

There are several environments in which you can access njt. Pick your favourite or use ’em all!

🟒 Command-line tool

Install njt globally from npm by running this command in your terminal:

npm install --global njt

You are all set. Now try executing njt <package> [destination] with some real arguments. For example, these two commands will take you to the Lodash github repo and homepage, respectively:

njt lodash g
njt lodash h

A list of supported destinations will be shown if you launch njt without arguments.

To uninstall, run npm remove --global njt. To reinstall or upgrade, run npm install --global njt again.

Pro tip πŸ’‘ When you specify . instead of a package name, njt takes the name from the nearest package.json file.

Pro tip πŸ’‘ To customise which browser you want to open, set an environment variable called NJT_BROWSER (or just BROWSER) with the app name of your choice. The value may vary based on your OS. Note that setting BROWSER instead of NJT_BROWSER can affect other tools, which may or may not be desired.

🟒 Custom search engine in Chrome

  1. Open Chrome settings, e.g. by navigating to chrome://settings

  2. Navigate to Manage search engines section (e.g. by typing its name in the Search settings field)

  3. Click Add next to Other search engines

  4. Fill in the Add search engine form:

    Field Value
    Search engine njt (npm jump to)
    Keyword njt
    Url with %s in place of query https://njt.vercel.app/jump?from=chrome&to=%s
  5. Press Add

From now on, typing njt <package> [destination] in the address bar will take you directly to a page you want. For example, njt react h will take you to the React.js homepage.

To uninstall, open Manage search engines section in Chrome settings, click on three dots next to Other search engines β†’ njt and hit Remove from list.

Pro tip πŸ’‘ You can use n instead of njt as a keyword to avoid typing two extra characters each time. The command to type in Chrome address bar will become n <package> [destination] πŸš€

🟒 Search bookmark in Firefox

You can use njt right from the address bar in Firefox.

  1. Open njt.vercel.app
  2. Right-click on the search input field
  3. In the context menu, select Add Keyword for this Search...
  4. You’ll see a small form; type njt into the Keyword field
  5. Press Save

From now on, typing njt <package> [destination] in the address bar will take you directly to a page you want. For example, njt react h will take you to the React.js homepage.

To uninstall, open Firefox bookmarks from the main menu, search for njt and remove the bookmark.

Pro tip πŸ’‘ You can use n instead of njt as a search keyword to avoid typing two extra characters each time. The command to type in Firefox address bar will become n <package> [destination] πŸš€

🟒 Alfred web search

Want to hop directly from Alfred launcher?

  1. Open Preferences β†’ Features β†’ Web Search

  2. Click Add Custom Search

  3. Fill in the form:

    Field Value
    Search URL https://njt.vercel.app/jump?from=alfred&to={query}
    Title Search njt for '{query}'
    Keyword njt
    Icon drag from https://njt.vercel.app/favicon-32x32.png
  4. Press Save

Alternatively, copy and open this special Alfred link to get all the above steps done for you:

alfred://customsearch/Search%20njt%20for%20%27%7Bquery%7D%27/njt/utf8/nospace/https%3A%2F%2Fnjt.vercel.app%2Fjump%3Ffrom%3Dalfred%26to%3D%7Bquery%7D

Pro tip πŸ’‘ You can use n instead of njt as a search keyword to avoid typing two extra characters each time. The command to type in Alfred address bar will become n <package> [destination] πŸš€

You can also create variants with your favorite njt suffixes to jump to your favorite locations in even fewer characters. For example, keyword ng can be a shortcut to njt {query} g.

🟒 VSCode

If you use Visual Studio Code, you can add njt to the command palette via LaunchX extension.

  1. Install the extension

  2. Open the command palette

  3. Type njt and press Enter

    njt in VSCode command palette

  4. Type your search and press Enter again

Pro tip πŸ’‘ Use ctrl+alt+n to bypass the command palette.

🟒 DuckDuckGo bang

DuckDuckGo bang is awaiting approval (please help if you know how to speed up the process).

If you use duckduckgo.com as your primary search engine, type !njt <package> [destination] in its search field (note the leading exclamation mark). This trick is possible thanks to DuckDuckGo’s awesome bang feature.

🟒 Online search field on the njt’s mini-website

Open njt.vercel.app, type your query, press Enter. This method is a bit slower than the other ones because it involves opening a web page with an input form. On the plus side, it works everywhere and does not require setup.

Thanks to Vercel for hosting njt.vercel.app πŸ’š

❓More ways

Are you a search shortcut guru? Feel free to suggest another entry point to njt and save people’s time around the world!

How njt works

Query resolution

The logic of njt is centralized and located within the njt.vercel.app/jump endpoint (source).

All njt interfaces submit user queries to https://njt.vercel.app/jump?from=UI_ID&to=USER_QUERY, from which you are redirected to the destination.

For queries like njt <package> or njt <package> y, the redirects are straightforward: https://www.npmjs.com/package/<package> or https://yarnpkg.com/package/<package>.

Most other cases involve a look into package.json for the latest version of the searched package. This file is fetched from www.npmjs.com. It contains the location of the repository, the homepage and some other fields which are used to construct the destination URL.

Privacy

Official njt interfaces and the njt.vercel.app/jump endpoint do not store submitted queries. Since njt.vercel.app is hosted by Vercel, performance and usage data is logged by the infrastructure (see Vercel Analytics).

When njt navigates to https://njt.vercel.app/jump?from=UI_ID&to=USER_QUERY, parameter from=UI_ID is sent to the endpoint alongside the user query. The value is currently ignored but it may be used in the future for resolving queries or for analysing the popularity of njt interfaces.

Prior art

Shortcuts to some of the njt destinations are built into npm cli:

πŸ“¦ npm home <package> or npm docs <package>
β­₯
🐸 njt <package> h (homepage)


πŸ“¦ npm issues <package> or npm bugs <package>
β­₯
🐸 njt <package> i (issues)


πŸ“¦ npm repo <package>
β­₯
🐸 njt <package> g (github, gitlab, etc. repo)

With njt, you have access to more shortcuts in multiple environments, which makes you more productive day to day.

More Repositories

1

php-r

Provides ability to run R scripts from PHP
PHP
143
star
2

KachkaevAssetsVersionBundle

Automates the process of updating assets version in Symfony2 & Symfony3 projects
PHP
57
star
3

tooling-for-how-old-is-this-house

Tooling for adding new cities to https://how-old-is-this.house/en
TypeScript
40
star
4

video-easter-eggs

A visual analytics tool for finding Easter eggs in videos
TypeScript
9
star
5

website

Personal mini-website built with Next.js, React, TypeScript, Tailwind and Playwright
TypeScript
9
star
6

aws-iot-button-logger-to-git

Lambda function that can be triggered by an AWS IoT device to log clicks in a git repository
TypeScript
7
star
7

suppress-exit-code

Cross-platform CLI wrapper that runs any command and exits with zero
JavaScript
6
star
8

special-internet-archive

Tooling to archive web pages
TypeScript
5
star
9

routine-npm-packages

A monorepo with npm packages commonly used in personal projects
JavaScript
5
star
10

KachkaevDropboxBackupBundle

[ABANDONED SINCE 2013] Allows backing up your mysql database to dropbox using symfony console
PHP
5
star
11

city4people-wiki

PHP
4
star
12

CICommandLineFaceDetector

A simple command line tool to detect faces in photographs using Apple’s Core Image Library
Objective-C
3
star
13

graph-plotter

TypeScript
3
star
14

graphql-type-regexp

RegExp scalar type for GraphQL.js, https://www.npmjs.com/package/graphql-type-regexp
JavaScript
2
star
15

react-boilerplate-react-map-gl-mwe

JavaScript
2
star
16

KachkaevPHPRBundle

Symfony2/3 bundle for integration with php-r library that provides ability to run R scripts from PHP
PHP
2
star
17

github-actions-color-ouput-bug

Missing space
1
star
18

styled-components-with-heavy-svgs-mwe

SVG Performance problem reproduction for iOS Safari / Chrome
JavaScript
1
star
19

kachkaev

meta
1
star
20

next-i18n

A simple yet powerful way of making your Next.js app multilingual (powered by i18next)
JavaScript
1
star
21

survey-glyphs

Photo Content Assessment tool for my PhD project. http://www.photoassessment.org/
JavaScript
1
star