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 🙏

© 2026 – Pkg Stats / Ryan Hefner

alerte404

v1.1.4

Published

Composant React + scraper pour afficher les alertes enlèvement (justice.gouv.fr).

Readme

Alerte404

Composant React + scraper pour afficher les alertes enlèvement sur votre site.


Comment ça marche

Le site officiel bloque les requêtes navigateur (CORS). Le scraping passe par votre serveur :

Navigateur                      Votre serveur                  Site gouv
    │                               │                              │
    │  GET /api/alerte-enlevement   │                              │
    │──────────────────────────────>│                              │
    │                               │  GET (scrape HTML)           │
    │                               │─────────────────────────────>│
    │                               │<─────────────────────────────│
    │                               │  parse → JSON                │
    │         { title, desc, ... }  │                              │
    │<──────────────────────────────│                              │
    │                               │                              │
    │  <AlerteEnlevementCard />     │                              │
    │  affiche la carte             │                              │

Installation

npm install alerte404 cheerio

cheerio est requis uniquement côté serveur.


1. Backend — créer l'endpoint

Express / Fastify

import express from "express";
import { scrapeAlerteEnlevement } from "alerte404/server";

const app = express();

app.get("/api/alerte-enlevement", async (_req, res) => {
  const data = await scrapeAlerteEnlevement();
  res.json(data);
});

Next.js (App Router)

// app/api/alerte-enlevement/route.ts
import { scrapeAlerteEnlevement } from "alerte404/server";
import { NextResponse } from "next/server";

export async function GET() {
  return NextResponse.json(await scrapeAlerteEnlevement());
}

Nuxt (server route)

// server/api/alerte-enlevement.get.ts
import { scrapeAlerteEnlevement } from "alerte404/server";

export default defineEventHandler(() => scrapeAlerteEnlevement());

2. Frontend — le composant React

import { AlerteEnlevementCard } from "alerte404";

export default function MyPage() {
  return <AlerteEnlevementCard />;
}

Le composant fetch /api/alerte-enlevement automatiquement. Pas d'alerte = rien ne s'affiche. Alerte active = la carte apparaît.


Props (toutes optionnelles)

<AlerteEnlevementCard
  apiUrl="/api/alerte-enlevement"
  showPhotos={true}
  showBanner={true}
  showIcon={true}
  animateIcon={true}
  testMode={false}
  debug={false}
  showSkeleton={true}
  className="my-class"
  style={{ maxWidth: 700 }}
/>

| Prop | Défaut | Description | | ------------- | ------------------------ | --------------------------------------- | | apiUrl | /api/alerte-enlevement | URL JSON (votre backend) | | data | — | Données inline. Pas de fetch si présent | | showPhotos | true | Afficher les visuels | | showBanner | true | Bandeau rouge « Alerte Enlèvement » | | showIcon | true | Triangle d'alerte dans le bandeau | | animateIcon | true | Animation pulsation du triangle | | testMode | false | Bandeau gris + fetch Wayback auto (dev) | | debug | false | Affiche erreurs API + lien Wayback | | showSkeleton| true | Squelette pendant le chargement (false = texte « Chargement… ») | | className | — | Classe CSS sur le wrapper | | style | — | Style inline sur le wrapper |


Personnalisation CSS

Les couleurs se surchargent via des variables CSS sur le wrapper .aec :

.aec {
  --aec-banner: #d90012;
  --aec-banner-text: #ffffff;
  --aec-bg: #ffffff;
  --aec-text: #2d2d2d;
  --aec-accent: #a8000e;
  --aec-radius: 6px;
}

Mode test (dev, sans backend)

<AlerteEnlevementCard testMode debug />

Fetch directement une capture Wayback Machine. Pas besoin de backend pour voir le rendu.


Récapitulatif des imports

| Import | Quoi | Dépendance supp. | | ------------------ | ----------------------- | ---------------- | | alerte404 | Composant React (front) | react | | alerte404/server | Scraper Node (back) | cheerio |


Contribution

Toute contribution est la bienvenue : issues, pull requests, idées ou retours d’expérience.


MIT