Skip to content
This repository has been archived by the owner on Jul 30, 2018. It is now read-only.

Create a build of monaco typescript and monaco editor

Kitson Kelly edited this page Apr 27, 2017 · 2 revisions

The current published packages of monaco-editor may not be built with a version of TypeScript that you wish to use. You will need to build a version of monaco-editor that has a monaco-typescript using the correct version of TypeScript.

Before you start, you will need both git and npm available on the command line.

Installing monaco-editor and monaco-typescript

You will need local copies of the repos:

$ git clone https://github.com/Microsoft/monaco-editor.git
Cloning into 'monaco-editor'...
$ git clone https://github.com/Microsoft/monaco-typescript.git
Cloning into 'monaco-typescript'...

You also need to npm install both repos:

$ cd monaco-typescript
$ npm install
$ cd ../monaco-editor
$ npm install

Updating monaco-typescript

In the root of monaco-typescript you will need to edit the package.json with the version of TypeScript you want. It is best to keep this version pinned to a particular version. Subsequently you should do another npm install to ensure the version gets installed.

After this, you need to instruct the package to import the appropriate information from TypeScript:

$ gulp import-typescript
[00:00:00] Using gulpfile ~/test/monaco-typescript/gulpfile.js
[00:00:00] Starting 'import-typescript'...
[00:00:00] Finished 'import-typescript' after 116 ms

You then need to do a release of monaco-typescript:

$ gulp release

At this point, you will need to make this version of monaco-typescript available to monaco-editor. The easiest way is to use npm link:

$ npm link

Updating monaco-editor

From the root of monaco-editor you will need to install the updated monaco-typescript:

$ npm link monaco-typescript

And again, do a release of monaco-editor:

$ gulp release

And again, make this available for web-editor:

$ npm link

Using with web-editor

With the custom version of monaco-editor available, it needs to be installed from the root of web-editor:

$ npm link monaco-editor

Builds post this will utilise this version. Whenever a distribution build is done, it will copy this version to the distribution before attempting to install other dependencies, so this version can be deployed to a web server and used without depending on the package being available on npm.