# google-buildartifacts-auth

> google-buildartifacts-auth is an npm module that allows you to configure npm to interact with npm repositories stored in Cloud Build Artifacts.

Latest version **1.0.0** (published 2019-08-14) · Apache-2.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install google-buildartifacts-auth
pnpm add google-buildartifacts-auth
yarn add google-buildartifacts-auth
bun add google-buildartifacts-auth
```

Provides the command `buildartifacts-auth`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-08-14 |
| First published | 2019-08-06 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 24.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 26 |
| Author | Google LLC |
| Maintainers | google-wombot |
| Keywords | google, google cloud platform, google cloud, cloud, cloud build artifacts, build artifacts, build-artifacts |

## Links

- npm: https://www.npmjs.com/package/google-buildartifacts-auth
- Repository: https://github.com/GoogleCloudPlatform/build-artifacts-npm-tools
- Homepage: https://github.com/GoogleCloudPlatform/build-artifacts-npm-tools#readme
- Issues: https://github.com/GoogleCloudPlatform/build-artifacts-npm-tools/issues
- npm.io page: https://npm.io/package/google-buildartifacts-auth

## Dependencies (1)

- [google-auth-library](https://npm.io/package/google-auth-library.md) ^5.0.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2019-08-14
- 0.9.0 — 2019-08-06

## README

# Build Artifacts tools for npm

This repository contains tools to simplify the process of working with npm
repositories using Cloud Build Artifacts.

# Cloud Build Artifacts Module

The Cloud Build Artifacts google-buildartifacts-auth module is an npm package
which allows you to configure npm to interact with npm repositories stored in
Cloud Build Artifacts.

The module authenticates to Cloud Build Artifacts using
[Google Application Default Credentials](https://developers.google.com/accounts/docs/application-default-credentials).

NOTE: This module would update credentials for **all** Cloud Build Artifacts
repositories. It would not be suitable if you use multiple account
credentials in npmrc file.

To use the module:

1.  Log in

    Using end user credentials:

    `$ gcloud auth application-default login`

    Using service account:

    `$ export GOOGLE_APPLICATION_CREDENTIALS=[path/to/key.json]`

2.  Add settings to connect to the repository to .npmrc. Use the output from the
    following command:

    `$ gcloud alpha build-artifacts print-settings npm`

    ```
    registry=https://npm.pkg.dev/PROJECT_ID/REPOSITORY_ID/
    //npm.pkg.dev/PROJECT_ID/REPOSITORY_ID/:_password=""
    //npm.pkg.dev/PROJECT_ID/REPOSITORY_ID:username=oauth2accesstoken
    //npm.pkg.dev/PROJECT_ID/REPOSITORY_ID/:email=not.valid@email.com
    //npm.pkg.dev/PROJECT_ID/REPOSITORY_ID/:always-auth=true
    ```

    Where

    **PROJECT_ID** is the ID of the project.

    **REPOSITORY_ID** is the ID of the repository.

3.  Use one of these below options to run the script

    1.  Run the script

        `$ npx google-buildartifacts-auth [path/to/.npmrc]`

    2.  Include the binary in the scripts in package.json

        ```
        "scripts": {
            "build-artifacts-login": "npx google-buildartifacts-auth [path/to/.npmrc]",
        }
        ```

        Run the script

        `$ npm run buildartifacts-login`

    3.  `npx` should come with `npm` 5.2+. If `npx` is not available:

        Install the module from npmjs.com as a dev dependency and include the
        binary in the script

        `$ npm install google-buildartifacts-auth --save-dev`

        ```
        "scripts": {
            "buildartifacts-auth": "google-buildartifacts-auth [path/to/.npmrc]",
        }
        ```

        Where **[path/to/.npmrc]** is the optional argument you can provide to
        the script. If no path is provided, .npmrc file at current directory is
        used.

        Run the script

        `$ npm run buildartifacts-login`

---
_Source: https://npm.io/package/google-buildartifacts-auth · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
