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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@johnhom/mrm-preset

v2.4.0

Published

MRM preset used by Johnhom for all packages

Downloads

7

Readme

@johnhom/mrm-preset

根据 mrm 开发的项目配置文件 preset。

包含的 task 设置项:

  • beauty

  • packageJson

  • commitlint

组合的task项:

  • base 包含(beauty, commitlint)

使用方式

首先需要全局安装mrm

pnpm i -g mrm
# 或者
yarn global add mrm
# 或者
npm i -g mrm

然后选择你想要的task配置项,例如你想要使用packageJson这个配置项,则在你的项目文件夹根目录下,执行以下代码:

mrm packageJson --preset @johnhom/mrm-preset

执行完成之后,package.json文件就会自动生成预设的字段,如果这个文件已存在,则会自动合并其中的值。

package.json的预设值如下:

{
  name: packageName,
  version: '1.0.0',
  description: '',
  author: '',
  main: 'index.js',
  files: ['index.js'],
  scripts: {},
  license: 'ISC',
  keywords: [],
  homepage: '',
  repository: '',
  publishConfig: {
    registry: 'https://registry.npmjs.org/',
    access: 'public',
  },
  dependencies: {},
  devDependencies: {},
}

使用场景

  1. 当你的前端项目创建完毕(带有package.json和lock文件)想要添加eslint、prettier等一系列项目的基础设施,可以运行以下的命令:
mrm base --preset @johnhom/mrm-preset

运行成功之后,你的项目将会自动安装以下的包:

  • eslint
  • prettier
  • husky
  • lint-staged
  • @commitlint/cli
  • @commitlint/config-conventional

同时会自动生成相应的配置文件。

由于husky的部分钩子需要手动触发,所以你可以跑一下package.json对应的script命令:

# 初始化husky文件夹
npm run postinstall

# 添加pre-commit钩子
npm run husky:precommit

# 添加commit-msg的钩子
npm run husky:commitmsg

运行完毕之后,就可以展开手脚着手开发项目了,无需再处理项目的一些基建配置。

调试

将该项目clone到电脑上之后,在根目录执行:

pnpm dev

然后在mrm-preset文件夹内会生成build文件夹,我们拿到build文件夹的绝对路径,然后在某个项目内,执行:

mrm beauty --dir <build_path>

TODO

  • [x] prettier 的预设配置
  • [x] husky 和 commitlint 的预设配置