﻿# Installation {#install}

<div id="requirements">

Vue 3 projects use [`@94ai-plus/common-ui`](https://front.94ai.com/common-ui-plus/#/), while Vue 2 projects use [`@94ai/common-ui`](https://front.94ai.com/common-ui/#/).

<ul class="package-stack-details">
  <li>The @94ai-plus component library is based on vue3.5.44+element-plus@2.14.7.</li>
  <li>The @94ai component library is based on vue2.7.16+element-ui@2.15.14.</li>
</ul>

</div>

## Alibaba Cloud private registry authentication {#private-registry}

Use this `.npmrc` template locally or in CI. The company registry uses a username and a Base64-encoded password; an npm public-registry token does not authenticate to the private registry.

```ini
registry=https://registry.npmjs.org/
@94ai:registry=https://packages.aliyun.com/644f755a97d94d909e43534c/npm/npm-registry/
@94ai-plus:registry=https://packages.aliyun.com/644f755a97d94d909e43534c/npm/npm-registry/
//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}
//packages.aliyun.com/644f755a97d94d909e43534c/npm/npm-registry/:username=${NPM_PRIVATE_USERNAME}
//packages.aliyun.com/644f755a97d94d909e43534c/npm/npm-registry/:_password=${NPM_PRIVATE_PASSWORD_BASE64}
//packages.aliyun.com/644f755a97d94d909e43534c/npm/npm-registry/:always-auth=true
```

Ask your administrator for `NPM_PRIVATE_USERNAME` and `NPM_PRIVATE_PASSWORD_BASE64`. The latter is a Base64-encoded password, not plaintext. Omit the public `_authToken` line if you do not need protected npm resources. A valid private-registry token may be used instead if your registry supports it; do not mix token and username/password authentication.

## npm public registry authentication {#public-registry}

To install from or publish to npm, change the registry for the relevant scopes:

```ini
registry=https://registry.npmjs.org/
@94ai:registry=https://registry.npmjs.org/
@94ai-plus:registry=https://registry.npmjs.org/
//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}
```

Obtain NPM_AUTH_TOKEN from the company administrator, or join the company's organization on npm as a Member and manually generate Access Tokens. When generating a token, enable Bypass two-factor authentication (2FA) to satisfy npm's 2FA/token policy.

## Yarn 4 configuration {#yarn-config}

Yarn 4 does not read authentication settings from `.npmrc`; it uses `.yarnrc.yml`. Yarn 4 supports both `npmAuthToken` and `npmAuthIdent` for different authentication methods:

- `npmAuthToken`: token authentication, such as an npm Access Token.
- `npmAuthIdent`: username/password authentication, accepting `username:password` or the Base64 encoding of that complete string.

Example username/password configuration:

```yaml
npmScopes:
  94ai-plus:
    npmRegistryServer: "https://packages.aliyun.com/644f755a97d94d909e43534c/npm/npm-registry/"
    npmAlwaysAuth: true
    npmAuthIdent: "${NPM_PRIVATE_AUTH_IDENT}"
```

`NPM_PRIVATE_AUTH_IDENT` is the Base64 encoding of the complete `username:plaintext-password` string, not the `.npmrc` `_password` value. The example above is for manual configuration; this repository automatically derives it in memory from `NPM_PRIVATE_USERNAME` and `NPM_PRIVATE_PASSWORD_BASE64`. No manual identity variable is needed, and the derived value is never logged or written to the repository.

Example token configuration:

```yaml
npmScopes:
  94ai-plus:
    npmRegistryServer: "https://registry.npmjs.org/"
    npmAlwaysAuth: true
    npmAuthToken: "${NPM_AUTH_TOKEN}"
```

You can temporarily configure authentication in PowerShell without modifying the version-controlled Yarn configuration:

```powershell
$env:NPM_REGISTRY_URL = 'https://registry.npmjs.org/'
# Inject NPM_AUTH_TOKEN via your environment or CI secrets; never put its value here.
yarn install --immutable
```

Fill these values in root `.env.local` in this repository:

```dotenv
NPM_REGISTRY_URL=https://packages.aliyun.com/644f755a97d94d909e43534c/npm/npm-registry/
NPM_PRIVATE_USERNAME=
NPM_PRIVATE_PASSWORD_BASE64=
```

Plain `yarn install --immutable` automatically loads the file without an extra Node command. Existing shell/CI values take priority. Complete private credentials take precedence for private installation and publication, with no `NPM_AUTH_TOKEN` required; publishing to public npm still needs a token. `.env.local` is Git-ignored. Direct npm commands do not load it automatically. Other projects using the manual Yarn examples must inject their own authentication environment variables.

## Install packages {#install-packages}

```bash
yarn add @94ai-plus/common-ui @94ai-plus/nf-theme-chalk vue@3.5.44 element-plus@2.14.7
```

Or use npm:

```bash
npm install @94ai-plus/common-ui @94ai-plus/nf-theme-chalk vue@3.5.44 element-plus@2.14.7
```
