Easier debugging in a webpacked world πŸ•ΈπŸ“¦πŸŒŽ (#92)

This commit is contained in:
Eric Jizba 2020-03-17 15:48:41 -07:00 ΠΊΠΎΠΌΠΌΠΈΡ‚ ΠΏΡ€ΠΎΠΈΠ·Π²Ρ‘Π» GitHub
Π ΠΎΠ΄ΠΈΡ‚Π΅Π»ΡŒ 0fd5da0479
ΠšΠΎΠΌΠΌΠΈΡ‚ 76c7c5817e
НС Π½Π°ΠΉΠ΄Π΅Π½ ΠΊΠ»ΡŽΡ‡, ΡΠΎΠΎΡ‚Π²Π΅Ρ‚ΡΡ‚Π²ΡƒΡŽΡ‰ΠΈΠΉ Π΄Π°Π½Π½ΠΎΠΉ подписи
Π˜Π΄Π΅Π½Ρ‚ΠΈΡ„ΠΈΠΊΠ°Ρ‚ΠΎΡ€ ΠΊΠ»ΡŽΡ‡Π° GPG: 4AEE18F83AFDEB23
5 ΠΈΠ·ΠΌΠ΅Π½Ρ‘Π½Π½Ρ‹Ρ… Ρ„Π°ΠΉΠ»ΠΎΠ²: 17 Π΄ΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠΉ ΠΈ 11 ΡƒΠ΄Π°Π»Π΅Π½ΠΈΠΉ

2
.vscode/launch.json поставляСмый
ΠŸΡ€ΠΎΡΠΌΠΎΡ‚Ρ€Π΅Ρ‚ΡŒ Ρ„Π°ΠΉΠ»

@ -17,7 +17,6 @@
],
"preLaunchTask": "npm: compile",
"env": {
"AZCODE_VIRTUALMACHINES_IGNORE_BUNDLE": "1",
"DEBUGTELEMETRY": "1",
"NODE_DEBUG": ""
}
@ -58,7 +57,6 @@
],
"preLaunchTask": "npm: compile",
"env": {
"AZCODE_VIRTUALMACHINES_IGNORE_BUNDLE": "1",
"MOCHA_grep": "", // RegExp of tests to run (empty for all)
"MOCHA_enableTimeouts": "0", // Disable time-outs
"DEBUGTELEMETRY": "1",

ΠŸΡ€ΠΎΡΠΌΠΎΡ‚Ρ€Π΅Ρ‚ΡŒ Ρ„Π°ΠΉΠ»

@ -11,10 +11,20 @@
// tslint:disable:no-unsafe-any
import * as cp from 'child_process';
import * as fse from 'fs-extra';
import * as gulp from 'gulp';
import * as path from 'path';
import { gulp_installAzureAccount, gulp_webpack } from 'vscode-azureextensiondev';
async function prepareForWebpack(): Promise<void> {
const mainJsPath: string = path.join(__dirname, 'main.js');
let contents: string = (await fse.readFile(mainJsPath)).toString();
contents = contents
.replace('out/src/extension', 'dist/extension.bundle')
.replace(', true /* ignoreBundle */', '');
await fse.writeFile(mainJsPath, contents);
}
function test() {
const env = process.env;
env.DEBUGTELEMETRY = '1';
@ -24,6 +34,6 @@ function test() {
return cp.spawn('node', ['./node_modules/vscode/bin/test'], { stdio: 'inherit', env });
}
exports['webpack-dev'] = () => gulp_webpack('development');
exports['webpack-prod'] = () => gulp_webpack('production');
exports['webpack-dev'] = gulp.series(prepareForWebpack, () => gulp_webpack('development'));
exports['webpack-prod'] = gulp.series(prepareForWebpack, () => gulp_webpack('production'));
exports.test = gulp.series(gulp_installAzureAccount, test);

ΠŸΡ€ΠΎΡΠΌΠΎΡ‚Ρ€Π΅Ρ‚ΡŒ Ρ„Π°ΠΉΠ»

@ -16,12 +16,10 @@ let perfStats = {
Object.defineProperty(exports, "__esModule", { value: true });
const ignoreBundle = !/^(false|0)?$/i.test(process.env.AZCODE_VIRTUALMACHINES_IGNORE_BUNDLE || '');
const extensionPath = ignoreBundle ? "./out/src/extension" : "./dist/extension.bundle";
const extension = require(extensionPath);
const extension = require('./out/src/extension');
async function activate(ctx) {
return await extension.activateInternal(ctx, perfStats);
return await extension.activateInternal(ctx, perfStats, true /* ignoreBundle */);
}
async function deactivate(ctx) {

ΠŸΡ€ΠΎΡΠΌΠΎΡ‚Ρ€Π΅Ρ‚ΡŒ Ρ„Π°ΠΉΠ»

@ -21,8 +21,9 @@ import { AzureAccountTreeItem } from './tree/AzureAccountTreeItem';
import { SubscriptionTreeItem } from './tree/SubscriptionTreeItem';
import { VirtualMachineTreeItem } from './tree/VirtualMachineTreeItem';
export async function activateInternal(context: vscode.ExtensionContext, perfStats: { loadStartTime: number; loadEndTime: number }): Promise<AzureExtensionApiProvider> {
export async function activateInternal(context: vscode.ExtensionContext, perfStats: { loadStartTime: number; loadEndTime: number }, ignoreBundle?: boolean): Promise<AzureExtensionApiProvider> {
ext.context = context;
ext.ignoreBundle = ignoreBundle;
ext.reporter = createTelemetryReporter(context);
ext.outputChannel = createAzExtOutputChannel('Azure Virtual Machines', ext.prefix);
context.subscriptions.push(ext.outputChannel);

ΠŸΡ€ΠΎΡΠΌΠΎΡ‚Ρ€Π΅Ρ‚ΡŒ Ρ„Π°ΠΉΠ»

@ -19,7 +19,6 @@ export namespace ext {
export let tree: AzExtTreeDataProvider;
export let treeView: TreeView<AzExtTreeItem>;
export let azureAccountTreeItem: AzureAccountTreeItem;
// tslint:disable-next-line: strict-boolean-expressions
export let ignoreBundle: boolean = !/^(false|0)?$/i.test(process.env.AZCODE_VIRTUALMACHINES_IGNORE_BUNDLE || '');
export let ignoreBundle: boolean | undefined;
export const prefix: string = 'azureVirtualMachines';
}