diff --git a/gulpfile.js b/gulpfile.js index 5cae06ba..a314f968 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -10,6 +10,16 @@ var httpServer = require('http-server'); var SAMPLES_MDOC_PATH = path.join(__dirname, 'website/playground/playground.mdoc'); var WEBSITE_GENERATED_PATH = path.join(__dirname, 'website/playground/samples'); +var MONACO_EDITOR_VERSION = (function() { + var packageJsonPath = path.join(__dirname, 'package.json'); + var packageJson = JSON.parse(fs.readFileSync(packageJsonPath).toString()); + var version = packageJson.version; + if (!/\d+\.\d+\.\d+/.test(version)) { + console.log('unrecognized package.json version: ' + version); + process.exit(0); + } + return version; +})(); gulp.task('clean-release', function(cb) { rimraf('release', { maxBusyTries: 1 }, cb); }); gulp.task('release', ['clean-release'], function() { @@ -344,6 +354,7 @@ gulp.task('website', ['clean-website', 'playground-samples'], function() { var contents = data.contents.toString(); contents = contents.replace(/\.\.\/release\/dev/g, 'node_modules/monaco-editor/min'); + contents = contents.replace(/{{version}}/g, MONACO_EDITOR_VERSION); // contents = contents.replace('© 2016 Microsoft', '© 2016 Microsoft [' + builtTime + ']'); data.contents = new Buffer(contents); diff --git a/website/index.html b/website/index.html index 09be6c8b..1ea26c84 100644 --- a/website/index.html +++ b/website/index.html @@ -38,7 +38,7 @@
  • GitHub
  • Playground
  • Monarch
  • -
  • Download
  • +
  • Download
  • @@ -56,11 +56,21 @@

    It is licensed under the MIT License and supports IE 9/10/11, Edge, Chrome, Firefox, Safari and Opera.

    The Monaco editor is not supported in mobile browsers or mobile web frameworks.

    - +

    Find more information at the Monaco Editor repo.


    +

    Download {{version}}

    +
    +
    +
    +

    The latest released version is {{version}}. Download from npm:

    +
    npm install monaco-editor@{{version}}
    + or with this direct download link. +
    +
    +

    Editor

    diff --git a/website/monarch.html b/website/monarch.html index 4bc553ac..58058fd0 100644 --- a/website/monarch.html +++ b/website/monarch.html @@ -33,9 +33,10 @@
    diff --git a/website/playground.html b/website/playground.html index b3c44570..a2ea4ec3 100644 --- a/website/playground.html +++ b/website/playground.html @@ -34,9 +34,10 @@