Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/build/azure-pipelines/common/listNodeModules.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
if (process.argv.length !== 3) {
13
console.error('Usage: node listNodeModules.js OUTPUT_FILE');
14
process.exit(-1);
15
}
16
const ROOT = path_1.default.join(__dirname, '../../../');
17
function findNodeModulesFiles(location, inNodeModules, result) {
18
const entries = fs_1.default.readdirSync(path_1.default.join(ROOT, location));
19
for (const entry of entries) {
20
const entryPath = `${location}/${entry}`;
21
if (/(^\/out)|(^\/src$)|(^\/.git$)|(^\/.build$)/.test(entryPath)) {
22
continue;
23
}
24
let stat;
25
try {
26
stat = fs_1.default.statSync(path_1.default.join(ROOT, entryPath));
27
}
28
catch (err) {
29
continue;
30
}
31
if (stat.isDirectory()) {
32
findNodeModulesFiles(entryPath, inNodeModules || (entry === 'node_modules'), result);
33
}
34
else {
35
if (inNodeModules) {
36
result.push(entryPath.substr(1));
37
}
38
}
39
}
40
}
41
const result = [];
42
findNodeModulesFiles('', false, result);
43
fs_1.default.writeFileSync(process.argv[2], result.join('\n') + '\n');
44
//# sourceMappingURL=listNodeModules.js.map
45