Skip to content

Commit b0810d8

Browse files
committed
add a simple clean-urls script
1 parent 2319bc6 commit b0810d8

File tree

3 files changed

+613
-1
lines changed

3 files changed

+613
-1
lines changed

clean-urls.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const walkSync = require('walk-sync');
2+
3+
const { renameSync, mkdirSync } = require('fs');
4+
5+
const { dirname, join } = require('path');
6+
7+
const paths = walkSync('json-docs');
8+
9+
paths.forEach(p => {
10+
if(p.includes('%')) {
11+
const newFile = decodeURIComponent(p);
12+
13+
mkdirSync(join('json-docs', dirname(newFile)), { recursive: true });
14+
15+
renameSync(join('json-docs', p), join('json-docs', newFile));
16+
}
17+
})

0 commit comments

Comments
 (0)