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

create-tm-project

v1.2.3

Published

Scaffold a Tampermonkey (userscript) project in TypeScript or JavaScript; optional react dependencies; bundles to a single file with rolldown; auto-detects the JS runtime (node/bun/deno); works with npm, pnpm, yarn and bun

Downloads

977

Readme

create-tm-project

创建油猴脚本(Tampermonkey / Userscript)项目脚手架,支持 TypeScript / JavaScript,可选 React,用 rolldown 打包为单个 js 文件。

特性

  • 零依赖,npm / pnpm / yarn / bun 均可安装运行
  • 只生成项目文件,依赖直接写入 package.json,不自动安装
  • 语言可选 TypeScript / JavaScript,可选 React 开发
  • 自动检测运行脚手架的 JS 运行时(node / bun / deno),决定 scripts.build
  • 产物自动还原为标准 // ==UserScript== 头,油猴可直接安装

安装

npm install -g create-tm-project
# 或 pnpm add -g / yarn global add / bun add -g

也可不安装直接执行:

npx create-tm-project my-userscript
# 或 pnpm dlx / bunx / yarn dlx

用法

create-tm-project <项目名|路径> [--lang <javascript|typescript>] [--runtime <node|bun|deno>] [--react <yes|no>]
  • 不带项目名会交互式询问;语言、React 用方向键 TUI 选择(↑/↓ 切换、回车确认),非交互终端(管道/CI)自动退回文本输入
  • 所有选项均可通过环境变量指定:CREATE_TM_PROJECT_LANG / CREATE_TM_PROJECT_RUNTIME / CREATE_TM_PROJECT_REACT
  • 脚手架只生成文件(依赖已写入 package.json),不会调用任何包管理器

语言(--lang)

| 值 | 说明 | | --- | --- | | javascript(默认) | 只写入 rolldown,生成 index.js,无 tsconfig.json | | typescript | 写入 typescript / @types/node / rolldown,生成 index.ts + tsconfig.json |

React(--react)

| 值 | 说明 | | --- | --- | | no(默认) | 入口为 index.ts / index.js | | yes | 入口为 index.tsx / index.jsx,写入 react / react-dom(TypeScript 另加 @types/react / @types/react-dom),初始模板为左上角 "hello, world!" 组件 |

运行时(--runtime)

决定生成项目 scripts.build 的内容,默认自动检测(bunx → bun、npx → node),检测不到时默认 node:

| 运行时 | scripts.build | | --- | --- | | node | node build.mjs | | bun | bun build.mjs | | deno | deno run -A build.mjs |

示例:

create-tm-project my-userscript
create-tm-project my-userscript --lang typescript
create-tm-project my-userscript --lang typescript --react yes
create-tm-project my-userscript --runtime bun
create-tm-project ./foo/my-userscript --lang typescript --runtime deno --react yes

创建后

cd my-userscript
pnpm install      # 或 npm install / bun install / yarn
pnpm run build    # 打包到 dist/index.js(或 npm run build / bun run build / yarn build)

产物 dist/index.js 已还原为标准 // ==UserScript== 头,可直接安装到油猴。

生成的项目

my-userscript/
├── package.json   # scripts.build 按运行时生成;dependencies / devDependencies 已写好
├── tsconfig.json  # TypeScript 项目(含 DOM 类型、react-jsx)
├── index.ts       # 入口(JS 为 index.js;React 为 index.tsx / index.jsx),用户脚本头用 //! 标注
├── build.mjs      # rolldown 打包:置顶用户脚本头、校验产物不含 node 依赖
└── .gitignore

提示:油猴运行在浏览器中,业务源码不能依赖 Node 运行时(node: 内置模块、process / Buffer 等),构建时会校验并报错;需要 Node 能力时改用油猴 API(GM_xmlhttpRequest / GM_setValue / GM_download 等)或放到后端服务。