11import { parseAuthor } from "./utils/author.js" ;
2- import { scase } from "./utils/common.js" ;
2+ import { scase , uniqify } from "./utils/common.js" ;
33import { makeTemplateComment , mdLink } from "./utils/index.js" ;
44import { parsePackageName , prettifyPackageName } from "./utils/name.js" ;
55/**
@@ -12,7 +12,7 @@ export const generateStackApps = (pkg, options) => {
1212 const { about = description , excerpt = description , installURL, languages = [ ] , minifiedURL, orgName, orgURL, postTitle, roomURL, screenshotAlt = "screenshot of the script" , screenshotURL = "" , tags = [ ] , testedIn = { } , thumbnailURL = "" , worksWith = [ ] } = options ;
1313 const browserNames = Object . keys ( testedIn ) ;
1414 const testingData = Object . values ( testedIn ) ;
15- const managerNames = worksWith . map ( scase ) ;
15+ const managerNames = uniqify ( worksWith . map ( scase ) ) ;
1616 const { name : authorName , url : authorUrl = "" } = parseAuthor ( author ) ;
1717 const parsedContribs = contributors . map ( parseAuthor ) ;
1818 const contribs = parsedContribs . length ? `\n\nContributors:${ parsedContribs . map ( ( { name, url } ) => `\n<br>${ url ? mdLink ( url , name ) : name } ` ) } ` : "" ;
@@ -22,9 +22,17 @@ export const generateStackApps = (pkg, options) => {
2222 const org = orgName ? `<br>Organization: ${ orgURL ? mdLink ( orgURL , orgName ) : orgName } ` : "" ;
2323 const room = roomURL ? `\nYou can also ${ mdLink ( roomURL , "drop by to chat" ) } , we are a friendly bunch.` : "" ;
2424 const screenshot = screenshotURL ? `## Screenshot\n\n!${ mdLink ( screenshotURL , screenshotAlt ) } \n` : "" ;
25+ const testing = testingData . some ( Boolean ) ?
26+ `Version number means "last tested on":
27+
28+ | ${ browserNames . map ( scase ) . join ( " | " ) } |
29+ | ${ new Array ( browserNames . length ) . fill ( "-" ) . join ( " | " ) } |
30+ | ${ testingData . map ( ( data ) => data && ! data . startsWith ( "no" ) ? `✔ ${ data } ` : "-" ) . join ( " | " ) } |\n` :
31+ "" ;
2532 const managers = managerNames . length ?
26- `\nSupported userscript managers:\n\n${ managerNames . map ( ( n ) => `- ${ scase ( n ) } ` ) . join ( "\n" ) } \n` :
33+ `${ testing ? "\n" : "" } Supported userscript managers:\n\n${ managerNames . map ( ( n ) => `- ${ scase ( n ) } ` ) . join ( "\n" ) } \n` :
2734 "" ;
35+ const platform = managers || testing ? `\n\n### Platform\n\n${ testing } ${ managers } ` : "" ;
2836 const body = `
2937${ makeTemplateComment ( "thumbnail" , thumbnailURL ) }
3038${ makeTemplateComment ( "version" , version ) }
@@ -45,15 +53,7 @@ The script is licensed under the ${mdLink(`https://spdx.org/licenses/${license}`
4553Latest version: ${ version }
4654
4755${ mdLink ( installURL , "Install" ) } ${ minified }
48-
49- ### Platform
50-
51- Version number means "last tested on":
52-
53- | ${ browserNames . map ( scase ) . join ( " | " ) } |
54- | ${ new Array ( browserNames . length ) . fill ( "-" ) . join ( " | " ) } |
55- | ${ testingData . map ( ( data ) => data && ! data . startsWith ( "no" ) ? `✔ ${ data } ` : "-" ) . join ( " | " ) } |
56- ${ managers }
56+ ${ platform }
5757## Change log
5858
5959| Version | Description |
0 commit comments