@@ -71,17 +71,6 @@ gulp.task('lint', function () {
7171 . pipe ( eslint . failAfterError ( ) ) ;
7272} ) ;
7373
74- gulp . task ( 'pr-check' , ( done ) => {
75- const packageJson = JSON . parse ( fs . readFileSync ( './package.json' ) . toString ( ) ) ;
76- if ( packageJson . activationEvents . length !== 1 && packageJson . activationEvents [ 0 ] !== '*' ) {
77- console . log ( 'Please make sure to not check in package.json that has been rewritten by the extension activation. If you intended to have changes in package.json, please only check-in your changes. If you did not, please run `git checkout -- package.json`.' ) ;
78- done ( ) ;
79- process . exit ( 1 ) ;
80- }
81-
82- done ( ) ;
83- } ) ;
84-
8574
8675// ****************************
8776// Command: translations-export
@@ -301,109 +290,6 @@ gulp.task("translations-import", (done) => {
301290 } ) ) ;
302291} ) ;
303292
304- // ****************************
305- // Command: generate-package-hashes
306- // Generates a hash for each dependency package
307- // ****************************
308-
309- async function DownloadFile ( urlString ) {
310- const buffers = [ ] ;
311- return new Promise ( ( resolve , reject ) => {
312- const req = https . request ( urlString , ( response ) => {
313- if ( response . statusCode === 301 || response . statusCode === 302 ) {
314- // Redirect - download from new location
315- let redirectUrl ;
316- if ( typeof response . headers . location === "string" ) {
317- redirectUrl = response . headers . location ;
318- } else {
319- if ( ! response . headers . location ) {
320- console . log ( `Invalid download location received` ) ;
321- return reject ( ) ;
322- }
323- redirectUrl = response . headers . location [ 0 ] ;
324- }
325- console . log ( `Using redirectUrl: '${ redirectUrl } '` ) ;
326- return resolve ( DownloadFile ( redirectUrl ) ) ;
327- } else if ( response . statusCode !== 200 ) {
328- if ( response . statusCode === undefined || response . statusCode === null ) {
329- console . log ( "unknown error code." ) ;
330- return reject ( ) ;
331- }
332- console . log ( `failed with error code: '${ response . statusCode } '` ) ;
333- return reject ( ) ;
334- }
335-
336- response . on ( 'data' , ( data ) => {
337- buffers . push ( data ) ;
338- } ) ;
339-
340- response . on ( 'end' , ( ) => {
341- if ( buffers . length > 0 ) {
342- return resolve ( Buffer . concat ( buffers ) ) ;
343- } else {
344- return reject ( ) ;
345- }
346- } ) ;
347-
348- response . on ( 'error' , err => {
349- console . log ( `problem with request: '${ err . message } '` ) ;
350- return reject ( ) ;
351- } ) ;
352- } ) ;
353-
354- req . on ( 'error' , err => {
355- console . log ( `problem with request: '${ err . message } '` ) ;
356- return reject ( ) ;
357- } ) ;
358-
359- // Execute the request
360- req . end ( ) ;
361- } ) ;
362-
363- }
364-
365- async function generatePackageHashes ( packageJson ) {
366- const downloadAndGetHash = async ( url ) => {
367- console . log ( url ) ;
368- try {
369- const buf = await DownloadFile ( url ) ;
370- if ( buf ) {
371- const hash = crypto . createHash ( 'sha256' ) ;
372- hash . update ( buf ) ;
373- const value = hash . digest ( 'hex' ) . toUpperCase ( ) ;
374- return value ;
375- }
376- return undefined ;
377- } catch ( err ) {
378- return undefined ;
379- }
380- } ;
381-
382- for ( let dependency of packageJson . runtimeDependencies ) {
383- console . log ( `-------- Downloading package: '${ dependency . description } ' --------` ) ;
384- const hash = await downloadAndGetHash ( dependency . url ) ;
385- if ( hash ) {
386- dependency . integrity = hash ;
387- console . log ( `integrity: '${ hash } '` ) ;
388- } else {
389- console . log ( `No hash generated for package '${ dependency . description } ` ) ;
390- }
391- console . log ( `\n` ) ;
392- }
393-
394- let content = JSON . stringify ( packageJson , null , 2 ) ;
395- return content ;
396- }
397-
398- gulp . task ( 'generate-package-hashes' , async ( done ) => {
399- const packageJsonPath = './package.json' ;
400- const packageJson = JSON . parse ( fs . readFileSync ( packageJsonPath ) . toString ( ) ) ;
401- const content = await generatePackageHashes ( packageJson ) ;
402- fs . writeFileSync ( packageJsonPath , content ) ;
403- done ( ) ;
404- } ) ;
405-
406-
407293// ****************************
408294// Command: translations-generate
409295// The following is used to import an i18n directory structure and generate files used at runtime.
0 commit comments