Comments (9)
That's a cool idea! Although I think I'd prefer keeping that second step in the CLI, something like this:
- User enters
njt <package>
without a destination (current behavior would be to default ton
) - Show a list of destinations sorted by keyword, something like this:
- ... with a prompt as well of course. Accepting input as soon as it matches a keyword (and if you introduce two-character keywords, if there isn't a longer keyword that start with the same character) without needing to hit enter would help keep the number of keystrokes low.
- A nice touch would be to delete most of those lines from the CLI after a choice was made, leaving only a summary of the flow.
Here's how that might look with 2-character keywords:
(added pp
from #172)
Personally, I don't think two-character keywords would be all that terrible, but I definitely think most users will only be a actively using a few.
I've been pondering the addition of a config, so users can change the default keywords as desired, maybe disable destinations they don't plan to use, or otherwise tweak the behavior.
Edit: screenshots above cobbled together with this code.
Edit 3: The above is CLI-centric, but something similar could be done on the website (keyboard shortcuts, minimal keystrokes, option to keep hands on keyboard).
from njt.
👋 @mrienstra! njt
CLI is just one of several user interfaces (entry points) for njt
. If we add more keywords and figure out UX for cli
, other environments like browsers, Alfred, etc. may degrade UX-wise. More keywords means more cognitive load on a human and therefore higher chances of landing on the wrong page.
Before we add more keywords, what we probably need is a universal way of providing search prompts for the query (like Google does when we type text in the browser’s address bar). Maybe we should explore this direction first, find a universal solution and then port it to all interfaces we have (which will include CLI). WDYT?
from njt.
I suggest that we figure out search autocompletion first as it will help with navigating between more destinations. We can frame the feature like this:
As a user, I should be able to type
njt[space]prettier[space]
and see a list of destinations.
I don't have any experience with this kind of stuff bu I believe that we need a new API endpoint which can be auto-discovered by Chrome, FF, Alfred etc. When this is sorted, we can add autocompletion support to njt.vercel.app and CLI. This will unblock pretty much any number of destinations we want. Adding two-letter destinations now will make the tool harder to use because it's difficult to remember a lot of abbreviations.
from njt.
One more possible destination
Find the true size of an npm package.
https://pkg-size.dev
from njt.
One more possible destination
browse type documentation for npm packages
https://tsdocs.dev
from njt.
Thanks for sharing these links @mrienstra – some of them are new to me!
I'd be interested in adding more tools, but I’m not quite sure how to elegantly go beyond one-character keywords. I’m afraid that if we introduce too many shortcuts, people may start jumping to wrong URLs, which will bring more harm than benefit.
I wonder if there’s room for something like d
for dashboard, which would open njt.vercel.app/-/packge-name
. That new page can contain links to all tools including those without direct shortcuts 🤔 WDYT?
from njt.
If you decide to go this route, check out prompts
. I ran across it recently while contributing to astro
, which uses prompts
for two CLI tools.
from njt.
Down to work on this if you'd like.
Also, small detail, but the prompt could show a default entry of n
for npmjs.com, so immediately pressing enter (without other entry) would take you to npmjs.com.
from njt.
Some of my insights.
I'm using this package extensively, daily.
My most used shortcuts are s
n
b
u
c
d
I'm using this package because it increases speed drastically.
I even had an attempt to add a cache layer for njt
results to increase the speed even more.
Personally, I wouldn't mind having shortcuts that will use 2 letters. After you learn them it is very easy to move around.
Having a way to set your own, or disable some shortcuts could also be a nice solution.
Do we have any analytics on what are the most used shortcuts, or how many users use njt
?
Having services with the name of 2 words we can use their initials:
bundlephobia
➡️bp
packagephobia
➡️pp
npmtrends
➡️nt
npmgraph
➡️ng
- ...
from njt.
Related Issues (16)
- Keyword search does not work as intended in Firefox HOT 1
- Add default destination configuration when ommited HOT 5
- Suggest packagephobia HOT 3
- Privacy policy: add to README.md and/or website HOT 2
- Dependency Dashboard
- New entry point suggestion HOT 2
- Add support for current repo HOT 4
- Support searching npm directly HOT 4
- Support for Alfred? HOT 1
- Support searching for package types TypeScript / Flow HOT 6
- Add OpenSearch description file
- Proposal to make njt fully configurable
- Add support for changelog by other names HOT 4
- VSCode integration HOT 3
- Suggest bundlephobia and unpkg entry HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from njt.