Difference between revisions of "Using github instead of npm"

From Logic Wiki
Jump to: navigation, search
(Created page with "Category:npm Category:Node Category:git == Create Personal Access Token in Github == [https://github.com/settings/tokens https://github.com/settings/tokens] give...")
 
(content of .npmrc file)
Line 36: Line 36:
  
 
==== content of .npmrc file ====
 
==== content of .npmrc file ====
 +
<pre>
 
//npm.pkg.github.com/:_authToken=<TOKEN>
 
//npm.pkg.github.com/:_authToken=<TOKEN>
 
@logicmade:registry=https://npm.pkg.github.com
 
@logicmade:registry=https://npm.pkg.github.com
 +
</pre>
  
 
=== publish ===
 
=== publish ===

Revision as of 11:53, 24 August 2021


Create Personal Access Token in Github

https://github.com/settings/tokens

give full access rights for packages

Login with token

C:\Users\aiybar>npm login --scope=@OWNER --registry=https://npm.pkg.github.com
npm notice Log in on https://npm.pkg.github.com/
Username: aliiybar
Password: <TOKEN>
Email: (this IS public) ali.iybar@gmail.com
Logged in as aliiybar on https://npm.pkg.github.com/.

Publishing a package

Note: Package names and scopes must only use lowercase letters.

By default, GitHub Packages publishes a package in the GitHub repository you specify in the name field of the package.json file.

Publishing a package using a local .npmrc file

In the same directory as your package.json file, create or edit an .npmrc file to include a line specifying GitHub Packages URL and the account owner. Replace OWNER with the name of the user or organization account that owns the repository containing your project.

changes in package.json

"name": "@logicmade/logic-booking",
"repository":"git@github.com:Logicmade/package-logger.git",
"publishConfig": {
      "registry":"https://npm.pkg.github.com"
},

content of .npmrc file

//npm.pkg.github.com/:_authToken=<TOKEN>
@logicmade:registry=https://npm.pkg.github.com

publish

npm publish


Using the package

create .npmrc file in project and it shoul contain the line like

@logicmade:registry=https://npm.pkg.github.com

specify the full-scoped package name, such as @my-org/server

npm install @logicmade/logic-booking