Skip to content

Commit 66f23ac

Browse files
committed
initial draft
1 parent 64317eb commit 66f23ac

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

scripts/website.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,38 @@ const tests = [
7676
...acquit.parse(fs.readFileSync(path.join(testPath, 'docs/schemas.test.js')).toString())
7777
];
7878

79+
function refreshDocs() {
80+
deleteAllHtmlFiles();
81+
if (process.env.DOCS_DEPLOY) {
82+
moveDocsToTemp();
83+
}
84+
}
85+
86+
function deleteAllHtmlFiles() {
87+
fs.unlinkSync('../index.html');
88+
const locations = ['../docs','../docs/tutorials', '../docs/typescript']
89+
for (let i = 0; i < locations.length; i++) {
90+
const files = fs.readdirSync(locations[i]);
91+
for (let index = 0; index < files.length; index++) {
92+
if (files[index].endsWith('.html')) {
93+
fs.unlinkSync(files[index]);
94+
}
95+
}
96+
}
97+
const folders = ['../docs/api', '../docs/source/_docs', '../tmp'];
98+
for (let i = 0; i < folders.length; i++) {
99+
fs.rmdirSync(folders[i])
100+
}
101+
}
102+
103+
function moveDocsToTemp() {
104+
const folder = '../docs/7.x';
105+
const directory = fs.readdirSync(folder);
106+
for (let i = 0; i < directory.length; i++) {
107+
fs.renameSync(`${folder}/${directory[i]}`, `./tmp/${directory[i]}`);
108+
}
109+
}
110+
79111
/**
80112
* Array of array of semver numbers, sorted with highest number first
81113
* @example

0 commit comments

Comments
 (0)