Skip to content

Commit 9153f94

Browse files
authored
Merge pull request #2436 from microsoft/add-smoke-build-to-create-vsix
Add smoke build to create VSIX file in smoke folder
2 parents 6a5f9cd + a72e9cd commit 9153f94

4 files changed

Lines changed: 563 additions & 76 deletions

File tree

.vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ release/**
2424
.npmignore
2525
npm-shrinkwrap.json
2626
SmokeTestLogs
27+
!dist/rn-extension.js

gulp_scripts/smoke-build.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
const { execSync } = require('child_process');
4+
5+
// Read package.json to compute VSIX file name as <name>-<version>.vsix
6+
const pkg = require('../package.json');
7+
const vsixName = `${pkg.name}-${pkg.version}.vsix`;
8+
9+
// VSIX output path (saved at repo root)
10+
const vsixSource = path.resolve(__dirname, '..', vsixName);
11+
12+
// Target directory for smoke tests (Windows/macOS friendly)
13+
const 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+
23+
function 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+
32+
function 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+
40+
function runSmokeTests() {
41+
console.log('🚀 Running smoke tests...');
42+
execSync('npm run smoke-tests', { stdio: 'inherit' });
43+
console.log('✅ Smoke tests completed');
44+
}
45+
46+
try {
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+
}

0 commit comments

Comments
 (0)