Skip to main content

Installing Acro packages

To access private packages hosted in Acro Commerce's GitLab registry you need to provide authentication to the package manager.

Important
  1. It is crucial to never commit the authentication files to your repository.
  2. If you are creating your access token, refer to the Personal Access Token page to determine the appropriate scope to use.

NPM Packages

your .npmrc file with the necessary credentials. This file serves as the npm configuration file and enables authentication for accessing required packages.

Setting your local ~/.npmrc file

  1. Create a .npmrc file in your home directory (~/.npmrc) or in the root of your project.
  2. Add the following lines to the .npmrc file:
@acromedia:registry=https://git.acromedia.com/api/v4/packages/npm/
//git.acromedia.com/api/v4/packages/npm/:_authToken=<YOUR GITLAB PERSONAL ACCESS TOKEN>
//git.acromedia.com/api/v4/projects/:_authToken=<YOUR GITLAB PERSONAL ACCESS TOKEN>
caution

Do not remove the // these are not comments. Doing so will result in incorrect authentication causing errors downloading gesso packages.

For seamless access to Acro Commerce's registry, it is recommended to place the .npmrc file in your home directory (~/.npmrc). This ensures constant accessibility to the registry. If you choose to create the file within an individual project, you will need to repeat the setup process every time, resulting in compatibility issues with the starter kits.

tip

In order to pull from Acro Commerce's registry, you must be added as a member in GitLab acromedia-npm-registry.

  • Join the Gesso Support Channel in Slack if you need support.

Composer Packages

Enhance your project's capabilities by integrating Composer packages from GitLab's Package Registry. Begin by updating your project's composer.json file and adding an auth.json for authentication (see Composer Authentication). Streamline your development process with these essential steps.

Automated Setup

Explore the Gesso Registry, accessible here, to discover a comprehensive list of available Gesso packages. Once you've identified your desired package, such as gesso_graphql, copy the command provided under Add composer registry and execute it in your terminal.

Example

For instance, executing the following commands will update your composer configurations to include the necessary repository support for gesso_graphql, which is assigned a group ID of 507.

composer config repositories.git.acromedia.com/507 '{"type": "composer", "url": "https://git.acromedia.com/api/v4/group/507/-/packages/composer/packages.json"}'

composer config gitlab-token.git.acromedia.com <YOUR_PERSONAL_ACCESS_TOKEN>

composer config gitlab-domains git.acromedia.com

Manual Setup

If you prefer to set up your composer.json file manually, you can utilize the example provided below. Remember to substitute <GroupID> with the appropriate group ID of the project package you're seeking.

{
...
"repositories": {
"git.acromedia.com/<GroupID>": {
"type": "composer",
"url": "https://git.acromedia.com/api/v4/group/<GroupID>/-/packages/composer/packages.json"
},
"0": {
"type": "composer",
"url": "https://packages.drupal.org/8"
}
},
"require": {
"acromedia/gesso_graphql": "^0.0.1",
...
},
"config": {
...
"gitlab-domains": ["git.acromedia.com"]
},

...
"minimum-stability": "dev",
}

Finding Your Project's Group ID

To find the Group ID of your project, navigate to your project group's settings page in GitLab. The Group ID can usually be found on the General page next to the Group name field. If you encounter difficulty locating it, please refer to GitLab's documentation or contact your project administrator for assistance. Eg. https://git.acromedia.com/groups/acromedia/gesso/-/edit

Composer Authentication

Authentication setup is necessary to access Composer packages securely.

Create an auth.json file within your project. Ensure that auth.json is included in your .gitignore file to prevent accidental commits of your personal access tokens.

Example of the auth.json file:

{
"gitlab-token": {
"git.acromedia.com": "<Your Gitlab Personal Access Token>"
}
}