Catalog npm
PACKAGE EXPLORERView in registry

1clearscientist

npm

A demo for publishing cool packages to npm registry

es6npmpackagepublishreactjs
Versions collected12
Direct dependencies0From release 1.0.56
Last observed20 Oct, 18:26 UTC

README

Current package documentation

NPM Publish Boilerplate

All you need to know for publishing a React or any JavaScript component/hook to NPM registry.

If you want to test this package, run

 npm i my-cool-package-name

Steps:

  1. Clone this Repo.

  2. Modify /src folder or overwrite index.js according to your package's need.

  3. Install all Dependencies by running:

npm install
  1. Build it by running:
npm run build
  1. Login into to your NPM account using terminal/cmd.

  2. Publish it

npm publish

Src Code Snippets

What is actually published: A basic example

/src/index.js

In Index.js just add prop type others are exactly same.

import React from 'react'
import PropTypes from "prop-types"

function MyPackage(props) {
  return (
      <div>
          <h3>Hello {props.name}</h3>
          <p>I hope this helped you :)</p>       
      </div>
  )
}

MyPackage.propTypes = {
    name: PropTypes.string
};

export default MyPackage

package.json

In package.json file, we changed the "main" and webpack build script.

{
 "name": "my-cool-package-name",
 "version": "1.0.0",
 "description": "A demo for publishing cool packages to npm registry",
 "main": "./build/index.js",
 "scripts": {
   "build": "webpack"
 },
 "repository": {
   "type": "git",
   "url": "git+https://github.com/rohitsaini1196/npm-publish-boilerplate.git"
 },
 "keywords": [
   "npm",
   "publish",
   "reactjs",
   "es6",
   "package"
 ],
 "author": "Rohit Saini",
 "license": "ISC",
 "devDependencies": {
   "@babel/core": "^7.7.5",
   "@babel/preset-env": "^7.7.6",
   "@babel/preset-react": "^7.7.4",
   "babel-loader": "^8.0.6",
   "css-loader": "^3.3.0",
   "style-loader": "^1.0.1",
   "webpack": "^4.41.2",
   "webpack-cli": "^3.3.10"
 },
 "dependencies": {
   "prop-types": "^15.7.2",
   "react": "^16.12.0"
 },
 "bugs": {
   "url": "https://github.com/rohitsaini1196/npm-publish-boilerplate/issues"
 },
 "homepage": "https://github.com/rohitsaini1196/npm-publish-boilerplate#readme"
}

Ask me if you have any doubt.


Rohit Saini

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 12

Collected releases
VersionPublishedDirect dependenciesOpen version
1.0.56Registry latest18 Feb 20230
1.0.5514 Feb 20230
1.0.544 Dec 20220
1.0.531 Dec 20220
1.0.5220 Nov 20220
1.0.512 Nov 20220
1.0.52 Nov 20220
1.0.42 Nov 20220
1.0.319 Oct 20220
1.0.219 Oct 20220
1.0.118 Sept 20220
1.0.018 Sept 20220

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
rohitsaini1196/npm-publish-boilerplate

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 18:26 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:6d0ac8b98a71cf393561fe3a0a0aab01b26614f604f50b69ace8658b53afb5cd