github-action-readme-generator 1.9.2 → 1.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +1 -1
  3. package/dist/bin/index.js +130 -53
  4. package/dist/mjs/Action.d.ts +15 -15
  5. package/dist/mjs/Action.js +11 -4
  6. package/dist/mjs/Action.js.map +1 -1
  7. package/dist/mjs/constants.js.map +1 -1
  8. package/dist/mjs/helpers.d.ts +4 -5
  9. package/dist/mjs/helpers.js +104 -30
  10. package/dist/mjs/helpers.js.map +1 -1
  11. package/dist/mjs/inputs.d.ts +3 -11
  12. package/dist/mjs/inputs.js +14 -14
  13. package/dist/mjs/inputs.js.map +1 -1
  14. package/dist/mjs/logtask/index.js +1 -1
  15. package/dist/mjs/logtask/index.js.map +1 -1
  16. package/dist/mjs/prettier.js +4 -3
  17. package/dist/mjs/prettier.js.map +1 -1
  18. package/dist/mjs/readme-editor.js.map +1 -1
  19. package/dist/mjs/readme-generator.d.ts +3 -3
  20. package/dist/mjs/readme-generator.js.map +1 -1
  21. package/dist/mjs/save.d.ts +2 -2
  22. package/dist/mjs/save.js.map +1 -1
  23. package/dist/mjs/sections/index.d.ts +1 -1
  24. package/dist/mjs/sections/index.js +8 -8
  25. package/dist/mjs/sections/index.js.map +1 -1
  26. package/dist/mjs/sections/update-badges.d.ts +1 -1
  27. package/dist/mjs/sections/update-badges.js.map +1 -1
  28. package/dist/mjs/sections/update-branding.d.ts +1 -1
  29. package/dist/mjs/sections/update-branding.js.map +1 -1
  30. package/dist/mjs/sections/update-contents.d.ts +1 -1
  31. package/dist/mjs/sections/update-contents.js.map +1 -1
  32. package/dist/mjs/sections/update-description.d.ts +1 -1
  33. package/dist/mjs/sections/update-description.js.map +1 -1
  34. package/dist/mjs/sections/update-inputs.d.ts +1 -1
  35. package/dist/mjs/sections/update-inputs.js.map +1 -1
  36. package/dist/mjs/sections/update-outputs.d.ts +1 -1
  37. package/dist/mjs/sections/update-outputs.js.map +1 -1
  38. package/dist/mjs/sections/update-title.d.ts +1 -1
  39. package/dist/mjs/sections/update-title.js.map +1 -1
  40. package/dist/mjs/sections/update-usage.d.ts +1 -1
  41. package/dist/mjs/sections/update-usage.js.map +1 -1
  42. package/dist/mjs/svg-editor.d.mts +2 -2
  43. package/dist/mjs/svg-editor.mjs +3 -3
  44. package/dist/mjs/svg-editor.mjs.map +1 -1
  45. package/dist/types/index.d.ts +109 -129
  46. package/package.json +15 -35
@@ -1 +1 @@
1
- {"version":3,"file":"update-branding.js","sourceRoot":"","sources":["../../../src/sections/update-branding.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,4BAA4B,EAAE,WAAW,EAAiB,MAAM,iBAAiB,CAAC;AAE3F,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAe1C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAe,EACf,IAA+B,EAC/B,OAA6B;IAE7B,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC;IAClC,SAAS,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AACrD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAgC;IAC/D,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACzF,CAAC;IAED,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,4BAA4B,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CACb,sCAAsC,IAAI,yCAAyC,CACpF,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,KAAK,CACb,sCAAsC,IAAI,kDAAkD,CAC7F,CAAC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AAM,MAAM,CAAC;AAC9D,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,YAA2B,EAC3B,MAAc;IAEd,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IAEtC,GAAG,CAAC,IAAI,CAAC,kBAAkB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAErE,GAAG,CAAC,KAAK,EAAE,CAAC;IACZ,wDAAwD;IACxD,MAAM,UAAU,GAAG,KAAK,CAAC;IACzB,MAAM,OAAO,GAAG,iBAAiB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACtD,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACzD,IAAI,OAAO,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;QAC9B,GAAG,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC;IACnD,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,GAAG,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC;IAC5B,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import type { FeatherIconNames } from 'feather-icons';\n\nimport type { BrandColors } from '../constants.js';\nimport { GITHUB_ACTIONS_OMITTED_ICONS, isValidIcon, ReadmeSection } from '../constants.js';\nimport type Inputs from '../inputs.js';\nimport LogTask from '../logtask/index.js';\nimport SVGEditor from '../svg-editor.mjs';\n/**\n * Wiith thanks to\n * https://github.com/haya14busa/github-action-brandings/blob/master/main.js\n * for the urls to the branding images.\n */\n\ntype Maybe<T> = T | undefined;\n\nexport interface IBranding {\n alt: string;\n img: string;\n url?: string;\n}\n\n/**\n * Generates a svg branding image.\n * example:\n * ```ts\n * generateSvgImage('/path/to/file.svg', 'home', 'red')\n * ```\n *\n * @param svgPath - The path to where the svg file will be saved\n * @param icon - The icon name from the feather-icons list\n * @param bgcolor - The background color of the circle behind the icon\n */\nexport function generateSvgImage(\n svgPath: string,\n icon: Partial<FeatherIconNames>,\n bgcolor: Partial<BrandColors>,\n): void {\n const svgEditor = new SVGEditor();\n svgEditor.generateSvgImage(svgPath, icon, bgcolor);\n}\n\n/**\n * This function returns a valid icon name based on the provided branding.\n * If the branding is undefined or not a valid icon name, an error is thrown.\n * It checks if the branding icon is present in the GITHUB_ACTIONS_BRANDING_ICONS set,\n * and if so, returns the corresponding feather icon key array.\n * If the branding icon is present in the GITHUB_ACTIONS_OMITTED_ICONS set,\n * an error is thrown specifying that the icon is part of the omitted icons list.\n * If the branding icon is not a valid icon from the feather-icons list, an error is thrown.\n * @param brand - The branding object\n * @returns The corresponding feather icon key array\n * @throws Error if the branding icon is undefined, not a valid icon name, or part of the omitted icons list\n */\nexport function getValidIconName(icon?: Partial<FeatherIconNames>): FeatherIconNames {\n if (!icon) {\n throw new Error(`No valid branding icon name found: action.yml branding is undefined`);\n }\n\n if (isValidIcon(icon)) {\n return icon;\n }\n\n if (GITHUB_ACTIONS_OMITTED_ICONS.has(icon)) {\n throw new Error(\n `No valid branding icon name found: ${icon} is part of the list of omitted icons. `,\n );\n }\n\n throw new Error(\n `No valid branding icon name found: ${icon} is not a valid icon from the feather-icons list`,\n );\n}\n\n/**\n * This function generates an HTML image markup with branding information.\n * It takes inputs and an optional width parameter.\n * If the branding_svg_path is provided, it generates an action.yml branding image for the specified icon and color.\n * Otherwise, it returns an error message.\n *\n * @param inputs - The inputs instance with data for the function.\n * @param width - The width of the image (default is '15%').\n * @returns The HTML image markup with branding information or an error message.\n */\nexport function generateImgMarkup(inputs: Inputs, width = '15%'): string {\n // Create a log task for debugging\n const log = new LogTask('generateImgMarkup');\n if (!inputs.action.branding) {\n log.info('No branding section');\n return '';\n }\n // Get the branding information from the inputs\n const { icon, color } = inputs.action.branding;\n const iconName = getValidIconName(icon);\n const svgPath = inputs.config.get('branding_svg_path') as Maybe<string>;\n const result = `<img src=\"${svgPath}\" width=\"${width}\" align=\"center\" alt=\"branding<icon:${iconName} color:${color}>\" />`;\n\n if (svgPath) {\n log.info(`Generating action.yml branding image for ${iconName}`);\n const svg = inputs.config.get('image_generated') as Maybe<string>;\n const hash = `${iconName}${color}`;\n if (svg && hash.localeCompare(svg) !== 0) {\n generateSvgImage(svgPath, iconName, color);\n inputs.config.set('image_generated', hash);\n }\n return result;\n }\n log.error(`No branding_svg_path provided or it is empty string, can't create the file!`);\n return `<!-- ERROR: no branding path found = ${result} -->`;\n}\n\n/**\n * This is a TypeScript function named \"updateBranding\" that takes in a sectionToken string and an object of inputs.\n * It exports the function as the default export.\n * The function logs the brand details from the inputs, starts a log task, generates image markup,\n * updates a section in the readme editor using the sectionToken and content, and logs success or failure messages.\n *\n * @param sectionToken - The sectionToken string that is used to identify the section in the readme editor.\n * @param inputs - The inputs object that contains data for the function.\n */\nexport default function updateBranding(\n sectionToken: ReadmeSection,\n inputs: Inputs,\n): Record<string, string> {\n const log = new LogTask(sectionToken);\n\n log.info(`Brand details: ${JSON.stringify(inputs.action.branding)}`);\n\n log.start();\n /** create <img /> markup with an image width of 15% */\n const imageWidth = '15%';\n const content = generateImgMarkup(inputs, imageWidth);\n inputs.readmeEditor.updateSection(sectionToken, content);\n if (content && content !== '') {\n log.success('branding svg successfully created');\n } else {\n log.fail('branding svg failed to be created');\n }\n\n const ret: Record<string, string> = {};\n ret[sectionToken] = content;\n return ret;\n}\n"]}
1
+ {"version":3,"file":"update-branding.js","sourceRoot":"","sources":["../../../src/sections/update-branding.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,4BAA4B,EAAE,WAAW,EAAsB,MAAM,iBAAiB,CAAC;AAEhG,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAgB1C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAg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CAAC;IACnD,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,GAAG,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC;IAC5B,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import type { FeatherIconNames } from 'feather-icons';\n\nimport type { BrandColors } from '../constants.js';\nimport { GITHUB_ACTIONS_OMITTED_ICONS, isValidIcon, type ReadmeSection } from '../constants.js';\nimport type Inputs from '../inputs.js';\nimport LogTask from '../logtask/index.js';\nimport SVGEditor from '../svg-editor.mjs';\n\n/**\n * Wiith thanks to\n * https://github.com/haya14busa/github-action-brandings/blob/master/main.js\n * for the urls to the branding images.\n */\n\ntype Maybe<T> = T | undefined;\n\nexport interface IBranding {\n alt: string;\n img: string;\n url?: string;\n}\n\n/**\n * Generates a svg branding image.\n * example:\n * ```ts\n * generateSvgImage('/path/to/file.svg', 'home', 'red')\n * ```\n *\n * @param svgPath - The path to where the svg file will be saved\n * @param icon - The icon name from the feather-icons list\n * @param bgcolor - The background color of the circle behind the icon\n */\nexport function generateSvgImage(\n svgPath: string,\n icon: Partial<FeatherIconNames>,\n bgcolor: Partial<BrandColors>,\n): void {\n const svgEditor = new SVGEditor();\n svgEditor.generateSvgImage(svgPath, icon, bgcolor);\n}\n\n/**\n * This function returns a valid icon name based on the provided branding.\n * If the branding is undefined or not a valid icon name, an error is thrown.\n * It checks if the branding icon is present in the GITHUB_ACTIONS_BRANDING_ICONS set,\n * and if so, returns the corresponding feather icon key array.\n * If the branding icon is present in the GITHUB_ACTIONS_OMITTED_ICONS set,\n * an error is thrown specifying that the icon is part of the omitted icons list.\n * If the branding icon is not a valid icon from the feather-icons list, an error is thrown.\n * @param brand - The branding object\n * @returns The corresponding feather icon key array\n * @throws Error if the branding icon is undefined, not a valid icon name, or part of the omitted icons list\n */\nexport function getValidIconName(icon?: Partial<FeatherIconNames>): FeatherIconNames {\n if (!icon) {\n throw new Error(`No valid branding icon name found: action.yml branding is undefined`);\n }\n\n if (isValidIcon(icon)) {\n return icon;\n }\n\n if (GITHUB_ACTIONS_OMITTED_ICONS.has(icon)) {\n throw new Error(\n `No valid branding icon name found: ${icon} is part of the list of omitted icons. `,\n );\n }\n\n throw new Error(\n `No valid branding icon name found: ${icon} is not a valid icon from the feather-icons list`,\n );\n}\n\n/**\n * This function generates an HTML image markup with branding information.\n * It takes inputs and an optional width parameter.\n * If the branding_svg_path is provided, it generates an action.yml branding image for the specified icon and color.\n * Otherwise, it returns an error message.\n *\n * @param inputs - The inputs instance with data for the function.\n * @param width - The width of the image (default is '15%').\n * @returns The HTML image markup with branding information or an error message.\n */\nexport function generateImgMarkup(inputs: Inputs, width: string = '15%'): string {\n // Create a log task for debugging\n const log = new LogTask('generateImgMarkup');\n if (!inputs.action.branding) {\n log.info('No branding section');\n return '';\n }\n // Get the branding information from the inputs\n const { icon, color } = inputs.action.branding;\n const iconName = getValidIconName(icon);\n const svgPath = inputs.config.get('branding_svg_path') as Maybe<string>;\n const result = `<img src=\"${svgPath}\" width=\"${width}\" align=\"center\" alt=\"branding<icon:${iconName} color:${color}>\" />`;\n\n if (svgPath) {\n log.info(`Generating action.yml branding image for ${iconName}`);\n const svg = inputs.config.get('image_generated') as Maybe<string>;\n const hash = `${iconName}${color}`;\n if (svg && hash.localeCompare(svg) !== 0) {\n generateSvgImage(svgPath, iconName, color);\n inputs.config.set('image_generated', hash);\n }\n return result;\n }\n log.error(`No branding_svg_path provided or it is empty string, can't create the file!`);\n return `<!-- ERROR: no branding path found = ${result} -->`;\n}\n\n/**\n * This is a TypeScript function named \"updateBranding\" that takes in a sectionToken string and an object of inputs.\n * It exports the function as the default export.\n * The function logs the brand details from the inputs, starts a log task, generates image markup,\n * updates a section in the readme editor using the sectionToken and content, and logs success or failure messages.\n *\n * @param sectionToken - The sectionToken string that is used to identify the section in the readme editor.\n * @param inputs - The inputs object that contains data for the function.\n */\nexport default function updateBranding(\n sectionToken: ReadmeSection,\n inputs: Inputs,\n): Record<string, string> {\n const log = new LogTask(sectionToken);\n\n log.info(`Brand details: ${JSON.stringify(inputs.action.branding)}`);\n\n log.start();\n /** create <img /> markup with an image width of 15% */\n const imageWidth = '15%';\n const content = generateImgMarkup(inputs, imageWidth);\n inputs.readmeEditor.updateSection(sectionToken, content);\n if (content && content !== '') {\n log.success('branding svg successfully created');\n } else {\n log.fail('branding svg failed to be created');\n }\n\n const ret: Record<string, string> = {};\n ret[sectionToken] = content;\n return ret;\n}\n"]}
@@ -4,6 +4,6 @@
4
4
  * @param {ReadmeSection} sectionToken - The sectionToken representing the section of the README to update.
5
5
  * @param {Inputs} inputs - The Inputs class instance.
6
6
  */
7
- import { ReadmeSection } from '../constants.js';
7
+ import type { ReadmeSection } from '../constants.js';
8
8
  import type Inputs from '../inputs.js';
9
9
  export default function updateContents(sectionToken: ReadmeSection, inputs: Inputs): Record<string, string>;
@@ -1 +1 @@
1
- {"version":3,"file":"update-contents.js","sourceRoot":"","sources":["../../../src/sections/update-contents.ts"],"names":[],"mappings":"AAQA,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAE1C;;;;GAIG;AACH,SAAS,cAAc,CAAC,IAAY;IAClC,OAAO,IAAI;SACR,WAAW,EAAE;SACb,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,2CAA2C;SACvE,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,8BAA8B;SACtD,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,4BAA4B;SACnD,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,kCAAkC;AACjE,CAAC;AAED;;;;GAIG;AACH,SAAS,cAAc,CAAC,OAAe;IACrC,MAAM,OAAO,GAAsC,EAAE,CAAC;IACtD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,WAAW,GAAG,KAAK,CAAC;I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AO,CAAC,IAAI,CAAC,GAAG,MAAM,MAAM,MAAM,CAAC,IAAI,MAAM,MAAM,GAAG,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACzD,GAAG,CAAC,OAAO,EAAE,CAAC;IAEd,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,GAAG,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * This TypeScript code exports a function named 'updateContents' which generates\n * a table of contents from the README.md headers.\n * @param {ReadmeSection} sectionToken - The sectionToken representing the section of the README to update.\n * @param {Inputs} inputs - The Inputs class instance.\n */\nimport { ReadmeSection } from '../constants.js';\nimport type Inputs from '../inputs.js';\nimport LogTask from '../logtask/index.js';\n\n/**\n * Converts a header text to a GitHub-compatible anchor link.\n * @param {string} text - The header text to convert.\n * @returns {string} The anchor link.\n */\nfunction headerToAnchor(text: string): string {\n return text\n .toLowerCase()\n .replaceAll(/[^\\w\\s-]/g, '') // Remove special characters except hyphens\n .replaceAll(/\\s+/g, '-') // Replace spaces with hyphens\n .replaceAll(/-+/g, '-') // Collapse multiple hyphens\n .replaceAll(/^-|-$/g, ''); // Remove leading/trailing hyphens\n}\n\n/**\n * Extracts headers from markdown content, excluding those in code blocks.\n * @param {string} content - The markdown content.\n * @returns {Array<{level: number, text: string}>} Array of header objects.\n */\nfunction extractHeaders(content: string): { level: number; text: string }[] {\n const headers: { level: number; text: string }[] = [];\n const lines = content.split('\\n');\n let inCodeBlock = false;\n\n for (const line of lines) {\n // Track code block state\n if (line.trim().startsWith('```')) {\n inCodeBlock = !inCodeBlock;\n continue;\n }\n\n // Skip if inside code block\n if (inCodeBlock) {\n continue;\n }\n\n // Match markdown headers (## Header)\n const headerMatch = /^(#{2,6})\\s+(.+)$/.exec(line);\n if (headerMatch) {\n const level = headerMatch[1].length;\n let text = headerMatch[2].trim();\n\n // Remove inline images and other markdown formatting from header text\n text = text.replaceAll(/<img[^>]*>/g, '').trim();\n // Remove markdown links but keep the text\n text = text.replaceAll(/\\[([^\\]]+)]\\([^)]+\\)/g, '$1');\n\n if (text) {\n headers.push({ level, text });\n }\n }\n }\n\n return headers;\n}\n\nexport default function updateContents(\n sectionToken: ReadmeSection,\n inputs: Inputs,\n): Record<string, string> {\n const log = new LogTask(sectionToken);\n log.start();\n\n const content: string[] = [];\n const readmeContent = inputs.readmeEditor.getReadmeContent();\n\n // Extract headers from README\n const headers = extractHeaders(readmeContent);\n\n // Filter out the title (h1) and contents section itself\n const tocHeaders = headers.filter(\n (h) => h.level >= 2 && !h.text.toLowerCase().includes('contents'),\n );\n\n if (tocHeaders.length === 0) {\n log.info('No headers found for table of contents');\n } else {\n log.info(`Generating table of contents with ${tocHeaders.length} entries`);\n\n // Find minimum header level for proper indentation\n const minLevel = Math.min(...tocHeaders.map((h) => h.level));\n\n // Track anchor occurrences to disambiguate duplicates like GitHub does\n const anchorCounts = new Map<string, number>();\n\n // Generate TOC entries\n content.push('## Table of Contents', '');\n\n for (const header of tocHeaders) {\n const indent = ' '.repeat(header.level - minLevel);\n const baseAnchor = headerToAnchor(header.text);\n\n // Track occurrences and compute unique anchor\n const count = anchorCounts.get(baseAnchor) ?? 0;\n anchorCounts.set(baseAnchor, count + 1);\n\n // First occurrence uses base anchor, subsequent ones get -1, -2, etc.\n const anchor = count === 0 ? baseAnchor : `${baseAnchor}-${count}`;\n\n content.push(`${indent}- [${header.text}](#${anchor})`);\n }\n }\n\n inputs.readmeEditor.updateSection(sectionToken, content);\n log.success();\n\n const ret: Record<string, string> = {};\n ret[sectionToken] = content.join('\\n');\n return ret;\n}\n"]}
1
+ {"version":3,"file":"update-contents.js","sourceRoot":"","sources":["../../../src/sections/update-contents.ts"],"names":[],"mappings":"AAQA,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAE1C;;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,MAAM,IAAI,UAAU,EAAE,CAAC;YAChC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,GAAG,QAAQ,CAAC,CAAC;YACpD,MAAM,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAE/C,8CAA8C;YAC9C,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAChD,YAAY,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;YAExC,sEAAsE;YACtE,MAAM,MAAM,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,IAAI,KAAK,EAAE,CAAC;YAEnE,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,MAAM,MAAM,CAAC,IAAI,MAAM,MAAM,GAAG,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACzD,GAAG,CAAC,OAAO,EAAE,CAAC;IAEd,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,GAAG,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * This TypeScript code exports a function named 'updateContents' which generates\n * a table of contents from the README.md headers.\n * @param {ReadmeSection} sectionToken - The sectionToken representing the section of the README to update.\n * @param {Inputs} inputs - The Inputs class instance.\n */\nimport type { ReadmeSection } from '../constants.js';\nimport type Inputs from '../inputs.js';\nimport LogTask from '../logtask/index.js';\n\n/**\n * Converts a header text to a GitHub-compatible anchor link.\n * @param {string} text - The header text to convert.\n * @returns {string} The anchor link.\n */\nfunction headerToAnchor(text: string): string {\n return text\n .toLowerCase()\n .replaceAll(/[^\\w\\s-]/g, '') // Remove special characters except hyphens\n .replaceAll(/\\s+/g, '-') // Replace spaces with hyphens\n .replaceAll(/-+/g, '-') // Collapse multiple hyphens\n .replaceAll(/^-|-$/g, ''); // Remove leading/trailing hyphens\n}\n\n/**\n * Extracts headers from markdown content, excluding those in code blocks.\n * @param {string} content - The markdown content.\n * @returns {Array<{level: number, text: string}>} Array of header objects.\n */\nfunction extractHeaders(content: string): { level: number; text: string }[] {\n const headers: { level: number; text: string }[] = [];\n const lines = content.split('\\n');\n let inCodeBlock = false;\n\n for (const line of lines) {\n // Track code block state\n if (line.trim().startsWith('```')) {\n inCodeBlock = !inCodeBlock;\n continue;\n }\n\n // Skip if inside code block\n if (inCodeBlock) {\n continue;\n }\n\n // Match markdown headers (## Header)\n const headerMatch = /^(#{2,6})\\s+(.+)$/.exec(line);\n if (headerMatch) {\n const level = headerMatch[1].length;\n let text = headerMatch[2].trim();\n\n // Remove inline images and other markdown formatting from header text\n text = text.replaceAll(/<img[^>]*>/g, '').trim();\n // Remove markdown links but keep the text\n text = text.replaceAll(/\\[([^\\]]+)]\\([^)]+\\)/g, '$1');\n\n if (text) {\n headers.push({ level, text });\n }\n }\n }\n\n return headers;\n}\n\nexport default function updateContents(\n sectionToken: ReadmeSection,\n inputs: Inputs,\n): Record<string, string> {\n const log = new LogTask(sectionToken);\n log.start();\n\n const content: string[] = [];\n const readmeContent = inputs.readmeEditor.getReadmeContent();\n\n // Extract headers from README\n const headers = extractHeaders(readmeContent);\n\n // Filter out the title (h1) and contents section itself\n const tocHeaders = headers.filter(\n (h) => h.level >= 2 && !h.text.toLowerCase().includes('contents'),\n );\n\n if (tocHeaders.length === 0) {\n log.info('No headers found for table of contents');\n } else {\n log.info(`Generating table of contents with ${tocHeaders.length} entries`);\n\n // Find minimum header level for proper indentation\n const minLevel = Math.min(...tocHeaders.map((h) => h.level));\n\n // Track anchor occurrences to disambiguate duplicates like GitHub does\n const anchorCounts = new Map<string, number>();\n\n // Generate TOC entries\n content.push('## Table of Contents', '');\n\n for (const header of tocHeaders) {\n const indent = ' '.repeat(header.level - minLevel);\n const baseAnchor = headerToAnchor(header.text);\n\n // Track occurrences and compute unique anchor\n const count = anchorCounts.get(baseAnchor) ?? 0;\n anchorCounts.set(baseAnchor, count + 1);\n\n // First occurrence uses base anchor, subsequent ones get -1, -2, etc.\n const anchor = count === 0 ? baseAnchor : `${baseAnchor}-${count}`;\n\n content.push(`${indent}- [${header.text}](#${anchor})`);\n }\n }\n\n inputs.readmeEditor.updateSection(sectionToken, content);\n log.success();\n\n const ret: Record<string, string> = {};\n ret[sectionToken] = content.join('\\n');\n return ret;\n}\n"]}
@@ -5,6 +5,6 @@
5
5
  * @param {ReadmeSection} sectionToken - The sectionToken representing the section of the README to update.
6
6
  * @param {Inputs} inputs - The Inputs class instance.
7
7
  */
8
- import { ReadmeSection } from '../constants.js';
8
+ import type { ReadmeSection } from '../constants.js';
9
9
  import type Inputs from '../inputs.js';
10
10
  export default function updateDescription(sectionToken: ReadmeSection, inputs: Inputs): Record<string, string>;
@@ -1 +1 @@
1
- {"version":3,"file":"update-description.js","sourceRoot":"","sources":["../../../src/sections/update-description.ts"],"names":[],"mappings":"AASA,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAE1C,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,YAA2B,EAC3B,MAAc;IAEd,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IAEtC,uBAAuB;IACvB,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,oCAAoC;IACpC,IAAI,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;QAChC,GAAG,CAAC,KAAK,EAAE,CAAC;QACZ,MAAM,IAAI,GAAW,MAAM,CAAC,MAAM,CAAC,WAAW;aAC3C,IAAI,EAAE;aACN,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,mBAAmB;aAC5C,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,4BAA4B;aACnD,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,mCAAmC;aAC3D,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,mCAAmC;QAEpE,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,MAAM,wCAAwC,CAAC,CAAC;QACzE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACzD,GAAG,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC;IACD,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,GAAG,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * This TypeScript code exports a function named 'updateDescription' which takes a sectionToken (ReadmeSection) and an instance of the 'Inputs' class as its parameters.\n * The function is responsible for updating the description section in the README.md file based on the provided inputs.\n * It utilizes the 'LogTask' class for logging purposes.\n * @param {ReadmeSection} sectionToken - The sectionToken representing the section of the README to update.\n * @param {Inputs} inputs - The Inputs class instance.\n */\nimport { ReadmeSection } from '../constants.js';\nimport type Inputs from '../inputs.js';\nimport LogTask from '../logtask/index.js';\n\nexport default function updateDescription(\n sectionToken: ReadmeSection,\n inputs: Inputs,\n): Record<string, string> {\n const log = new LogTask(sectionToken);\n\n // Build the new README\n const content: string[] = [];\n\n // Build the new description section\n if (inputs?.action?.description) {\n log.start();\n const desc: string = inputs.action.description\n .trim()\n .replaceAll('\\r\\n', '\\n') // Convert CR to LF\n .replaceAll(/ +/g, ' ') // Squash consecutive spaces\n .replaceAll(' \\n', '\\n') // Squash space followed by newline\n .replaceAll('\\n\\n', '<br />'); // Convert double return to a break\n\n log.info(`Writing ${desc.length} characters to the description section`);\n content.push(desc);\n inputs.readmeEditor.updateSection(sectionToken, content);\n log.success();\n }\n const ret: Record<string, string> = {};\n ret[sectionToken] = content.join('\\n');\n return ret;\n}\n"]}
1
+ {"version":3,"file":"update-description.js","sourceRoot":"","sources":["../../../src/sections/update-description.ts"],"names":[],"mappings":"AASA,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAE1C,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,YAA2B,EAC3B,MAAc;IAEd,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IAEtC,uBAAuB;IACvB,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,oCAAoC;IACpC,IAAI,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;QAChC,GAAG,CAAC,KAAK,EAAE,CAAC;QACZ,MAAM,IAAI,GAAW,MAAM,CAAC,MAAM,CAAC,WAAW;aAC3C,IAAI,EAAE;aACN,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,mBAAmB;aAC5C,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,4BAA4B;aACnD,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,mCAAmC;aAC3D,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,mCAAmC;QAEpE,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,MAAM,wCAAwC,CAAC,CAAC;QACzE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACzD,GAAG,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC;IACD,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,GAAG,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * This TypeScript code exports a function named 'updateDescription' which takes a sectionToken (ReadmeSection) and an instance of the 'Inputs' class as its parameters.\n * The function is responsible for updating the description section in the README.md file based on the provided inputs.\n * It utilizes the 'LogTask' class for logging purposes.\n * @param {ReadmeSection} sectionToken - The sectionToken representing the section of the README to update.\n * @param {Inputs} inputs - The Inputs class instance.\n */\nimport type { ReadmeSection } from '../constants.js';\nimport type Inputs from '../inputs.js';\nimport LogTask from '../logtask/index.js';\n\nexport default function updateDescription(\n sectionToken: ReadmeSection,\n inputs: Inputs,\n): Record<string, string> {\n const log = new LogTask(sectionToken);\n\n // Build the new README\n const content: string[] = [];\n\n // Build the new description section\n if (inputs?.action?.description) {\n log.start();\n const desc: string = inputs.action.description\n .trim()\n .replaceAll('\\r\\n', '\\n') // Convert CR to LF\n .replaceAll(/ +/g, ' ') // Squash consecutive spaces\n .replaceAll(' \\n', '\\n') // Squash space followed by newline\n .replaceAll('\\n\\n', '<br />'); // Convert double return to a break\n\n log.info(`Writing ${desc.length} characters to the description section`);\n content.push(desc);\n inputs.readmeEditor.updateSection(sectionToken, content);\n log.success();\n }\n const ret: Record<string, string> = {};\n ret[sectionToken] = content.join('\\n');\n return ret;\n}\n"]}
@@ -5,6 +5,6 @@
5
5
  * @param {ReadmeSection} sectionToken - The sectionToken representing the section of the README to update.
6
6
  * @param {Inputs} inputs - The Inputs class instance.
7
7
  */
8
- import { ReadmeSection } from '../constants.js';
8
+ import type { ReadmeSection } from '../constants.js';
9
9
  import type Inputs from '../inputs.js';
10
10
  export default function updateInputs(sectionToken: ReadmeSection, inputs: Inputs): Record<string, string>;
@@ -1 +1 @@
1
- {"version":3,"file":"update-inputs.js","sourceRoot":"","sources":["../../../src/sections/update-inputs.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAEhD,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,YAA2B,EAC3B,MAAc;IAEd,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,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CAAC,GAAG,CAAC;gBACd,WAAW;gBACX,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,EAAE;gBACvD,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW;aAC5C,CAAC;YACF,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;YAC/B,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC;QACxC,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,UAAU,YAAY,EAAE,CAAC,CAAC;QACnD,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACzD,GAAG,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,KAAK,CAAC,iBAAiB,YAAY,EAAE,CAAC,CAAC;IAC7C,CAAC;IACD,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,GAAG,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * This TypeScript code exports a function named 'updateInputs' which takes a sectionToken (ReadmeSection) and an instance of the 'Inputs' class as its parameters.\n * The function is responsible for updating the inputs section in the README.md file based on the provided inputs.\n * It utilizes the 'LogTask' class for logging purposes, 'columnHeader' and 'rowHeader' functions from '../helpers.js' for formatting table headers, and 'markdowner' function from '../markdowner/index.js' for generating markdown content.\n * @param {ReadmeSection} sectionToken - The sectionToken representing the section of the README to update.\n * @param {Inputs} inputs - The Inputs class instance.\n */\nimport { ReadmeSection } from '../constants.js';\nimport { columnHeader, rowHeader } from '../helpers.js';\nimport type Inputs from '../inputs.js';\nimport LogTask from '../logtask/index.js';\nimport markdowner from '../markdowner/index.js';\n\nexport default function updateInputs(\n sectionToken: ReadmeSection,\n inputs: Inputs,\n): Record<string, string> {\n const log = new LogTask(sectionToken);\n\n // Build the new README\n const content: string[] = [];\n const markdownArray: string[][] = [];\n const titleArray = ['Input', 'Description', 'Default', 'Required'];\n const titles: string[] = [];\n\n for (const t of titleArray) {\n titles.push(columnHeader(t));\n }\n\n markdownArray.push(titles);\n\n const vars = inputs.action.inputs;\n const tI = vars ? Object.keys(vars).length : 0;\n\n if (vars && tI > 0) {\n log.start();\n\n for (const key of Object.keys(vars)) {\n const values = vars[key];\n let description = values?.description ?? '';\n\n // Check if only the first line should be added (only subject without body)\n const matches = /(.*?)\\n\\n([Ss]*)/.exec(description);\n\n if (matches && matches.length >= 2) {\n description = matches[1] || description;\n }\n\n description = description.trim().replace('\\n', '<br />');\n\n const row: string[] = [\n rowHeader(key),\n description,\n values?.default ? `<code>${values.default}</code>` : '',\n values?.required ? '**true**' : '__false__',\n ];\n log.debug(JSON.stringify(row));\n markdownArray.push(row);\n }\n content.push(markdowner(markdownArray));\n log.info(`Action has ${tI} total ${sectionToken}`);\n inputs.readmeEditor.updateSection(sectionToken, content);\n log.success();\n } else {\n log.debug(`Action has no ${sectionToken}`);\n }\n const ret: Record<string, string> = {};\n ret[sectionToken] = content.join('\\n');\n return ret;\n}\n"]}
1
+ {"version":3,"file":"update-inputs.js","sourceRoot":"","sources":["../../../src/sections/update-inputs.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAEhD,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,YAA2B,EAC3B,MAAc;IAEd,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IAEtC,uBAAuB;IACvB,MAAM,OAAO,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O,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,EAAE;gBACvD,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW;aAC5C,CAAC;YACF,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;YAC/B,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC;QACxC,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,UAAU,YAAY,EAAE,CAAC,CAAC;QACnD,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACzD,GAAG,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,KAAK,CAAC,iBAAiB,YAAY,EAAE,CAAC,CAAC;IAC7C,CAAC;IACD,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,GAAG,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * This TypeScript code exports a function named 'updateInputs' which takes a sectionToken (ReadmeSection) and an instance of the 'Inputs' class as its parameters.\n * The function is responsible for updating the inputs section in the README.md file based on the provided inputs.\n * It utilizes the 'LogTask' class for logging purposes, 'columnHeader' and 'rowHeader' functions from '../helpers.js' for formatting table headers, and 'markdowner' function from '../markdowner/index.js' for generating markdown content.\n * @param {ReadmeSection} sectionToken - The sectionToken representing the section of the README to update.\n * @param {Inputs} inputs - The Inputs class instance.\n */\nimport type { ReadmeSection } from '../constants.js';\nimport { columnHeader, rowHeader } from '../helpers.js';\nimport type Inputs from '../inputs.js';\nimport LogTask from '../logtask/index.js';\nimport markdowner from '../markdowner/index.js';\n\nexport default function updateInputs(\n sectionToken: ReadmeSection,\n inputs: Inputs,\n): Record<string, string> {\n const log = new LogTask(sectionToken);\n\n // Build the new README\n const content: string[] = [];\n const markdownArray: string[][] = [];\n const titleArray = ['Input', 'Description', 'Default', 'Required'];\n const titles: string[] = [];\n\n for (const t of titleArray) {\n titles.push(columnHeader(t));\n }\n\n markdownArray.push(titles);\n\n const vars = inputs.action.inputs;\n const tI = vars ? Object.keys(vars).length : 0;\n\n if (vars && tI > 0) {\n log.start();\n\n for (const key of Object.keys(vars)) {\n const values = vars[key];\n let description = values?.description ?? '';\n\n // Check if only the first line should be added (only subject without body)\n const matches = /(.*?)\\n\\n([Ss]*)/.exec(description);\n\n if (matches && matches.length >= 2) {\n description = matches[1] || description;\n }\n\n description = description.trim().replace('\\n', '<br />');\n\n const row: string[] = [\n rowHeader(key),\n description,\n values?.default ? `<code>${values.default}</code>` : '',\n values?.required ? '**true**' : '__false__',\n ];\n log.debug(JSON.stringify(row));\n markdownArray.push(row);\n }\n content.push(markdowner(markdownArray));\n log.info(`Action has ${tI} total ${sectionToken}`);\n inputs.readmeEditor.updateSection(sectionToken, content);\n log.success();\n } else {\n log.debug(`Action has no ${sectionToken}`);\n }\n const ret: Record<string, string> = {};\n ret[sectionToken] = content.join('\\n');\n return ret;\n}\n"]}
@@ -6,6 +6,6 @@
6
6
  * @param {ReadmeSection} sectionToken - The sectionToken used for identifying the section.
7
7
  * @param {Inputs} inputs - The Inputs class instance.
8
8
  */
9
- import { ReadmeSection } from '../constants.js';
9
+ import type { ReadmeSection } from '../constants.js';
10
10
  import type Inputs from '../inputs.js';
11
11
  export default function updateOutputs(sectionToken: ReadmeSection, inputs: Inputs): Record<string, string>;
@@ -1 +1 @@
1
- {"version":3,"file":"update-outputs.js","sourceRoot":"","sources":["../../../src/sections/update-outputs.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,OAAO,MAAM,qBAAq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;YAC1C,CAAC;YAED,WAAW,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YACzD,MAAM,KAAK,GAAG,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YACzD,MAAM,GAAG,GAAa,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;YAE3D,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;YAC/B,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC;QACxC,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,UAAU,YAAY,EAAE,CAAC,CAAC;QACnD,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACzD,GAAG,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,KAAK,CAAC,iBAAiB,YAAY,EAAE,CAAC,CAAC;IAC7C,CAAC;IACD,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,GAAG,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * This TypeScript code exports a function named 'updateOutputs' which takes a sectionToken (string) and an instance of the 'Inputs' class as its parameters.\n * The function is responsible for updating the outputs section in the README.md file based on the provided inputs.\n * It generates a table with three columns: Output name, Description, and Value (for composite actions).\n * It utilizes the 'LogTask' class for logging purposes, 'columnHeader' and 'rowHeader' functions from '../helpers.js' for formatting table headers, and 'markdowner' function from '../markdowner/index.js' for generating markdown content.\n * @param {ReadmeSection} sectionToken - The sectionToken used for identifying the section.\n * @param {Inputs} inputs - The Inputs class instance.\n */\nimport { ReadmeSection } from '../constants.js';\nimport { columnHeader, rowHeader } from '../helpers.js';\nimport type Inputs from '../inputs.js';\nimport LogTask from '../logtask/index.js';\nimport markdowner from '../markdowner/index.js';\n\nexport default function updateOutputs(\n sectionToken: ReadmeSection,\n inputs: Inputs,\n): Record<string, string> {\n const log = new LogTask(sectionToken);\n\n // Build the new README\n const content: string[] = [];\n\n const markdownArray: string[][] = [];\n const titleArray = ['Output', 'Description', 'Value'];\n const titles: string[] = [];\n for (const t of titleArray) {\n titles.push(columnHeader(t));\n }\n markdownArray.push(titles);\n const vars = inputs.action.outputs;\n const tI = vars ? Object.keys(vars).length : 0;\n if (vars && tI > 0) {\n log.start();\n for (const key of Object.keys(vars)) {\n const values = vars[key];\n\n let description = values?.description ?? '';\n\n // Check if only first line should be added (only subject without body)\n\n const matches = /(.*?)\\n\\n([Ss]*)/.exec(description);\n if (matches && matches.length >= 2) {\n description = matches[1] || description;\n }\n\n description = description.trim().replace('\\n', '<br />');\n const value = values?.value ? `\\`${values.value}\\`` : '';\n const row: string[] = [rowHeader(key), description, value];\n\n log.debug(JSON.stringify(row));\n markdownArray.push(row);\n }\n content.push(markdowner(markdownArray));\n log.info(`Action has ${tI} total ${sectionToken}`);\n inputs.readmeEditor.updateSection(sectionToken, content);\n log.success();\n } else {\n log.debug(`Action has no ${sectionToken}`);\n }\n const ret: Record<string, string> = {};\n ret[sectionToken] = content.join('\\n');\n return ret;\n}\n"]}
1
+ {"version":3,"file":"update-outputs.js","sourceRoot":"","sources":["../../../src/sections/update-outputs.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAEhD,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,YAA2B,EAC3B,MAAc;IAE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,KAAK,GAAG,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YACzD,MAAM,GAAG,GAAa,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;YAE3D,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;YAC/B,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC;QACxC,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,UAAU,YAAY,EAAE,CAAC,CAAC;QACnD,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACzD,GAAG,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,KAAK,CAAC,iBAAiB,YAAY,EAAE,CAAC,CAAC;IAC7C,CAAC;IACD,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,GAAG,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * This TypeScript code exports a function named 'updateOutputs' which takes a sectionToken (string) and an instance of the 'Inputs' class as its parameters.\n * The function is responsible for updating the outputs section in the README.md file based on the provided inputs.\n * It generates a table with three columns: Output name, Description, and Value (for composite actions).\n * It utilizes the 'LogTask' class for logging purposes, 'columnHeader' and 'rowHeader' functions from '../helpers.js' for formatting table headers, and 'markdowner' function from '../markdowner/index.js' for generating markdown content.\n * @param {ReadmeSection} sectionToken - The sectionToken used for identifying the section.\n * @param {Inputs} inputs - The Inputs class instance.\n */\nimport type { ReadmeSection } from '../constants.js';\nimport { columnHeader, rowHeader } from '../helpers.js';\nimport type Inputs from '../inputs.js';\nimport LogTask from '../logtask/index.js';\nimport markdowner from '../markdowner/index.js';\n\nexport default function updateOutputs(\n sectionToken: ReadmeSection,\n inputs: Inputs,\n): Record<string, string> {\n const log = new LogTask(sectionToken);\n\n // Build the new README\n const content: string[] = [];\n\n const markdownArray: string[][] = [];\n const titleArray = ['Output', 'Description', 'Value'];\n const titles: string[] = [];\n for (const t of titleArray) {\n titles.push(columnHeader(t));\n }\n markdownArray.push(titles);\n const vars = inputs.action.outputs;\n const tI = vars ? Object.keys(vars).length : 0;\n if (vars && tI > 0) {\n log.start();\n for (const key of Object.keys(vars)) {\n const values = vars[key];\n\n let description = values?.description ?? '';\n\n // Check if only first line should be added (only subject without body)\n\n const matches = /(.*?)\\n\\n([Ss]*)/.exec(description);\n if (matches && matches.length >= 2) {\n description = matches[1] || description;\n }\n\n description = description.trim().replace('\\n', '<br />');\n const value = values?.value ? `\\`${values.value}\\`` : '';\n const row: string[] = [rowHeader(key), description, value];\n\n log.debug(JSON.stringify(row));\n markdownArray.push(row);\n }\n content.push(markdowner(markdownArray));\n log.info(`Action has ${tI} total ${sectionToken}`);\n inputs.readmeEditor.updateSection(sectionToken, content);\n log.success();\n } else {\n log.debug(`Action has no ${sectionToken}`);\n }\n const ret: Record<string, string> = {};\n ret[sectionToken] = content.join('\\n');\n return ret;\n}\n"]}
@@ -5,6 +5,6 @@
5
5
  * @param {ReadmeSection} sectionToken - The sectionToken representing the section of the README to update.
6
6
  * @param {Inputs} inputs - The Inputs class instance.
7
7
  */
8
- import { ReadmeSection } from '../constants.js';
8
+ import type { ReadmeSection } from '../constants.js';
9
9
  import type Inputs from '../inputs.js';
10
10
  export default function updateTitle(sectionToken: ReadmeSection, inputs: Inputs): Record<string, string>;
@@ -1 +1 @@
1
- {"version":3,"file":"update-title.js","sourceRoot":"","sources":["../../../src/sections/update-title.ts"],"names":[],"mappings":"AASA,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,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named 'updateTitle' which takes a sectionToken (ReadmeSection) and an instance of the 'Inputs' class as its parameters.\n * The function is responsible for updating the title section in the README.md file based on the provided inputs.\n * It utilizes the 'LogTask' class for logging purposes, the 'generateImgMarkup' function from './update-branding.js' for generating image markup.\n * @param {ReadmeSection} sectionToken - The sectionToken representing the section of the README to update.\n * @param {Inputs} inputs - The Inputs class instance.\n */\nimport { ReadmeSection } from '../constants.js';\nimport type Inputs from '../inputs.js';\nimport LogTask from '../logtask/index.js';\nimport { generateImgMarkup } from './update-branding.js';\n\nexport default function updateTitle(\n sectionToken: ReadmeSection,\n inputs: Inputs,\n): Record<string, string> {\n const log = new LogTask(sectionToken);\n\n // Build the new README\n const content: string[] = [];\n let name = '';\n let svgInline = '';\n\n if (inputs.action.name) {\n log.start();\n name = inputs.action.name;\n if (inputs.config.get('branding_as_title_prefix') as boolean) {\n svgInline = `${generateImgMarkup(inputs, '60px')} `;\n }\n log.info(`Writing ${name.length} characters to the title`);\n const title = `# ${svgInline}${inputs.config.get('title_prefix') as string}${\n inputs.action.name\n }`;\n log.info(`Title: ${title}`);\n // Build the new usage section\n content.push(title);\n inputs.readmeEditor.updateSection(sectionToken, content, true);\n\n log.success();\n }\n const ret: Record<string, string> = {};\n ret[sectionToken] = content.join('\\n');\n return ret;\n}\n"]}
1
+ {"version":3,"file":"update-title.js","sourceRoot":"","sources":["../../../src/sections/update-title.ts"],"names":[],"mappings":"AASA,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,CAAC,OAAO,UAAU,WAAW,CACjC,YAA2B,EAC3B,MAAc;IAEd,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IAEtC,uBAAuB;IACvB,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,SAAS,GAAG,EAAE,CAAC;IAEnB,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACvB,GAAG,CAAC,KAAK,EAAE,CAAC;QACZ,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;QAC1B,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,0BAA0B,CAAY,EAAE,CAAC;YAC7D,SAAS,GAAG,GAAG,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC;QACtD,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,MAAM,0BAA0B,CAAC,CAAC;QAC3D,MAAM,KAAK,GAAG,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,cAAc,CAAW,GACxE,MAAM,CAAC,MAAM,CAAC,IAChB,EAAE,CAAC;QACH,GAAG,CAAC,IAAI,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC;QAC5B,8BAA8B;QAC9B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpB,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QAE/D,GAAG,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC;IACD,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,GAAG,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * This TypeScript code exports a function named 'updateTitle' which takes a sectionToken (ReadmeSection) and an instance of the 'Inputs' class as its parameters.\n * The function is responsible for updating the title section in the README.md file based on the provided inputs.\n * It utilizes the 'LogTask' class for logging purposes, the 'generateImgMarkup' function from './update-branding.js' for generating image markup.\n * @param {ReadmeSection} sectionToken - The sectionToken representing the section of the README to update.\n * @param {Inputs} inputs - The Inputs class instance.\n */\nimport type { ReadmeSection } from '../constants.js';\nimport type Inputs from '../inputs.js';\nimport LogTask from '../logtask/index.js';\nimport { generateImgMarkup } from './update-branding.js';\n\nexport default function updateTitle(\n sectionToken: ReadmeSection,\n inputs: Inputs,\n): Record<string, string> {\n const log = new LogTask(sectionToken);\n\n // Build the new README\n const content: string[] = [];\n let name = '';\n let svgInline = '';\n\n if (inputs.action.name) {\n log.start();\n name = inputs.action.name;\n if (inputs.config.get('branding_as_title_prefix') as boolean) {\n svgInline = `${generateImgMarkup(inputs, '60px')} `;\n }\n log.info(`Writing ${name.length} characters to the title`);\n const title = `# ${svgInline}${inputs.config.get('title_prefix') as string}${\n inputs.action.name\n }`;\n log.info(`Title: ${title}`);\n // Build the new usage section\n content.push(title);\n inputs.readmeEditor.updateSection(sectionToken, content, true);\n\n log.success();\n }\n const ret: Record<string, string> = {};\n ret[sectionToken] = content.join('\\n');\n return ret;\n}\n"]}
@@ -1,3 +1,3 @@
1
- import { ReadmeSection } from '../constants.js';
1
+ import type { ReadmeSection } from '../constants.js';
2
2
  import type Inputs from '../inputs.js';
3
3
  export default function updateUsage(sectionToken: ReadmeSection, inputs: Inputs): Promise<Record<string, string>>;
@@ -1 +1 @@
1
- {"version":3,"file":"update-usage.js","sourceRoot":"","sources":["../../../src/sections/update-usage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjD,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,WAAW,CACvC,YAA2B,EAC3B,MAAc;IAEd,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IACtC,GAAG,CAAC,KAAK,EAAE,CAAC;IAEZ,MAAM,UAAU,GAAG,GAAG,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;IACpD,GAAG,CAAC,IAAI,CAAC,gBAAgB,UAAU,EAAE,CAAC,CAAC;IACvC,M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b,CAAC","sourcesContent":["import { ReadmeSection } from '../constants.js';\nimport { getCurrentVersionString } from '../helpers.js';\nimport type Inputs from '../inputs.js';\nimport LogTask from '../logtask/index.js';\nimport { wrapDescription } from '../prettier.js';\n\ntype DescriptionType = Record<string, string[]>;\nexport default async function updateUsage(\n sectionToken: ReadmeSection,\n inputs: Inputs,\n): Promise<Record<string, string>> {\n const log = new LogTask(sectionToken);\n log.start();\n\n const actionName = `${inputs.owner}/${inputs.repo}`;\n log.info(`Action name: ${actionName}`);\n const versionString: string = getCurrentVersionString(inputs);\n\n log.info(`Version string: ${versionString}`);\n\n const actionReference = `${actionName}@${versionString}`;\n\n const indent = ' # ';\n // Build the new README\n const content: string[] = [];\n // Build the new usage section\n content.push('```yaml', `- uses: ${actionReference}`, ' with:');\n\n const inp = inputs.action.inputs;\n let firstInput = true;\n const descriptionPromises: Record<string, Promise<string[]>> = {};\n if (inp) {\n for (const key of Object.keys(inp)) {\n const input = inp[key];\n if (input !== undefined) {\n descriptionPromises[key] = wrapDescription(`Description: ${input.description}`, [], indent);\n }\n }\n\n const descriptions: DescriptionType = {};\n const kvArray = await Promise.all(\n Object.keys(descriptionPromises).map(async (key) => {\n return { key, value: await descriptionPromises[key] };\n }),\n );\n for (const e of kvArray) {\n descriptions[e.key] = e.value;\n log.debug(`${e.key}: ${descriptions[e.key].join('\\n')}`);\n }\n\n for (const key of Object.keys(inp)) {\n const input = inp[key];\n if (input !== undefined) {\n // Line break between inputs\n if (!firstInput) {\n content.push('');\n }\n\n // Constrain the width of the description, and append it\n content.push(...descriptions[key]);\n\n if (input.default !== undefined) {\n // Append blank line if description had paragraphs\n // if (input.description?.trimEnd().match(/\\n *\\r?\\n/)) {\n // content.push(' #');\n // }\n\n // Default\n content.push(`${indent}Default: ${input.default}`);\n }\n\n // Input name\n content.push(` ${key}: ''`);\n\n firstInput = false;\n }\n }\n }\n\n content.push('```\\n');\n\n inputs.readmeEditor.updateSection(sectionToken, content);\n log.success();\n const ret: Record<string, string> = {};\n ret[sectionToken] = content.join('\\n');\n return ret;\n}\n"]}
1
+ {"version":3,"file":"update-usage.js","sourceRoot":"","sources":["../../../src/sections/update-usage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjD,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,WAAW,CACvC,YAA2B,EAC3B,MAAc;IAEd,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IACtC,GAAG,CAAC,KAAK,EAAE,CAAC;IAEZ,MAAM,UAAU,GAAG,GAAG,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;IACpD,GAAG,CAAC,IAAI,CAAC,gBAAgB,UAAU,EAAE,CAAC,CAAC;IACvC,MAAM,aAAa,GAAW,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAE9D,GAAG,CAAC,IAAI,CAAC,mBAAmB,aAAa,EAAE,CAAC,CAAC;IAE7C,MAAM,eAAe,GAAG,GAAG,UAAU,IAAI,aAAa,EAAE,CAAC;IAEzD,MAAM,MAAM,GAAG,QAAQ,CAAC;IACxB,uBAAuB;IACvB,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,8BAA8B;IAC9B,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,eAAe,EAAE,EAAE,SAAS,CAAC,CAAC;IAEjE,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;IACjC,IAAI,UAAU,GAAG,IAAI,CAAC;IACtB,MAAM,mBAAmB,GAAsC,EAAE,CAAC;IAClE,IAAI,GAAG,EAAE,CAAC;QACR,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACnC,MAAM,KAAK,GAAG,GAAG,CAAC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D,yDAAyD;oBACzD,2BAA2B;oBAC3B,IAAI;oBAEJ,UAAU;oBACV,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,YAAY,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;gBACrD,CAAC;gBAED,aAAa;gBACb,OAAO,CAAC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;gBAE/B,UAAU,GAAG,KAAK,CAAC;YACrB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAEtB,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACzD,GAAG,CAAC,OAAO,EAAE,CAAC;IACd,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,GAAG,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import type { ReadmeSection } from '../constants.js';\nimport { getCurrentVersionString } from '../helpers.js';\nimport type Inputs from '../inputs.js';\nimport LogTask from '../logtask/index.js';\nimport { wrapDescription } from '../prettier.js';\n\ntype DescriptionType = Record<string, string[]>;\nexport default async function updateUsage(\n sectionToken: ReadmeSection,\n inputs: Inputs,\n): Promise<Record<string, string>> {\n const log = new LogTask(sectionToken);\n log.start();\n\n const actionName = `${inputs.owner}/${inputs.repo}`;\n log.info(`Action name: ${actionName}`);\n const versionString: string = getCurrentVersionString(inputs);\n\n log.info(`Version string: ${versionString}`);\n\n const actionReference = `${actionName}@${versionString}`;\n\n const indent = ' # ';\n // Build the new README\n const content: string[] = [];\n // Build the new usage section\n content.push('```yaml', `- uses: ${actionReference}`, ' with:');\n\n const inp = inputs.action.inputs;\n let firstInput = true;\n const descriptionPromises: Record<string, Promise<string[]>> = {};\n if (inp) {\n for (const key of Object.keys(inp)) {\n const input = inp[key];\n if (input !== undefined) {\n descriptionPromises[key] = wrapDescription(`Description: ${input.description}`, [], indent);\n }\n }\n\n const descriptions: DescriptionType = {};\n const kvArray = await Promise.all(\n Object.keys(descriptionPromises).map(async (key) => {\n return { key, value: await descriptionPromises[key] };\n }),\n );\n for (const e of kvArray) {\n descriptions[e.key] = e.value;\n log.debug(`${e.key}: ${descriptions[e.key].join('\\n')}`);\n }\n\n for (const key of Object.keys(inp)) {\n const input = inp[key];\n if (input !== undefined) {\n // Line break between inputs\n if (!firstInput) {\n content.push('');\n }\n\n // Constrain the width of the description, and append it\n content.push(...descriptions[key]);\n\n if (input.default !== undefined) {\n // Append blank line if description had paragraphs\n // if (input.description?.trimEnd().match(/\\n *\\r?\\n/)) {\n // content.push(' #');\n // }\n\n // Default\n content.push(`${indent}Default: ${input.default}`);\n }\n\n // Input name\n content.push(` ${key}: ''`);\n\n firstInput = false;\n }\n }\n }\n\n content.push('```\\n');\n\n inputs.readmeEditor.updateSection(sectionToken, content);\n log.success();\n const ret: Record<string, string> = {};\n ret[sectionToken] = content.join('\\n');\n return ret;\n}\n"]}
@@ -21,7 +21,7 @@ export default class SVGEditor {
21
21
  /**
22
22
  * Initializes the SVG window, document, and canvas if not already set up.
23
23
  */
24
- initSVG(): Promise<void>;
24
+ initSVG(): void;
25
25
  /**
26
26
  * Generates a branded SVG image.
27
27
  * @param {string | undefined} svgPath - Path to write the generated SVG file to.
@@ -29,7 +29,7 @@ export default class SVGEditor {
29
29
  * @param {Partial<BrandColors>} bgcolor - Background color for the image.
30
30
  * @returns {Promise<void>} A promise that resolves when the image is generated.
31
31
  */
32
- generateSvgImage(svgPath: string | undefined, icon?: Partial<FeatherIconNames>, bgcolor?: Partial<BrandColors>): Promise<void>;
32
+ generateSvgImage(svgPath: string | undefined, icon?: Partial<FeatherIconNames>, bgcolor?: Partial<BrandColors>): void;
33
33
  /**
34
34
  * Writes the SVG xml to disk.
35
35
  * @param {string} svgPath - File path to save the SVG to.
@@ -28,7 +28,7 @@ export default class SVGEditor {
28
28
  /**
29
29
  * Initializes the SVG window, document, and canvas if not already set up.
30
30
  */
31
- async initSVG() {
31
+ initSVG() {
32
32
  if (!this.window) {
33
33
  this.window = createSVGWindow();
34
34
  const { document } = this.window;
@@ -45,7 +45,7 @@ export default class SVGEditor {
45
45
  * @param {Partial<BrandColors>} bgcolor - Background color for the image.
46
46
  * @returns {Promise<void>} A promise that resolves when the image is generated.
47
47
  */
48
- async generateSvgImage(svgPath, icon = DEFAULT_BRAND_ICON, bgcolor = DEFAULT_BRAND_COLOR) {
48
+ generateSvgImage(svgPath, icon = DEFAULT_BRAND_ICON, bgcolor = DEFAULT_BRAND_COLOR) {
49
49
  if (!svgPath || svgPath.length === 0) {
50
50
  this.log.debug('No svgPath provided');
51
51
  return;
@@ -62,7 +62,7 @@ export default class SVGEditor {
62
62
  }
63
63
  this.log.info(`SVG to generate ${icon} at ${svgPath} with color ${bgcolor}.`);
64
64
  // Initialize SVG
65
- await this.initSVG();
65
+ this.initSVG();
66
66
  // Generate SVG content
67
67
  const svgContent = this.generateSVGContent(icon, bgcolor);
68
68
  // Write SVG file
@@ -1 +1 @@
1
- {"version":3,"file":"svg-editor.mjs","sourceRoot":"","sources":["../../src/svg-editor.mts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,eAAe,EAA0B,MAAM,QAAQ,CAAC,CAAC,oBAAoB;AAGtF,OAAO,EACL,gCAAgC,EAChC,mBAAmB,EACnB,kBAAkB,EAClB,8BAA8B,EAC9B,6BAA6B,EAC7B,YAAY,EACZ,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,OAAO,MAAM,oBAAoB,CAAC;AAEzC;;GAEG;AAEH,MAAM,CAAC,OAAO,OAAO,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MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAE9D,2BAA2B;QAC3B,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QAEpC,qEAAqE;QACrE,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAEhC,6DAA6D;QAC7D,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAErC,8BAA8B;QAC9B,OAAO,CAAC,wDAAwD,EAAE,MAAM,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,IAAI,CACxF,IAAI,CACL,CAAC;IACJ,CAAC;CACF","sourcesContent":["/**\n * This TypeScript code imports necessary modules and defines a class named 'SVGEditor' for generating SVG images.\n * The class has methods for initializing the SVG window, generating SVG content, and writing SVG files.\n * It utilizes various packages such as 'fs', 'path', '@svgdotjs/svg.js', 'feather-icons', and 'svgdom' for SVG manipulation and file operations.\n * The class also defines interfaces for badges and brand colors.\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport type { Container } from '@svgdotjs/svg.js';\nimport { registerWindow, SVG } from '@svgdotjs/svg.js';\nimport type { FeatherIconNames } from 'feather-icons';\nimport * as feather from 'feather-icons';\nimport { createSVGWindow, SVGDocument, SVGWindow } from 'svgdom'; /// main-module.js';\n\nimport type { BrandColors } from './constants.js';\nimport {\n brandingSquareEdgeLengthInPixels,\n DEFAULT_BRAND_COLOR,\n DEFAULT_BRAND_ICON,\n GITHUB_ACTIONS_BRANDING_COLORS,\n GITHUB_ACTIONS_BRANDING_ICONS,\n isValidColor,\n isValidIcon,\n} from './constants.js';\nimport LogTask from './logtask/index.js';\n\n/**\n * Utility class for generating SVG images.\n */\n\nexport default class SVGEditor {\n private log: LogTask;\n\n private window?: SVGWindow;\n\n private canvas?: Container;\n\n private document?: SVGDocument;\n\n /**\n * Initializes a new SVGEditor instance.\n */\n constructor() {\n this.log = new LogTask('SVGEditor');\n }\n\n /**\n * Initializes the SVG window, document, and canvas if not already set up.\n */\n async initSVG(): Promise<void> {\n if (!this.window) {\n this.window = createSVGWindow();\n const { document } = this.window;\n registerWindow(this.window, document);\n if (!this.canvas) {\n this.canvas = SVG(document.documentElement) as Container;\n }\n }\n }\n\n /**\n * Generates a branded SVG image.\n * @param {string | undefined} svgPath - Path to write the generated SVG file to.\n * @param {Partial<FeatherIconNames>} icon - Name of the icon to use.\n * @param {Partial<BrandColors>} bgcolor - Background color for the image.\n * @returns {Promise<void>} A promise that resolves when the image is generated.\n */\n async generateSvgImage(\n svgPath: string | undefined,\n icon: Partial<FeatherIconNames> = DEFAULT_BRAND_ICON,\n bgcolor: Partial<BrandColors> = DEFAULT_BRAND_COLOR\n ): Promise<void> {\n if (!svgPath || svgPath.length === 0) {\n this.log.debug('No svgPath provided');\n return;\n }\n\n if (!isValidIcon(icon)) {\n this.log.error(`Valid Branding Icon Names: ${GITHUB_ACTIONS_BRANDING_ICONS}`);\n this.log.fail(`Invalid icon name: ${icon}`);\n return;\n }\n if (!isValidColor(bgcolor)) {\n this.log.error(`Valid Branding Colors: ${GITHUB_ACTIONS_BRANDING_COLORS}`);\n this.log.fail('Invalid branding color');\n return;\n }\n this.log.info(`SVG to generate ${icon} at ${svgPath} with color ${bgcolor}.`);\n // Initialize SVG\n await this.initSVG();\n // Generate SVG content\n const svgContent = this.generateSVGContent(icon, bgcolor);\n\n // Write SVG file\n this.writeSVGFile(svgPath, svgContent);\n\n this.log.debug('SVG image generated successfully');\n }\n\n /**\n * Writes the SVG xml to disk.\n * @param {string} svgPath - File path to save the SVG to.\n * @param {string} svgContent - The XML for the SVG file.\n */\n writeSVGFile(svgPath: string, svgContent: string): void {\n fs.mkdirSync(path.dirname(svgPath), { recursive: true });\n this.log.debug(`Writing SVG file to ${svgPath}`);\n fs.writeFile(svgPath, svgContent, 'utf8', () => {\n return this.log.debug(`SVG image generated: ${svgPath}`);\n });\n }\n\n /**\n * Generates the SVG content for the branding image.\n * @param {FeatherIconNames} icon - Name of the icon to use.\n * @param {BrandColors} color - Background color for the image.\n * @param {number} outerViewBox - Size of the canvas for the image.\n * @returns {string} The generated SVG content.\n */\n generateSVGContent(icon: FeatherIconNames, color: BrandColors, outerViewBox = 100): string {\n const { canvas, log } = this;\n // Validate canvas\n if (!canvas) {\n log.fail('Canvas not initialized');\n return '';\n }\n\n const svgData = feather.icons[icon];\n log.debug(`SVG data to ingest: ${svgData.toSvg()}`);\n\n canvas.clear();\n\n // Create a canvas that is `outerViewBox` x `outerViewBox`\n canvas\n .size(brandingSquareEdgeLengthInPixels, brandingSquareEdgeLengthInPixels)\n .viewbox(`0 0 ${outerViewBox} ${outerViewBox}`)\n .fill('none');\n\n // Create a 'color' circle that touches the edges of the canvas\n const circleSize = outerViewBox / 2;\n canvas\n .circle('50%')\n .fill(color)\n .radius(circleSize)\n .cx(circleSize)\n .cy(circleSize)\n .stroke({ width: 0 });\n\n // Create an svg box that is half the size of the parent\n const iconsvgOuter = canvas.nested();\n iconsvgOuter.attr('overflow', 'visible').height('50%').width('50%').x('25%').y('25%');\n\n // create a nested svg and add the feather-icon paths to the svg\n const iconsvg = iconsvgOuter.nested();\n iconsvg.id('icon').svg(svgData.contents);\n\n // Append all of the attributes from the fether-icon\n for (const attr of Object.keys(svgData.attrs)) {\n iconsvg.attr(attr, svgData.attrs[attr]);\n }\n\n // invert the stroke color if it matches the background color\n iconsvg.stroke(color.startsWith('white') ? 'white' : 'black');\n\n // remove the edge clipping\n iconsvg.attr('overflow', 'visible');\n\n // Make the viewbox of the svg match the exact dimensions of the icon\n iconsvg.viewbox(iconsvg.bbox());\n\n // Make the svg icon center itself vertically and horozonally\n iconsvg.height('auto').width('auto');\n\n // return the xml file content\n return ['<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>', canvas.svg(), '\\n'].join(\n '\\n'\n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AAE,SAAS,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAEtF,gEAAgE;QAChE,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC;QACtC,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEzC,oDAAoD;QACpD,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9C,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1C,CAAC;QAED,6DAA6D;QAC7D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAE9D,2BAA2B;QAC3B,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QAEpC,qEAAqE;QACrE,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAEhC,6DAA6D;QAC7D,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAErC,8BAA8B;QAC9B,OAAO,CAAC,wDAAwD,EAAE,MAAM,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,IAAI,CACxF,IAAI,CACL,CAAC;IACJ,CAAC;CACF","sourcesContent":["/**\n * This TypeScript code imports necessary modules and defines a class named 'SVGEditor' for generating SVG images.\n * The class has methods for initializing the SVG window, generating SVG content, and writing SVG files.\n * It utilizes various packages such as 'fs', 'path', '@svgdotjs/svg.js', 'feather-icons', and 'svgdom' for SVG manipulation and file operations.\n * The class also defines interfaces for badges and brand colors.\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport type { Container } from '@svgdotjs/svg.js';\nimport { registerWindow, SVG } from '@svgdotjs/svg.js';\nimport type { FeatherIconNames } from 'feather-icons';\nimport * as feather from 'feather-icons';\nimport { createSVGWindow, type SVGDocument, type SVGWindow } from 'svgdom'; /// main-module.js';\n\nimport type { BrandColors } from './constants.js';\nimport {\n brandingSquareEdgeLengthInPixels,\n DEFAULT_BRAND_COLOR,\n DEFAULT_BRAND_ICON,\n GITHUB_ACTIONS_BRANDING_COLORS,\n GITHUB_ACTIONS_BRANDING_ICONS,\n isValidColor,\n isValidIcon,\n} from './constants.js';\nimport LogTask from './logtask/index.js';\n\n/**\n * Utility class for generating SVG images.\n */\n\nexport default class SVGEditor {\n private log: LogTask;\n\n private window?: SVGWindow;\n\n private canvas?: Container;\n\n private document?: SVGDocument;\n\n /**\n * Initializes a new SVGEditor instance.\n */\n constructor() {\n this.log = new LogTask('SVGEditor');\n }\n\n /**\n * Initializes the SVG window, document, and canvas if not already set up.\n */\n initSVG(): void {\n if (!this.window) {\n this.window = createSVGWindow();\n const { document } = this.window;\n registerWindow(this.window, document);\n if (!this.canvas) {\n this.canvas = SVG(document.documentElement) as Container;\n }\n }\n }\n\n /**\n * Generates a branded SVG image.\n * @param {string | undefined} svgPath - Path to write the generated SVG file to.\n * @param {Partial<FeatherIconNames>} icon - Name of the icon to use.\n * @param {Partial<BrandColors>} bgcolor - Background color for the image.\n * @returns {Promise<void>} A promise that resolves when the image is generated.\n */\n generateSvgImage(\n svgPath: string | undefined,\n icon: Partial<FeatherIconNames> = DEFAULT_BRAND_ICON,\n bgcolor: Partial<BrandColors> = DEFAULT_BRAND_COLOR\n ): void {\n if (!svgPath || svgPath.length === 0) {\n this.log.debug('No svgPath provided');\n return;\n }\n\n if (!isValidIcon(icon)) {\n this.log.error(`Valid Branding Icon Names: ${GITHUB_ACTIONS_BRANDING_ICONS}`);\n this.log.fail(`Invalid icon name: ${icon}`);\n return;\n }\n if (!isValidColor(bgcolor)) {\n this.log.error(`Valid Branding Colors: ${GITHUB_ACTIONS_BRANDING_COLORS}`);\n this.log.fail('Invalid branding color');\n return;\n }\n this.log.info(`SVG to generate ${icon} at ${svgPath} with color ${bgcolor}.`);\n // Initialize SVG\n this.initSVG();\n // Generate SVG content\n const svgContent = this.generateSVGContent(icon, bgcolor);\n\n // Write SVG file\n this.writeSVGFile(svgPath, svgContent);\n\n this.log.debug('SVG image generated successfully');\n }\n\n /**\n * Writes the SVG xml to disk.\n * @param {string} svgPath - File path to save the SVG to.\n * @param {string} svgContent - The XML for the SVG file.\n */\n writeSVGFile(svgPath: string, svgContent: string): void {\n fs.mkdirSync(path.dirname(svgPath), { recursive: true });\n this.log.debug(`Writing SVG file to ${svgPath}`);\n fs.writeFile(svgPath, svgContent, 'utf8', () => {\n return this.log.debug(`SVG image generated: ${svgPath}`);\n });\n }\n\n /**\n * Generates the SVG content for the branding image.\n * @param {FeatherIconNames} icon - Name of the icon to use.\n * @param {BrandColors} color - Background color for the image.\n * @param {number} outerViewBox - Size of the canvas for the image.\n * @returns {string} The generated SVG content.\n */\n generateSVGContent(\n icon: FeatherIconNames,\n color: BrandColors,\n outerViewBox: number = 100\n ): string {\n const { canvas, log } = this;\n // Validate canvas\n if (!canvas) {\n log.fail('Canvas not initialized');\n return '';\n }\n\n const svgData = feather.icons[icon];\n log.debug(`SVG data to ingest: ${svgData.toSvg()}`);\n\n canvas.clear();\n\n // Create a canvas that is `outerViewBox` x `outerViewBox`\n canvas\n .size(brandingSquareEdgeLengthInPixels, brandingSquareEdgeLengthInPixels)\n .viewbox(`0 0 ${outerViewBox} ${outerViewBox}`)\n .fill('none');\n\n // Create a 'color' circle that touches the edges of the canvas\n const circleSize = outerViewBox / 2;\n canvas\n .circle('50%')\n .fill(color)\n .radius(circleSize)\n .cx(circleSize)\n .cy(circleSize)\n .stroke({ width: 0 });\n\n // Create an svg box that is half the size of the parent\n const iconsvgOuter = canvas.nested();\n iconsvgOuter.attr('overflow', 'visible').height('50%').width('50%').x('25%').y('25%');\n\n // create a nested svg and add the feather-icon paths to the svg\n const iconsvg = iconsvgOuter.nested();\n iconsvg.id('icon').svg(svgData.contents);\n\n // Append all of the attributes from the fether-icon\n for (const attr of Object.keys(svgData.attrs)) {\n iconsvg.attr(attr, svgData.attrs[attr]);\n }\n\n // invert the stroke color if it matches the background color\n iconsvg.stroke(color.startsWith('white') ? 'white' : 'black');\n\n // remove the edge clipping\n iconsvg.attr('overflow', 'visible');\n\n // Make the viewbox of the svg match the exact dimensions of the icon\n iconsvg.viewbox(iconsvg.bbox());\n\n // Make the svg icon center itself vertically and horozonally\n iconsvg.height('auto').width('auto');\n\n // return the xml file content\n return ['<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>', canvas.svg(), '\\n'].join(\n '\\n'\n );\n }\n}\n"]}