Skip to content

Conversation

@SGeesan
Copy link
Contributor

@SGeesan SGeesan commented Dec 15, 2025

Purpose

Resolves Issue #1047

Approach

  • Converted Bash Commands: Replaced several bash commands with equivalent Node.js commands.
  • Downgraded fantasticon: Pinned the fantasticon dependency to an earlier version for font-wso2-vscode build stability.
  • Fixed package-vsix Execution: Added shell: true to the spawnSync options.

Summary by CodeRabbit

  • Chores
    • Refactored build and packaging scripts across extensions to use centralized packaging utilities for consistency and maintainability.
    • Updated icon font character mappings in multiple extensions for improved visual representation.
    • Updated font generation tool dependency reference to use the scoped package version.
    • Added mkdirp dependency for cross-platform directory creation in build processes.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 15, 2025

Walkthrough

The changes consolidate build scripts across multiple extensions by replacing shell conditionals with a centralized Node.js packaging script, swap shell-based directory creation with cross-platform mkdirp utility, update font icon character mappings, and migrate to a scoped npm package for font generation dependencies.

Changes

Cohort / File(s) Summary
Build Script Consolidation
workspaces/ballerina/ballerina-extension/package.json, workspaces/choreo/choreo-extension/package.json, workspaces/wso2-platform/wso2-platform-extension/package.json
Package scripts updated to use centralized package-vsix.js instead of inline shell conditionals; postbuild script simplified to unconditional sequence. Shell mkdir -p replaced with mkdirp in copy-webview-lib scripts.
Shared Packaging Script
workspaces/common-libs/scripts/package-vsix.js
Added support for --baseImagesUrl command-line argument; updated spawnSync invocation to use shell: true.
Font Dependencies
workspaces/common-libs/font-wso2-vscode/package.json, workspaces/common-libs/font-wso2-vscode/src/generate-font/generate-font.js
Replaced fantasticon with scoped package @twbs/fantasticon in both package manifest and import statement.
Font Icon Mappings
workspaces/ballerina/ballerina-extension/package.json, workspaces/choreo/choreo-extension/package.json, workspaces/mi/mi-extension/package.json
Updated multiple icon fontCharacter values across extensions (e.g., \f11c\f21f, \f188\f189, \f175\f1a4).
Build Utilities
workspaces/choreo/choreo-extension/package.json, workspaces/wso2-platform/wso2-platform-extension/package.json
Added mkdirp@^3.0.1 as dev/project dependency.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Hark! Scripts now dance in uniform grace,
Shell conditionals yield to Node's embrace,
Icons reimagined in hex's new light,
mkdirp brings paths built just right,
One shared script rules them all with delight!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix for windows build support' is relevant and accurately describes the main purpose of addressing Windows build compatibility issues.
Description check ✅ Passed The PR description includes the Purpose (issue resolution) and Approach sections with specific technical details about the changes, but omits most template sections like Goals, Testing, and Documentation.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bd35975 and 654284a.

📒 Files selected for processing (1)
  • workspaces/ballerina/ballerina-extension/package.json
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-11-25T06:34:10.812Z
Learnt from: CR
Repo: wso2/vscode-extensions PR: 0
File: workspaces/ballerina/component-diagram/AGENTS.md:0-0
Timestamp: 2025-11-25T06:34:10.812Z
Learning: Applies to workspaces/ballerina/component-diagram/**/*.config.{js,ts} : Use minimatch-compatible glob patterns for file matching in build and test configuration files

Applied to files:

  • workspaces/ballerina/ballerina-extension/package.json
📚 Learning: 2025-11-10T15:05:11.309Z
Learnt from: madushajg
Repo: wso2/vscode-extensions PR: 868
File: workspaces/bi/bi-extension/src/utils.ts:224-242
Timestamp: 2025-11-10T15:05:11.309Z
Learning: The workspaces/bi/bi-extension and workspaces/ballerina/ballerina-extension are separate VS Code extensions that are packaged and distributed independently, so they cannot share code via imports and must maintain their own implementations of common utilities.

Applied to files:

  • workspaces/ballerina/ballerina-extension/package.json
🔇 Additional comments (2)
workspaces/ballerina/ballerina-extension/package.json (2)

1218-1218: LGTM! Postbuild script simplified as discussed.

The removal of the shell-specific conditional is correct. As agreed in previous reviews, the isPreRelease condition is now handled within the download-ls.js script itself (referenced at line 1214), making this build step cross-platform compatible for Windows support.


1050-1050: Verify icon mappings render correctly after the fantasticon downgrade.

Font character mappings have been updated for four icons, likely due to the fantasticon dependency downgrade mentioned in the PR objectives. Ensure that all affected icons still render correctly in the VS Code UI:

  • distro-start (\f21f) - used in Run commands
  • distro-debug (\f19f) - used in Debug commands
  • distro-persist-diagram (\f1f9) - used in Entity Diagram command
  • distro-design-view (\f1a4) - used in Design View command

Verify by opening the extension in VS Code and checking that these icons display correctly in the command palette, editor toolbar buttons, and context menus.

Also applies to: 1057-1057, 1071-1071, 1169-1169


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
workspaces/wso2-platform/wso2-platform-extension/package.json (1)

259-259: ⚠️ Resolve Zod version mismatch between dependent packages in wso2-platform workspace.

The wso2-platform-extension (which depends on @wso2/wso2-platform-vscode-webviews) uses zod@^3.22.4, while its dependency wso2-platform-webviews uses [email protected]—different major versions. Both import from "zod/v3", but the major version divergence in the same workspace dependency chain could cause issues. Align these to the same major version (either standardize on v3 or v4 across both packages).

workspaces/ballerina/ballerina-extension/package.json (1)

1217-1217: Zod version inconsistency: ballerina-extension uses v4 while mi-extension and wso2-platform-extension use v3.

Line 1217 sets zod: ^4.1.8, but mi-extension uses ^3.24.1 and wso2-platform-extension uses ^3.22.4. However, wso2-platform-webviews already uses 4.1.11 in this same codebase, so v4 compatibility is already established. The usage patterns in ballerina-extension (z.object, z.string, z.array, z.default, z.lazy, z.describe) are all v4-compatible—no deprecated APIs detected.

Clarify whether the version split is intentional or if extensions should align to either v3 or v4 for consistency.

🧹 Nitpick comments (1)
workspaces/ballerina/ballerina-extension/package.json (1)

1172-1172: Postbuild script is functionally correct but complexity risks maintainability.

The script correctly chains conditional download-ls logic with unconditional copyFonts, copyJSLibs, package, and copyVSIX steps using execSync with stdio: 'inherit'. However, the inline Node.js implementation spans multiple commands in a single line, making it difficult to maintain, debug, and test.

Recommendation: Extract this logic into a separate file (e.g., scripts/postbuild.js) for clarity and testability, especially since similar but simpler patterns are being applied in other extensions.

Example refactored structure:

// scripts/postbuild.js
const { execSync } = require('child_process');

const isPreRelease = String(process.env.isPreRelease).toLowerCase() === 'true';

try {
  // Conditional: download-ls or download-ls:prerelease
  execSync(isPreRelease ? 'pnpm run download-ls:prerelease' : 'pnpm run download-ls', { stdio: 'inherit' });
  
  // Always run these in sequence
  execSync('pnpm run copyFonts', { stdio: 'inherit' });
  execSync('pnpm run copyJSLibs', { stdio: 'inherit' });
  execSync('pnpm run package', { stdio: 'inherit' });
  execSync('pnpm run copyVSIX', { stdio: 'inherit' });
} catch (error) {
  process.exit(1);
}

Then update the script to: "postbuild": "node scripts/postbuild.js"

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0379f15 and 68393b0.

⛔ Files ignored due to path filters (1)
  • common/config/rush/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • workspaces/ballerina/ballerina-extension/package.json (3 hunks)
  • workspaces/ballerina/ballerina-extension/src/features/project/cmds/pack.ts (1 hunks)
  • workspaces/choreo/choreo-extension/package.json (3 hunks)
  • workspaces/common-libs/font-wso2-vscode/package.json (1 hunks)
  • workspaces/common-libs/scripts/package-vsix.js (1 hunks)
  • workspaces/mi/mi-extension/package.json (1 hunks)
  • workspaces/wso2-platform/wso2-platform-extension/package.json (2 hunks)
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-11-25T06:34:10.812Z
Learnt from: CR
Repo: wso2/vscode-extensions PR: 0
File: workspaces/ballerina/component-diagram/AGENTS.md:0-0
Timestamp: 2025-11-25T06:34:10.812Z
Learning: Applies to workspaces/ballerina/component-diagram/src/resources/icons/**/*.tsx : Create separate SVG icon components in src/resources/icons/ for all diagram icons and import them as React components

Applied to files:

  • workspaces/mi/mi-extension/package.json
  • workspaces/ballerina/ballerina-extension/package.json
📚 Learning: 2025-12-12T13:11:28.926Z
Learnt from: madushajg
Repo: wso2/vscode-extensions PR: 1096
File: workspaces/ballerina/ballerina-extension/src/features/project/cmds/add.ts:105-112
Timestamp: 2025-12-12T13:11:28.926Z
Learning: In workspaces/ballerina/ballerina-extension/src/features/project/cmds/add.ts, the `getPackage` function is only called in contexts where `projectInfo.children[].projectPath` is guaranteed to be available, so no filtering for undefined values is needed when mapping over children.

Applied to files:

  • workspaces/ballerina/ballerina-extension/src/features/project/cmds/pack.ts
📚 Learning: 2025-11-25T06:34:10.812Z
Learnt from: CR
Repo: wso2/vscode-extensions PR: 0
File: workspaces/ballerina/component-diagram/AGENTS.md:0-0
Timestamp: 2025-11-25T06:34:10.812Z
Learning: Applies to workspaces/ballerina/component-diagram/**/*.config.{js,ts} : Use minimatch-compatible glob patterns for file matching in build and test configuration files

Applied to files:

  • workspaces/wso2-platform/wso2-platform-extension/package.json
  • workspaces/ballerina/ballerina-extension/package.json
📚 Learning: 2025-11-25T06:34:10.812Z
Learnt from: CR
Repo: wso2/vscode-extensions PR: 0
File: workspaces/ballerina/component-diagram/AGENTS.md:0-0
Timestamp: 2025-11-25T06:34:10.812Z
Learning: Applies to workspaces/ballerina/component-diagram/src/**/*.{ts,tsx} : Define all constants (node types, sizing, spacing) in src/resources/constants.ts and import them where needed instead of hardcoding values

Applied to files:

  • workspaces/ballerina/ballerina-extension/package.json
📚 Learning: 2025-11-10T15:05:11.309Z
Learnt from: madushajg
Repo: wso2/vscode-extensions PR: 868
File: workspaces/bi/bi-extension/src/utils.ts:224-242
Timestamp: 2025-11-10T15:05:11.309Z
Learning: The workspaces/bi/bi-extension and workspaces/ballerina/ballerina-extension are separate VS Code extensions that are packaged and distributed independently, so they cannot share code via imports and must maintain their own implementations of common utilities.

Applied to files:

  • workspaces/ballerina/ballerina-extension/package.json
🔇 Additional comments (8)
workspaces/ballerina/ballerina-extension/src/features/project/cmds/pack.ts (1)

68-68: Minor style consistency improvement.

Adding the semicolon improves consistency with TypeScript/JavaScript conventions.

workspaces/common-libs/font-wso2-vscode/package.json (1)

15-15: Verify build script compatibility with Fantasticon 1.2.3.

The Fantasticon 2.0.0+ versions have known Windows compatibility issues with glob 8.x, which justifies the downgrade to 1.2.3 for Windows build support. However, this is a major version downgrade (3.x → 1.x) that may introduce API differences.

Ensure that all build scripts (gen-icons, build, copy-icons) remain compatible with version 1.2.3. Confirm that:

  • The generate-font scripts in workspaces/common-libs/font-wso2-vscode/src/generate-font/ work with the older API
  • No Fantasticon 3.x-specific features are being used
  • The configuration format matches version 1.2.3 expectations

Additionally, consider if the caret range ^1.2.3 is appropriate—it will allow updates to 1.3.x but not 2.x. Verify this is intentional to avoid inadvertently pulling in future minor versions.

workspaces/common-libs/scripts/package-vsix.js (1)

12-12: LGTM! Correct fix for Windows compatibility.

Adding shell: true enables proper resolution of npx on Windows, where it exists as npx.cmd or npx.ps1 rather than a direct executable. This change correctly addresses the Windows build support issue described in the PR objectives.

The security implications of shell: true are acceptable here since the command and arguments are fully controlled (no user input), and this is a build script rather than production code.

workspaces/choreo/choreo-extension/package.json (2)

172-172: Script refactor for cross-platform directory creation is correct.

The conversion from mkdir -p to node -e "require('fs').mkdirSync('./resources/jslibs', { recursive: true })" is a proper cross-platform equivalent that maintains the same behavior on Windows and Unix-like systems.


185-185: Extract inline Node.js script to a reusable module; identical pattern duplicated across extensions.

The script is functionally correct with adequate error handling (execSync with stdio: 'inherit' propagates errors naturally), but the inline implementation is identical in workspaces/choreo/choreo-extension/package.json:185 and workspaces/wso2-platform/wso2-platform-extension/package.json:209.

The codebase already demonstrates this extraction pattern—workspaces/ballerina/ballerina-extension/scripts/download-ls.js and workspaces/common-libs/scripts/package-vsix.js both use similar logic for reading isPreRelease. Consider consolidating both extensions to use a shared script in common-libs or a dedicated scripts/package.js file within each extension to reduce duplication and improve maintainability.

⛔ Skipped due to learnings
Learnt from: madushajg
Repo: wso2/vscode-extensions PR: 868
File: workspaces/bi/bi-extension/src/utils.ts:224-242
Timestamp: 2025-11-10T15:05:11.309Z
Learning: The workspaces/bi/bi-extension and workspaces/ballerina/ballerina-extension are separate VS Code extensions that are packaged and distributed independently, so they cannot share code via imports and must maintain their own implementations of common utilities.
Learnt from: madushajg
Repo: wso2/vscode-extensions PR: 868
File: workspaces/bi/bi-extension/src/utils.ts:153-169
Timestamp: 2025-11-10T15:04:50.474Z
Learning: The workspaces/bi/bi-extension and workspaces/ballerina/ballerina-extension are separate, independently deployable VSCode extensions in the wso2/vscode-extensions repository. Code duplication between these extensions is acceptable and often necessary to maintain their independence, rather than creating cross-extension dependencies.
workspaces/wso2-platform/wso2-platform-extension/package.json (1)

196-196: Approved: Cross-platform script refactors are consistent with choreo-extension.

Both the copy-webview-lib and package scripts use the same cross-platform approach seen in choreo-extension, ensuring consistent behavior across Windows and Unix-like systems.

Also applies to: 209-209

workspaces/ballerina/ballerina-extension/package.json (2)

1004-1004: Verify icon glyph consistency across all extensions.

Multiple icon character mappings are being updated:

  • distro-design-view: \f16e\f19e (consistent with mi-extension and choreo-extension)
  • distro-start: \f11a\f214 (unique to this extension)
  • distro-debug: \f171\f199 (unique to this extension)
  • distro-persist-diagram: \f133\f1ef (unique to this extension)

Ensure these mappings correspond to the correct glyphs in the regenerated @wso2/font-wso2-vscode font file.

Also applies to: 1011-1011, 1018-1018, 1032-1032


1173-1173: Approved: copyJSLibs script correctly copies visualizer assets.

The script properly chains two copyfiles commands to copy JavaScript files from both ballerina-visualizer and trace-visualizer into the resources/jslibs directory.

"default": {
"fontPath": "./resources/font-wso2-vscode/dist/wso2-vscode.woff",
"fontCharacter": "\\f16e"
"fontCharacter": "\\f19e"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for distro-design-view and distro-build-package icon mappings across all package.json files
rg -A 2 '"distro-design-view":|"distro-build-package":' --type json

Repository: wso2/vscode-extensions

Length of output: 1038


🏁 Script executed:

#!/bin/bash
# Search for fontCharacter values in distro-design-view and distro-build-package sections
echo "=== distro-design-view fontCharacter values ==="
rg -B 2 -A 5 '"distro-design-view"' --type json | grep -A 5 fontCharacter | head -30

echo ""
echo "=== distro-build-package fontCharacter values ==="
rg -B 2 -A 5 '"distro-build-package"' --type json | grep -A 5 fontCharacter | head -30

Repository: wso2/vscode-extensions

Length of output: 1229


🏁 Script executed:

#!/bin/bash
# Check distro-build-package in other extensions
echo "=== Checking all distro-build-package definitions ==="
rg -B 2 -A 5 '"distro-build-package"' --type json

echo ""
echo "=== Summary: fontCharacter values ==="
echo "distro-design-view across extensions:"
rg '"distro-design-view"' -A 10 --type json | grep fontCharacter

echo ""
echo "distro-build-package across extensions:"
rg '"distro-build-package"' -A 10 --type json | grep fontCharacter

Repository: wso2/vscode-extensions

Length of output: 1139


Resolve fontCharacter inconsistency for distro-design-view across extensions.

The distro-design-view icon uses \f19e in mi-extension and ballerina-extension but \f133 in api-designer-extension. Verify whether this inconsistency is intentional or should be unified. The distro-build-package icon (\f179) is only defined in mi-extension and has no equivalent in other extensions.

@SGeesan SGeesan requested a review from tharindulak December 15, 2025 05:56
@SGeesan SGeesan requested a review from gigara December 16, 2025 03:44
@SGeesan SGeesan requested a review from kaje94 December 16, 2025 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants