create-typescript-app 2.26.6 → 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,19 +1,18 @@
|
|
|
1
|
+
const lastTagMatchers = [`">`, "/p>", "/>"];
|
|
1
2
|
async function readReadmeExplainer(getReadme) {
|
|
2
3
|
const readme = await getReadme();
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
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];
|