From d8d0570244aaa69a144319caa8522c53452099e4 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Fri, 17 Sep 2021 09:31:54 -0700 Subject: [PATCH] gzip and minify json --- build/azure-pipelines/upload-nlsmetadata.js | 9 ++++++++- build/azure-pipelines/upload-nlsmetadata.ts | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/build/azure-pipelines/upload-nlsmetadata.js b/build/azure-pipelines/upload-nlsmetadata.js index 7292b3b58de..5524325b8d0 100644 --- a/build/azure-pipelines/upload-nlsmetadata.js +++ b/build/azure-pipelines/upload-nlsmetadata.js @@ -9,6 +9,7 @@ const es = require("event-stream"); const vfs = require("vinyl-fs"); const util = require("../lib/util"); const merge = require("gulp-merge-json"); +const gzip = require("gulp-gzip"); const azure = require('gulp-azure-storage'); const root = path.dirname(path.dirname(__dirname)); const commit = util.getVersion(root); @@ -16,6 +17,7 @@ function main() { return es.merge(vfs.src('out-vscode-min/nls.metadata.json', { base: 'out-vscode-min' }), vfs.src('.build/extensions/**/nls.metadata.json', { base: '.build/extensions' }), vfs.src('.build/extensions/**/nls.metadata.header.json', { base: '.build/extensions' }), vfs.src('.build/extensions/**/package.nls.json', { base: '.build/extensions' })) .pipe(merge({ fileName: 'combined.nls.metadata.json', + jsonSpace: '', edit: (parsedJson, file) => { let key; if (file.base === 'out-vscode-min') { @@ -64,6 +66,7 @@ function main() { return { [key]: parsedJson }; }, })) + .pipe(gzip({ append: false })) .pipe(vfs.dest('./nlsMetadata')) .pipe(es.through(function (data) { console.log(`Uploading ${data.path}`); @@ -75,7 +78,11 @@ function main() { account: process.env.AZURE_STORAGE_ACCOUNT, key: process.env.AZURE_STORAGE_ACCESS_KEY, container: 'nlsmetadata', - prefix: commit + '/' + prefix: commit + '/', + contentSettings: { + contentEncoding: 'gzip', + cacheControl: 'max-age=31536000, public' + } })); } main(); diff --git a/build/azure-pipelines/upload-nlsmetadata.ts b/build/azure-pipelines/upload-nlsmetadata.ts index db0b551161b..44b65e51dcb 100644 --- a/build/azure-pipelines/upload-nlsmetadata.ts +++ b/build/azure-pipelines/upload-nlsmetadata.ts @@ -11,6 +11,7 @@ import * as Vinyl from 'vinyl'; import * as vfs from 'vinyl-fs'; import * as util from '../lib/util'; import * as merge from 'gulp-merge-json'; +import * as gzip from 'gulp-gzip'; const azure = require('gulp-azure-storage'); const root = path.dirname(path.dirname(__dirname)); @@ -30,6 +31,7 @@ function main() { vfs.src('.build/extensions/**/package.nls.json', { base: '.build/extensions' })) .pipe(merge({ fileName: 'combined.nls.metadata.json', + jsonSpace: '', edit: (parsedJson, file) => { let key; if (file.base === 'out-vscode-min') { @@ -82,6 +84,7 @@ function main() { return { [key]: parsedJson }; }, })) + .pipe(gzip({ append: false })) .pipe(vfs.dest('./nlsMetadata')) .pipe(es.through(function (data: Vinyl) { console.log(`Uploading ${data.path}`); @@ -93,7 +96,11 @@ function main() { account: process.env.AZURE_STORAGE_ACCOUNT, key: process.env.AZURE_STORAGE_ACCESS_KEY, container: 'nlsmetadata', - prefix: commit + '/' + prefix: commit + '/', + contentSettings: { + contentEncoding: 'gzip', + cacheControl: 'max-age=31536000, public' + } })); }