Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions workspaces/ballerina/ballerina-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,7 @@
"copyVSIX": "copyfiles *.vsix ./vsix",
"copyVSIXToRoot": "copyfiles -f ./vsix/*.vsix ../../..",
"download-ls": "node scripts/download-ls.js",
"download-ls:prerelease": "node scripts/download-ls.js --prerelease --replace",
"build": "pnpm run compile && pnpm run lint && pnpm run postbuild",
"rebuild": "pnpm run clean && pnpm run compile && pnpm run postbuild",
"postbuild": "if [ \"$isPreRelease\" = \"true\" ]; then pnpm run download-ls --prerelease; else pnpm run download-ls; fi && pnpm run copyFonts && pnpm run copyJSLibs && pnpm run package && pnpm run copyVSIX",
Expand Down
10 changes: 8 additions & 2 deletions workspaces/ballerina/ballerina-extension/scripts/download-ls.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const GITHUB_REPO_URL = 'https://api.github.com/repos/ballerina-platform/balleri

const args = process.argv.slice(2);
const usePrerelease = args.includes('--prerelease') || process.env.isPreRelease === 'true';
const forceReplace = args.includes('--replace');

function checkExistingJar() {
try {
Expand Down Expand Up @@ -177,11 +178,16 @@ async function getLatestRelease(usePrerelease) {

async function main() {
try {
if (checkExistingJar()) {
if (!forceReplace && checkExistingJar()) {
process.exit(0);
}

console.log(`Downloading Ballerina language server${usePrerelease ? ' (prerelease)' : ''}...`);
console.log(`Downloading Ballerina language server${usePrerelease ? ' (prerelease)' : ''}${forceReplace ? ' (force replace)' : ''}...`);

if (forceReplace && fs.existsSync(LS_DIR)) {
console.log('Force replace enabled: clearing existing language server directory...');
fs.rmSync(LS_DIR, { recursive: true, force: true });
}

if (!fs.existsSync(LS_DIR)) {
fs.mkdirSync(LS_DIR, { recursive: true });
Expand Down
Loading