refactor: handle packaged node_modules

Issue: Follow-up: Remove sed command that overwrites c... (#427 - closed)

What does this MR do and why?

By default, the node_modules directory is ignored during yarn pack. To get around this, we renamed node_modules to bundled_node_modules. However, this poses an issue when upgrading VSCode fork to 1.93.1, which includes changes that rely on the presence of the node_modules directory.

This refactor aims to gracefully solve this issue by:

  • Add postinstall script to handle renaming bundled_node_modules to node_modules as part of the package's install lifecycle.
  • Move the node_modules renaming logic from vscode-build Makefile to web-ide package's prepack hook as a way to colocate this renaming logic.
  • Update vscode-bootstrap to use node_modules instead of bundled_node_modules.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

demo

How to set up and validate locally

Installing in main project

  • In Web IDE repo, run ./scripts/pack-web-ide-package.sh. Copy path to package archive generated at the end of the script.
  • In gitlab repo, run yarn add <path_to_package_archive>.
  • Inspect that the node_modules directory in the @gitlab/web-ide package is successfully renamed by running ls node_modules/@gitlab/web-ide/dist/public/vscode in the root of the main project.
  • Ensure that the Web IDE loads as expected

Installing Example App

  • In the Web IDE repo, run yarn clean
  • Run yarn start:example
  • Ensure that the Example App successfully starts
Edited by Enrique Alcántara

Merge request reports

Loading