Do you want to make use of our NPM and Composer packages? Then these are the walk-through for you! The first few steps are common between the two, after that we will split off into the two processes.
- Go to your GitHub account settings.
- Click on Developer Settings
- Click on Personal Access Tokens -> Tokens (Classic)
- Click to generate a new token (Classic)
- Give it a name that you will recognize (ex. RootreeWeb GitHub Packages)
- Give access to repository and read:packages
- Copy the token that is generated
- The rest of the steps are different depending on whether you are using NPM or Composer
NPM
-
Create an environment variable named “GHACCESS” and set it to the token that you generated.
-
If you are working with a project that has already been using our NPM packages, you should be all set, otherwise…
-
Depending on your package manager/environment, you will need to add the following to your configuration file:
Yarn
Create or add to your
.yarnrc.ymlfile:npmScopes: rootreeweb: npmAlwaysAuth: true npmAuthToken: "${GHACCESS}" npmRegistryServer: "https://npm.pkg.github.com"This tells Yarn to look at the GitHub repository for any packages that start with @rootreeweb. Run
yarn installto test your configuration.Bun
Create or add to your
bunfig.tomlfile:[install.scopes] "@rootreeweb" = { token = "$GHACCESS", url = "https://npm.pkg.github.com" }
Composer
-
Ensure that your composer.json file has the repository that you wish to include indicated. ex.
{ "version": "3.2.8", "repositories": [ { "type": "vcs", "url": "https://github.com/rootreeweb/rt-plugin-lib.git" } ], "require": { "php": "8.4.*", "rootree/plugin-lib": "dev-main" } } -
Run
composer installit will prompt you for the access token that you generated.
Appendix: Publishing
This content has been moved to Publishing Packages.