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

generator-quality-npm-package

v1.0.2

Published

Yeoman generator to create quality npm packages with eslint, prettier, commitlint, husky, babel and other tools.

Downloads

155

Readme

Yeoman generator to create quality npm packages with eslint, prettier, commitlint, husky, babel and other tools.

🏠 Homepage

The generator-quality-npm-package provides a structure to create a npm package similar to that used in the: @cljmenez/json-serializer-vue-localstorage-reactive, @cljimenez/json-serializer-core and @cljimenez/json-serializer-base-serializers. The structure created by this generator includes:

Example of a npm package generated by generator-quality-npm-package:

Captura de pantalla (5)

This generator uses rollup to create the dist folder. The packages publishes by this generator are exported using the following structure:

package.json

"main": "./dist/cjs/index.cjs",
"types": "./dist/types/index.d.ts",
"exports": {
  "types": "./dist/types/index.d.ts",
  "import": "./dist/esm/index.mjs",
  "require": "./dist/cjs/index.cjs"
},
"files": [
  "dist"
]

Index

Installation

First, install Yeoman and generator-quality-npm-package using npm (we assume you have pre-installed node.js).

npm install -g yo
npm install -g generator-quality-npm-package

Then generate your new project:

yo quality-npm-package

The configuration files

The configuration files included are:

  • Eslint: .eslintignore (the files and directories ignored by eslint) and .eslintrc.json (configuration used by eslint).

  • Git: .gitignore (the files and directories ignored by git).

  • Lint-staged: .lintstagedrc.json (configuration used by lint-staged).

  • Prettier: .prettierignore (the files and directories ignored by prettier) and .prettierrc.json (configuration used by prettier).

  • Babel: babel.config.json (configuration used by babel):

    • The env.buildCommonjs contains the configuration used to transpile the source code to es5. It is used into rollup.config.js and rollup.config.mjs.

    • The env.buildESmodules contains the configuration used to transpile the source code to es6. It is used into rollup.config.js and rollup.config.mjs.

    • If the package.json, generated by this generator, contains the field type:commonjs will be included the env.test property in babel.config.json. That property is used by jest to transpile the source code to es5 before to run the tests.

  • Commitlint: commitlint.config.js (configuration used by commitlint).

  • Jest: jest.config.js (configuration used by jest).

  • Rollup: rollup.config.js and rollup.config.mjs (configuration used by rollup).

  • TypeScript: tsconfig.json (configuration used by TypeScript compiler).

The question: Do you want to automatically run the scripts that configure the package, then installing the dependencies?

When you selects the true value, the following scripts ubicated in the package.json are executed:

  • init
  • documentation:create
  • test
  • build

If you selects the false value, you must run npm run init obligatory.

The scripts in package.json

The more important scripts added into the package.json created by this generator are:

  • "init": Runs the commands necessary to initialize the package, for example init:husky.
  • "documentation:create": Creates documentation using readme-md-generator.
  • "format": Checks the format using prettier.
  • "format:fix": Fixes the format using prettier.
  • "format:build-stage" and "format:build-stage:fix": similar to "format" and "format:fix". They used when the npm run build is called.
  • "lint": static code analysis using eslint.
  • "lint:fix": Fixes the code using eslint.
  • "lint:build-stage" and "lint:build-stage:fix": similar to "lint" and "lint:fix". They are used when the npm run build is called.
  • "build:bundle": Bundles the files into src folder using rollup. It is used when the npm run build is called.
  • "build:tsc": Generates .d.ts files using the TypeScript compilator. It is used when the npm run build is called.
  • "build": Generates the dist folder that contains the cjs folder (source code transpiled to es5), the esm folder (source code transpiled to es6), and types folder (it contains the declaration files).
  • "prepublishOnly": Used before publishing your package using npm publish. Runs npm run build.
  • "test": Runs the tests using jest.
  • "commitlint": Runs commitlint. It is used into .husky/commit-msg file. It is called by the commit-msg hook. See git hook.
  • "lint-staged": Runs lint-staged. It is used into .husky/pre-commit file. It is called by the pre-commit hook. See git hook.
  • "quality-check": Runs npm run format && npm run lint && npm run test. It is used into .husky/pre-push file. It is called by the pre-push hook See git hook.

Getting To Know Yeoman

  • Yeoman has a heart of gold.
  • Yeoman is a person with feelings and opinions, but is very easy to work with.
  • Yeoman can be too opinionated at times but is easily convinced not to be.
  • Feel free to learn more about Yeoman.

Author

👤 Cristopher Jiménez

🤝 Contributing

Contributions, issues and feature requests are welcome!Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2023 Cristopher Jiménez. This project is MIT licensed.


This README was generated with ❤️ by readme-md-generator