Skip to content

Commit

Permalink
feat: generate treemending patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc Mangeonjean committed Apr 28, 2023
1 parent 45e355b commit bf4c2aa
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions scripts/install-vscode
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ set -e

vscodeRef=$(cat './node_modules/monaco-editor/package.json' | jq -r '.["vscodeRef"]')

monaco_esm_directory="`pwd`/node_modules/monaco-editor/esm"
output_directory="`pwd`/vscode"
extension_output_directory="`pwd`/vscode-default-extensions"
patch_file="`pwd`/scripts/vscode.patch"
editor_patch_file="`pwd`/monaco-editor-treemending.patch"
version_info=$output_directory/version.info

if [[ -e $version_info && $(cat $version_info) == $vscodeRef ]]; then
Expand All @@ -32,6 +34,26 @@ yarn install --ignore-scripts
echo "Patching vscode..."
patch -p1 < $patch_file

# build editor without treeshaking to generate the treemending patch
echo "Installing build dependencies"
which node
cd build
yarn install --ignore-engines
cd ..

mkdir -p editor-patch
cp -R $monaco_esm_directory editor-patch/a
cp -R $monaco_esm_directory editor-patch/b
## Change shake level from ClassMembers to Files
sed -i 's/shakeLevel: 2/shakeLevel: 0/g' build/gulpfile.editor.js
npx gulp editor-distro
cd out-monaco-editor-core/esm/
cp --parents $(find -name \*.js) ../../editor-patch/b
cd ../../editor-patch
diff -urN -x '*.map' a b > "$editor_patch_file" || true
cd ..
# end treemending patch

# copy default extensions
rm -rf $extension_output_directory
cp -R extensions "$extension_output_directory"
Expand Down

0 comments on commit bf4c2aa

Please sign in to comment.