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

Adding Typescript support #232

Merged
merged 9 commits into from
Jul 3, 2018
Merged

Adding Typescript support #232

merged 9 commits into from
Jul 3, 2018

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Jul 2, 2018

Adding Typescript support to Firestore.

Note:

  • I only converted path.js to TS for now (as a proof of concept)
  • I did not (yet) run gts fix since it re-formats almost everything (which is why as of now all tests are failing)

The tests are also spewing errors about Google Default Credentials not working. I am not sure if this is new in this PR, but it doesn't (yet) cause problems. It might make sense to fix that in a follow up.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 2, 2018
@codecov
Copy link

codecov bot commented Jul 2, 2018

Codecov Report

Merging #232 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #232    +/-   ##
======================================
  Coverage     100%   100%            
======================================
  Files          13     12     -1     
  Lines        1846   1740   -106     
======================================
- Hits         1846   1740   -106
Impacted Files Coverage Δ
src/index.js 100% <100%> (ø) ⬆️
src/write-batch.js 100% <0%> (ø) ⬆️
src/transaction.js 100% <0%> (ø) ⬆️
src/validate.js 100% <0%> (ø) ⬆️
src/document.js 100% <0%> (ø) ⬆️
src/watch.js 100% <0%> (ø) ⬆️
src/backoff.js 100% <0%> (ø) ⬆️
src/timestamp.js 100% <0%> (ø) ⬆️
src/reference.js 100% <0%> (ø) ⬆️
... and 3 more

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 116c7e2...6cd1dc1. Read the comment docs.

@JustinBeckwith
Copy link
Contributor

Wow, this is a big PR 🤣 Usually when we do a TypeScript transition, we're very careful to take a minimum number of steps. I have those pretty well laid out here:
googleapis/nodejs-translate#51

The issue with any library that uses GAPIC is that we're using generated JavaScript code. How are you getting around that out of curiosity?

@schmidt-sebastian
Copy link
Contributor Author

Wow, this is a big PR 🤣 Usually when we do a TypeScript transition, we're very careful to take a minimum number of steps. I have those pretty well laid out here:
googleapis/nodejs-translate#51

The issue with any library that uses GAPIC is that we're using generated JavaScript code. How are you getting around that out of curiosity?

The PR was rather large since it contained a bunch of reformatting done by gts fix. I have reverted these changes for the first round of review.

I want to convert the client one file at a time and am leaving JS support on for now.

"src/*{/*,/**/*}.js",
"src/*/v*/*.js",
"test/**/*.js"
"build/src/*{/*,/**/*}.js",

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@@ -8,14 +8,11 @@
"node": ">=4.0.0"
},
"repository": "googleapis/nodejs-firestore",
"main": "./src/index.js",
"main": "./build/src/index.js",
"types": "./types/firestore.d.ts",

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

package.json Outdated
"test": "npm run cover"
"system-test": "mocha build/system-test/*.js --timeout 600000",
"conformance": "mocha build/conformance/*.js --no-timeouts",
"test-no-cover": "mocha build/test/*.js --no-timeouts",

This comment was marked as spam.

This comment was marked as spam.

src/path.ts Outdated
: Array.prototype.slice.call(arguments, 2);

constructor(
private readonly projectId: string, private readonly databaseId: string,

This comment was marked as spam.

This comment was marked as spam.

src/path.ts Outdated
construct(segments) {
return new ResourcePath(this._projectId, this._databaseId, segments);
construct(segments: string[]): ResourcePath {
return new ResourcePath(this.projectId, this.databaseId, ...segments);

This comment was marked as spam.

This comment was marked as spam.

other._projectId !== '{{projectId}}'
) {
if (this._projectId < other._projectId) {
if (this.projectId !== '{{projectId}}' &&

This comment was marked as spam.

This comment was marked as spam.

src/path.ts Outdated
segments = is.array(segments)
? segments
: Array.prototype.slice.call(arguments);
segments = segments.length === 1 && is.array(segments[0]) ?

This comment was marked as spam.

This comment was marked as spam.

Copy link
Contributor Author

@schmidt-sebastian schmidt-sebastian left a comment

Choose a reason for hiding this comment

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

Addressed comments.

"src/*{/*,/**/*}.js",
"src/*/v*/*.js",
"test/**/*.js"
"build/src/*{/*,/**/*}.js",

This comment was marked as spam.

@@ -8,14 +8,11 @@
"node": ">=4.0.0"
},
"repository": "googleapis/nodejs-firestore",
"main": "./src/index.js",
"main": "./build/src/index.js",
"types": "./types/firestore.d.ts",

This comment was marked as spam.

package.json Outdated
"test": "npm run cover"
"system-test": "mocha build/system-test/*.js --timeout 600000",
"conformance": "mocha build/conformance/*.js --no-timeouts",
"test-no-cover": "mocha build/test/*.js --no-timeouts",

This comment was marked as spam.

src/path.ts Outdated
construct(segments) {
return new ResourcePath(this._projectId, this._databaseId, segments);
construct(segments: string[]): ResourcePath {
return new ResourcePath(this.projectId, this.databaseId, ...segments);

This comment was marked as spam.

other._projectId !== '{{projectId}}'
) {
if (this._projectId < other._projectId) {
if (this.projectId !== '{{projectId}}' &&

This comment was marked as spam.

src/path.ts Outdated
segments = is.array(segments)
? segments
: Array.prototype.slice.call(arguments);
segments = segments.length === 1 && is.array(segments[0]) ?

This comment was marked as spam.

tsconfig.json Outdated
"rootDir": ".",
"outDir": "build",
"target": "es6",
"noImplicitAny": false

This comment was marked as spam.

This comment was marked as spam.

tsconfig.json Outdated
"moduleResolution": "node",
"outDir": "dist/es6",
"rootDir": "./",
"declaration": false,

This comment was marked as spam.

This comment was marked as spam.

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.

LGTM w/ nits

.prettierrc Outdated
@@ -5,4 +5,4 @@ semi: true
singleQuote: true
tabWidth: 2
trailingComma: es5
useTabs: false
useTabs: false

This comment was marked as spam.

This comment was marked as spam.

@@ -8,14 +8,11 @@
"node": ">=4.0.0"
},
"repository": "googleapis/nodejs-firestore",
"main": "./src/index.js",
"main": "./build/src/index.js",
"types": "./types/firestore.d.ts",

This comment was marked as spam.

@schmidt-sebastian schmidt-sebastian merged commit d5573ff into master Jul 3, 2018
@schmidt-sebastian schmidt-sebastian deleted the tstools branch July 24, 2018 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants