microsoft/vscode-react-native

Public

mirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
bumo-glob-cli-fix

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

gulp_scripts/smoke-build.js

55lines ยท modecode

1const fs = require('fs');
2const path = require('path');
3const { execSync } = require('child_process');
4
5// Read package.json to compute VSIX file name as <name>-<version>.vsix
6const pkg = require('../package.json');
7const vsixName = `${pkg.name}-${pkg.version}.vsix`;
8
9// VSIX output path (saved at repo root)
10const vsixSource = path.resolve(__dirname, '..', vsixName);
11
12// Target directory for smoke tests (Windows/macOS friendly)
13const targetDir = path.resolve(
14 process.env.USERPROFILE || process.env.HOME || '',
15 'vscode-extensions',
16 'vscode-react-native',
17 'test',
18 'smoke',
19 'resources',
20 'extension'
21);
22
23function buildVsix() {
24 console.log('๐Ÿ“ฆ Packaging VSIX...');
25 execSync(`npx vsce package -o "${vsixSource}"`, { stdio: 'inherit' });
26 if (!fs.existsSync(vsixSource)) {
27 throw new Error('โŒ VSIX not found. Ensure `vsce package` succeeded and entry file is not ignored.');
28 }
29 console.log(`โœ… VSIX packaged: ${vsixSource}`);
30}
31
32function copyVsix() {
33 console.log('๐Ÿ“‚ Copying VSIX to smoke resources...');
34 if (!fs.existsSync(targetDir)) fs.mkdirSync(targetDir, { recursive: true });
35 const targetPath = path.join(targetDir, path.basename(vsixSource));
36 fs.copyFileSync(vsixSource, targetPath);
37 console.log(`โœ… Copied to: ${targetPath}`);
38}
39
40function runSmokeTests() {
41 console.log('๐Ÿš€ Running smoke tests...');
42 execSync('npm run smoke-tests', { stdio: 'inherit' });
43 console.log('โœ… Smoke tests completed');
44}
45
46try {
47 buildVsix();
48 copyVsix();
49 if (process.argv.includes('--test')) {
50 runSmokeTests();
51 }
52} catch (err) {
53 console.error(err.message || err);
54 process.exit(1);
55}