Code Monkey home page Code Monkey logo

njt's Introduction

🐸 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.

njt's People

Contributors

dependabot[bot] avatar iamandrewluca avatar kachkaev avatar mikestopcontinues avatar renovate[bot] avatar skratchdot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

njt's Issues

Support searching for package types TypeScript / Flow

Allow to search for main entry types file from package.json if exists, or link to definitelytyped if exists

Candidates for keywords

  • t not available (list of git tags)
  • dt from definitelytyped
  • dts from *.d.ts
  • ts typescript types *.ts
  • ft flow typed
  • flow flow types *.flow
  • types for both TypeScript and Flow, but better to have them separated

Think would be better to have different keywords for TypeScript and Flow

Add default destination configuration when ommited

I'm using njt most of the time just to jump to the repository.
And I have always to type

njt react g

Would be good to have some configuration in web, that you can set for example default destinatio to g and jsut write

njt react

Possible ways to implement it

  • manually set a default destination
  • jump to last used destination
  • use most used destination

ps: I might start a PR soon.

Support for Alfred?

I love this app! It would be great to make the same jumps from Alfred. Any thoughts about an official plugin?

Add support for changelog by other names

Instead of getting a 404 response it would be nice to try the following names since not all projects use CHANGELOG.md, I come across:

  • changelog.md (lowercase)
  • CHANGELOG
  • changelog

Some more possible destinations

Neat tool! I can see how it will save time if I remember to use it!

Some of these are kinda random, some of these I actually use, but thought I'd just go for it, in case any of them strike a chord.

https://npmtrends.com/njt

npm-audit: https://www.gyanblog.com/tutorials/how-node-npm-audit-rest-api-vulnerability/

https://npmgraph.js.org/?q=njt

https://snyk.io/advisor/npm-package/njt

https://socket.dev/npm/package/njt

https://techgaun.github.io/active-forks/index.html#https://github.com/kachkaev/njt

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci.yaml
  • actions/checkout v4
  • pnpm/action-setup v2
  • actions/setup-node v4
  • ubuntu 22.04
npm
cli/package.json
  • chalk ^5.3.0
  • commander ^11.0.0
  • find-package-json ^1.2.0
  • open ^10.0.0
  • ncp ^2.0.0
  • node >=16
package.json
  • @vercel/analytics 1.1.1
  • hosted-git-info 7.0.1
  • lru-cache 10.0.2
  • next 14.0.2
  • react 18.2.0
  • react-dom 18.2.0
  • styled-components 6.1.8
  • styled-normalize 8.1.0
  • url 0.11.3
  • @kachkaev/eslint-config-react 0.6.0
  • @kachkaev/markdownlint-config 0.5.0
  • @next/eslint-plugin-next 14.0.2
  • @tsconfig/next 2.0.3
  • @tsconfig/strictest 2.0.5
  • @types/hosted-git-info 3.0.5
  • @types/node 20.12.7
  • @types/react 18.2.79
  • eslint 8.57.0
  • husky 9.0.11
  • lint-staged 15.2.2
  • markdownlint-cli 0.39.0
  • npm-run-all2 6.1.2
  • prettier 3.2.5
  • prettier-plugin-packagejson 2.5.0
  • prettier-plugin-sh 0.14.0
  • typescript 5.4.5
  • pnpm 9.0.5

  • Check this box to trigger a request for Renovate to run again on this repository

Proposal to make njt fully configurable

Warning

This proposal is still in progress to be filled in.
The maintainer will be pinged when it is complete.
But they may pitch in if they understand the idea πŸ˜„

To be changed:

  • REPO: Allow any destinations to be proposed and added without a default shortcut.
  • WEB: Default to current existing destinations and their shortcuts.
  • CLI: Default to current existing destinations and their shortcuts.

Later:

  • WEB: Allow changing the list of active destinations.
  • WEB: Allow changing the shortcuts of the active destinations.
  • CLI: Allow changing the list of active destinations via configuration.
  • CLI: Allow changing the shortcuts of the active destinations via configuration.

Possibilities:

  • More than 1 letter shortcuts
  • Fuzzy search for any destinations
  • Add Raycast support
Experiment Raycast

https://github.com/allindevelopers/npmgo/blob/main/index.ts
https://github.com/allindevelopers/raycast-npmgo/blob/main/src/index.tsx

New:

image

Old:

image

Privacy policy: add to README.md and/or website

Currently, there is nothing (that I could find) stating if any data is collected on https://njt.vercel.app/ during use, whether beginning there or just hopping through from CLI or browser extension (etc.), and what will and will not be done with said data.

I'm imagining that's because no data is collected -- aside from the boring goes-without-saying side effect of hosting / DNS / etc. -- but it would be nice to make that explicit.

Additional keywords: tracking, analytics, google, targeted ads, data broker

Keyword search does not work as intended in Firefox

Hi @kachkaev! Thanks for making this time-saving utility.

When I try to add the keyword search for njt in Firefox, the following location gets added:

https://njt.vercel.app/jump?from=bookmark&to=%s

The problem is this value only accepts the package name but not the destination. For e.g., if I search

njt react d

it takes me to the DuckDuckGo search results page instead of the React docs page. I tried updating the location to:

https://njt.vercel.app/jump?from=bookmark&to=%s %s

but I still face the same issue.

Could you please suggest a solution?

Thanks & with regards,
Viraj

VSCode integration

Awesome project! I'm adding njt as a search bookmark in Firefox right away.

Another idea for a useful integration: a VSCode extension to add a single command to VSCode's command palette (accessible by pressing F1).

Add OpenSearch description file

In the past I'm sure I saw somewhere that is possible to add some meta tags in page head, that tells browser that this page can be used as a search engine, and there will be no more need to add njt manually as a search engine. You just search once on njt.now.sh and search engine should be added.

Needs investigation.

Ok. It is possible. Found
https://developer.mozilla.org/en-US/docs/Web/OpenSearch

Example https://bundlephobia.com/

<link rel="search" type="application/opensearchdescription+xml" href="/open-search-description.xml" title="bundlephobia" />

https://bundlephobia.com/open-search-description.xml

<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
    <ShortName>bundlephobia</ShortName>
    <Description>Search npm packages on bundlephobia</Description>
    <InputEncoding>UTF-8</InputEncoding>
    <OutputEncoding>UTF-8</OutputEncoding>
    <Language>en-us</Language>
    <Image width="32" height="32" type="image/png">https://bundlephobia.com/favicon-32x32.png</Image>
    <Tags>bundlephobia</Tags>
    <Url type="text/html"
         template="https://bundlephobia.com/result?p={searchTerms}"/>
    <moz:SearchForm>https://bundlephobia.com</moz:SearchForm>
</OpenSearchDescription>

Support searching npm directly

Sometimes I want to search on npm.

  • I can go to npmjs and search
  • I can add npmjs as search engine and search directly in address bar

Would be great to have also this into njt, having f (find) as a keyword (s is already used)

njt -> google map react f -> https://www.npmjs.com/search?q=google+map+react

New entry point suggestion

Suggestion

It would be awesome if we had a bit.dev integration!

Bit is an open-source cli tool for collaborating on isolated components across projects and repositories. (in short, it's yarn but for UI component packages).

Something like njt prettier b can be a good choice but let's talk about it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.