-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): add clear script, adjust docs structure (#5681)
* feat(site): add script that clear generated docs * chore: adjust docs structure * style(docs): config style of summary tag
- Loading branch information
Showing
6 changed files
with
79 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,8 @@ | |
height: 100%; | ||
overflow-y: auto; | ||
} | ||
|
||
summary { | ||
color: #873bf4; | ||
cursor: pointer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ | |
/support | ||
|
||
## api doc | ||
docs/apis/.gitignore | ||
docs/api/.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
/** | ||
* | ||
*/ | ||
function clear() { | ||
const baseDir = path.resolve(__dirname, '../docs/api'); | ||
|
||
// read gitignore | ||
const gitignore = fs.readFileSync(path.resolve(baseDir, '.gitignore'), 'utf-8'); | ||
|
||
// clear all files list in .gitignore | ||
const lines = gitignore.split('\n'); | ||
|
||
lines.forEach((line) => { | ||
if (line.startsWith('#')) return; | ||
|
||
const file = line.trim(); | ||
if (file) { | ||
const filepath = path.resolve(baseDir, file); | ||
|
||
if (fs.existsSync(filepath)) { | ||
if (fs.lstatSync(filepath).isDirectory()) { | ||
console.log('Clearing folder: ', filepath); | ||
fs.rmdirSync(filepath, { recursive: true }); | ||
} else { | ||
console.log('Clearing file: ', filepath); | ||
fs.unlinkSync(filepath); | ||
} | ||
} | ||
} | ||
}); | ||
|
||
// remove .gitignore | ||
fs.unlinkSync('docs/api/.gitignore'); | ||
} | ||
|
||
clear(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export const inputFolder = 'support/api'; | ||
export const outputFolder = 'docs/apis'; | ||
export const outputFolder = 'docs/api'; | ||
export const referenceFoldername = 'reference'; |