create-typescript-app 2.26.5 → 2.26.7

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.
@@ -1,5 +1,5 @@
1
1
  var name = "create-typescript-app";
2
- var version = "2.26.4";
2
+ var version = "2.26.6";
3
3
  var description = "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 🎁";
4
4
  var repository = {
5
5
  type: "git",
@@ -1,4 +1,4 @@
1
- import { indicatorTemplatedBy } from "./readReadmeFootnotes.js";
1
+ import { indicatorsTemplatedBy } from "./readReadmeFootnotes.js";
2
2
  const indicatorAfterAllContributors = /<!--\s*ALL-CONTRIBUTORS-LIST:END\s*-->/;
3
3
  const indicatorAfterAllContributorsSpellCheck = /<!--\s*spellchecker:\s*enable\s*-->/;
4
4
  async function readReadmeAdditional(getReadme) {
@@ -10,10 +10,16 @@ async function readReadmeAdditional(getReadme) {
10
10
  if (!indexAfterContributors) {
11
11
  return void 0;
12
12
  }
13
- const templatedByMatch = indicatorTemplatedBy.exec(readme);
13
+ const indexOfFirstTemplatedBy = indicatorsTemplatedBy.reduce(
14
+ (smallest, indicator) => {
15
+ const indexOf = indicator.exec(readme)?.index;
16
+ return indexOf ? Math.min(smallest, indexOf) : smallest;
17
+ },
18
+ readme.length
19
+ );
14
20
  return readme.slice(
15
21
  indexAfterContributors.index + indexAfterContributors[0].length,
16
- templatedByMatch?.index
22
+ indexOfFirstTemplatedBy
17
23
  ).trim();
18
24
  }
19
25
  export {
@@ -1,19 +1,18 @@
1
+ const lastTagMatchers = [`">`, "/p>", "/>"];
1
2
  async function readReadmeExplainer(getReadme) {
2
3
  const readme = await getReadme();
3
- const indexOfUsageH2 = /## Usage/.exec(readme)?.index ?? readme.indexOf("##");
4
- if (indexOfUsageH2 === -1) {
5
- return void 0;
6
- }
7
- const beforeUsageH2 = readme.slice(0, indexOfUsageH2);
8
- const [indexOfLastTag, lastTagMatcher] = lastLastIndexOf(beforeUsageH2, [
9
- `">`,
10
- "/p>",
11
- "/>"
12
- ]);
4
+ const indexOfFirstH2 = readme.indexOf("##");
5
+ const indexOfUsageH2 = /## Usage/.exec(readme)?.index;
6
+ const beforeH2s = readme.slice(0, indexOfUsageH2 ?? indexOfFirstH2);
7
+ const [indexOfLastTag, lastTagMatcher] = lastLastIndexOf(
8
+ beforeH2s,
9
+ lastTagMatchers
10
+ );
13
11
  if (!lastTagMatcher) {
14
12
  return void 0;
15
13
  }
16
- return readme.slice(indexOfLastTag + lastTagMatcher.length, indexOfUsageH2).trim();
14
+ const endingIndex = indexOfUsageH2 ?? /## (?:Contrib|Develop)/.exec(readme)?.index;
15
+ return readme.slice(indexOfLastTag + lastTagMatcher.length, endingIndex).trim();
17
16
  }
18
17
  function lastLastIndexOf(text, matchers) {
19
18
  let pair = [-1, void 0];
@@ -1,4 +1,4 @@
1
- declare const indicatorTemplatedBy: RegExp;
1
+ declare const indicatorsTemplatedBy: RegExp[];
2
2
  declare function readReadmeFootnotes(getReadme: () => Promise<string>): Promise<string | undefined>;
3
3
 
4
- export { indicatorTemplatedBy, readReadmeFootnotes };
4
+ export { indicatorsTemplatedBy, readReadmeFootnotes };
@@ -1,17 +1,26 @@
1
- const indicatorTemplatedBy = /> .* This package (?:is|was) (?:based|build|templated) (?:on|with) |<!-- You can remove this notice/;
1
+ const indicatorsTemplatedBy = [
2
+ /> .* This package (?:is|was) (?:based|build|templated) (?:on|with)/,
3
+ /<!-- You can remove this notice/
4
+ ];
2
5
  async function readReadmeFootnotes(getReadme) {
3
6
  const readme = await getReadme();
4
7
  if (!readme) {
5
8
  return void 0;
6
9
  }
7
- const indexOfTemplatedBy = indicatorTemplatedBy.exec(readme)?.index;
8
- if (!indexOfTemplatedBy) {
10
+ const indexOfLastTemplatedBy = indicatorsTemplatedBy.reduce(
11
+ (largest, indicator) => {
12
+ const indexOf = indicator.exec(readme)?.index;
13
+ return indexOf ? Math.max(largest, indexOf) : largest;
14
+ },
15
+ 0
16
+ );
17
+ if (!indexOfLastTemplatedBy) {
9
18
  return void 0;
10
19
  }
11
- const indexOfNextLine = readme.indexOf("\n", indexOfTemplatedBy);
20
+ const indexOfNextLine = readme.indexOf("\n", indexOfLastTemplatedBy);
12
21
  return readme.slice(indexOfNextLine).trim() || void 0;
13
22
  }
14
23
  export {
15
- indicatorTemplatedBy,
24
+ indicatorsTemplatedBy,
16
25
  readReadmeFootnotes
17
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-typescript-app",
3
- "version": "2.26.5",
3
+ "version": "2.26.7",
4
4
  "description": "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 🎁",
5
5
  "repository": {
6
6
  "type": "git",