Skip to content

Commit 436182c

Browse files
committed
fix: generate sitemap
1 parent 54291d5 commit 436182c

File tree

3 files changed

+3
-13
lines changed

3 files changed

+3
-13
lines changed

packages/crd-scripts/src/conf/getPrerenderRoutes.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const getDirTree = (cmd) => {
1212
path,
1313
options: otherProps,
1414
}))
15-
// console.log('dirTree', dirTree)
1615
return dirTree
1716
}
1817

@@ -38,8 +37,7 @@ function recursive(data, routePath, arr) {
3837

3938
if (item.type === 'directory') {
4039
if (item.children && item.children.length > 0) {
41-
// todo: judge if use deep clone to isolate them.
42-
// item.children = recursive(item.children, composeRouteName, arr)
40+
item.children = recursive(item.children, composeRouteName, arr)
4341
} else {
4442
item.children = []
4543
}

packages/crd-scripts/src/conf/node-directory-tree.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ function directoryTree({
125125
}
126126
} else if (stats.isDirectory()) {
127127
const dirData = safeReadDirSync(path)
128-
console.log('dirData', dirData)
129128
if (dirData === null) return null
130129
item.children = dirData
131130
.map(child =>

packages/crd-scripts/src/conf/webpack.config.prod.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ module.exports = function (cmd) {
2727
config.output.chunkFilename = 'js/[name].[hash:8].js'
2828
config.output.publicPath = docsConfig.repo ? `/${docsConfig.repo}/` : '/'
2929
config.output.path = docsConfig.repo ? `${docsBuildDist}/${docsConfig.repo}` : docsBuildDist
30-
31-
console.log('dirTree12345', dirTree)
32-
3330
config.module.rules = config.module.rules.map((item) => {
3431
if (item.oneOf) {
3532
const loaders = []
@@ -170,15 +167,11 @@ module.exports = function (cmd) {
170167
// not use fs.move here or it'll throw error in github action
171168
await fs.copy(`${docsBuildDist}/${docsConfig.repo}`, docsBuildDist)
172169
await fs.remove(`${docsBuildDist}/${docsConfig.repo}`)
173-
// move README as root index.html
174-
// todo: replace README with correct path
175-
176170
const defaultPath = (dirTree.find(data => data.name === 'README.md')
177171
&& dirTree.find(data => data.name === 'README.md').mdconf
178172
&& dirTree.find(data => data.name === 'README.md').mdconf.abbrlink) || 'README'
179-
180-
181-
await fs.copy(`${docsBuildDist}/README/index.html`, `${docsBuildDist}/index.html`)
173+
// move README as root index.html
174+
await fs.copy(`${docsBuildDist}/${defaultPath}/index.html`, `${docsBuildDist}/index.html`)
182175
console.log('✅ generate prerender file success!')
183176
if (docsConfig.seo) {
184177
if (docsConfig.seo.google) {

0 commit comments

Comments
 (0)