mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 13:46:13 +00:00
Web: publish web files.txt (#140163)
* build: publish web files.txt * fix cdn
This commit is contained in:
parent
e3b2098f06
commit
44452718b8
|
@ -6,6 +6,7 @@
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path = require("path");
|
||||
const es = require("event-stream");
|
||||
const Vinyl = require("vinyl");
|
||||
const vfs = require("vinyl-fs");
|
||||
const util = require("../lib/util");
|
||||
const filter = require("gulp-filter");
|
||||
|
@ -15,16 +16,9 @@ const azure = require('gulp-azure-storage');
|
|||
const root = path.dirname(path.dirname(__dirname));
|
||||
const commit = util.getVersion(root);
|
||||
const credential = new identity_1.ClientSecretCredential(process.env['AZURE_TENANT_ID'], process.env['AZURE_CLIENT_ID'], process.env['AZURE_CLIENT_SECRET']);
|
||||
function main() {
|
||||
return new Promise((c, e) => {
|
||||
vfs.src('**', { cwd: '../vscode-web', base: '../vscode-web', dot: true })
|
||||
.pipe(filter(f => !f.isDirectory()))
|
||||
.pipe(gzip({ append: false }))
|
||||
.pipe(es.through(function (data) {
|
||||
console.log('Uploading CDN file:', data.relative); // debug
|
||||
this.emit('data', data);
|
||||
}))
|
||||
.pipe(azure.upload({
|
||||
async function main() {
|
||||
const files = [];
|
||||
const options = {
|
||||
account: process.env.AZURE_STORAGE_ACCOUNT,
|
||||
credential,
|
||||
container: process.env.VSCODE_QUALITY,
|
||||
|
@ -33,7 +27,30 @@ function main() {
|
|||
contentEncoding: 'gzip',
|
||||
cacheControl: 'max-age=31536000, public'
|
||||
}
|
||||
};
|
||||
await new Promise((c, e) => {
|
||||
vfs.src('**', { cwd: '../vscode-web', base: '../vscode-web', dot: true })
|
||||
.pipe(filter(f => !f.isDirectory()))
|
||||
.pipe(gzip({ append: false }))
|
||||
.pipe(es.through(function (data) {
|
||||
console.log('Uploading:', data.relative); // debug
|
||||
files.push(data.relative);
|
||||
this.emit('data', data);
|
||||
}))
|
||||
.pipe(azure.upload(options))
|
||||
.on('end', () => c())
|
||||
.on('error', (err) => e(err));
|
||||
});
|
||||
await new Promise((c, e) => {
|
||||
const listing = new Vinyl({
|
||||
path: 'files.txt',
|
||||
contents: Buffer.from(files.join('\n')),
|
||||
stat: { mode: 0o666 }
|
||||
});
|
||||
console.log(`Uploading: files.txt (${files.length} files)`); // debug
|
||||
es.readArray([listing])
|
||||
.pipe(gzip({ append: false }))
|
||||
.pipe(azure.upload(options))
|
||||
.on('end', () => c())
|
||||
.on('error', (err) => e(err));
|
||||
});
|
||||
|
|
|
@ -19,16 +19,9 @@ const root = path.dirname(path.dirname(__dirname));
|
|||
const commit = util.getVersion(root);
|
||||
const credential = new ClientSecretCredential(process.env['AZURE_TENANT_ID']!, process.env['AZURE_CLIENT_ID']!, process.env['AZURE_CLIENT_SECRET']!);
|
||||
|
||||
function main(): Promise<void> {
|
||||
return new Promise((c, e) => {
|
||||
vfs.src('**', { cwd: '../vscode-web', base: '../vscode-web', dot: true })
|
||||
.pipe(filter(f => !f.isDirectory()))
|
||||
.pipe(gzip({ append: false }))
|
||||
.pipe(es.through(function (data: Vinyl) {
|
||||
console.log('Uploading CDN file:', data.relative); // debug
|
||||
this.emit('data', data);
|
||||
}))
|
||||
.pipe(azure.upload({
|
||||
async function main(): Promise<void> {
|
||||
const files: string[] = [];
|
||||
const options = {
|
||||
account: process.env.AZURE_STORAGE_ACCOUNT,
|
||||
credential,
|
||||
container: process.env.VSCODE_QUALITY,
|
||||
|
@ -37,7 +30,33 @@ function main(): Promise<void> {
|
|||
contentEncoding: 'gzip',
|
||||
cacheControl: 'max-age=31536000, public'
|
||||
}
|
||||
};
|
||||
|
||||
await new Promise<void>((c, e) => {
|
||||
vfs.src('**', { cwd: '../vscode-web', base: '../vscode-web', dot: true })
|
||||
.pipe(filter(f => !f.isDirectory()))
|
||||
.pipe(gzip({ append: false }))
|
||||
.pipe(es.through(function (data: Vinyl) {
|
||||
console.log('Uploading:', data.relative); // debug
|
||||
files.push(data.relative);
|
||||
this.emit('data', data);
|
||||
}))
|
||||
.pipe(azure.upload(options))
|
||||
.on('end', () => c())
|
||||
.on('error', (err: any) => e(err));
|
||||
});
|
||||
|
||||
await new Promise<void>((c, e) => {
|
||||
const listing = new Vinyl({
|
||||
path: 'files.txt',
|
||||
contents: Buffer.from(files.join('\n')),
|
||||
stat: { mode: 0o666 } as any
|
||||
});
|
||||
|
||||
console.log(`Uploading: files.txt (${files.length} files)`); // debug
|
||||
es.readArray([listing])
|
||||
.pipe(gzip({ append: false }))
|
||||
.pipe(azure.upload(options))
|
||||
.on('end', () => c())
|
||||
.on('error', (err: any) => e(err));
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue