2018-03-14 01:45:44 +03:00
|
|
|
/*---------------------------------------------------------------------------------------------
|
|
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
|
2020-03-14 02:17:21 +03:00
|
|
|
// tslint:disable:no-implicit-dependencies (this allows the use of dev dependencies)
|
|
|
|
|
2020-05-19 22:03:33 +03:00
|
|
|
import * as fse from 'fs-extra';
|
2019-01-03 22:50:22 +03:00
|
|
|
import * as gulp from 'gulp';
|
|
|
|
import * as path from 'path';
|
2020-03-14 02:17:21 +03:00
|
|
|
import { Stream } from "stream";
|
|
|
|
import { gulp_installAzureAccount, gulp_installVSCodeExtension, gulp_webpack } from 'vscode-azureextensiondev';
|
2018-12-06 01:54:59 +03:00
|
|
|
|
2020-05-19 22:03:33 +03:00
|
|
|
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);
|
2019-01-03 22:50:22 +03:00
|
|
|
}
|
|
|
|
|
2020-03-14 02:17:21 +03:00
|
|
|
function gulp_installCosmosDBExtension(): Promise<void> | Stream {
|
2020-05-19 22:03:33 +03:00
|
|
|
return gulp_installVSCodeExtension('ms-azuretools', 'vscode-cosmosdb');
|
2020-03-14 02:17:21 +03:00
|
|
|
}
|
|
|
|
|
2020-05-19 22:03:33 +03:00
|
|
|
exports['webpack-dev'] = gulp.series(prepareForWebpack, () => gulp_webpack('development'));
|
|
|
|
exports['webpack-prod'] = gulp.series(prepareForWebpack, () => gulp_webpack('production'));
|
|
|
|
exports.preTest = gulp.series(gulp_installAzureAccount, gulp_installCosmosDBExtension);
|