Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct Long types import #358

Merged
merged 8 commits into from May 9, 2019
Merged

fix: correct Long types import #358

merged 8 commits into from May 9, 2019

Conversation

SimenB
Copy link
Contributor

@SimenB SimenB commented Mar 8, 2019

Fixes #345

Ref #352

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 8, 2019
@SimenB
Copy link
Contributor Author

SimenB commented Mar 8, 2019

ergh no, the generator removes the manual edit I made 😅 Does need the dependency in package.json, though

Copy link
Contributor

@JustinBeckwith JustinBeckwith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for submitting a fix! And sorry for the 🤦‍♂️ You were super close.

package.json Show resolved Hide resolved
@@ -1,5 +1,5 @@
import * as $protobuf from "protobufjs";
import * as long from "long";
import * as Long from "long";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yarrr, nice find and sorry for the mixup. What you really wanna do here is update this line in package.json:

"proto:datastore": "mkdir -p proto && pbjs -t static-module -w commonjs -p node_modules/google-proto-files google/datastore/v1/datastore.proto | pbts -i long -o proto/datastore.d.ts -",

Make that:

"proto:datastore": "mkdir -p proto && pbjs -t static-module -w commonjs -p node_modules/google-proto-files google/datastore/v1/datastore.proto | pbts -i Long -o proto/datastore.d.ts -",

That way the fix doesn't get roughed up by the generator.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it's import Long from 'Long' which I guess will go boom on linux?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, it'll probably be fine

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This very much will blow up on Linux -- import filenames are case sensitive there. Applying the suggestion results in:

> @google-cloud/datastore@3.1.2 compile /home/mgl/3psrc/nodejs-datastore
> tsc -p . && cp -r src/v1 build/src && cp -r proto* build && cp test/*.js build/test

proto/datastore.d.ts:2:23 - error TS2307: Cannot find module 'Long'.

2 import * as Long from "Long";
                        ~~~~~~


Found 2 errors.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this what we want? protobufjs/protobuf.js#1166

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes lol. That would fix all the things.

@callmehiphop callmehiphop added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 8, 2019
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 8, 2019
@codecov
Copy link

codecov bot commented Mar 11, 2019

Codecov Report

Merging #358 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #358   +/-   ##
=======================================
  Coverage   98.05%   98.05%           
=======================================
  Files           5        5           
  Lines         617      617           
  Branches      145      145           
=======================================
  Hits          605      605           
  Partials       12       12

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 19bc787...9230198. Read the comment docs.

@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Mar 15, 2019
@callmehiphop
Copy link
Contributor

@JustinBeckwith in some of the other clients we are just editing the generated file until a better solution presents itself. Assuming we're cool doing that here as well, I think this PR is good to go unless you have any objections

@JustinBeckwith
Copy link
Contributor

SGTM. Let's just be careful about not blasting these away :)

@JustinBeckwith JustinBeckwith added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 26, 2019
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 26, 2019
@JustinBeckwith JustinBeckwith added automerge Merge the pull request once unit tests and other checks pass. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Mar 28, 2019
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 29, 2019
@callmehiphop
Copy link
Contributor

@JustinBeckwith I see you became a contributor to Protobuf.js 😮 any chance we'll see a release soon with the Long fix?

@callmehiphop callmehiphop added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 9, 2019
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 9, 2019
Copy link
Contributor

@callmehiphop callmehiphop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to merge this, but until the needed patch for protobufjs is released we should be mindful not to overwrite this change by re-generating types.

@callmehiphop callmehiphop merged commit dfe1def into googleapis:master May 9, 2019
@SimenB SimenB deleted the long-type-import branch May 10, 2019 07:56
@yoshi-automation yoshi-automation removed the 🚨 This issue needs some love. label Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge the pull request once unit tests and other checks pass. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing explicit dependency on Long.js
8 participants