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

[WIP] feat: move source files to "src" folder #432

Closed
wants to merge 36 commits into from

Conversation

trivikr
Copy link
Contributor

@trivikr trivikr commented Sep 28, 2021

Issue #, if available:
Refs: aws/aws-sdk-js-v3#1306

Description of changes:
Move source files to "src" folder

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Contributor

@JordonPhillips JordonPhillips left a comment

Choose a reason for hiding this comment

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

Most of these comments are broadly applicable to other parts of the code

@@ -429,7 +430,7 @@ private void generateClient(ServiceShape shape) {
for (OperationShape operation : containedOperations) {
if (operation.hasTrait(PaginatedTrait.ID)) {
hasPaginatedOperation = true;
String outputFilename = PaginationGenerator.getOutputFilelocation(operation);
String outputFilename = CodegenUtils.SOURCE_FOLDER + "/" + PaginationGenerator.getOutputFilelocation(operation);
Copy link
Contributor

Choose a reason for hiding this comment

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

All these get output file location operations / constants should embed this prefix rather than you adding it on in post.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I update output file location, the import in index.ts imports from src instead directly.

Should I remove src while exporting from IndexGenerator instead?
Or use some abstraction which removes src automatically?

Copy link
Contributor

Choose a reason for hiding this comment

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

You could have a getOutputFilelocation and getOutputNamespace or some such, the latter of which would not include src.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 53b6977 (#432)

Comment on lines 73 to 75
String serviceSymbolName = serviceSymbol.getName();
writer.addImport(serviceSymbolName, serviceSymbolName,
"./" + CodegenUtils.SOURCE_FOLDER + serviceSymbol.getNamespace().substring(1));
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
String serviceSymbolName = serviceSymbol.getName();
writer.addImport(serviceSymbolName, serviceSymbolName,
"./" + CodegenUtils.SOURCE_FOLDER + serviceSymbol.getNamespace().substring(1));
writer.addUseImports(serviceSymbol);

If that doesn't work, the symbol itself needs updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

writer.addUseImports(serviceSymbol);

This doesn't work.

I need to update Symbol while creating it in SymbolVisitor right?
https://github.com/awslabs/smithy-typescript/blob/5a242c73bcfeac9d637dce3203dff90d[…]va/software/amazon/smithy/typescript/codegen/SymbolVisitor.java

Copy link
Contributor

Choose a reason for hiding this comment

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

right

@trivikr
Copy link
Contributor Author

trivikr commented Sep 28, 2021

Commenting here for future reference.

The commit in 1ca2bde (#432) has working solution.
I'm working on moving prefixing of SOURCE_FOLDER to Symbol creation instead to make it clean.

@trivikr trivikr changed the title feat: move source files to "src" folder [WIP] feat: move source files to "src" folder Sep 29, 2021
@trivikr
Copy link
Contributor Author

trivikr commented Sep 29, 2021

Superceded by #434

@trivikr trivikr closed this Sep 29, 2021
@trivikr trivikr deleted the client-src branch September 29, 2021 01:08
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.

2 participants