Skip to content

Commit 5dc75ee

Browse files
committed
docs: update README regarding developer packages
Explains how to install a developer package from the GitHub npm registry. Also explains how to configure a GitHub personal access token.
1 parent d2e6810 commit 5dc75ee

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,40 @@ Please add this repository to your dependencies.
1919
npm install https://github.com/codemonger-io/mapbox-collision-boxes#v0.3.0
2020
```
2121

22+
#### Installing from GitHub Packages
23+
24+
Whenever commits are pushed to the `main` branch, a _developer package_ is published to the npm registry managed by GitHub Packages.
25+
A _developer package_ bears the next release version but followed by a dash (`-`) plus the short commit hash; e.g., `0.3.0-abc1234` where `abc1234` is the short commit hash of the commit used to build the package (_snapshot_).
26+
You can find _developer packages_ [here](https://github.com/codemonger-io/mapbox-collision-boxes/pkgs/npm/mapbox-collision-boxes).
27+
28+
##### Configuring a GitHub personal access token
29+
30+
To install a _developer package_, you need to configure a **classic** GitHub personal access token (PAT) with at least the `read:packages` scope.
31+
Below briefly explains how to configure a PAT.
32+
Please refer to the [GitHub documentation](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry) for more details.
33+
34+
Once you have a PAT, please create a `.npmrc` file in your home directory with the following contents:
35+
36+
```
37+
//npm.pkg.github.com/:_authToken=$YOUR_GITHUB_PAT
38+
```
39+
40+
Please replace `$YOUR_GITHUB_PAT` with your PAT.
41+
42+
In the root directory of your project, create another `.npmrc` file with the following contents:
43+
44+
```
45+
@codemonger-io:registry=https://npm.pkg.github.com
46+
```
47+
48+
Then you can install a _developer package_ with the following command:
49+
50+
```sh
51+
npm install @codemonger-io/mapbox-collision-boxes@0.3.0-abc1234
52+
```
53+
54+
Please replace `abc1234` with the short commit hash of the _snapshot_ you want to install.
55+
2256
### Usage
2357

2458
The following snippet is an example to collect features hidden by a clicked symbol on the screen.

README_ja.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,40 @@ Mapboxマップ上の衝突ボックスを画面座標系で計算する、[Mapb
1919
npm install https://github.com/codemonger-io/mapbox-collision-boxes#v0.3.0
2020
```
2121

22+
#### GitHub Packagesからインストールする
23+
24+
`main`ブランチにコミットがプッシュされるたびに、*開発者用パッケージ*がGitHub Packagesが管理するnpmレジストリにパブリッシュされます。
25+
*開発者用パッケージ*のバージョンは次のリリースバージョンにハイフン(`-`)と短いコミットハッシュつなげたものになります。例、`0.3.0-abc1234` (`abc1234`はパッケージをビルドするのに使ったコミット(*スナップショット*)の短いコミットハッシュ)。
26+
*開発者用パッケージ*[こちら](https://github.com/codemonger-io/mapbox-collision-boxes/pkgs/npm/mapbox-collision-boxes)にあります。
27+
28+
##### GitHubパーソナルアクセストークンの設定
29+
30+
*開発者用パッケージ*をインストールするには、最低限`read:packages`スコープの**クラシック**GitHubパーソナルアクセストークン(PAT)を設定する必要があります。
31+
以下、簡単にPATの設定方法を説明します。
32+
より詳しくは[GitHubのドキュメント](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry)をご参照ください。
33+
34+
PATが手に入ったら以下の内容の`.npmrc`ファイルをホームディレクトリに作成してください。
35+
36+
```
37+
//npm.pkg.github.com/:_authToken=$YOUR_GITHUB_PAT
38+
```
39+
40+
`$YOUR_GITHUB_PAT`はご自身のPATに置き換えてください。
41+
42+
プロジェクトのルートディレクトリには以下の内容の`.npmrc`ファイルを作成してください。
43+
44+
```
45+
@codemonger-io:registry=https://npm.pkg.github.com
46+
```
47+
48+
これで以下のコマンドで*開発者用パッケージ*をインストールできます。
49+
50+
```sh
51+
npm install @codemonger-io/mapbox-collision-boxes@0.3.0-abc1234
52+
```
53+
54+
`abc1234`はインストールしたい*スナップショット*の短いコミットハッシュに置き換えてください。
55+
2256
### 使い方
2357

2458
以下のスニペットはクリックしたシンボルに画面上で隠されているFeatureを集めてくる例です。

0 commit comments

Comments
 (0)