Glanceway Glanceway
Tüm kaynaklar

npm Trending

Geliştirici v1.0.0

Popular and trending packages on npm

@codytseng #npm #packages #javascript

Install and configure this source

  1. Install Glanceway and open it on your Mac before using the install link above.
  2. Choose Install in Glanceway. If the browser cannot open the app, download the .gwsrc file and import it through source management.
  3. Complete the required fields below, save, and choose a refresh interval. Check the source after its first successful fetch.

Configuration checklist

  • KEYWORD — Optional. Search keyword, e.g. typescript, react, cli, ai

If items are missing

  • Verify the field names, list entries, and credentials against the current version’s configuration table. Sample values below are examples, not active credentials.
  • Check network access and upstream service availability. Authentication failures and rate limits can prevent a refresh; use a slower interval when the provider limits requests.
  • An empty result can also mean there are no matching items. Fetched content and update timing depend on the provider and source implementation.

Yapılandırma

Ad Anahtar Tür Zorunlu Varsayılan Açıklama
Keyword KEYWORD string Hayır typescript Search keyword, e.g. typescript, react, cli, ai

Kaynak Kodu

id: codytseng/npm-trending
version: 1.0.0
name: npm Trending
description: Popular and trending packages on npm
author: codytseng
author_url: https://github.com/codytseng
category: Developer
tags:
  - npm
  - packages
  - javascript

config:
  - key: KEYWORD
    name: Keyword
    type: string
    required: false
    default: typescript
    description: "Search keyword, e.g. typescript, react, cli, ai"
module.exports = async (api) => {
  const keyword = api.config.get("KEYWORD") || "typescript";

  async function fetchData() {
    const res = await api.fetch(
      `https://registry.npmjs.org/-/v1/search?text=${encodeURIComponent(keyword)}&popularity=1.0&quality=0.5&maintenance=0.0&size=250`,
    );

    if (!res.ok || !res.json) {
      throw new Error(`Failed to fetch npm search results (HTTP ${res.status})`);
    }

    api.emit(
      res.json.objects.map((obj) => {
        const pkg = obj.package;
        const author = pkg.publisher?.username
          ? ` · by ${pkg.publisher.username}`
          : "";

        return {
          id: pkg.name,
          title: `${pkg.name}@${pkg.version}`,
          subtitle: `${pkg.description || ""}${author}`,
          url: pkg.links.npm,
          timestamp: pkg.date,
        };
      }),
    );
  }

  await fetchData();

  return {
    refresh: fetchData,
  };
};

İlgili Kaynaklar