Skip to content

Refactor NodeJS codegen - #4360

Merged
TomChv merged 7 commits into
dagger:mainfrom
dolanor:nodejs-refacto-codegen
Feb 16, 2023
Merged

TomChv merged 7 commits into
dagger:mainfrom
dolanor:nodejs-refacto-codegen

Conversation

@dolanor

@dolanor dolanor commented Jan 11, 2023

Copy link
Copy Markdown
Contributor

Goal

  • remove extraneous template commands (use }} instead of -}} as we already have {{- in general)
  • remove template files if too simple (simple range)

@dolanor
dolanor marked this pull request as draft January 11, 2023 10:42
@dolanor dolanor linked an issue Jan 11, 2023 that may be closed by this pull request
@dolanor dolanor linked an issue Jan 11, 2023 that may be closed by this pull request
@TomChv
TomChv force-pushed the nodejs-refacto-codegen branch from 1e3c857 to 7f9f4a0 Compare January 14, 2023 03:26
@TomChv
TomChv force-pushed the nodejs-refacto-codegen branch 2 times, most recently from b31e278 to d7cd479 Compare January 19, 2023 02:04
@TomChv
TomChv marked this pull request as ready for review January 19, 2023 17:47
@TomChv
TomChv force-pushed the nodejs-refacto-codegen branch from d7cd479 to 80c02da Compare January 19, 2023 17:47
@slumbering

Copy link
Copy Markdown
Contributor

@dolanor @TomChv Do we have any friction between this PR and this one ?

@TomChv

TomChv commented Jan 23, 2023

Copy link
Copy Markdown
Member

Do we have any friction between this PR and this one ?

Not at all :D

@TomChv
TomChv force-pushed the nodejs-refacto-codegen branch from 80c02da to b9c258a Compare January 24, 2023 04:29
@TomChv
TomChv force-pushed the nodejs-refacto-codegen branch from b9c258a to efeaa32 Compare January 25, 2023 23:34
@dolanor

dolanor commented Jan 26, 2023

Copy link
Copy Markdown
Contributor Author

I'll check this one tomorrow!

@TomChv
TomChv force-pushed the nodejs-refacto-codegen branch from efeaa32 to a00d965 Compare January 31, 2023 17:56
@slumbering

Copy link
Copy Markdown
Contributor

Is this PR still relevant (cc @dolanor @TomChv ) ?

@TomChv

TomChv commented Feb 8, 2023

Copy link
Copy Markdown
Member

Is this PR still relevant (cc @dolanor @TomChv ) ?

Of course! I'll rebase it and I'm waiting for Tanguy's review

@slumbering

Copy link
Copy Markdown
Contributor

cc @dolanor ☝️

@dolanor dolanor left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Excellent work, I think you really streamlined it better.
There are a few -}} that can be avoided I think.

I would need a new version of the client generated code part of the PR to make sure that we don't have regression now that we removed most of codegen unit test.
Can you run a go run ./cmd/client-gen/ --lang nodejs -o ./sdk/nodejs/api/client.gen.ts and commit it with this PR so we see if we didn't break anything during the refactor?

@slumbering

Copy link
Copy Markdown
Contributor

@dolanor as you're the author of this PR, do you think it could be possible for you to make those changes above in order to ship this PR ?

@TomChv
TomChv force-pushed the nodejs-refacto-codegen branch from 431c71a to c8f8260 Compare February 11, 2023 04:14
@slumbering
slumbering requested a review from TomChv February 16, 2023 09:22
@dolanor

dolanor commented Feb 16, 2023

Copy link
Copy Markdown
Contributor Author

I'm gonna rebase this and fix conflicts.

dolanor and others added 2 commits February 16, 2023 16:45
VSCode has an extension for Go template but it only parses files with *.go.tpml
or *.gtpl extension. To enable this capabilities, we rename *.ts.tpml to
*.ts.gtpl.

Simplify types.ts.tpml by merging external template
in it. This removes type, type_field_comment and object_comment template.

Add comments on some template files.

Signed-off-by: Tom Chauveau <[email protected]>
TomChv and others added 4 commits February 16, 2023 16:54
Merge returns template into files.
Add comments.
Make templates more readable.

Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Tanguy ⧓ Herrmann <[email protected]>
@dolanor
dolanor force-pushed the nodejs-refacto-codegen branch 2 times, most recently from 0021f39 to 56a8c9f Compare February 16, 2023 16:52
- (only use it on template comments {{- /* xxx */ -}} or if not possible
  to use a `{{- "" }}` on the next line.
- make templates directive indented by `\t`. Only use ` ` for actual TS
  code indentation

Signed-off-by: Tanguy ⧓ Herrmann <[email protected]>
@dolanor
dolanor force-pushed the nodejs-refacto-codegen branch from 56a8c9f to 819df4a Compare February 16, 2023 17:08
@dolanor

dolanor commented Feb 16, 2023

Copy link
Copy Markdown
Contributor Author

Ok, good to review/merge!

@TomChv TomChv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@TomChv
TomChv merged commit 32efa92 into dagger:main Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ Refactor NodeJS SDK generator

3 participants