node-red / nr-monaco-build

Build tools for bundling the Monaco editor in Node-RED
Apache License 2.0
6 stars 6 forks source link


IMPORTANT NOTE: This project is specifically for building monaco for node-red and will likely not be of much use to any other projects


About

This project makes an ESM bundle of monaco-editor with 50 themes and localization support. It was built specifically for use in node-red.

Credits

Notes

Instructions

Clone repo

git clone https://github.com/node-red/nr-monaco-build
cd nr-monaco-build

Prepare

Firstly

Check + update node-red (function node/server-side) type defs

Build

npm install --include=dev
npm run clean
npm run build

This will bundle the monaco editor with localization support and themes:

cd output/monaco/dist/

Check it works

Check editor works in browser...

npm run demo

Now go to

http://localhost:8080/demo.html

and you should see monaco editor with the monokai theme and French menus (try opening the context menu with a right click)

Add to node-red src

export nr_src=~/repos/github/node-red-org/node-red
# clean up
rm -rf $nr_src/packages/node_modules/@node-red/editor-client/src/vendor/monaco/dist/*
rm -rf $nr_src/packages/node_modules/@node-red/editor-client/src/types/node/*
rm -rf $nr_src/packages/node_modules/@node-red/editor-client/src/types/node-red/*

# copy
cp -r output/monaco/dist \
    $nr_src/packages/node_modules/@node-red/editor-client/src/vendor/monaco/
cp -r output/types \
    $nr_src/packages/node_modules/@node-red/editor-client/src/