Skip to content
Merged
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
25 changes: 9 additions & 16 deletions extensions/reviewed/PanelSpriteButton.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"name": "PanelSpriteButton",
"previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Interface Elements/Interface Elements_interface_ui_button_ok_cta_clock_tap.svg",
"shortDescription": "A button that can be customized.",
"version": "1.4.3",
"version": "1.4.4",
"description": [
"The button can be customized with a background for each state and a label. It handles user interactions and a simple condition can be used to check if it is clicked.",
"",
Expand Down Expand Up @@ -60,8 +60,7 @@
"textG": 0,
"textR": 0
},
"comment": "The \"Validated\" state only last one frame.",
"comment2": ""
"comment": "The \"Validated\" state only last one frame."
},
{
"type": "BuiltinCommonInstructions::Standard",
Expand Down Expand Up @@ -111,8 +110,7 @@
"textG": 0,
"textR": 0
},
"comment": "Make sure the cursor position is only checked once per frame.",
"comment2": ""
"comment": "Make sure the cursor position is only checked once per frame."
},
{
"type": "BuiltinCommonInstructions::Standard",
Expand Down Expand Up @@ -176,8 +174,7 @@
"textG": 0,
"textR": 0
},
"comment": "Touches are always pressed, so ShouldCheckHovering doesn't matter.",
"comment2": ""
"comment": "Touches are always pressed, so ShouldCheckHovering doesn't matter."
},
{
"type": "BuiltinCommonInstructions::Standard",
Expand Down Expand Up @@ -1231,8 +1228,7 @@
"textG": 0,
"textR": 0
},
"comment": "Create one background instance for of each state.\nOnly the instance for the current state is shown.",
"comment2": ""
"comment": "Create one background instance for of each state.\nOnly the instance for the current state is shown."
},
{
"type": "BuiltinCommonInstructions::Standard",
Expand Down Expand Up @@ -1312,8 +1308,7 @@
"textG": 0,
"textR": 0
},
"comment": "Place the label over the backgrounds.",
"comment2": ""
"comment": "Place the label over the backgrounds."
},
{
"type": "BuiltinCommonInstructions::Standard",
Expand Down Expand Up @@ -1444,8 +1439,7 @@
"textG": 0,
"textR": 0
},
"comment": "Show the right background accordingly to the new state.",
"comment2": ""
"comment": "Show the right background accordingly to the new state."
},
{
"type": "BuiltinCommonInstructions::Standard",
Expand Down Expand Up @@ -1810,8 +1804,7 @@
"textG": 0,
"textR": 0
},
"comment": "Children instances must be resized when the button size change:\n- backgrounds for each state are resized to take the full dimensions of the button\n- the label is put back at the center of the button\n\nThe scale is set back to 1 because it means that the parent instance has the same dimensions as the union of its children instances.",
"comment2": ""
"comment": "Children instances must be resized when the button size change:\n- backgrounds for each state are resized to take the full dimensions of the button\n- the label is put back at the center of the button\n\nThe scale is set back to 1 because it means that the parent instance has the same dimensions as the union of its children instances."
},
{
"type": "BuiltinCommonInstructions::Standard",
Expand Down Expand Up @@ -2194,7 +2187,7 @@
"type": "object"
},
{
"description": "",
"description": "Text",
"name": "LabelText",
"type": "string"
}
Expand Down
15 changes: 11 additions & 4 deletions scripts/lib/ExtensionValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,23 @@ const loadRules = (async function loadRules() {
async function validateExtension(extensionWithFileInfo) {
/** @type {Error[]} */
const errors = [];
const { eventsBasedBehaviors, eventsFunctions } =
const { eventsBasedBehaviors, eventsBasedObjects, eventsFunctions } =
extensionWithFileInfo.extension;

const behaviorFunctions = eventsBasedBehaviors.flatMap(
({ eventsFunctions }) => eventsFunctions
);
const objectFunctions = eventsBasedObjects
? eventsBasedObjects.flatMap(({ eventsFunctions }) => eventsFunctions)
: [];
/**
* A list of all events functions of the extension.
* @type {EventsFunction[]}
*/
const allEventsFunctions = eventsFunctions.concat(
eventsBasedBehaviors.flatMap(({ eventsFunctions }) => eventsFunctions)
);
const allEventsFunctions = [];
Array.prototype.push.apply(allEventsFunctions, eventsFunctions);
Array.prototype.push.apply(allEventsFunctions, behaviorFunctions);
Array.prototype.push.apply(allEventsFunctions, objectFunctions);

/**
* A list of all events functions that will be used by extension users (non-lifecycle and non-private functions).
Expand Down
1 change: 1 addition & 0 deletions scripts/lib/ExtensionsValidatorExceptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const lifecycleFunctions = new Set([
'onSceneResumed',
'onScenePostEvents',
'onScenePreEvents',
'onHotReloading',
]);

/**
Expand Down
13 changes: 13 additions & 0 deletions scripts/lib/rules/FilledOutDescriptions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/** @typedef {import("../../types").Extension} Extension */
/** @typedef {import("../../types").EventsFunction} EventsFunction */
/** @typedef {import("../../types").EventsBasedBehaviors} EventsBasedBehaviors */
/** @typedef {import("../../types").EventsBasedObjects} EventsBasedObjects */
/** @typedef {import("../../types").Parameter} Parameter */

/**
Expand All @@ -17,6 +18,8 @@ const NECESSARY_FIELDS = {
ACTION_WITH_OPERATOR: ['name', 'getterName'],
/** @type {Partial<keyof EventsBasedBehaviors>[]} */
BEHAVIOR: ['name', 'fullName', 'description'],
/** @type {Partial<keyof EventsBasedObjects>[]} */
OBJECT: ['name', 'fullName', 'description'],
/** @type {Partial<keyof Parameter>[]} */
PARAMETER: ['description', 'name', 'type'],
};
Expand Down Expand Up @@ -88,6 +91,16 @@ async function validate({ extension, publicEventsFunctions, onError }) {
`the behavior '${behavior.name}'`,
onError
);
if (extension.eventsBasedObjects) {
for (const object of extension.eventsBasedObjects) {
checkForFilledOutString(
object,
NECESSARY_FIELDS.OBJECT,
`the object '${object.name}'`,
onError
);
}
}
}

/** @type {import("./rule").RuleModule} */
Expand Down
9 changes: 9 additions & 0 deletions scripts/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,21 @@ export interface EventsBasedBehaviors {
eventsFunctions: EventsFunction[];
}

export interface EventsBasedObjects {
description: string;
fullName: string;
name: string;
defaultName: string;
eventsFunctions: EventsFunction[];
}

export interface Extension
extends ExtensionAndShortHeaderFields,
ExtensionAndHeaderFields {
tags: string | string[];
eventsFunctions: EventsFunction[];
eventsBasedBehaviors: EventsBasedBehaviors[];
eventsBasedObjects?: EventsBasedObjects[];
}

export interface ExtensionWithProperFileInfo {
Expand Down