Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/build/npm/mixin-telemetry-docs.mjs
3520 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
import { execSync } from 'child_process';
6
import { join, resolve } from 'path';
7
import { existsSync, rmSync } from 'fs';
8
import { fileURLToPath } from 'url';
9
10
const rootPath = resolve(fileURLToPath(import.meta.url), '..', '..', '..');
11
const telemetryDocsPath = join(rootPath, 'vscode-telemetry-docs');
12
const repoUrl = 'https://github.com/microsoft/vscode-telemetry-docs';
13
14
console.log('Cloning vscode-telemetry-docs repository...');
15
16
// Remove existing directory if it exists
17
if (existsSync(telemetryDocsPath)) {
18
console.log('Removing existing vscode-telemetry-docs directory...');
19
rmSync(telemetryDocsPath, { recursive: true, force: true });
20
}
21
22
try {
23
// Clone the repository (shallow clone of main branch only)
24
console.log(`Cloning ${repoUrl} to ${telemetryDocsPath}...`);
25
execSync(`git clone --depth 1 --branch main --single-branch ${repoUrl} vscode-telemetry-docs`, {
26
cwd: rootPath,
27
stdio: 'inherit'
28
});
29
30
console.log('Successfully cloned vscode-telemetry-docs repository.');
31
} catch (error) {
32
console.error('Failed to clone vscode-telemetry-docs repository:', error.message);
33
process.exit(1);
34
}
35
36