Path: blob/main/extensions/copilot/build/listBuildCacheFiles.js
13383 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45//@ts-check6'use strict';78const fs = require('fs');9const path = require('path');1011if (process.argv.length !== 3) {12console.error('Usage: node listBuildCacheFiles.js OUTPUT_FILE');13process.exit(-1);14}1516const ROOT = path.join(__dirname, '../');1718/**19* @param {string} location20* @param {string[]} result21*/22function listAllFiles(location, result) {23const entries = fs.readdirSync(path.join(ROOT, location));24for (const entry of entries) {25const entryPath = `${location}/${entry}`;2627/** @type {import('fs').Stats} */28let stat;29try {30stat = fs.statSync(path.join(ROOT, entryPath));31} catch (err) {32continue;33}3435if (stat.isDirectory()) {36listAllFiles(entryPath, result);37} else {38result.push(entryPath);39}40}41}4243/** @type {string[]} */44const result = [];45listAllFiles('node_modules', result); // node modules46listAllFiles('dist', result); // contains wasm files47fs.writeFileSync(process.argv[2], result.join('\n') + '\n');484950