ASP.NET Core MVC 2.0 Cookbook
上QQ阅读APP看书,第一时间看更新

Publishing the package

  1. First, let's create an account on the npm website:
  1. Now we can connect to the repository with our credentials by using the command line. The repository will be Git. Let's type the following:
npm adduser 
  1. We answer three questions about the username, password, and email:
  1. After that, we create the Git repository locally by typing the following:
git init  
  1. Let's now go to the GitHub website to create a remote repository. First, we need to create an account, if we don't have one yet.
  2. To create an account we need to fill the form on the GitHub create-account page, which will provide project.json:
git remote add origin 'repo-url-adress'

npm init
Create a repository on your GitHub account:
  1. To push package.json on the GitHub online repository, enter the following:
git add . 
 
git commit -m "my comment" 
 
git push 
 
git push origin master 
  1. Now let's type the following in our local project Git repository:
npm publish 

If we excute the following command, we can see the package.json:

npm info [packagename] 

Excute the following command:

npm repo [packagename] 

A web page is launched on our GitHub repository website listing the existing files of our npm package.

If we type http://npm.im/packagename in the browser address bar, we will see our package homepage on the npm website.

We can find our node package on the npm website https://www.npmjs.com/, synchronized with our GitHub website https://github.com/ repository.