fe-shared-components-2
v1.0.2
Published
## Preparation 1. You'll need a npm-account. 2. You'll need a git-account. 3. `npm` and `git` must to be installed on your system.
Downloads
2
Readme
Create and update your npm-package
Preparation
- You'll need a npm-account.
- You'll need a git-account.
npm
andgit
must to be installed on your system.
Create a package
Start your package by using npm init
. This will guide you through a quick process. Watch out for these fields:
name
(required) must be globally unique! To ensure this, its common sense to use namespaces, eg.project-name-package-name
.version
(required).main
(required) starting point,index.js
by default.author
(optional) format:Your Name <[email protected]> (https://your-website.de)
Next, create a file named like your main
-field above (index.js
by default). Your code inside must be exported, otherwise you cant use it when including your package. Your file may look like this:
exports.printMyMessage() = function() {
console.log('Hello World');
}
Create a Readme.md
file. This will be used as your default readme for both git and npm.
Your folder structure should now look like this:
- package-folder
- package.json
- index.js
- Readme.md
At this point you should start your git-repository. Use git init
and push to the repository-provider of your choice. Make sure your working directory is clean!
Notice: Like git, everything in your package-folder will be included in your package! You can use a .npmignore
-file to exclude certain files or folders as you do with .gitignore
.
Login to your npm-account via npm login
. Fill in your credentials.
Finally, publish your package by using npm publish
.
Done!
Your package is now aviable in your profile (for official npm, this will be https://npmjs.org/~your.username) or directly via https://npmjs.com/packge/your-package-name.
Update your npm-package
- Change or add files as you need.
- Push your changes to git. Your working directory must be clean!
- Update your package-version by using
npm version patch
. This will increase your version like1.0.0
to1.0.1
. - Publish updated package using
npm publish
.