Skip to content

Commit

Permalink
[Stable9.2] Cherry pick Crowdin, monaco, and image editor fixes to Mi…
Browse files Browse the repository at this point in the history
…necraft stable (#10009)

* [stable9.0] Cherry picking crowdin changes over to Calliope's stable branch (#9991)

* [V9] Cherry picking crowdin work over to v9 branch (#9963)

* Upgrade to Crowdin V2 APIs (#9954)

* use crowdin v2 apis

* rename crowdin API

* add projectid setting

* fix test mode

* copy pxt-translations crowdin config

* re-enable crowdin stats (#9962)

* Add restore command and keep translations when updating (#9966) (#9968)

* add restore command and keep translations when updating

* add --test flag

* add parameter to prevent accidental runs

* hide asset name when assetEditor is false (#9878)

* Fixes for image editor in micro:bit (#9900)

* fix compile variants when palette is in dep

* add field editor param for the tagged template

* fix help link in monaco flyout (#10008)
  • Loading branch information
riknoll authored May 17, 2024
1 parent 926ab44 commit 8bb9759
Show file tree
Hide file tree
Showing 16 changed files with 904 additions and 585 deletions.
107 changes: 59 additions & 48 deletions cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ function checkIfTaggedCommitAsync() {

let readJson = nodeutil.readJson;

function ciAsync() {
async function ciAsync() {
forceCloudBuild = true;
const buildInfo = ciBuildInfo();
pxt.log(`ci build using ${buildInfo.ci}`);
Expand Down Expand Up @@ -446,53 +446,53 @@ function ciAsync() {
let pkg = readJson("package.json")
if (pkg["name"] == "pxt-core") {
pxt.log("pxt-core build");
return checkIfTaggedCommitAsync()
.then(isTaggedCommit => {
pxt.log(`is tagged commit: ${isTaggedCommit}`);
let p = npmPublishAsync();
if (branch === "master" && isTaggedCommit) {
if (uploadDocs)
p = p
.then(() => buildWebStringsAsync())
.then(() => crowdin.execCrowdinAsync("upload", "built/webstrings.json"))
.then(() => crowdin.execCrowdinAsync("upload", "built/skillmap-strings.json"))
.then(() => crowdin.execCrowdinAsync("upload", "built/authcode-strings.json"))
.then(() => crowdin.execCrowdinAsync("upload", "built/multiplayer-strings.json"))
.then(() => crowdin.execCrowdinAsync("upload", "built/kiosk-strings.json"));
if (uploadApiStrings)
p = p.then(() => crowdin.execCrowdinAsync("upload", "built/strings.json"))
if (uploadDocs || uploadApiStrings)
p = p.then(() => crowdin.internalUploadTargetTranslationsAsync(uploadApiStrings, uploadDocs));
}
return p;
});

const isTaggedCommit = await checkIfTaggedCommitAsync();
pxt.log(`is tagged commit: ${isTaggedCommit}`);
await npmPublishAsync();
if (branch === "master" && isTaggedCommit) {
if (uploadDocs) {
await buildWebStringsAsync();
await crowdin.uploadBuiltStringsAsync("built/webstrings.json");
await crowdin.uploadBuiltStringsAsync(`built/skillmap-strings.json`);
await crowdin.uploadBuiltStringsAsync(`built/authcode-strings.json`);
await crowdin.uploadBuiltStringsAsync(`built/multiplayer-strings.json`);
await crowdin.uploadBuiltStringsAsync(`built/kiosk-strings.json`);
}
if (uploadApiStrings) {
await crowdin.uploadBuiltStringsAsync("built/strings.json");
}
if (uploadDocs || uploadApiStrings) {
await crowdin.internalUploadTargetTranslationsAsync(uploadApiStrings, uploadDocs);
pxt.log("translations uploaded");
}
else {
pxt.log("skipping translations upload");
}
}
} else {
pxt.log("target build");
return internalBuildTargetAsync()
.then(() => internalCheckDocsAsync(true))
.then(() => blockTestsAsync())
.then(() => npmPublishAsync())
.then(() => {
if (!process.env["PXT_ACCESS_TOKEN"]) {
// pull request, don't try to upload target
pxt.log('no token, skipping upload')
return Promise.resolve();
}
const trg = readLocalPxTarget();
const label = `${trg.id}/${tag || latest}`;
pxt.log(`uploading target with label ${label}...`);
return uploadTargetAsync(label);
})
.then(() => {
pxt.log("target uploaded");
if (uploadDocs || uploadApiStrings) {
return crowdin.internalUploadTargetTranslationsAsync(uploadApiStrings, uploadDocs)
.then(() => pxt.log("translations uploaded"));
} else {
pxt.log("skipping translations upload");
return Promise.resolve();
}
});
await internalBuildTargetAsync();
await internalCheckDocsAsync(true);
await blockTestsAsync();
await npmPublishAsync();
if (!process.env["PXT_ACCESS_TOKEN"]) {
// pull request, don't try to upload target
pxt.log('no token, skipping upload')
}
else {
const trg = readLocalPxTarget();
const label = `${trg.id}/${tag || latest}`;
pxt.log(`uploading target with label ${label}...`);
await uploadTargetAsync(label);
}
pxt.log("target uploaded");
if (uploadDocs || uploadApiStrings) {
await crowdin.internalUploadTargetTranslationsAsync(uploadApiStrings, uploadDocs);
pxt.log("translations uploaded");
} else {
pxt.log("skipping translations upload");
}
}
}

Expand Down Expand Up @@ -7017,7 +7017,7 @@ ${pxt.crowdin.KEY_VARIABLE} - crowdin key
advanced: true,
}, pc => uploadTargetRefsAsync(pc.args[0]));
advancedCommand("uploadtt", "upload tagged release", uploadTaggedTargetAsync, "");
advancedCommand("downloadtrgtranslations", "download translations from bundled projects", crowdin.downloadTargetTranslationsAsync, "<package>");
advancedCommand("downloadtrgtranslations", "download translations from bundled projects", crowdin.downloadTargetTranslationsAsync, "[package]");

p.defineCommand({
name: "checkdocs",
Expand Down Expand Up @@ -7103,7 +7103,18 @@ ${pxt.crowdin.KEY_VARIABLE} - crowdin key

advancedCommand("augmentdocs", "test markdown docs replacements", augmnetDocsAsync, "<temlate.md> <doc.md>");

advancedCommand("crowdin", "upload, download, clean, stats files to/from crowdin", pc => crowdin.execCrowdinAsync.apply(undefined, pc.args), "<cmd> <path> [output]")
p.defineCommand({
name: "crowdin",
advanced: true,
argString: "<cmd> <path> [output]",
help: "upload, download, clean, stats files to/from crowdin",
flags: {
test: { description: "test run, do not upload files to crowdin" }
}
}, pc => {
if (pc.flags.test) pxt.crowdin.setTestMode();
return crowdin.execCrowdinAsync.apply(undefined, pc.args)
})

advancedCommand("hidlist", "list HID devices", hid.listAsync)
advancedCommand("hidserial", "run HID serial forwarding", hid.serialAsync, undefined, true);
Expand Down
Loading

0 comments on commit 8bb9759

Please sign in to comment.