File tree Expand file tree Collapse file tree 2 files changed +45
-1
lines changed
Expand file tree Collapse file tree 2 files changed +45
-1
lines changed Original file line number Diff line number Diff line change 55 validateExtension,
66 validateNoDuplicates,
77} = require ( './lib/ExtensionValidator' ) ;
8+ const { getExtensionReferencePagePath } = require ( './lib/WikiHelpLink' ) ;
89const args = require ( 'minimist' ) ( process . argv . slice ( 2 ) ) ;
910
1011/** @typedef {import('./types').ExtensionShortHeader } ExtensionShortHeader */
@@ -322,7 +323,7 @@ const filterEventsFunctions = (eventsFunctions) =>
322323 name,
323324 eventsBasedBehaviorsCount : eventsBasedBehaviors . length ,
324325 eventsFunctionsCount : eventsFunctions . length ,
325- helpPath : extension . helpPath ,
326+ helpPath : extension . helpPath || getExtensionReferencePagePath ( name ) ,
326327 } ;
327328
328329 if ( tier === 'reviewed' ) {
Original file line number Diff line number Diff line change 1+ // @ts -check
2+
3+ /** @param {string } str */
4+ const toKebabCase = ( str ) => {
5+ return str
6+ . replace ( / ( [ a - z ] ) ( [ A - Z ] ) / g, '$1-$2' ) // get all lowercase letters that are near to uppercase ones
7+ . replace ( / [ \s _ ] + / g, '-' ) // replace all spaces and low dash
8+ . toLowerCase ( ) ; // convert to lower case
9+ } ;
10+
11+ /** @type {Record<string, string> } */
12+ const renamedExtensionNames = {
13+ AdMob : 'Admob' ,
14+ BuiltinFile : 'Storage' ,
15+ FileSystem : 'Filesystem' ,
16+ TileMap : 'Tilemap' ,
17+ BuiltinMouse : 'MouseTouch' ,
18+ } ;
19+
20+ /**
21+ * @param {string } extensionName
22+ * @returns {string }
23+ */
24+ const getExtensionFolderName = ( extensionName ) => {
25+ return toKebabCase (
26+ renamedExtensionNames [ extensionName ] ||
27+ extensionName . replace ( / ^ B u i l t i n / , '' )
28+ ) ;
29+ } ;
30+
31+ /**
32+ * @param {string } extensionName
33+ * @returns {string }
34+ */
35+ const getExtensionReferencePagePath = ( extensionName ) => {
36+ const folderName = getExtensionFolderName ( extensionName ) ;
37+ const referencePagePath = `/extensions/${ folderName } ` ;
38+ return referencePagePath ;
39+ } ;
40+
41+ module . exports = {
42+ getExtensionReferencePagePath,
43+ } ;
You can’t perform that action at this time.
0 commit comments