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

@mayson-org/inject-script

v1.0.32

Published

CLI and library to inject Mayson watermark, ascii, and PWA into Next.js App Router layouts.

Downloads

2,183

Readme

@mayson-org/inject-script

Locate the Next.js App Router root layout, generate Mayson plugin components next to it, and inject imports + JSX into the layout. Injection logic is unchanged; plugins supply component source. The pwa plugin also writes project-level artifacts (public/, manifest.ts, layout meta).

Requires Node 20+.

Install

bun add -d @mayson-org/inject-script@latest
# or
npx @mayson-org/inject-script --type=watermark

Quick usage

npx @mayson-org/inject-script                 # watermark + ascii + pwa
npx @mayson-org/inject-script --type=watermark
npx @mayson-org/inject-script --type=pwa
npx @mayson-org/inject-script --type=all
npx @mayson-org/inject-script --no-pwa
npx @mayson-org/inject-script --type=watermark --dry-run
npx @mayson-org/inject-script --dir=./my-app

Watermark

--type=watermark writes MaysonWatermark.tsx beside the root layout and injects <MaysonWatermark /> before </body>.

The pill:

  • Fixed bottom-right “Edit with Mayson” (logo + label)
  • Dismiss (×) hides it for the session
  • Click navigates to https://mayson.dev/ (hardcoded for now)

API gating (show_remix_pill / enable_remix)

At inject time the CLI fetches generated-app-metadata (same API as the old build plugins):

GET {MAYSON_API_BASE_URL}/sigma/web/v1/generated-app-metadata/workspaces/{id}/collections/{id}
Header: M-Web-Token: {MAYSON_WEB_TOKEN}

| API field | Effect | |-----------|--------| | show_remix_pill | If false, watermark is not injected; if true, inject | | enable_remix | Still fetched for later use; click target is hardcoded to https://mayson.dev/ for now | | website_title | Optional; used as PWA manifest name / short_name when present |

Metadata not found (404): if the API returns HTTP 404 or a body like { "response_code": 404, "message": "Generated app metadata not found", "value": {} }, treat as show_remix_pill=true and enable_remix=true (show watermark).

Defaults when the API is not called or fails for other reasons: showRemixPill=false, enableRemix=false (watermark skipped).

Env vars (inject-time)

| Variable | Purpose | |----------|---------| | MAYSON_WORKSPACE_ID | Workspace id | | MAYSON_COLLECTION_ID | Collection id (also baked into remix URL) | | MAYSON_API_BASE_URL | API base for metadata | | MAYSON_APP_BASE_URL | App base (default https://mayson.dev) | | MAYSON_WEB_TOKEN | Auth for generated-app-metadata | | MAYSON_WEBSITE_TITLE | Optional PWA/manifest app name (else API website_title, else "My App") |

PWA

Default-on (like ascii). Skip with --no-pwa.

Writes / patches:

| Target | Behavior | |--------|----------| | {layoutDir}/MaysonServiceWorkerRegister.tsx | Prod-only /sw.js register; layout-injected | | {layoutDir}/MaysonInstallPrompt.tsx | Install UI (beforeinstallprompt, iOS hint, ?pwa_install=1); inline styles | | {appDir}/manifest.ts | Write if missing; refresh if marked @mayson-pwa-manifest; else skip | | {projectRoot}/public/sw.js | Write/overwrite if missing or marked @mayson-pwa-sw (mayson-pwa-v1 cache) | | {projectRoot}/public/icons/*.png | Copy default Mayson icons if missing (never overwrite) | | Root layout metadata | Insert appleWebApp / viewport.themeColor when absent |

No next-pwa / Workbox deps. Custom unmarked manifest.ts / sw.js are left alone.

Programmatic API

import { runAutoInject } from '@mayson-org/inject-script';

const result = await runAutoInject(process.cwd()); // watermark + ascii + pwa
await runAutoInject(process.cwd(), { types: ['pwa'], dryRun: true });
await runAutoInject(process.cwd(), { pwa: false }); // skip PWA

Package layout

src/
  cli.ts / index.ts
  core/                  # find-root-layout, injector, generators
  plugins/watermark/     # remix pill template
  plugins/ascii|metadata
  plugins/pwa/           # multi-artifact injectProject
  shared/                # config, generated-app-metadata, remix-url
assets/pwa/              # default PWA icons shipped with the package

Notes

  • Default inject is watermark + ascii + pwa (override with --type / --no-pwa).
  • Watermark is gated by show_remix_pill; ascii and pwa always inject when selected.
  • Idempotent: skips components already present; does not clobber custom icons or unmarked PWA files.
  • Does not patch .next HTML; source inject only.