@distributionos/cli 0.1.6 → 0.1.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.
- package/package.json +1 -1
- package/src/initialization.js +25 -10
package/package.json
CHANGED
package/src/initialization.js
CHANGED
|
@@ -129,16 +129,31 @@ async function readProjectDocs(cwd) {
|
|
|
129
129
|
return {};
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
function extractOverviewExcerpt(text) {
|
|
133
|
-
const normalized = text.replace(/\r\n/g, '\n');
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
132
|
+
function extractOverviewExcerpt(text) {
|
|
133
|
+
const normalized = text.replace(/\r\n/g, '\n');
|
|
134
|
+
if (isScaffoldReadme(normalized)) {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
const overviewIndex = normalized.search(/(^|\n)#{1,3}\s+(Project Overview|Overview|Solution|What it does)\s*\n/i);
|
|
138
|
+
const source = overviewIndex >= 0 ? normalized.slice(overviewIndex) : normalized;
|
|
139
|
+
return source
|
|
140
|
+
.split(/\n{2,}/)
|
|
141
|
+
.map(block => block.replace(/^#{1,6}\s+[^\n]+\n?/, '').trim())
|
|
142
|
+
.find(block => block.length >= 80 && !/secret|api key|environment variables/i.test(block) && !isScaffoldReadme(block))
|
|
143
|
+
?.slice(0, 700) ?? null;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function isScaffoldReadme(value) {
|
|
147
|
+
const text = value.toLowerCase();
|
|
148
|
+
return [
|
|
149
|
+
'this is a [next.js]',
|
|
150
|
+
'bootstrapped with [`create-next-app`]',
|
|
151
|
+
'next.js documentation',
|
|
152
|
+
'learn next.js',
|
|
153
|
+
'deploy on vercel',
|
|
154
|
+
'you can start editing the page by modifying',
|
|
155
|
+
].filter(needle => text.includes(needle)).length >= 2;
|
|
156
|
+
}
|
|
142
157
|
|
|
143
158
|
function routeReference(route, files) {
|
|
144
159
|
if (route === '/blog' && files.includes('src/app/blog/page.tsx')) return 'src/app/blog/page.tsx';
|