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

dummynpmpackage

v1.0.0

Published

a package to test npm publish

Downloads

1

Readme

instructions to create a npm package. source: https://betterprogramming.pub/how-to-create-and-publish-react-typescript-npm-package-with-demo-and-automated-build-80c40ec28aca

Step 1. Preparing the Project

  • In the command line of your project, execute: npm init -y
  • create src folder

Step 2. Create a react component

  • Create your component
  • Create an index.ts:
    import App from './App';
    
    export { App }

Step 3. Change scripts in package.json

```
"scripts": {
  "build": "tsc"
}, 
```

Step 4. Adding tests with Jest:

npm add -D jest jest-canvas-mock jest-environment-jsdom ts-jest @types/jest @testing-library/react

  • Create jestconfig.json:
     {
       "transform": {
         "^.+\\.(t|j)sx?$": "ts-jest"
       },
       "testRegex": "(/tests/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
       "moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"],
       "testEnvironment": "jsdom"
     }
  • Change/update tests key in package.json:
     "test": "jest --config jestconfig.json"
  • replace build to:

Step 5. Test package before publish/update

- add "prepare" and "prepublishOnly" to scripts in package.json: 
  ```
  "scripts": {
    "build": "tsc",
    "prepare": "npm run build",
    "prepublishOnly": "npm run test"
  },
  ```
- replace "main" to: 
  ```
    "main": "./dist/cjs/index.js",
    "module": "./dist/esm/index.js",
    "types": "./dist/esm/index.d.ts"
  ```

Step 6. Add info about git repository:

  "repository": {
    "type": "git",
    "url": "git+https://github.com/gapon2401/my-react-typescript-package.git"
  },

Step 7. Specify that the project that will use our package must have the NEEDED DEPENCDENCIES

  "peerDependencies": {
    "react": "^17.0.1",
    "react-dom": "^17.0.1"
  },

Step 8: To ensure that your package does not have any redundant files, use only allowed files and folders that will be added to the package:

  "files": [
    "dist",
    "LICENSE",
    "README.md"
  ],

Step 9: Add keywords key to package.json:

  "keywords": [
    "react",
    "typescript",
    "npm",
    "package"
  ],

Step 10: Specify you license:

"license": "MIT",

Step 11: Publishing to NPM

  • Check if your package name is available:
    • go to: https://www.npmjs.com/ and if page is 404, the package-name is available - npm adduser, if you dont have an user yet. -npm login -npm publish --dry-run to check if your files are correct, there are no error, everything is ok (this doesnt publish anything, only check)
  • npm publish to publish the package