fix(playground): fix report version (#3614)

master
Ika 2017-12-31 09:12:56 +08:00 committed by Lucas Azzola
parent 6872ed8310
commit 8a86c0cc9f
3 changed files with 4 additions and 3 deletions

View File

@ -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");
}

View File

@ -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 =

View File

@ -103,7 +103,7 @@ self.onmessage = function(message) {
doc: doc,
ast: ast,
formatted2: formatted2,
version: prettier.prVersion || prettier.version
version: prettier.version
});
};