mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Export-XLF function for ADS (#15709)
* wip commit * added function to generate XLFs for ADS * code cleanup * removed unnecessary locfunc * updated extensions and locfunc * changed wording to be more clear * added working single extension compile * added export all extensions * added more comments and closing sql carbon edit braces. * consolidated gulpfile.extensions changes * changed name to remove ADS part. * changed gulpfile name use
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.translatePackageJSON = exports.packageRebuildExtensionsStream = exports.cleanRebuildExtensions = exports.packageExternalExtensionsStream = exports.scanBuiltinExtensions = exports.packageMarketplaceExtensionsStream = exports.packageLocalExtensionsStream = exports.fromMarketplace = void 0;
|
||||
exports.translatePackageJSON = exports.packageRebuildExtensionsStream = exports.cleanRebuildExtensions = exports.packageExternalExtensionsStream = exports.scanBuiltinExtensions = exports.packageMarketplaceExtensionsStream = exports.packageLocalExtensionsStream = exports.fromMarketplace = exports.fromLocalNormal = exports.fromLocal = void 0;
|
||||
const es = require("event-stream");
|
||||
const fs = require("fs");
|
||||
const glob = require("glob");
|
||||
@@ -71,6 +71,7 @@ function fromLocal(extensionPath, forWeb) {
|
||||
}
|
||||
return input;
|
||||
}
|
||||
exports.fromLocal = fromLocal;
|
||||
function fromLocalWebpack(extensionPath, webpackConfigFileName) {
|
||||
const result = es.through();
|
||||
const packagedDependencies = [];
|
||||
@@ -163,6 +164,7 @@ function fromLocalNormal(extensionPath) {
|
||||
.catch(err => result.emit('error', err));
|
||||
return result.pipe(stats_1.createStatsStream(path.basename(extensionPath)));
|
||||
}
|
||||
exports.fromLocalNormal = fromLocalNormal;
|
||||
const baseHeaders = {
|
||||
'X-Market-Client-Id': 'VSCode Build',
|
||||
'User-Agent': 'VSCode Build',
|
||||
|
||||
@@ -54,7 +54,7 @@ function updateExtensionPackageJSON(input: Stream, update: (data: any) => any):
|
||||
.pipe(packageJsonFilter.restore);
|
||||
}
|
||||
|
||||
function fromLocal(extensionPath: string, forWeb: boolean): Stream {
|
||||
export function fromLocal(extensionPath: string, forWeb: boolean): Stream { // {{SQL CARBON EDIT}} - Needed in locFunc
|
||||
const webpackConfigFileName = forWeb ? 'extension-browser.webpack.config.js' : 'extension.webpack.config.js';
|
||||
|
||||
const isWebPacked = fs.existsSync(path.join(extensionPath, webpackConfigFileName));
|
||||
@@ -171,7 +171,7 @@ function fromLocalWebpack(extensionPath: string, webpackConfigFileName: string):
|
||||
return result.pipe(createStatsStream(path.basename(extensionPath)));
|
||||
}
|
||||
|
||||
function fromLocalNormal(extensionPath: string): Stream {
|
||||
export function fromLocalNormal(extensionPath: string): Stream { // {{SQL CARBON EDIT}} - Needed in locFunc
|
||||
const result = es.through();
|
||||
|
||||
const vsce = require('vsce') as typeof import('vsce');
|
||||
|
||||
@@ -4,14 +4,12 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.packageLangpacksStream = void 0;
|
||||
exports.packageSingleExtensionStream = exports.packageLangpacksStream = void 0;
|
||||
const es = require("event-stream");
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const stats_1 = require("./stats");
|
||||
const File = require("vinyl");
|
||||
const glob = require("glob");
|
||||
const rename = require("gulp-rename");
|
||||
const ext = require("./extensions");
|
||||
const root = path.dirname(path.dirname(__dirname));
|
||||
// Modified packageLocalExtensionsStream from extensions.ts, but for langpacks.
|
||||
function packageLangpacksStream() {
|
||||
@@ -22,28 +20,24 @@ function packageLangpacksStream() {
|
||||
return { name: langpackName, path: langpackPath };
|
||||
});
|
||||
const builtLangpacks = langpackDescriptions.map(langpack => {
|
||||
return fromLocalNormal(langpack.path)
|
||||
return ext.fromLocalNormal(langpack.path)
|
||||
.pipe(rename(p => p.dirname = `langpacks/${langpack.name}/${p.dirname}`));
|
||||
});
|
||||
return es.merge(builtLangpacks);
|
||||
}
|
||||
exports.packageLangpacksStream = packageLangpacksStream;
|
||||
//copied from extensions.
|
||||
function fromLocalNormal(extensionPath) {
|
||||
const result = es.through();
|
||||
const vsce = require('vsce');
|
||||
vsce.listFiles({ cwd: extensionPath, packageManager: vsce.PackageManager.Yarn })
|
||||
.then(fileNames => {
|
||||
const files = fileNames
|
||||
.map(fileName => path.join(extensionPath, fileName))
|
||||
.map(filePath => new File({
|
||||
path: filePath,
|
||||
stat: fs.statSync(filePath),
|
||||
base: extensionPath,
|
||||
contents: fs.createReadStream(filePath)
|
||||
}));
|
||||
es.readArray(files).pipe(result);
|
||||
})
|
||||
.catch(err => result.emit('error', err));
|
||||
return result.pipe(stats_1.createStatsStream(path.basename(extensionPath)));
|
||||
// Modified packageLocalExtensionsStream but for any ADS extensions including excluded/external ones.
|
||||
function packageSingleExtensionStream(name) {
|
||||
const extenalExtensionDescriptions = glob.sync(`extensions/${name}/package.json`)
|
||||
.map(manifestPath => {
|
||||
const extensionPath = path.dirname(path.join(root, manifestPath));
|
||||
const extensionName = path.basename(extensionPath);
|
||||
return { name: extensionName, path: extensionPath };
|
||||
});
|
||||
const builtExtension = extenalExtensionDescriptions.map(extension => {
|
||||
return ext.fromLocal(extension.path, false)
|
||||
.pipe(rename(p => p.dirname = `extensions/${extension.name}/${p.dirname}`));
|
||||
});
|
||||
return es.merge(builtExtension);
|
||||
}
|
||||
exports.packageSingleExtensionStream = packageSingleExtensionStream;
|
||||
|
||||
@@ -5,12 +5,9 @@
|
||||
|
||||
import * as es from 'event-stream';
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
import { createStatsStream } from './stats';
|
||||
import * as File from 'vinyl';
|
||||
import { Stream } from 'stream';
|
||||
import * as glob from 'glob';
|
||||
import rename = require('gulp-rename');
|
||||
import ext = require('./extensions');
|
||||
|
||||
const root = path.dirname(path.dirname(__dirname));
|
||||
|
||||
@@ -24,33 +21,26 @@ export function packageLangpacksStream(): NodeJS.ReadWriteStream {
|
||||
})
|
||||
|
||||
const builtLangpacks = langpackDescriptions.map(langpack => {
|
||||
return fromLocalNormal(langpack.path)
|
||||
return ext.fromLocalNormal(langpack.path)
|
||||
.pipe(rename(p => p.dirname = `langpacks/${langpack.name}/${p.dirname}`));
|
||||
});
|
||||
|
||||
return es.merge(builtLangpacks);
|
||||
}
|
||||
|
||||
//copied from extensions.
|
||||
function fromLocalNormal(extensionPath: string): Stream {
|
||||
const result = es.through();
|
||||
|
||||
const vsce = require('vsce') as typeof import('vsce');
|
||||
|
||||
vsce.listFiles({ cwd: extensionPath, packageManager: vsce.PackageManager.Yarn })
|
||||
.then(fileNames => {
|
||||
const files = fileNames
|
||||
.map(fileName => path.join(extensionPath, fileName))
|
||||
.map(filePath => new File({
|
||||
path: filePath,
|
||||
stat: fs.statSync(filePath),
|
||||
base: extensionPath,
|
||||
contents: fs.createReadStream(filePath) as any
|
||||
}));
|
||||
|
||||
es.readArray(files).pipe(result);
|
||||
// Modified packageLocalExtensionsStream but for any ADS extensions including excluded/external ones.
|
||||
export function packageSingleExtensionStream(name : string): NodeJS.ReadWriteStream {
|
||||
const extenalExtensionDescriptions = (<string[]>glob.sync(`extensions/${name}/package.json`))
|
||||
.map(manifestPath => {
|
||||
const extensionPath = path.dirname(path.join(root, manifestPath));
|
||||
const extensionName = path.basename(extensionPath);
|
||||
return { name: extensionName, path: extensionPath };
|
||||
})
|
||||
.catch(err => result.emit('error', err));
|
||||
|
||||
return result.pipe(createStatsStream(path.basename(extensionPath)));
|
||||
const builtExtension = extenalExtensionDescriptions.map(extension => {
|
||||
return ext.fromLocal(extension.path, false)
|
||||
.pipe(rename(p => p.dirname = `extensions/${extension.name}/${p.dirname}`));
|
||||
});
|
||||
|
||||
return es.merge(builtExtension);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user