Π·Π΅ΡΠΊΠ°Π»ΠΎ ΠΈΠ· https://github.com/microsoft/vscode-azurevirtualmachines.git
Easier debugging in a webpacked world πΈπ¦π (#92)
This commit is contained in:
Π ΠΎΠ΄ΠΈΡΠ΅Π»Ρ
0fd5da0479
ΠΠΎΠΌΠΌΠΈΡ
76c7c5817e
|
@ -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",
|
||||
|
|
14
gulpfile.ts
14
gulpfile.ts
|
@ -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);
|
||||
|
|
6
main.js
6
main.js
|
@ -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';
|
||||
}
|
||||
|
|
ΠΠ°Π³ΡΡΠ·ΠΊΠ°β¦
Π‘ΡΡΠ»ΠΊΠ° Π² Π½ΠΎΠ²ΠΎΠΉ Π·Π°Π΄Π°ΡΠ΅