JetBrains: Use esbuild to build artifacts
Created by: philipp-spiess
Closes #34571 (closed)
This enables esbuild as the build tool of choice for the JetBrains extension. In addition to the changes that we also did for VSCode, this also removes support for the webpack build completely so that there's no other option than using esbuild anymore.
There's one catch to this though: esbuild does not run the TypeScript compiler so builds no longer check if types are sound. This leaves us with two issues:
- We need a way to locally run a script to check if our project is sound outside of IDE integrations
- We need CI to ensure that types are sound.
To do this, I added a new script yarn typecheck
into the JetBrains folder. However this script only works if you run a full typescript build of the whole Sourcegraph folder to include dependencies, so it will take a bit longer the first time it runs. All of the files it generates seem to be part of gitignore rules already so this is not breaking your local changes.
The good thing is that we do not need to care about 2) because yarn build-ts
in the root is already run on CI and will detect type issues for all of the TypeScript packages in our repo which JetBrains is a part of.
Test plan
The plugin still works
tyepcheck
script works locally
The α jetbrains (ps/jetbrains-esbuild) yarn typecheck
yarn run v1.22.17
$ tsc -b
webview/src/telemetry/EventLogger.ts:122:13 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
122 eventName,
~~~~~~~~~
webview/src/telemetry/EventLogger.ts:145:22 - error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
145 listener(eventName)
~~~~~~~~~
webview/src/telemetry/EventLogger.ts:149:13 - error TS2322: Type 'number' is not assignable to type 'string'.
149 event: eventName,
~~~~~
webview/src/graphql-operations.ts:660:5
660 event: Scalars['String']
~~~~~
The expected type comes from property 'event' which is declared here on type 'Event'
Found 3 errors.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
We detect type issues on CI
App preview:
Check out the client app preview documentation to learn more.