Code reusability and modular design are what have made React one of the best JavaScript frameworks out there. Also, thanks to NPM, publishing a new JavaScript module has never been easier. All you need to do is point the main JavaScript file in your package.json
 and run npm publish
let create our own package
Plan
- initialize next project
 - compile the project
 - config package.json for deployement
 
Let go
- create a next project
 
npx create-next-app myapp -typescript
After creating our app, we need to add some features.
When we finish adding all features to our app, we need to publish it to NPM. We need a file named .npmignore it is similar to .gitignore, it is just to ignore some files and folder when we'll publish our package.
- add a 
.npmignorefile 
# https://docs.npmjs.com/misc/developers#keeping-files-out-of-your-package
#tests
test
coverage
#build tools
.travis.yml
.jenkins.yml
.codeclimate.yml
#linters
.jscsrc
.jshintrc
.eslintrc*
#editor settings
.idea
.editorconfig
- connect or create a NPM account
 
add this to package.json
{
    "files": [
        "/lib"
    ]
}
make shure this line your package is not private inside package.json "private": false,
- connect your project to npm
 
npm login
- after logged in pusblish to npm
 
npm publish
now your package is installed
    
Top comments (0)