MCPcopy Create free account
hub / github.com/angular/angular / main

Function main

vscode-ng-language-service/tools/vsix_contents_goldens.mjs:18–53  ·  view source on GitHub ↗
(outPath)

Source from the content-addressed store, hash-verified

16const rootPath = join(import.meta.dirname, '../');
17
18async function main(outPath) {
19 // `vsce ls` needs to run with a CWD of what will be packaged.
20 // There is no way to provide this via args.
21 const {stdout, stderr} = await exec(
22 `node ${join(rootPath, `node_modules/@vscode/vsce/vsce`)} ls`,
23 {
24 cwd: join(rootPath, 'vsix_sandbox'),
25 },
26 );
27
28 if (stderr) {
29 console.error(stderr);
30 throw new Error('Failed with error. See above.');
31 }
32
33 const paths = stdout.trim().split('\n').filter(Boolean);
34 const resultSet = new Set();
35
36 for (const filePath of paths) {
37 if (filePath.startsWith('node_modules/') && !filePath.includes('@angular')) {
38 // Regex to capture 'node_modules/' followed by either:
39 // - A scoped package (e.g., @vscode/vsce)
40 // - A standard package (e.g., typescript)
41 // It stops matching before the next slash after the package name.
42 const match = filePath.match(/^(node_modules\/(?:@[^\/]+\/[^\/]+|[^\/]+))/);
43 if (match) {
44 resultSet.add(match[1]);
45 }
46 } else {
47 // Add non-node_modules or @angular/ paths directly
48 resultSet.add(filePath);
49 }
50 }
51
52 await writeFile(outPath, Array.from(resultSet).sort().join('\n'));
53}
54
55const argv = process.argv.slice(2);
56if (argv.length !== 1) {

Callers 1

Calls 7

joinFunction · 0.85
errorMethod · 0.65
addMethod · 0.65
joinMethod · 0.65
writeFileFunction · 0.50
filterMethod · 0.45
matchMethod · 0.45

Tested by

no test coverage detected