react-show-greeting v1.0.1
react-package-publisher
react-package-publisher is a toolkit for reactjs developers to build, test and publish a react component to the Node Package Magaer(npm). This project contains important commands in a script file to build, test and publish a package.
react-show-greeting is reactjs based package published using the
react-package-publisher. This is an example package to greet you once you type-in your name.
Usage
- Fork or clone this repo.
- Change the directory to, react-package-publisher
- Edit the
package.jsonwith your package name, version, author, license, dependencies, devDependencies etc. Please note, thepeerDependenciesare already set for a specific version ofreactandreact-dom. Please feel free to change the versions suitable to your need. If you are new to the npm dependency management, please read this. - Create your component file and write the component code.
Run the
build.shfile. Please note, use a unix based terminal(example, GitBash) to run thebuild.shfile../build.sh
What is in build.sh file?
The build.sh file is the main file that helps in building, packaging and publishing your react component to the npm. It helps automating many steps that are usually need to execute line by line and time consuming. It contains commands to faciliate the followings,
- Check Node, NPM and Yarn Versions.
- Remove the existing
distfolder. This folder will be generated at the compilation step automatically. - Remove the existing
index.jsfile. This file will be generated at the compilation step automatically. - Perform
yarn install(Dependency Management). - Build Components and creates
index.jsfile anddistfolder. - Copy other required files like,
README.MD,*.scssetc files to thedistfolder. - Create a tarball npm for local testing.
Login and Publish. Here are 2 ways to login
- Using Intercative mode(Default) => npm login will ask for username, password and email.
- Using non interactive mode => Edit the file to comment the above option and uncomment the line starts with
npm-login-noninteractive. Please edit the required parameter values like, <USER_NAME>, and . Please install npm-login-noninteractive globally as a depenency to use this option.
- Using non interactive mode => Edit the file to comment the above option and uncomment the line starts with
Further Read
A step-by-step turorial to use this toolkit is on the way, please stay tuned.