Skip to content

Commit

Permalink
add missing deps
Browse files Browse the repository at this point in the history
  • Loading branch information
glasser committed Jun 3, 2022
1 parent 9414775 commit b15bc2c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
2 changes: 2 additions & 0 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
"@types/lru-cache": "^7.6.1",
"@types/node-fetch": "^2.6.1",
"async-retry": "^1.2.1",
"body-parser": "^1.20.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"graphql-tag": "^2.11.0",
"keyv": "^4.2.2",
Expand Down
38 changes: 20 additions & 18 deletions packages/server/usageReportingProtobuf/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# `apollo-reporting-protobuf`
# Usage reporting protobuf

> **Note:** The Apollo usage reporting API is subject to change. We strongly
> encourage developers to contact Apollo support at `support@apollographql.com`
> to discuss their use case prior to building their own reporting agent using
> this module.
This module provides JavaScript/TypeScript
[Protocol buffer](https://developers.google.com/protocol-buffers/) definitions
for the Apollo usage reporting API. These definitions are generated for
consumption from the `reports.proto` file which is defined internally within
Apollo.
This subdirectory provides JavaScript/TypeScript [Protocol
buffer](https://developers.google.com/protocol-buffers/) definitions for the
Apollo usage reporting API. These definitions are generated for consumption
from the `reports.proto` file which is defined internally within Apollo.

## Development

Expand All @@ -18,22 +17,25 @@ Apollo.
> this can't be avoided, the time just hasn't been taken to make those changes.
> We'd happily accept a PR which makes the appropriate changes!
Currently, this package generates a majority of its code with
This directory contains .js and .d.ts files. The index files are written
manually and the files in `generated` are automatically generated with
`@apollo/protobufjs` (a fork of
[`protobufjs`](https://www.npmjs.com/package/protobufjs) that we maintain
specifically for this package) based on the `reports.proto` file. The output is
generated with the `generate` npm script.

The root of the repository provides some `devDependencies` necessary to build
these definitions聽and the `prepare` npm script is invoked programmatically via
the monorepo tooling (e.g. Lerna) thanks to _this_ module's `postinstall`
script. Therefore, when making changes to this module, run scripts via `npx
lerna run SCRIPTNAME` in the **root** of this monorepo in order to update the
definitions in _this_ module.
specifically for this package) based on the `reports.proto` file. None of these
files are generated from .ts files by tsc, which is why this directory is not
under `src`.

To update `reports.proto` to the current version recognized by the Studio usage
reporting ingress, run `lerna run update-proto`. To then regenerate the JS and
TS files, run `npx lerna run generate`. We check in the generated code and only
reporting ingress, run `npm run protobuf-update`. To then regenerate the JS and
TS files, run `npm run protobuf-generate`. We check in the generated code and only
regenerate it manually, partially to make builds faster (no need to run pbjs on
every `npm install`) and partially so that we don't have to make sure that
`pbjs` runs on every Node version that we support.

The files in this subdirectory are large, so we want to avoid loading them at
runtime unless necessary. Thus, files in this directory should only be imported
in three contexts:
- Inside `src/plugin`, in files that will only be loaded indirectly via the
runtime require calls in `src/plugin/index.ts`
- In tests
- At compile-time only via `import type` calls

0 comments on commit b15bc2c

Please sign in to comment.