Commit Graph

58 Commits

Author SHA1 Message Date
Koen Vlaswinkel
3cb92233ac Add types to TextMate gulp step 2024-02-14 14:26:42 +01:00
Koen Vlaswinkel
1ce652629c Recompile view when shared files change 2024-02-14 09:46:58 +01:00
Koen Vlaswinkel
9d6962ede2 Enforce consistent type imports 2024-01-05 17:13:45 +01:00
Koen Vlaswinkel
034bfc230c Remove unnecessary namespace imports
This removes all unnecessary namespace imports. The only namespace
imports that are left are those that are needed for spying on functions
in tests.
2024-01-05 10:42:36 +01:00
Koen Vlaswinkel
dc3e1ce096 Add script for updating Chromium version 2024-01-02 16:28:27 +01:00
Koen Vlaswinkel
ef28154b95 Improve ESBuild globs 2024-01-02 10:42:05 +01:00
Koen Vlaswinkel
c1a3c2f6e5 Switch view to ESBuild
This switches the view code from Webpack to ESBuild to unify the build
systems for the extension and view code. There are no changes in
behavior, except that some features are now not supported (like dynamic
require/import) and importing the `classnames` package fails. However,
these were really easy to fix and don't hinder the further development
of the view code, so I've just fixed those instances.
2024-01-02 10:42:03 +01:00
Koen Vlaswinkel
7a7092de0d Add eslint-plugin-import
It seems like we had some rules that disabled rules of this plugin, but
we didn't actually have it installed. I've now installed it, used the
recommended configuration, and removed our own disable rules. I've fixed
any errors that this introduced.
2023-12-21 17:02:37 +01:00
Robert
ef38ffaa6d Move resolution of package.json path to inside deployPackage 2023-09-18 15:49:06 +01:00
Robert
f195e93d91 Import type of package.json 2023-09-18 15:47:37 +01:00
Robert
b9367095cf Avoid use of "as any" in gulpfile.ts/deploy.ts 2023-09-18 15:26:18 +01:00
Koen Vlaswinkel
016940f2ce Remove path-browserify 2023-07-26 11:23:39 +02:00
Koen Vlaswinkel
d2df162afd Switch to Webpack asset modules
css-loader 6 deprecates the use of `file-loader`. As a replacement,
we can use asset modules which generates very similar results. This is a
fairly simple change, and this makes fonts work again.

See: https://github.com/webpack-contrib/css-loader/releases/tag/v6.0.0
See: https://webpack.js.org/guides/asset-modules/
2023-06-08 11:38:20 +02:00
Koen Vlaswinkel
d151b2f5f9 Do not copy node_modules when packaging
We are no longer including our dependencies in the VSIX package, so we
can tell VSCE that we don't want it to look at dependencies using
`--no-dependencies`. If we do this, VSCE doesn't require the
`node_modules` directory anymore and we can skip that step, which will
make building significantly faster.

I've confirmed that there are no changes between the two options by
building the extension both without and with the change. This is the
diff of the two outputs (using `diff -r`):

```diff
diff --color -r vscode-codeql-1.8.0-dev.2023.3.8.15.10.13/extension/package.json vscode-codeql-old/extension/package.json
7c7
<   "version": "1.8.0-dev.2023.3.8.15.10.13",
---
>   "version": "1.8.0-dev.2023.3.8.15.6.51",
diff --color -r vscode-codeql-1.8.0-dev.2023.3.8.15.10.13/extension.vsixmanifest vscode-codeql-old/extension.vsixmanifest
4c4
< 			<Identity Language="en-US" Id="vscode-codeql" Version="1.8.0-dev.2023.3.8.15.10.13" Publisher="GitHub" />
---
> 			<Identity Language="en-US" Id="vscode-codeql" Version="1.8.0-dev.2023.3.8.15.6.51" Publisher="GitHub" />
```

The only difference is the version number, which is expected.
2023-03-08 16:18:55 +01:00
Koen Vlaswinkel
7b5e5a6407 Merge pull request #1963 from github/koesie10/webpack-production-build
Use Webpack in production mode for releases
2023-01-17 09:49:59 +01:00
Nora
c19f58b0e3 Rename schema file 2023-01-16 10:22:55 +00:00
Koen Vlaswinkel
b4bb1b6ad7 Upload sourcemaps for release builds
To allow us to reconstruct a stack trace, this will upload the
sourcemaps for all release builds.
2023-01-16 10:58:00 +01:00
Koen Vlaswinkel
f6f8b68ce9 Use Webpack in production mode for releases
This will set the `mode` of Webpack to `production` for release builds.
It will also stop inlining the sourcemap and instead produce a separate
file which is excluded by `.vscodeignore`.

In terms of the bundled extension, this will add 1 file
(`out/webview.js.LICENSE.txt`). It decreases the size of the VSIX file
from 4.28MB to 1.77MB.
2023-01-13 14:23:51 +02:00
Koen Vlaswinkel
bb63dc52c9 Fix debugging not working
VSCode was not able to find the original source of the bundled
extension because it was looking for the source in the `out` directory.
By setting the `sourceRoot` to the `extensions/ql-vscode` directory
which is located at `..` from the `out` directory, VSCode is able to
find the original source and breakpoints are hit.
2023-01-11 12:13:55 +02:00
Koen Vlaswinkel
477b32662f Copy WASM file from source-map
This will copy the WASM file from source-map to the output directory.
This makes the source-map package work. See the comment in the code for
more details.
2023-01-11 10:43:45 +02:00
Koen Vlaswinkel
f13f0b3bc3 Bundle extension files using ESBuild
This bundles the extension files using esbuild, as recommended by
VSCode. This reduces the size of the extension from 34MB to less than
5MB.

Gulp will still run TypeScript to check types, but will not use the
TypeScript compiler output in the bundle.

Tests are now run separately, outside of Gulp, so their data doesn't
need to be copied anymore.

See: https://code.visualstudio.com/api/working-with-extensions/bundling-extension
2023-01-11 10:42:24 +02:00
Charis Kyriakou
35d1d8ba6e Move VS Code integration tests to /test directory (#1912) 2023-01-03 10:31:38 +00:00
Koen Vlaswinkel
cac7c3ae4e Simplify gulpfile.ts/tsconfig.json
The `tsconfig.json` inside `gulpfile.ts` needs to match the root
`tsconfig.json`, so by making it extend the root `tsconfig.json` and
changing just the options which decide which files are included, we can
remove a lot of duplication.
2022-12-12 10:13:58 +01:00
Koen Vlaswinkel
2e7557ba09 Run type checking on all directories in CI
This commit adds a new step to the CI workflow that runs type checking
on all directories containing `tsconfig.json` files, using `find` and
`xargs`. Unfortunately, this does not work on Windows, so on Windows
it's not possible to run all of these type checks locally.
2022-12-07 16:50:19 +01:00
Elena Tanasoiu
b45c67f24f Autofix prefer-template 2022-12-01 09:10:46 +00:00
Elena Tanasoiu
30cf72b6c8 Autofix object-shorthand 2022-12-01 09:10:46 +00:00
Elena Tanasoiu
670c863f3f Autofix import/no-namespace
I'm leaving the rule turned off as it still has 100+ offenses that aren't
autofixable.
2022-12-01 09:10:44 +00:00
Nora
b6f33d7c7b Update compiler target version in gulp and extension tsconfig 2022-11-21 15:49:38 +01:00
Koen Vlaswinkel
ebcdf8ad0b Run Prettier on all files
This will change all existing files to match Prettier formatting.

The command used is `npm run format`.
2022-11-16 19:06:13 +01:00
Nora
ea0887622e Copy schema to extension files 2022-11-03 14:56:33 +01:00
Elena Tanasoiu
75ed7d20dc Await file operations when copying test data
Both `copyNoWorkspaceData` and `copyCliIntegrationData` return
promises. Since file copy-ing is quite fast at the moment, this
hasn't been a problem, but it might become a problem in the future
if we start copying larger files.

Let's wait for the operations to finish.
2022-11-03 09:49:57 +00:00
Elena Tanasoiu
abfd1e2e83 Make it possible to have test data in cli-integration
This will now reload any files that live in `src/vscode-tests/*/data`.
2022-11-03 09:49:56 +00:00
Elena Tanasoiu
cf6a10ccb2 Introduce watch method for test files
Because we're no longer running `gulp` when we run our test command,
we're going to need a way to update our test files when they change.

This will watch for any changes in our test files and copy the new
version over.

Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-11-02 15:50:59 +00:00
Koen Vlaswinkel
ba8b32078d Simplify and clarify Webpack font config 2022-09-01 11:21:06 +02:00
Koen Vlaswinkel
3749e17769 Bundle Codicons using Webpack
This will include the Codicons inside the webview bundle, reducing the
number of files that need to be loaded and the resource roots that need
to be included.
2022-08-29 14:31:29 +02:00
Koen Vlaswinkel
45da1e0f1f Unify the Webpack bundle
This will move all webviews into a single Webpack bundle. This will make
it easier to add new webviews since we don't need to add a new bundle,
but just need to add a new directory with an `index.tsx` file.

It also moves the CSS processing to Webpack so that we don't need to
specify the CSS files to use separately, but can simply do so in the
TypeScript files.
2022-08-26 11:15:24 +02:00
Andrew Eisenberg
4e4d8b2f04 Fix js-yaml issues
With js-yaml 4.0, safeLoad is no longer available. Use load instead.
2022-05-18 14:45:28 -07:00
Andrew Eisenberg
c8ba967a54 Remove jsonc dependency
This dependency was only used to parse package.json and
this can be just as easily parsed by regular JSON object.

jsonc can also parse JSON with comments, but there are no
comments in package.json.
2022-04-14 15:45:24 -07:00
Andrew Eisenberg
21bcd62ba8 Merge pull request #1239 from github/dependabot/npm_and_yarn/extensions/ql-vscode/types/gulp-replace-1.1.0
Bump @types/gulp-replace from 0.0.31 to 1.1.0 in /extensions/ql-vscode
2022-03-29 14:21:06 -07:00
Andrew Eisenberg
d8d394ce40 Use new version of gulp-replace 2022-03-29 14:09:01 -07:00
Andrew Eisenberg
ef28c9531b Update extensions/ql-vscode/gulpfile.ts/webpack.ts 2022-03-29 08:50:42 -07:00
Andrew Eisenberg
7e872aa6d6 Add webpack watch gulp task
Now, when running `npm run watch`, both the regular tsc command
and the webpack command will be run in watch mode.

The raw gulp tasks are now:

- `gulp watchView` to watch webpack compilation.
- `gulp watchCss` to watch for css changes.
- `gulp compileView` to compile the webpack once and exit.

However, stats are no longer being printed out. Not sure why.
2022-03-28 15:43:35 -07:00
Charis Kyriakou
b54cc27cab Update ECMAScript version to be the same across the codebase (#1177) 2022-03-01 16:01:29 +00:00
Andrew Eisenberg
56eeb1badb Delete output folder before building 2021-12-17 13:09:02 -08:00
Shati Patel
7e6483490a Merge remote queries webview outline into main (#1027) 2021-12-03 10:48:54 +00:00
Henry Mercer
fba8f51d1b Add polyfill for path to fix a bug that prevented the results view from being loaded (#842)
* Add a polyfill for the Node.js path module

Webpack >v5 doesn't include polyfills for core modules from Node.js by
default. Since we use `path` in the results table UI, we need to include
our own polyfill. This commit adds `path-browserify` to the
distributed extension.

As future work, we could move SARIF location rendering into the core
extension so we don't need to use `path.basename` in the UI. This would
allow us to remove the polyfill.

* Add changelog note
2021-04-23 12:53:48 +01:00
Andrew Eisenberg
bdda27703a Ensure snippets.json is copied when packaging the extension 2021-03-31 10:47:48 -07:00
Andrew Eisenberg
36bfb3987e Fix dependabot warnings (#816)
This commit updates to webpack 5 in order to fix some dependabot errors.
Because webpack 5 introduces some breaking changes, this commit also
makes some minor changes to the build code.
2021-03-29 19:46:20 +00:00
Marcono1234
a86c1ce69b Use HTTPS for links 2021-03-14 22:58:50 -07:00
Andrew Eisenberg
292e695646 Add telemetry for commands
This commit adds telemetry capturing for command execution. The data
captured explicitly captured and sent to application insights is only
the command id, execution time, and command completion status. We also
capture errors thrown by any command execution, but these are not sent
to application insights.

Telemetry capturing is opt-in. No data will be sent to application
insights unless the user explicitly allows it.

There are two new config settings added. The first controls whether or
not telemetry should be sent. This setting AND the global telemetry setting
must be enabled in order for telemetry to be sent.

The second setting controls whether or not telemetry event data should
be logged to the extension console. The hope here is that users can
inspect exactly what data is sent to the server and can have confidence
that nothing concerning is being leaked.

Note that the global setting for disabling telemetry collection is
handled inside the  `vscode-extension-telemetry` package implicitly, so
this extension doesn't touch that setting explicitly.

The `codeql.canary` setting is being used to add an additional flag to
telemetry events. This flag will help us determine if a user in internal
or not.

The application insights key is injected at build time through a
repository secret.

This commit also includes a new `TELEMETRY.md` file that explains what
is being captured, and why.
2021-01-29 15:21:12 -08:00