Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/build/azure-pipelines/distro/mixin-npm.js
3520 views
1
"use strict";
2
var __importDefault = (this && this.__importDefault) || function (mod) {
3
return (mod && mod.__esModule) ? mod : { "default": mod };
4
};
5
Object.defineProperty(exports, "__esModule", { value: true });
6
/*---------------------------------------------------------------------------------------------
7
* Copyright (c) Microsoft Corporation. All rights reserved.
8
* Licensed under the MIT License. See License.txt in the project root for license information.
9
*--------------------------------------------------------------------------------------------*/
10
const fs_1 = __importDefault(require("fs"));
11
const path_1 = __importDefault(require("path"));
12
const { dirs } = require('../../npm/dirs');
13
function log(...args) {
14
console.log(`[${new Date().toLocaleTimeString('en', { hour12: false })}]`, '[distro]', ...args);
15
}
16
function mixin(mixinPath) {
17
if (!fs_1.default.existsSync(`${mixinPath}/node_modules`)) {
18
log(`Skipping distro npm dependencies: ${mixinPath} (no node_modules)`);
19
return;
20
}
21
log(`Mixing in distro npm dependencies: ${mixinPath}`);
22
const distroPackageJson = JSON.parse(fs_1.default.readFileSync(`${mixinPath}/package.json`, 'utf8'));
23
const targetPath = path_1.default.relative('.build/distro/npm', mixinPath);
24
for (const dependency of Object.keys(distroPackageJson.dependencies)) {
25
fs_1.default.rmSync(`./${targetPath}/node_modules/${dependency}`, { recursive: true, force: true });
26
fs_1.default.cpSync(`${mixinPath}/node_modules/${dependency}`, `./${targetPath}/node_modules/${dependency}`, { recursive: true, force: true, dereference: true });
27
}
28
log(`Mixed in distro npm dependencies: ${mixinPath} ✔︎`);
29
}
30
function main() {
31
log(`Mixing in distro npm dependencies...`);
32
const mixinPaths = dirs.filter(d => /^.build\/distro\/npm/.test(d));
33
for (const mixinPath of mixinPaths) {
34
mixin(mixinPath);
35
}
36
}
37
main();
38
//# sourceMappingURL=mixin-npm.js.map
39