2023-04-02 15:35:39 +08:00
|
|
|
"use strict";
|
|
|
|
/*---------------------------------------------------------------------------------------------
|
|
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
const fs = require("fs");
|
|
|
|
const path = require("path");
|
|
|
|
function log(...args) {
|
|
|
|
console.log(`[${new Date().toLocaleTimeString('en', { hour12: false })}]`, '[distro]', ...args);
|
|
|
|
}
|
|
|
|
function main() {
|
|
|
|
const quality = process.env['VSCODE_QUALITY'];
|
|
|
|
if (!quality) {
|
|
|
|
throw new Error('Missing VSCODE_QUALITY, skipping mixin');
|
|
|
|
}
|
|
|
|
log(`Mixing in distro quality...`);
|
|
|
|
const basePath = `.build/distro/mixin/${quality}`;
|
|
|
|
for (const name of fs.readdirSync(basePath)) {
|
|
|
|
const distroPath = path.join(basePath, name);
|
|
|
|
const ossPath = path.relative(basePath, distroPath);
|
|
|
|
if (ossPath === 'product.json') {
|
|
|
|
const distro = JSON.parse(fs.readFileSync(distroPath, 'utf8'));
|
|
|
|
const oss = JSON.parse(fs.readFileSync(ossPath, 'utf8'));
|
|
|
|
let builtInExtensions = oss.builtInExtensions;
|
|
|
|
if (Array.isArray(distro.builtInExtensions)) {
|
|
|
|
log('Overwriting built-in extensions:', distro.builtInExtensions.map(e => e.name));
|
|
|
|
builtInExtensions = distro.builtInExtensions;
|
|
|
|
}
|
|
|
|
else if (distro.builtInExtensions) {
|
|
|
|
const include = distro.builtInExtensions['include'] ?? [];
|
|
|
|
const exclude = distro.builtInExtensions['exclude'] ?? [];
|
|
|
|
log('OSS built-in extensions:', builtInExtensions.map(e => e.name));
|
|
|
|
log('Including built-in extensions:', include.map(e => e.name));
|
|
|
|
log('Excluding built-in extensions:', exclude);
|
|
|
|
builtInExtensions = builtInExtensions.filter(ext => !include.find(e => e.name === ext.name) && !exclude.find(name => name === ext.name));
|
|
|
|
builtInExtensions = [...builtInExtensions, ...include];
|
|
|
|
log('Final built-in extensions:', builtInExtensions.map(e => e.name));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
log('Inheriting OSS built-in extensions', builtInExtensions.map(e => e.name));
|
|
|
|
}
|
|
|
|
const result = { webBuiltInExtensions: oss.webBuiltInExtensions, ...distro, builtInExtensions };
|
|
|
|
fs.writeFileSync(ossPath, JSON.stringify(result, null, '\t'), 'utf8');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fs.cpSync(distroPath, ossPath, { force: true, recursive: true });
|
|
|
|
}
|
|
|
|
log(distroPath, '✔︎');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
main();
|
2023-10-03 02:40:35 +08:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWl4aW4tcXVhbGl0eS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIm1peGluLXF1YWxpdHkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Z0dBR2dHOztBQUVoRyx5QkFBeUI7QUFDekIsNkJBQTZCO0FBbUI3QixTQUFTLEdBQUcsQ0FBQyxHQUFHLElBQVc7SUFDMUIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxJQUFJLElBQUksSUFBSSxFQUFFLENBQUMsa0JBQWtCLENBQUMsSUFBSSxFQUFFLEVBQUUsTUFBTSxFQUFFLEtBQUssRUFBRSxDQUFDLEdBQUcsRUFBRSxVQUFVLEVBQUUsR0FBRyxJQUFJLENBQUMsQ0FBQztBQUNqRyxDQUFDO0FBRUQsU0FBUyxJQUFJO0lBQ1osTUFBTSxPQUFPLEdBQUcsT0FBTyxDQUFDLEdBQUcsQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFDO0lBRTlDLElBQUksQ0FBQyxPQUFPLEVBQUUsQ0FBQztRQUNkLE1BQU0sSUFBSSxLQUFLLEN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