Skip to content

Commit

Permalink
Extension metadata updates (#1888)
Browse files Browse the repository at this point in the history
- put original author first
- allow marking extension as scratch-compatible
- mark hacked block collection as scratch-compatible
  • Loading branch information
GarboMuffin authored Jan 25, 2025
1 parent 7d40bad commit 268a22f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions development/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,9 @@ class JSONMetadataFile extends BuildFile {
if (samples) {
extension.samples = samples.map((i) => i.getTitle());
}
if (metadata.scratchCompatible) {
extension.scratchCompatible = true;
}

extensions.push(extension);
}
Expand Down
11 changes: 9 additions & 2 deletions development/homepage-template.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,15 @@
<h2><%= metadata.name %></h2>
<p>
<%= metadata.description %>
<%- metadata.by.length ? `Created by ${peopleToHTML(metadata.by)}.` : '' %>
<%- metadata.original.length ? `Originally created by ${peopleToHTML(metadata.original)}.` : '' %>
<%-
(metadata.original.length && metadata.by.length) ? (
`Created by ${peopleToHTML(metadata.original)}. Updated by ${peopleToHTML(metadata.by)}.`
) : metadata.by.length ? (
`Created by ${peopleToHTML(metadata.by)}.`
) : metadata.original.length ? (
`Created by ${peopleToHTML(metadata.original)}.`
) : ''
%>
</p>
</div>
<% } %>
Expand Down
4 changes: 4 additions & 0 deletions development/parse-extension-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Extension {
/** @type {Person[]} */
this.original = [];
this.context = "";
this.scratchCompatible = false;
}
}

Expand Down Expand Up @@ -102,6 +103,9 @@ const parseMetadata = (extensionCode) => {
case "context":
metadata.context = value;
break;
case "scratch-compatible":
metadata.scratchCompatible = value === "true";
break;
default:
// TODO
break;
Expand Down
1 change: 1 addition & 0 deletions extensions/Lily/HackedBlocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// By: LilyMakesThings <https://scratch.mit.edu/users/LilyMakesThings/>
// By: pumpkinhasapatch
// License: MIT AND LGPL-3.0
// Scratch-compatible: true

(function (Scratch) {
"use strict";
Expand Down

0 comments on commit 268a22f

Please sign in to comment.