code ~/.npmrc
mkdir github-package-demo
cd github-package-demo
npm init -y
code .
module.exports = function () {
console.log('Hello from GitHub Package Registry!')
}
touch npmrc
@imran-baitham:registry=https://npm.pkg.github.com
"repository": {
"url": "git://github.com/imran-baitham/github-package-demo.git" // package name
}
npm publish
create react app like i do and also connect the github package using npmrc create .npmrc file
@imran-baitham:registry=https://npm.pkg.github.com // replace this with your package
yarn add @imran-baitham/github-package-demo
import logo from './logo.svg'
import './App.css'
import greeting from '@imran-baitham/github-package-demo'
greeting()
function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
)
}
export default App