create-typescript-app 1.29.29 → 1.29.31

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.
@@ -4,7 +4,7 @@ async function updateLocalFiles(options) {
4
4
  const existingPackage = await readFileSafeAsJson("./package.json") ?? {};
5
5
  const replacements = [
6
6
  [/Create TypeScript App/g, options.title],
7
- [/JoshuaKGoldberg/g, options.owner],
7
+ [/JoshuaKGoldberg(?!\/console-fail-test)/g, options.owner],
8
8
  [/create-typescript-app/g, options.repository],
9
9
  [/\/\*\n.+\*\/\n\n/gs, ``, ".eslintrc.cjs"],
10
10
  [/"author": ".+"/g, `"author": "${options.author}"`, "./package.json"],
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/steps/updateLocalFiles.ts"],"sourcesContent":["import replaceInFile from \"replace-in-file\";\n\nimport { readFileSafeAsJson } from \"../shared/readFileSafeAsJson.js\";\nimport { Options } from \"../shared/types.js\";\n\ninterface ExistingPackageData {\n\tdescription?: string;\n\tversion?: string;\n}\n\nexport async function updateLocalFiles(options: Options) {\n\tconst existingPackage = ((await readFileSafeAsJson(\"./package.json\")) ??\n\t\t{}) as ExistingPackageData;\n\n\tconst replacements = [\n\t\t[/Create TypeScript App/g, options.title],\n\t\t[/JoshuaKGoldberg/g, options.owner],\n\t\t[/create-typescript-app/g, options.repository],\n\t\t[/\\/\\*\\n.+\\*\\/\\n\\n/gs, ``, \".eslintrc.cjs\"],\n\t\t[/\"author\": \".+\"/g, `\"author\": \"${options.author}\"`, \"./package.json\"],\n\t\t[/\"bin\": \".+\\n/g, ``, \"./package.json\"],\n\t\t[/\"create:test\": \".+\\n/g, ``, \"./package.json\"],\n\t\t[/\"initialize:test\": \".*/g, ``, \"./package.json\"],\n\t\t[/\"initialize\": \".*/g, ``, \"./package.json\"],\n\t\t[/\"migrate:test\": \".+\\n/g, ``, \"./package.json\"],\n\t\t[/## Getting Started.*## Development/gs, `## Development`, \"./README.md\"],\n\t\t[/\\n## Setup Scripts.*$/gs, \"\", \"./.github/DEVELOPMENT.md\"],\n\t\t[`\\t\\t\"src/initialize/index.ts\",\\n`, ``, \"./knip.jsonc\"],\n\t\t[`\\t\\t\"src/migrate/index.ts\",\\n`, ``, \"./knip.jsonc\"],\n\t\t[\n\t\t\t`[\"src/index.ts!\", \"script/initialize*.js\"]`,\n\t\t\t`\"src/index.ts!\"`,\n\t\t\t\"./knip.jsonc\",\n\t\t],\n\t\t[`[\"src/**/*.ts!\", \"script/**/*.js\"]`, `\"src/**/*.ts!\"`, \"./knip.jsonc\"],\n\t];\n\n\tif (existingPackage.description) {\n\t\treplacements.push([\n\t\t\tnew RegExp(existingPackage.description, \"g\"),\n\t\t\toptions.description,\n\t\t]);\n\t}\n\n\tif (existingPackage.version) {\n\t\treplacements.push([\n\t\t\tnew RegExp(`\"version\": \"${existingPackage.version}\"`, \"g\"),\n\t\t\t`\"version\": \"0.0.0\"`,\n\t\t\t\"./package.json\",\n\t\t]);\n\t}\n\n\tfor (const [from, to, files = [\"./.github/**/*\", \"./*.*\"]] of replacements) {\n\t\ttry {\n\t\t\t// @ts-expect-error -- https://github.com/microsoft/TypeScript/issues/54342\n\t\t\tawait replaceInFile({ files, from, to });\n\t\t} catch (error) {\n\t\t\tthrow new Error(\n\t\t\t\t`Failed to replace ${from.toString()} with ${to} in ${files.toString()}`,\n\t\t\t\t{\n\t\t\t\t\tcause: error,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t}\n}\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,0BAA0B;AAQnC,eAAsB,iBAAiB,SAAkB;AACxD,QAAM,kBAAoB,MAAM,mBAAmB,gBAAgB,KAClE,CAAC;AAEF,QAAM,eAAe;AAAA,IACpB,CAAC,0BAA0B,QAAQ,KAAK;AAAA,IACxC,CAAC,oBAAoB,QAAQ,KAAK;AAAA,IAClC,CAAC,0BAA0B,QAAQ,UAAU;AAAA,IAC7C,CAAC,sBAAsB,IAAI,eAAe;AAAA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from \"replace-in-file\";\n\nimport { readFileSafeAsJson } from \"../shared/readFileSafeAsJson.js\";\nimport { Options } from \"../shared/types.js\";\n\ninterface ExistingPackageData {\n\tdescription?: string;\n\tversion?: string;\n}\n\nexport async function updateLocalFiles(options: Options) {\n\tconst existingPackage = ((await readFileSafeAsJson(\"./package.json\")) ??\n\t\t{}) as ExistingPackageData;\n\n\tconst replacements = [\n\t\t[/Create TypeScript App/g, options.title],\n\t\t[/JoshuaKGoldberg(?!\\/console-fail-test)/g, options.owner],\n\t\t[/create-typescript-app/g, options.repository],\n\t\t[/\\/\\*\\n.+\\*\\/\\n\\n/gs, ``, \".eslintrc.cjs\"],\n\t\t[/\"author\": \".+\"/g, `\"author\": \"${options.author}\"`, \"./package.json\"],\n\t\t[/\"bin\": \".+\\n/g, ``, \"./package.json\"],\n\t\t[/\"create:test\": \".+\\n/g, ``, \"./package.json\"],\n\t\t[/\"initialize:test\": \".*/g, ``, \"./package.json\"],\n\t\t[/\"initialize\": \".*/g, ``, \"./package.json\"],\n\t\t[/\"migrate:test\": \".+\\n/g, ``, \"./package.json\"],\n\t\t[/## Getting Started.*## Development/gs, `## Development`, \"./README.md\"],\n\t\t[/\\n## Setup Scripts.*$/gs, \"\", \"./.github/DEVELOPMENT.md\"],\n\t\t[`\\t\\t\"src/initialize/index.ts\",\\n`, ``, \"./knip.jsonc\"],\n\t\t[`\\t\\t\"src/migrate/index.ts\",\\n`, ``, \"./knip.jsonc\"],\n\t\t[\n\t\t\t`[\"src/index.ts!\", \"script/initialize*.js\"]`,\n\t\t\t`\"src/index.ts!\"`,\n\t\t\t\"./knip.jsonc\",\n\t\t],\n\t\t[`[\"src/**/*.ts!\", \"script/**/*.js\"]`, `\"src/**/*.ts!\"`, \"./knip.jsonc\"],\n\t];\n\n\tif (existingPackage.description) {\n\t\treplacements.push([\n\t\t\tnew RegExp(existingPackage.description, \"g\"),\n\t\t\toptions.description,\n\t\t]);\n\t}\n\n\tif (existingPackage.version) {\n\t\treplacements.push([\n\t\t\tnew RegExp(`\"version\": \"${existingPackage.version}\"`, \"g\"),\n\t\t\t`\"version\": \"0.0.0\"`,\n\t\t\t\"./package.json\",\n\t\t]);\n\t}\n\n\tfor (const [from, to, files = [\"./.github/**/*\", \"./*.*\"]] of replacements) {\n\t\ttry {\n\t\t\t// @ts-expect-error -- https://github.com/microsoft/TypeScript/issues/54342\n\t\t\tawait replaceInFile({ files, from, to });\n\t\t} catch (error) {\n\t\t\tthrow new Error(\n\t\t\t\t`Failed to replace ${from.toString()} with ${to} in ${files.toString()}`,\n\t\t\t\t{\n\t\t\t\t\tcause: error,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t}\n}\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,0BAA0B;AAQnC,eAAsB,iBAAiB,SAAkB;AACxD,QAAM,kBAAoB,MAAM,mBAAmB,gBAAgB,KAClE,CAAC;AAEF,QAAM,eAAe;AAAA,IACpB,CAAC,0BAA0B,QAAQ,KAAK;AAAA,IACxC,CAAC,2CAA2C,QAAQ,KAAK;AAAA,IACzD,CAAC,0BAA0B,QAAQ,UAAU;AAAA,IAC7C,CAAC,sBAAsB,IAAI,eAAe;AAAA,IAC1C,CAAC,mBAAmB,cAAc,QAAQ,MAAM,KAAK,gBAAgB;AAAA,IACrE,CAAC,iBAAiB,IAAI,gBAAgB;AAAA,IACtC,CAAC,yBAAyB,IAAI,gBAAgB;AAAA,IAC9C,CAAC,2BAA2B,IAAI,gBAAgB;AAAA,IAChD,CAAC,sBAAsB,IAAI,gBAAgB;AAAA,IAC3C,CAAC,0BAA0B,IAAI,gBAAgB;AAAA,IAC/C,CAAC,wCAAwC,kBAAkB,aAAa;AAAA,IACxE,CAAC,2BAA2B,IAAI,0BAA0B;AAAA,IAC1D,CAAC;AAAA,GAAoC,IAAI,cAAc;AAAA,IACvD,CAAC;AAAA,GAAiC,IAAI,cAAc;AAAA,IACpD;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA,CAAC,sCAAsC,kBAAkB,cAAc;AAAA,EACxE;AAEA,MAAI,gBAAgB,aAAa;AAChC,iBAAa,KAAK;AAAA,MACjB,IAAI,OAAO,gBAAgB,aAAa,GAAG;AAAA,MAC3C,QAAQ;AAAA,IACT,CAAC;AAAA,EACF;AAEA,MAAI,gBAAgB,SAAS;AAC5B,iBAAa,KAAK;AAAA,MACjB,IAAI,OAAO,eAAe,gBAAgB,OAAO,KAAK,GAAG;AAAA,MACzD;AAAA,MACA;AAAA,IACD,CAAC;AAAA,EACF;AAEA,aAAW,CAAC,MAAM,IAAI,QAAQ,CAAC,kBAAkB,OAAO,CAAC,KAAK,cAAc;AAC3E,QAAI;AAEH,YAAM,cAAc,EAAE,OAAO,MAAM,GAAG,CAAC;AAAA,IACxC,SAAS,OAAO;AACf,YAAM,IAAI;AAAA,QACT,qBAAqB,KAAK,SAAS,CAAC,SAAS,EAAE,OAAO,MAAM,SAAS,CAAC;AAAA,QACtE;AAAA,UACC,OAAO;AAAA,QACR;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;","names":[]}
@@ -50,35 +50,34 @@ function findH1Close(contents) {
50
50
  }
51
51
  function generateTopContent(options) {
52
52
  const badgeLines = [
53
- !options.excludeContributors && `<a href="#contributors" target="_blank">
53
+ !options.excludeContributors && ` <a href="#contributors" target="_blank">
54
54
  <!-- prettier-ignore-start -->
55
55
  <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
56
56
  <img alt="All Contributors: 2" src="https://img.shields.io/badge/all_contributors-17-21bb42.svg" />
57
57
  <!-- ALL-CONTRIBUTORS-BADGE:END -->
58
58
  <!-- prettier-ignore-end -->
59
- </a>`,
60
- !options.excludeTests && `<a href="https://codecov.io/gh/${options.owner}/${options.repository}" target="_blank">
61
- <img alt="Codecov Test Coverage" src="https://codecov.io/gh/${options.owner}/${options.repository}/branch/main/graph/badge.svg"/>
62
- </a>`,
63
- `<a href="https://github.com/${options.owner}/${options.repository}/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank">
64
- <img alt="Contributor Covenant" src="https://img.shields.io/badge/code_of_conduct-enforced-21bb42" />
65
- </a>`,
66
- `<a href="https://github.com/${options.owner}/${options.repository}/blob/main/LICENSE.md" target="_blank">
67
- <img alt="License: MIT" src="https://img.shields.io/github/license/${options.owner}/${options.repository}?color=21bb42">
68
- </a>`,
69
- options.funding && `
70
- <a href="https://github.com/sponsors/${options.funding}" target="_blank">
71
- <img alt="Sponsor: On GitHub" src="https://img.shields.io/badge/sponsor-on_github-21bb42.svg" />
72
- </a>`,
73
- `<img alt="Style: Prettier" src="https://img.shields.io/badge/style-prettier-21bb42.svg" />`,
74
- `<img alt="TypeScript: Strict" src="https://img.shields.io/badge/typescript-strict-21bb42.svg" />`
59
+ </a>`,
60
+ !options.excludeTests && ` <a href="https://codecov.io/gh/${options.owner}/${options.repository}" target="_blank">
61
+ <img alt="Codecov Test Coverage" src="https://codecov.io/gh/${options.owner}/${options.repository}/branch/main/graph/badge.svg"/>
62
+ </a>`,
63
+ ` <a href="https://github.com/${options.owner}/${options.repository}/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank">
64
+ <img alt="Contributor Covenant" src="https://img.shields.io/badge/code_of_conduct-enforced-21bb42" />
65
+ </a>`,
66
+ ` <a href="https://github.com/${options.owner}/${options.repository}/blob/main/LICENSE.md" target="_blank">
67
+ <img alt="License: MIT" src="https://img.shields.io/github/license/${options.owner}/${options.repository}?color=21bb42">
68
+ </a>`,
69
+ options.funding && ` <a href="https://github.com/sponsors/${options.funding}" target="_blank">
70
+ <img alt="Sponsor: On GitHub" src="https://img.shields.io/badge/sponsor-on_github-21bb42.svg" />
71
+ </a>`,
72
+ ` <img alt="Style: Prettier" src="https://img.shields.io/badge/style-prettier-21bb42.svg" />`,
73
+ ` <img alt="TypeScript: Strict" src="https://img.shields.io/badge/typescript-strict-21bb42.svg" />`
75
74
  ].filter(Boolean);
76
75
  return `<h1 align="center">${options.title}</h1>
77
76
 
78
77
  <p align="center">${options.description}</p>
79
78
 
80
79
  <p align="center">
81
- ${badgeLines.join("\n")}
80
+ ${badgeLines.join("\n")}
82
81
  </p>`;
83
82
  }
84
83
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/steps/writeReadme.ts"],"sourcesContent":["import fs from \"node:fs/promises\";\n\nimport { readFileSafe } from \"../shared/readFileSafe.js\";\nimport { Options } from \"../shared/types.js\";\nimport { endOfReadmeNotice } from \"./updateReadme.js\";\n\nconst contributorsIndicator = `<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->`;\n\nfunction generateAllContributorsContent(options: Options) {\n\treturn [\n\t\t`## Contributors`,\n\t\t``,\n\t\t`<!-- spellchecker: disable -->`,\n\t\tcontributorsIndicator,\n\t\t`<!-- prettier-ignore-start -->`,\n\t\t!options.excludeLintMd && `<!-- markdownlint-disable -->`,\n\t\t`<table>`,\n\t\t`<!-- (this will be filled in by all-contributors) -->`,\n\t\t`</table>`,\n\t\t``,\n\t\t!options.excludeLintMd && `<!-- markdownlint-restore -->`,\n\t\t`<!-- prettier-ignore-end -->`,\n\t\t``,\n\t\t`<!-- ALL-CONTRIBUTORS-LIST:END -->`,\n\t\t`<!-- spellchecker: enable -->`,\n\t]\n\t\t.filter(Boolean)\n\t\t.join(\"\\n\");\n}\n\nexport async function writeReadme(options: Options) {\n\tconst allContributorsContent =\n\t\t!options.excludeContributors && generateAllContributorsContent(options);\n\tlet contents = await readFileSafe(\"README.md\", \"\");\n\tif (!contents) {\n\t\tawait fs.writeFile(\n\t\t\t\"README.md\",\n\t\t\t[generateTopContent(options), allContributorsContent, endOfReadmeNotice]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(\"\\n\\n\"),\n\t\t);\n\t\treturn;\n\t}\n\n\tconst endOfH1 = findH1Close(contents);\n\n\tcontents = [generateTopContent(options), contents.slice(endOfH1)]\n\t\t.join(\"\")\n\t\t.replace(/\\[!\\[.+\\]\\(.+\\)\\]\\(.+\\)/g, \"\")\n\t\t.replace(/!\\[.+\\]\\(.+\\)/g, \"\")\n\t\t.replaceAll(\"\\r\", \"\")\n\t\t.replaceAll(\"\\n\\n\\n\", \"\\n\\n\");\n\n\tif (allContributorsContent && !contents.includes(contributorsIndicator)) {\n\t\tcontents = [contents, allContributorsContent].join(\"\\n\\n\");\n\t}\n\n\tif (!contents.includes(endOfReadmeNotice)) {\n\t\tcontents = [contents, endOfReadmeNotice].join(\"\\n\\n\");\n\t}\n\n\tawait fs.writeFile(\"README.md\", contents);\n}\n\nfunction findH1Close(contents: string) {\n\tconst markdownMatch = contents.match(/^#.+/);\n\tif (markdownMatch) {\n\t\treturn (markdownMatch.index ?? 0) + markdownMatch[0].length;\n\t}\n\n\treturn contents.indexOf(\"</h1>\") + \"</h1>\".length;\n}\n\nfunction generateTopContent(options: Options) {\n\tconst badgeLines = [\n\t\t!options.excludeContributors &&\n\t\t\t`<a href=\"#contributors\" target=\"_blank\">\n<!-- prettier-ignore-start -->\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n<img alt=\"All Contributors: 2\" src=\"https://img.shields.io/badge/all_contributors-17-21bb42.svg\" />\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n<!-- prettier-ignore-end -->\n</a>`,\n\t\t!options.excludeTests &&\n\t\t\t`<a href=\"https://codecov.io/gh/${options.owner}/${options.repository}\" target=\"_blank\">\n\t<img alt=\"Codecov Test Coverage\" src=\"https://codecov.io/gh/${options.owner}/${options.repository}/branch/main/graph/badge.svg\"/>\n</a>`,\n\t\t`<a href=\"https://github.com/${options.owner}/${options.repository}/blob/main/.github/CODE_OF_CONDUCT.md\" target=\"_blank\">\n\t<img alt=\"Contributor Covenant\" src=\"https://img.shields.io/badge/code_of_conduct-enforced-21bb42\" />\n</a>`,\n\t\t`<a href=\"https://github.com/${options.owner}/${options.repository}/blob/main/LICENSE.md\" target=\"_blank\">\n\t<img alt=\"License: MIT\" src=\"https://img.shields.io/github/license/${options.owner}/${options.repository}?color=21bb42\">\n</a>`,\n\t\toptions.funding &&\n\t\t\t`\n\t\t<a href=\"https://github.com/sponsors/${options.funding}\" target=\"_blank\">\n\t\t\t<img alt=\"Sponsor: On GitHub\" src=\"https://img.shields.io/badge/sponsor-on_github-21bb42.svg\" />\n\t\t</a>`,\n\t\t`<img alt=\"Style: Prettier\" src=\"https://img.shields.io/badge/style-prettier-21bb42.svg\" />`,\n\t\t`<img alt=\"TypeScript: Strict\" src=\"https://img.shields.io/badge/typescript-strict-21bb42.svg\" />`,\n\t].filter(Boolean);\n\n\treturn `<h1 align=\"center\">${options.title}</h1>\n\n<p align=\"center\">${options.description}</p>\n\n<p align=\"center\">\n\t${badgeLines.join(\"\\n\")}\n</p>`;\n}\n"],"mappings":"AAAA,OAAO,QAAQ;AAEf,SAAS,oBAAoB;AAE7B,SAAS,yBAAyB;AAElC,MAAM,wBAAwB;AAE9B,SAAS,+BAA+B,SAAkB;AACzD,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,iBAAiB;AAAA,IAC1B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,iBAAiB;AAAA,IAC1B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,EACE,OAAO,OAAO,EACd,KAAK,IAAI;AACZ;AAEA,eAAsB,YAAY,SAAkB;AACnD,QAAM,yBACL,CAAC,QAAQ,uBAAuB,+BAA+B,OAAO;AACvE,MAAI,WAAW,MAAM,aAAa,aAAa,EAAE;AACjD,MAAI,CAAC,UAAU;AACd,UAAM,GAAG;AAAA,MACR;AAAA,MACA,CAAC,mBAAmB,OAAO,GAAG,wBAAwB,iBAAiB,EACrE,OAAO,OAAO,EACd,KAAK,MAAM;AAAA,IACd;AACA;AAAA,EACD;AAEA,QAAM,UAAU,YAAY,QAAQ;AAEpC,aAAW,CAAC,mBAAmB,OAAO,GAAG,SAAS,MAAM,OAAO,CA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C;AAAA;AAExB;","names":[]}
1
+ {"version":3,"sources":["../../src/steps/writeReadme.ts"],"sourcesContent":["import fs from \"node:fs/promises\";\n\nimport { readFileSafe } from \"../shared/readFileSafe.js\";\nimport { Options } from \"../shared/types.js\";\nimport { endOfReadmeNotice } from \"./updateReadme.js\";\n\nconst contributorsIndicator = `<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->`;\n\nfunction generateAllContributorsContent(options: Options) {\n\treturn [\n\t\t`## Contributors`,\n\t\t``,\n\t\t`<!-- spellchecker: disable -->`,\n\t\tcontributorsIndicator,\n\t\t`<!-- prettier-ignore-start -->`,\n\t\t!options.excludeLintMd && `<!-- markdownlint-disable -->`,\n\t\t`<table>`,\n\t\t`<!-- (this will be filled in by all-contributors) -->`,\n\t\t`</table>`,\n\t\t``,\n\t\t!options.excludeLintMd && `<!-- markdownlint-restore -->`,\n\t\t`<!-- prettier-ignore-end -->`,\n\t\t``,\n\t\t`<!-- ALL-CONTRIBUTORS-LIST:END -->`,\n\t\t`<!-- spellchecker: enable -->`,\n\t]\n\t\t.filter(Boolean)\n\t\t.join(\"\\n\");\n}\n\nexport async function writeReadme(options: Options) {\n\tconst allContributorsContent =\n\t\t!options.excludeContributors && generateAllContributorsContent(options);\n\tlet contents = await readFileSafe(\"README.md\", \"\");\n\tif (!contents) {\n\t\tawait fs.writeFile(\n\t\t\t\"README.md\",\n\t\t\t[generateTopContent(options), allContributorsContent, endOfReadmeNotice]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(\"\\n\\n\"),\n\t\t);\n\t\treturn;\n\t}\n\n\tconst endOfH1 = findH1Close(contents);\n\n\tcontents = [generateTopContent(options), contents.slice(endOfH1)]\n\t\t.join(\"\")\n\t\t.replace(/\\[!\\[.+\\]\\(.+\\)\\]\\(.+\\)/g, \"\")\n\t\t.replace(/!\\[.+\\]\\(.+\\)/g, \"\")\n\t\t.replaceAll(\"\\r\", \"\")\n\t\t.replaceAll(\"\\n\\n\\n\", \"\\n\\n\");\n\n\tif (allContributorsContent && !contents.includes(contributorsIndicator)) {\n\t\tcontents = [contents, allContributorsContent].join(\"\\n\\n\");\n\t}\n\n\tif (!contents.includes(endOfReadmeNotice)) {\n\t\tcontents = [contents, endOfReadmeNotice].join(\"\\n\\n\");\n\t}\n\n\tawait fs.writeFile(\"README.md\", contents);\n}\n\nfunction findH1Close(contents: string) {\n\tconst markdownMatch = contents.match(/^#.+/);\n\tif (markdownMatch) {\n\t\treturn (markdownMatch.index ?? 0) + markdownMatch[0].length;\n\t}\n\n\treturn contents.indexOf(\"</h1>\") + \"</h1>\".length;\n}\n\nfunction generateTopContent(options: Options) {\n\tconst badgeLines = [\n\t\t!options.excludeContributors &&\n\t\t\t`\t<a href=\"#contributors\" target=\"_blank\">\n<!-- prettier-ignore-start -->\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n<img alt=\"All Contributors: 2\" src=\"https://img.shields.io/badge/all_contributors-17-21bb42.svg\" />\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n<!-- prettier-ignore-end -->\n\t</a>`,\n\t\t!options.excludeTests &&\n\t\t\t`\t<a href=\"https://codecov.io/gh/${options.owner}/${options.repository}\" target=\"_blank\">\n\t\t<img alt=\"Codecov Test Coverage\" src=\"https://codecov.io/gh/${options.owner}/${options.repository}/branch/main/graph/badge.svg\"/>\n\t</a>`,\n\t\t`\t<a href=\"https://github.com/${options.owner}/${options.repository}/blob/main/.github/CODE_OF_CONDUCT.md\" target=\"_blank\">\n\t\t<img alt=\"Contributor Covenant\" src=\"https://img.shields.io/badge/code_of_conduct-enforced-21bb42\" />\n\t</a>`,\n\t\t`\t<a href=\"https://github.com/${options.owner}/${options.repository}/blob/main/LICENSE.md\" target=\"_blank\">\n\t\t<img alt=\"License: MIT\" src=\"https://img.shields.io/github/license/${options.owner}/${options.repository}?color=21bb42\">\n\t</a>`,\n\t\toptions.funding &&\n\t\t\t`\t<a href=\"https://github.com/sponsors/${options.funding}\" target=\"_blank\">\n\t\t<img alt=\"Sponsor: On GitHub\" src=\"https://img.shields.io/badge/sponsor-on_github-21bb42.svg\" />\n\t</a>`,\n\t\t`\t<img alt=\"Style: Prettier\" src=\"https://img.shields.io/badge/style-prettier-21bb42.svg\" />`,\n\t\t`\t<img alt=\"TypeScript: Strict\" src=\"https://img.shields.io/badge/typescript-strict-21bb42.svg\" />`,\n\t].filter(Boolean);\n\n\treturn `<h1 align=\"center\">${options.title}</h1>\n\n<p align=\"center\">${options.description}</p>\n\n<p align=\"center\">\n${badgeLines.join(\"\\n\")}\n</p>`;\n}\n"],"mappings":"AAAA,OAAO,QAAQ;AAEf,SAAS,oBAAoB;AAE7B,SAAS,yBAAyB;AAElC,MAAM,wBAAwB;AAE9B,SAAS,+BAA+B,SAAkB;AACzD,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,iBAAiB;AAAA,IAC1B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,iBAAiB;AAAA,IAC1B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,EACE,OAAO,OAAO,EACd,KAAK,IAAI;AACZ;AAEA,eAAsB,YAAY,SAAkB;AACnD,QAAM,yBACL,CAAC,QAAQ,uBAAuB,+BAA+B,OAAO;AACvE,MAAI,WAAW,MAAM,aAAa,aAAa,EAAE;AACjD,MAAI,CAAC,UAAU;AACd,UAAM,GAAG;AAAA,MACR;AAAA,MACA,CAAC,mBAAmB,OAAO,GAAG,wBAAwB,iBAAiB,EACrE,OAAO,OAAO,EACd,KAAK,MAAM;AAAA,IACd;AACA;AAAA,EACD;AAEA,QAAM,UAAU,YAAY,QAAQ;AAEpC,aAAW,CAAC,mBAAmB,OAAO,GAAG,SAAS,MAAM,OAAO,CAAC,EAC9D,KAAK,EAAE,EACP,QAAQ,4BAA4B,EAAE,EACtC,QAAQ,kBAAkB,EAAE,EAC5B,WAAW,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.29.29",
3
+ "version": "1.29.31",
4
4
  "description": "Quickstart-friendly TypeScript template with comprehensive formatting, linting, releases, testing, and other great tooling built-in. ✨",
5
5
  "repository": {
6
6
  "type": "git",
@@ -87,7 +87,7 @@
87
87
  "globby": "^13.2.2",
88
88
  "husky": "^8.0.3",
89
89
  "jsonc-eslint-parser": "^2.3.0",
90
- "knip": "2.21.0",
90
+ "knip": "2.21.1",
91
91
  "lint-staged": "^14.0.1",
92
92
  "markdownlint": "^0.30.0",
93
93
  "markdownlint-cli": "^0.35.0",
@@ -104,7 +104,7 @@
104
104
  "vitest": "^0.34.3",
105
105
  "yaml-eslint-parser": "^1.2.2"
106
106
  },
107
- "packageManager": "pnpm@8.7.0",
107
+ "packageManager": "pnpm@8.7.1",
108
108
  "engines": {
109
109
  "node": ">=18"
110
110
  },