diff --git a/build/azure-pipelines/mixin.js b/build/azure-pipelines/mixin.ts similarity index 72% rename from build/azure-pipelines/mixin.js rename to build/azure-pipelines/mixin.ts index e133b2d2bb9..b6818d6957d 100644 --- a/build/azure-pipelines/mixin.js +++ b/build/azure-pipelines/mixin.ts @@ -5,15 +5,33 @@ 'use strict'; -const json = require('gulp-json-editor'); +import * as json from 'gulp-json-editor'; const buffer = require('gulp-buffer'); -const filter = require('gulp-filter'); -const es = require('event-stream'); -const vfs = require('vinyl-fs'); -const fancyLog = require('fancy-log'); -const ansiColors = require('ansi-colors'); -const fs = require('fs'); -const path = require('path'); +import * as filter from 'gulp-filter'; +import * as es from 'event-stream'; +import * as Vinyl from 'vinyl'; +import * as vfs from 'vinyl-fs'; +import * as fancyLog from 'fancy-log'; +import * as ansiColors from 'ansi-colors'; +import * as fs from 'fs'; +import * as path from 'path'; + +interface IBuiltInExtension { + readonly name: string; + readonly version: string; + readonly repo: string; + readonly metadata: any; +} + +interface OSSProduct { + readonly builtInExtensions: IBuiltInExtension[]; + readonly webBuiltInExtensions?: IBuiltInExtension[]; +} + +interface Product { + readonly builtInExtensions?: IBuiltInExtension[] | { 'include'?: IBuiltInExtension[], 'exclude'?: string[] }; + readonly webBuiltInExtensions?: IBuiltInExtension[]; +} function main() { const quality = process.env['VSCODE_QUALITY']; @@ -31,8 +49,8 @@ function main() { .pipe(filter(f => !f.isDirectory())) .pipe(productJsonFilter) .pipe(buffer()) - .pipe(json(o => { - const ossProduct = JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'product.json'), 'utf8')); + .pipe(json((o: Product) => { + const ossProduct = JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'product.json'), 'utf8')) as OSSProduct; let builtInExtensions = ossProduct.builtInExtensions; if (Array.isArray(o.builtInExtensions)) { @@ -58,7 +76,7 @@ function main() { return { webBuiltInExtensions: ossProduct.webBuiltInExtensions, ...o, builtInExtensions }; })) .pipe(productJsonFilter.restore) - .pipe(es.mapSync(function (f) { + .pipe(es.mapSync(function (f: Vinyl) { fancyLog(ansiColors.blue('[mixin]'), f.relative, ansiColors.green('✔︎')); return f; })) diff --git a/build/azure-pipelines/upload-sourcemaps.js b/build/azure-pipelines/upload-sourcemaps.ts similarity index 76% rename from build/azure-pipelines/upload-sourcemaps.js rename to build/azure-pipelines/upload-sourcemaps.ts index b70335efe5b..11204f21c8e 100644 --- a/build/azure-pipelines/upload-sourcemaps.js +++ b/build/azure-pipelines/upload-sourcemaps.ts @@ -5,20 +5,22 @@ 'use strict'; -const path = require('path'); -const es = require('event-stream'); +import * as path from 'path'; +import * as es from 'event-stream'; +import * as Vinyl from 'vinyl'; +import * as vfs from 'vinyl-fs'; +import * as util from '../lib/util'; const azure = require('gulp-azure-storage'); -const vfs = require('vinyl-fs'); -const util = require('../lib/util'); + const root = path.dirname(path.dirname(__dirname)); const commit = util.getVersion(root); // optionally allow to pass in explicit base/maps to upload const [, , base, maps] = process.argv; -const fetch = function (base, maps = `${base}/**/*.map`) { +function src(base: string, maps = `${base}/**/*.map`) { return vfs.src(maps, { base }) - .pipe(es.mapSync(f => { + .pipe(es.mapSync((f: Vinyl) => { f.path = `${f.base}/core/${f.relative}`; return f; })); @@ -29,7 +31,7 @@ function main() { // vscode client maps (default) if (!base) { - const vs = fetch('out-vscode-min'); // client source-maps only + const vs = src('out-vscode-min'); // client source-maps only sources.push(vs); const extensionsOut = vfs.src(['.build/extensions/**/*.js.map', '!**/node_modules/**'], { base: '.build' }); @@ -38,11 +40,11 @@ function main() { // specific client base/maps else { - sources.push(fetch(base, maps)); + sources.push(src(base, maps)); } return es.merge(...sources) - .pipe(es.through(function (data) { + .pipe(es.through(function (data: Vinyl) { console.log('Uploading Sourcemap', data.relative); // debug this.emit('data', data); }))