Skip to content

Commit 182f3b7

Browse files
author
Guillaume Chau
committed
fix: check more files for links
1 parent 99b030a commit 182f3b7

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

scripts/checkLinks.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ const path = require('path')
22
const fs = require('fs')
33
const request = require('request-promise-native')
44

5-
const root = path.resolve(__dirname, '../packages/@vue')
65
const promises = []
76

87
async function checkLink (file, link, n) {
@@ -36,23 +35,22 @@ function checkLinks (file) {
3635
}
3736
}
3837

39-
function checkFiles (folder, recursive = false) {
38+
function checkFiles (folder, all = false, recursive = false) {
4039
const files = fs.readdirSync(folder)
4140
for (const file of files) {
4241
const fullPath = path.join(folder, file)
43-
if (file === 'ui.js') {
42+
if (file === 'ui.js' || file === 'prompts.js') {
4443
checkLinks(fullPath)
4544
} else if (fs.statSync(fullPath).isDirectory()) {
46-
if (file === 'ui') {
47-
checkLinks(path.join(fullPath, 'index.js'))
48-
} else if (recursive) {
49-
checkFiles(fullPath)
50-
}
45+
checkFiles(fullPath, file === 'ui' || file === 'prompts')
46+
} else if (all) {
47+
checkLinks(fullPath)
5148
}
5249
}
5350
}
5451

55-
checkFiles(root, true)
52+
checkFiles(path.resolve(__dirname, '../packages/@vue'), false, true)
53+
checkFiles(path.resolve(__dirname, '../packages/@vue/cli/lib/promptModules'), true, true)
5654
Promise.all(promises).catch(() => {
5755
process.exit(1)
5856
})

0 commit comments

Comments
 (0)