Skip to content

Commit 212fc3d

Browse files
committed
migrate last js files
related to microsoft#107356
1 parent 785f9ce commit 212fc3d

2 files changed

Lines changed: 40 additions & 20 deletions

File tree

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,33 @@
55

66
'use strict';
77

8-
const json = require('gulp-json-editor');
8+
import * as json from 'gulp-json-editor';
99
const buffer = require('gulp-buffer');
10-
const filter = require('gulp-filter');
11-
const es = require('event-stream');
12-
const vfs = require('vinyl-fs');
13-
const fancyLog = require('fancy-log');
14-
const ansiColors = require('ansi-colors');
15-
const fs = require('fs');
16-
const path = require('path');
10+
import * as filter from 'gulp-filter';
11+
import * as es from 'event-stream';
12+
import * as Vinyl from 'vinyl';
13+
import * as vfs from 'vinyl-fs';
14+
import * as fancyLog from 'fancy-log';
15+
import * as ansiColors from 'ansi-colors';
16+
import * as fs from 'fs';
17+
import * as path from 'path';
18+
19+
interface IBuiltInExtension {
20+
readonly name: string;
21+
readonly version: string;
22+
readonly repo: string;
23+
readonly metadata: any;
24+
}
25+
26+
interface OSSProduct {
27+
readonly builtInExtensions: IBuiltInExtension[];
28+
readonly webBuiltInExtensions?: IBuiltInExtension[];
29+
}
30+
31+
interface Product {
32+
readonly builtInExtensions?: IBuiltInExtension[] | { 'include'?: IBuiltInExtension[], 'exclude'?: string[] };
33+
readonly webBuiltInExtensions?: IBuiltInExtension[];
34+
}
1735

1836
function main() {
1937
const quality = process.env['VSCODE_QUALITY'];
@@ -31,8 +49,8 @@ function main() {
3149
.pipe(filter(f => !f.isDirectory()))
3250
.pipe(productJsonFilter)
3351
.pipe(buffer())
34-
.pipe(json(o => {
35-
const ossProduct = JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'product.json'), 'utf8'));
52+
.pipe(json((o: Product) => {
53+
const ossProduct = JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'product.json'), 'utf8')) as OSSProduct;
3654
let builtInExtensions = ossProduct.builtInExtensions;
3755

3856
if (Array.isArray(o.builtInExtensions)) {
@@ -58,7 +76,7 @@ function main() {
5876
return { webBuiltInExtensions: ossProduct.webBuiltInExtensions, ...o, builtInExtensions };
5977
}))
6078
.pipe(productJsonFilter.restore)
61-
.pipe(es.mapSync(function (f) {
79+
.pipe(es.mapSync(function (f: Vinyl) {
6280
fancyLog(ansiColors.blue('[mixin]'), f.relative, ansiColors.green('✔︎'));
6381
return f;
6482
}))

build/azure-pipelines/upload-sourcemaps.js renamed to build/azure-pipelines/upload-sourcemaps.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,22 @@
55

66
'use strict';
77

8-
const path = require('path');
9-
const es = require('event-stream');
8+
import * as path from 'path';
9+
import * as es from 'event-stream';
10+
import * as Vinyl from 'vinyl';
11+
import * as vfs from 'vinyl-fs';
12+
import * as util from '../lib/util';
1013
const azure = require('gulp-azure-storage');
11-
const vfs = require('vinyl-fs');
12-
const util = require('../lib/util');
14+
1315
const root = path.dirname(path.dirname(__dirname));
1416
const commit = util.getVersion(root);
1517

1618
// optionally allow to pass in explicit base/maps to upload
1719
const [, , base, maps] = process.argv;
1820

19-
const fetch = function (base, maps = `${base}/**/*.map`) {
21+
function src(base: string, maps = `${base}/**/*.map`) {
2022
return vfs.src(maps, { base })
21-
.pipe(es.mapSync(f => {
23+
.pipe(es.mapSync((f: Vinyl) => {
2224
f.path = `${f.base}/core/${f.relative}`;
2325
return f;
2426
}));
@@ -29,7 +31,7 @@ function main() {
2931

3032
// vscode client maps (default)
3133
if (!base) {
32-
const vs = fetch('out-vscode-min'); // client source-maps only
34+
const vs = src('out-vscode-min'); // client source-maps only
3335
sources.push(vs);
3436

3537
const extensionsOut = vfs.src(['.build/extensions/**/*.js.map', '!**/node_modules/**'], { base: '.build' });
@@ -38,11 +40,11 @@ function main() {
3840

3941
// specific client base/maps
4042
else {
41-
sources.push(fetch(base, maps));
43+
sources.push(src(base, maps));
4244
}
4345

4446
return es.merge(...sources)
45-
.pipe(es.through(function (data) {
47+
.pipe(es.through(function (data: Vinyl) {
4648
console.log('Uploading Sourcemap', data.relative); // debug
4749
this.emit('data', data);
4850
}))

0 commit comments

Comments
 (0)