Skip to content

Commit 3c12798

Browse files
authored
Merge pull request #71 from rajbos/install
Updating scripts
2 parents 11212ef + 2f160d7 commit 3c12798

2 files changed

Lines changed: 63 additions & 0 deletions

File tree

build.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
# Ensure the script stops on errors
44
$ErrorActionPreference = "Stop"
5+
#0 Install dependencies
6+
Write-Host "Installing dependencies..."
7+
npm install
58

69
# 1. Run the compile script to build the JavaScript output
710
Write-Host "Compiling extension..."

publish.ps1

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# This script builds the extension and publishes it to the VS Code Marketplace.
2+
3+
# Ensure the script stops on errors
4+
$ErrorActionPreference = "Stop"
5+
6+
# 1. Run the build script to create the VSIX package
7+
Write-Host "Building extension..." -ForegroundColor Cyan
8+
& .\build.ps1
9+
if ($LASTEXITCODE -ne 0) {
10+
Write-Host "Build failed. Please fix the errors and try again." -ForegroundColor Red
11+
exit 1
12+
}
13+
14+
# 2. Check if we're already logged in to vsce
15+
Write-Host "`nChecking marketplace login status..." -ForegroundColor Cyan
16+
$publisherName = "RobBos" # From package.json
17+
18+
# Try to get the list of publishers (this will fail if not logged in)
19+
$vsceListOutput = npx vsce ls-publishers 2>&1
20+
$isLoggedIn = $LASTEXITCODE -eq 0
21+
22+
if (-not $isLoggedIn) {
23+
Write-Host "You are not logged in to the VS Code Marketplace." -ForegroundColor Yellow
24+
Write-Host ""
25+
Write-Host "To publish extensions, you need a Personal Access Token from Azure DevOps:" -ForegroundColor Yellow
26+
Write-Host "1. Go to https://dev.azure.com" -ForegroundColor Gray
27+
Write-Host "2. Click User Settings -> Personal Access Tokens" -ForegroundColor Gray
28+
Write-Host "3. Create new token with 'Marketplace (Publish)' scope" -ForegroundColor Gray
29+
Write-Host "4. Set organization to 'All accessible organizations'" -ForegroundColor Gray
30+
Write-Host ""
31+
32+
$publisher = Read-Host "Enter your publisher name (default: $publisherName from package.json)"
33+
if ([string]::IsNullOrWhiteSpace($publisher)) {
34+
$publisher = $publisherName
35+
}
36+
37+
Write-Host "`nLogging in as '$publisher'..." -ForegroundColor Cyan
38+
Write-Host "You will be prompted for your Personal Access Token." -ForegroundColor Gray
39+
npx vsce login $publisher
40+
41+
if ($LASTEXITCODE -ne 0) {
42+
Write-Host "`nLogin failed. Cannot publish without authentication." -ForegroundColor Red
43+
exit 1
44+
}
45+
Write-Host "Login successful!" -ForegroundColor Green
46+
} else {
47+
Write-Host "Already logged in to the marketplace." -ForegroundColor Green
48+
}
49+
50+
# 3. Publish the extension
51+
Write-Host "`nPublishing extension to the VS Code Marketplace..." -ForegroundColor Cyan
52+
npx vsce publish
53+
54+
if ($LASTEXITCODE -eq 0) {
55+
Write-Host "`n✅ Extension published successfully!" -ForegroundColor Green
56+
Write-Host "It may take a few minutes to appear in the marketplace." -ForegroundColor Gray
57+
} else {
58+
Write-Host "`n❌ Publishing failed. Please check the error messages above." -ForegroundColor Red
59+
exit 1
60+
}

0 commit comments

Comments
 (0)