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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Prepare the build:

1. Check & update `package.json` for latest version of `monaco-editor` (check [here](https://www.npmjs.com/package/monaco-editor)) and other dev dependencies
2. Update the `package.json` `version` field to match the version of `monaco-editor` you are using.
3. Check + update `setup.js` in particular the node version set in `env.NODE_VERSION_TO_INCLUDE` This should match a version found in [@types/node](https://www.npmjs.com/package/@types/node?activeTab=versions) on NPM e.g. `v20.14.8`

#### Step 2

Expand Down Expand Up @@ -68,7 +69,7 @@ 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)
and you should see monaco editor with a theme set and foreign menus (try opening the context menu with a right click)

### Add to node-red src

Expand Down
28 changes: 23 additions & 5 deletions generate-monaco-esm-i18n.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const gitPullOrClone = require('git-pull-or-clone');
const degit = require('degit');
const fs = require("fs");
const path = require("path");
const recursive = require("recursive-readdir");
Expand Down Expand Up @@ -96,7 +96,24 @@ function injectSourcePath(monacoVersion, callback) {
`$1($2, ['${transPath}', `,
],
});
if (file.endsWith("actionList.js")) {
if (file.endsWith("base\\common\\cancellation.js") || file.endsWith("base/common/cancellation.js")) {
// Disable this line to prevent firing the event with undefined
// See: https://github.com/microsoft/monaco-editor/issues/4389#issuecomment-2715085208
replaceInFileSync({
files: file,
from: /this\._emitter\.fire\(undefined\);/,
to: '// Disabled by nr-monaco-build: this._emitter.fire(undefined);',
});
} else if (file.endsWith("base\\common\\async.js") || file.endsWith("base/common/async.js")) {
// Disable this line to prevent firing the event with undefined
// See: https://github.com/cardstack/boxel/commit/7cacc9e15020696b89e07e4badd4f6a124975109
replaceInFileSync({
files: file,
// this.doReject?.(new CancellationError());
from: /this\.doReject\?\.\(new CancellationError/,
to: '// Disabled by nr-monaco-build: this.doReject?.(new CancellationError',
});
} else if (file.endsWith("actionList.js")) {
// node-red editor body has a client height of 0. This messes up the editor layout.
// need to replace
// * this.domNode.ownerDocument.body.clientHeight
Expand Down Expand Up @@ -228,9 +245,8 @@ async function main() {
mkdirp.sync(gitDir);
injectSourcePath(monacoVersion, err => {
if (err) throw err;
gitPullOrClone(vsCodeRepository, vsCodeLocDir, { shell: true }, function (err) {
if (err) throw err;

const emitter = degit('Microsoft/vscode-loc', { force: true });
emitter.clone(vsCodeLocDir).then(() => {
fs.readdir(vsCodeLocI18nDir, (err, langDirs) => {
if (err) throw err;
langDirs.forEach(langDir => {
Expand All @@ -252,6 +268,8 @@ async function main() {
}
})
});
}).catch(err => {
throw err;
});
});
}
Expand Down
Loading