在 5/10 Github 官方 Blog 說明要推出一項產品 GitHub Package Registry,目前公佈會支援的功能有 JavaScript (npm), Java (Maven), Ruby (RubyGems), .NET (NuGet), 與 Docker images,對於 Open Source 一樣是免費的,而私人方案官方表示很快就會公布了。
除了以上提到的功能之外之後還會有其他的服務釋出,大家就慢慢期待拉 ~
而目前這個服務主要是要準備 Beta,因此有興趣的朋友可以使用此連結註冊,註冊完會看到已經加入等候名單了 ~
目前已經是正式版囉!所以現在不用再註冊直接就可以使用了
目前在 npm 已經有準備好一個 Sample 範例給大家看了,而這個 Sample 是可以下載的呦!下面就來教大家未來 Github Package Registry 要怎麼下載吧 ~
首先要拿到 Github 的 Token
- 在右方找到頭像,在下拉式選單裡面找到 Settings
- 在左方找到 Developer settings
- 進去之後在左方找到 Personal access tokens
- 點選 Generate new token
- 給予你的 token 一個名字
- 在此篇的需求只要勾選 read:packages 就好了
- 點選 Generate token
拿到 Token 後設定一下 ~/.npmrc,如果沒有這個文件就創一個,內文如下
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//npm.pkg.github.com/:_authToken=PERSONAL-ACCESS-TOKEN | |
@Codertocat:registry=https://npm.pkg.github.com/ |
如此就可以當成一般 npm 使用了,現在可以開一個空的資料夾使用以下指令
不過覺得比較麻煩的是可能每個專案都要設定 npmrc,不然就是要把所有專案都導入 Github,不過這樣可能更麻煩
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install @Codertocat/[email protected] |
以上就是這次介紹 Github Package Registry,不過看了介紹感覺應該會滿好用的 ~
參考資料:
- https://help.github.com/en/articles/about-github-package-registry
- https://help.github.com/en/articles/configuring-npm-for-use-with-github-package-registry
- https://www.pscp.tv/w/1jMKgvMEggwxL
《AWS CDK 完全學習手冊:打造雲端基礎架構程式碼 IaC》
第 12 屆 iT 邦幫忙鐵人賽 DevOps 組冠的《用 CDK 定 義 AWS 架構》
第 11 屆 iT 邦幫忙鐵人賽《LINE bot 好好玩 30 天玩轉 LINE API》
一個熱愛分享的雲端工程師!