55
66'use strict' ;
77
8- const json = require ( 'gulp-json-editor' ) ;
8+ import * as json from 'gulp-json-editor' ;
99const 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
1836function 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 } ) )
0 commit comments