From 8a86c0cc9f4eb72510bfa02ae70108731982f494 Mon Sep 17 00:00:00 2001 From: Ika Date: Sun, 31 Dec 2017 09:12:56 +0800 Subject: [PATCH] fix(playground): fix report version (#3614) --- scripts/build/build-docs.js | 2 +- website/static/playground.js | 3 ++- website/static/worker.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/build/build-docs.js b/scripts/build/build-docs.js index f20ad0ff..bee13cfa 100644 --- a/scripts/build/build-docs.js +++ b/scripts/build/build-docs.js @@ -24,7 +24,7 @@ const parserPaths = parsers.map(stripLanguageDirectory); if (isPullRequest) { const pkg = require("../../package.json"); - pkg.prVersion = `pr-${process.env.REVIEW_ID}`; + pkg.version = `999.999.999-pr.${process.env.REVIEW_ID}`; pipe(JSON.stringify(pkg, null, 2)).to("package.json"); shell.exec("node scripts/build/build.js"); } diff --git a/website/static/playground.js b/website/static/playground.js index ff287540..c807da28 100644 --- a/website/static/playground.js +++ b/website/static/playground.js @@ -85,10 +85,11 @@ window.onload = function() { prettierVersion = message.data.version; var link = document.createElement("a"); - var match = prettierVersion.match(/^pr-(\d+)$/); + var match = prettierVersion.match(/^\d+\.\d+\.\d+-pr.(\d+)$/); if (match) { link.href = "https://github.com/prettier/prettier/pull/" + match[1]; link.textContent = "PR #" + match[1]; + prettierVersion = "pr-" + match[1]; } else { if (prettierVersion.match(/\.0$/)) { link.href = diff --git a/website/static/worker.js b/website/static/worker.js index b65073c8..06013285 100644 --- a/website/static/worker.js +++ b/website/static/worker.js @@ -103,7 +103,7 @@ self.onmessage = function(message) { doc: doc, ast: ast, formatted2: formatted2, - version: prettier.prVersion || prettier.version + version: prettier.version }); };