Skip to content

Commit b15bc2c

Browse files
committed
add missing deps
1 parent 9414775 commit b15bc2c

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

packages/server/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
"@types/lru-cache": "^7.6.1",
4141
"@types/node-fetch": "^2.6.1",
4242
"async-retry": "^1.2.1",
43+
"body-parser": "^1.20.0",
44+
"cors": "^2.8.5",
4345
"express": "^4.17.1",
4446
"graphql-tag": "^2.11.0",
4547
"keyv": "^4.2.2",
Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
# `apollo-reporting-protobuf`
1+
# Usage reporting protobuf
22

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

1413
## Development
1514

@@ -18,22 +17,25 @@ Apollo.
1817
> this can't be avoided, the time just hasn't been taken to make those changes.
1918
> We'd happily accept a PR which makes the appropriate changes!
2019
21-
Currently, this package generates a majority of its code with
20+
This directory contains .js and .d.ts files. The index files are written
21+
manually and the files in `generated` are automatically generated with
2222
`@apollo/protobufjs` (a fork of
2323
[`protobufjs`](https://www.npmjs.com/package/protobufjs) that we maintain
24-
specifically for this package) based on the `reports.proto` file. The output is
25-
generated with the `generate` npm script.
26-
27-
The root of the repository provides some `devDependencies` necessary to build
28-
these definitions and the `prepare` npm script is invoked programmatically via
29-
the monorepo tooling (e.g. Lerna) thanks to _this_ module's `postinstall`
30-
script. Therefore, when making changes to this module, run scripts via `npx
31-
lerna run SCRIPTNAME` in the **root** of this monorepo in order to update the
32-
definitions in _this_ module.
24+
specifically for this package) based on the `reports.proto` file. None of these
25+
files are generated from .ts files by tsc, which is why this directory is not
26+
under `src`.
3327

3428
To update `reports.proto` to the current version recognized by the Studio usage
35-
reporting ingress, run `lerna run update-proto`. To then regenerate the JS and
36-
TS files, run `npx lerna run generate`. We check in the generated code and only
29+
reporting ingress, run `npm run protobuf-update`. To then regenerate the JS and
30+
TS files, run `npm run protobuf-generate`. We check in the generated code and only
3731
regenerate it manually, partially to make builds faster (no need to run pbjs on
3832
every `npm install`) and partially so that we don't have to make sure that
3933
`pbjs` runs on every Node version that we support.
34+
35+
The files in this subdirectory are large, so we want to avoid loading them at
36+
runtime unless necessary. Thus, files in this directory should only be imported
37+
in three contexts:
38+
- Inside `src/plugin`, in files that will only be loaded indirectly via the
39+
runtime require calls in `src/plugin/index.ts`
40+
- In tests
41+
- At compile-time only via `import type` calls

0 commit comments

Comments
 (0)