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:
Alex Ma
2021-06-22 09:57:15 -07:00
committed by GitHub
parent 49562239a0
commit 1dc4a437eb
6 changed files with 103 additions and 52 deletions

View File

@@ -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;