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

bazel: generate graphql operation interfaces, css module typings #45756

Merged
merged 6 commits into from
Dec 21, 2022

Conversation

jbedard
Copy link
Contributor

@jbedard jbedard commented Dec 16, 2022

This replaces #45682 . You can see the fixup commits there for the feedback in that PR.

Test plan

Existing tests

@sourcegraph-bot
Copy link
Contributor

sourcegraph-bot commented Dec 16, 2022

Codenotify: Notifying subscribers in CODENOTIFY files for diff e8aae97...3efc8f8.

Notify File(s)
@philipp-spiess client/jetbrains/BUILD.bazel
client/jetbrains/webview/BUILD.bazel
@vdavid client/jetbrains/BUILD.bazel
client/jetbrains/webview/BUILD.bazel

@sourcegraph-bot
Copy link
Contributor

sourcegraph-bot commented Dec 16, 2022

Codenotify: Notifying subscribers in OWNERS files for diff e8aae97...3efc8f8.

Notify File(s)
@sourcegraph/code-exploration-devs client/wildcard/BUILD.bazel
@vovakulikov client/wildcard/BUILD.bazel

@sg-e2e-regression-test-bob
Copy link

Bundle size report 📦

Initial size Total size Async size Modules
-0.58% (-16.69 kb) 🔽 -0.17% (-25.27 kb) 🔽 -0.07% (-8.58 kb) 0.00% (0)

Look at the Statoscope report for a full comparison between the commits 7405f24 and 749998a or learn more.

Open explanation
  • Initial size is the size of the initial bundle (the one that is loaded when you open the page)
  • Total size is the size of the initial bundle + all the async loaded chunks
  • Async size is the size of all the async loaded chunks
  • Modules is the number of modules in the initial bundle

@jbedard jbedard changed the title Bazel generate typings bazel: generate graphql operation interfaces, css module typings Dec 16, 2022
Copy link
Member

@valerybugakov valerybugakov left a comment

Choose a reason for hiding this comment

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

We should address a couple of CI failures before merging:

  1. Run prettier over client/shared/dev/generateGraphQlOperations.js
  2. Fix the issues with the "Circular type definition of import alias" that blocks many CI jobs.

noExport: false,
enumValues:
operation.interfaceNameForOperations === 'SharedGraphQlOperations'
? undefined
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was another thing that was different in one of the operations which we missed.

@kormide was there a reason for changing how this works other then removing duplication?

Copy link
Contributor

Choose a reason for hiding this comment

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

The changes here were to reduce duplication to make it easier to generate one operations file at a time under Bazel. Is the problem the presence of the field which is undefined rather than the field not existing as above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The SharedGraphQlOperations interface needs this set to undefined, where all the others have the same value (which was easy to miss when refactoring it).

Copy link
Member

@valerybugakov valerybugakov left a comment

Choose a reason for hiding this comment

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

Nice!

Comment on lines 173 to 178
async function main(args) {
if (args.length !== 2) {
throw new Error('Usage: <schemaName>')
}

const [interfaceNameForOperations, outputPath] = args
Copy link
Member

Choose a reason for hiding this comment

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

Should the error message here be different from the generateSchema script?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't really know the terminology enough to say. Did you have a preference?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, sorry. Here's what I mean: in the generateSchema script, the error message Usage: <schemaName> makes sense because we expect one CLI argument — schemaName. It would be nice to update the error message here to match the expected argument list. Does it make sense?

async function main(args) {
if (args.length !== 1) {
throw new Error('Usage: <schemaName>')
}
const schemaName = args[0]
await generateSchema(schemaName)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added <outputPath> which I think is enough?

Copy link
Member

Choose a reason for hiding this comment

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

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants