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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
|
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
|
-
|
|
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
|
|
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];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const indicatorsTemplatedBy: RegExp[];
|
|
2
2
|
declare function readReadmeFootnotes(getReadme: () => Promise<string>): Promise<string | undefined>;
|
|
3
3
|
|
|
4
|
-
export {
|
|
4
|
+
export { indicatorsTemplatedBy, readReadmeFootnotes };
|
|
@@ -1,17 +1,26 @@
|
|
|
1
|
-
const
|
|
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
|
|
8
|
-
|
|
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",
|
|
20
|
+
const indexOfNextLine = readme.indexOf("\n", indexOfLastTemplatedBy);
|
|
12
21
|
return readme.slice(indexOfNextLine).trim() || void 0;
|
|
13
22
|
}
|
|
14
23
|
export {
|
|
15
|
-
|
|
24
|
+
indicatorsTemplatedBy,
|
|
16
25
|
readReadmeFootnotes
|
|
17
26
|
};
|