Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1841,6 +1841,8 @@ function replaceStaticImagesInJsonBlob(cfg: any, staticAssetHandler: (fileLocati
return pxt.replaceStringsInJsonBlob(cfg, /^\.?\/static\/.+\.(png|gif|jpeg|jpg|svg|mp4|ico)$/i, staticAssetHandler);
}

const GENERATED_FILE_DECLARATION = `<!-- This file is generated from targetconfig.json. Do not edit. -->\n\n`;

function saveThemeJson(cfg: pxt.TargetBundle, localDir?: boolean, packaged?: boolean) {
cfg.appTheme.id = cfg.id
cfg.appTheme.title = cfg.title
Expand Down Expand Up @@ -1929,19 +1931,15 @@ function saveThemeJson(cfg: pxt.TargetBundle, localDir?: boolean, packaged?: boo
if (targetConfig?.galleries) {
const docsRoot = nodeutil.targetDir;
let gcards: pxt.CodeCard[] = [];
let tocmd: string =
`# Projects

`;
let tocmd: string = GENERATED_FILE_DECLARATION + `# Projects\n`;
Object.keys(targetConfig.galleries).forEach(k => {
targetStrings[k] = k;
const galleryUrl = getGalleryUrl(targetConfig.galleries[k])
const gallerymd = nodeutil.resolveMd(docsRoot, galleryUrl);
const gallery = pxt.gallery.parseGalleryMardown(gallerymd);
const gurl = `/${galleryUrl.replace(/^\//, '')}`;
tocmd +=
`* [${k}](${gurl})
`;
`* [${k}](${gurl})\n`;
const gcard: pxt.CodeCard = {
name: k,
url: gurl
Expand All @@ -1964,18 +1962,21 @@ function saveThemeJson(cfg: pxt.TargetBundle, localDir?: boolean, packaged?: boo
});

nodeutil.writeFileSync(path.join(docsRoot, "docs/projects/SUMMARY.md"), tocmd, { encoding: "utf8" });
nodeutil.writeFileSync(path.join(docsRoot, "docs/projects.md"),
`# Projects

\`\`\`codecard
${JSON.stringify(gcards, null, 4)}
\`\`\`

## See Also

${gcards.map(gcard => `[${gcard.name}](${gcard.url})`).join(',\n')}

`, { encoding: "utf8" });
const PROJECTS_MD_CONTENT = [
GENERATED_FILE_DECLARATION,
'',
'# Projects',
'',
'```codecard',
JSON.stringify(gcards, null, 4),
'```',
'',
'## See Also',
'',
gcards.map(gcard => `[${gcard.name}](${gcard.url})`).join(',\n')
].join('\n');

nodeutil.writeFileSync(path.join(docsRoot, "docs/projects.md"), PROJECTS_MD_CONTENT, { encoding: "utf8" });
}
const multiplayerGames = targetConfig?.multiplayer?.games;
for (const game of (multiplayerGames ?? [])) {
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pxt-core",
"version": "11.4.7",
"version": "11.4.8",
"description": "Microsoft MakeCode provides Blocks / JavaScript / Python tools and editors",
"keywords": [
"TypeScript",
Expand Down Expand Up @@ -79,7 +79,7 @@
"cssnano": "4.1.10",
"dashjs": "^4.4.0",
"diff-match-patch": "^1.0.5",
"dompurify": "2.0.17",
"dompurify": "3.2.6",
"faye-websocket": "0.11.1",
"karma": "6.4.4",
"karma-chai": "0.1.0",
Expand All @@ -90,15 +90,15 @@
"marked": "0.3.19",
"mocha": "8.4.0",
"pngjs": "3.4.0",
"postcss": "6.0.21",
"postcss": "^8.5.4",
"promise.prototype.finally": "^3.1.2",
"puppeteer": "23.11.1",
"request": "2.88.0",
"rimraf": "2.5.4",
"rtlcss": "2.2.1",
"sanitize-html": "2.3.2",
"sanitize-html": "^2.17.0",
"semantic-ui-less": "2.4.1",
"terser": "5.6.0"
"terser": "^5.42.0"
},
"lazyDependencies": {
"node-hid": "^0.7.2",
Expand Down Expand Up @@ -132,26 +132,26 @@
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.23.1",
"fuse.js": "3.2.0",
"gulp": "4.0.0",
"gulp": "^5.0.1",
"gulp-concat": "2.6.1",
"gulp-header": "2.0.9",
"gulp-replace": "1.0.0",
"gulp-typescript": "5.0.1",
"highlight.js": "9.12.0",
"highlight.js": "^11.11.1",
"jquery": "3.5.0",
"merge-stream": "2.0.0",
"monaco-editor": "0.24.0",
"pouchdb": "7.2.1",
"pouchdb": "^7.3.1",
"pouchdb-adapter-memory": "7.2.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-modal": "3.15.1",
"react-redux": "7.2.9",
"react-tooltip": "3.9.0",
"redux": "4.2.0",
"smoothie": "1.35.0",
"smoothie": "^1.36.1",
"typescript": "4.8.3",
"uglifyify": "5.0.2"
"uglifyify": "^5.0.0"
},
"overrides": {
"@blockly/field-colour": {
Expand Down
4 changes: 3 additions & 1 deletion pxtlib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ namespace pxt {


export function replaceStringsInJsonBlob(blobPart: any, matcher: RegExp, matchHandler: (matchingString: string) => string): any {
if (Array.isArray(blobPart)) {
if (blobPart == null) {
return blobPart; // Return null or undefined as is
} else if (Array.isArray(blobPart)) {
return blobPart.map(el => replaceStringsInJsonBlob(el, matcher, matchHandler));
} else if (typeof blobPart === "object") {
for (const key of Object.keys(blobPart)) {
Expand Down
Loading