From 4d2a04d472ce1a6ebfc5494742d95d05ec726a81 Mon Sep 17 00:00:00 2001 From: Summer Ji Date: Thu, 5 May 2022 16:46:18 -0700 Subject: [PATCH] build!: reduce module size by remove duplicate storage for protos files (#1249) Significantly reduce the module size -- | before | after -- | -- | --| package size | 869.6 kB |575.4KB unpacked size | 10.9 MB | 5. MB This is a BREAKING_CHANGE! A client library refer to `protos/..` file should throw error with gax updates. To fix it, we should refer to `build/protos/..` instead. --- package.json | 1 - src/googleError.ts | 2 +- test/fixtures/google-gax-packaging-test-app/src/index.ts | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 19407bc51..140131ddf 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,6 @@ "files": [ "build/src", "build/tools/compileProtos.js", - "protos", "build/protos/" ], "bin": { diff --git a/src/googleError.ts b/src/googleError.ts index 19089e89a..437b5fe64 100644 --- a/src/googleError.ts +++ b/src/googleError.ts @@ -130,7 +130,7 @@ export class GoogleErrorDecoder { constructor() { // eslint-disable-next-line @typescript-eslint/no-var-requires - const errorProtoJson = require('../../protos/status.json'); + const errorProtoJson = require('../../build/protos/status.json'); this.root = protobuf.Root.fromJSON(errorProtoJson); this.anyType = this.root.lookupType('google.protobuf.Any'); this.statusType = this.root.lookupType('google.rpc.Status'); diff --git a/test/fixtures/google-gax-packaging-test-app/src/index.ts b/test/fixtures/google-gax-packaging-test-app/src/index.ts index 95dff939b..561df790f 100644 --- a/test/fixtures/google-gax-packaging-test-app/src/index.ts +++ b/test/fixtures/google-gax-packaging-test-app/src/index.ts @@ -139,6 +139,7 @@ async function testEchoError(client: EchoClient) { '..', '..', '..', + 'build', 'protos', 'google', 'rpc'