From 1f9655af225e479c465b36b722df9e5ddc208643 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 3 Dec 2021 17:15:37 +0100 Subject: [PATCH] Read the latest published version from npm, do not rely on `package.json` (fixes #2800) --- build/website.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build/website.js b/build/website.js index 9385462f..058cd400 100644 --- a/build/website.js +++ b/build/website.js @@ -16,9 +16,8 @@ const { REPO_ROOT, removeDir, readFiles, writeFiles } = require('./utils'); /** @type {string} */ const MONACO_EDITOR_VERSION = (() => { - const packageJsonPath = path.join(REPO_ROOT, 'package.json'); - const packageJson = JSON.parse(fs.readFileSync(packageJsonPath).toString()); - const version = packageJson.version; + const output = cp.execSync(`npm show monaco-editor version`).toString(); + const version = output.split(/\r\n|\r|\n/g)[0]; if (!/\d+\.\d+\.\d+/.test(version)) { console.log('unrecognized package.json version: ' + version); process.exit(1);