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
20 lines
619 B
TypeScript
20 lines
619 B
TypeScript
import { src, dest } from "gulp";
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
const replace = require("gulp-replace");
|
|
|
|
/** Inject the application insights key into the telemetry file */
|
|
export function injectAppInsightsKey() {
|
|
if (!process.env.APP_INSIGHTS_KEY) {
|
|
// noop
|
|
console.log(
|
|
"APP_INSIGHTS_KEY environment variable is not set. So, cannot inject it into the application.",
|
|
);
|
|
return Promise.resolve();
|
|
}
|
|
|
|
// replace the key
|
|
return src(["out/extension.js"])
|
|
.pipe(replace(/REPLACE-APP-INSIGHTS-KEY/, process.env.APP_INSIGHTS_KEY))
|
|
.pipe(dest("out/"));
|
|
}
|