mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-03-09 00:39:29 -05:00
fix: check more files for links
This commit is contained in:
@@ -2,7 +2,6 @@ const path = require('path')
|
||||
const fs = require('fs')
|
||||
const request = require('request-promise-native')
|
||||
|
||||
const root = path.resolve(__dirname, '../packages/@vue')
|
||||
const promises = []
|
||||
|
||||
async function checkLink (file, link, n) {
|
||||
@@ -36,23 +35,22 @@ function checkLinks (file) {
|
||||
}
|
||||
}
|
||||
|
||||
function checkFiles (folder, recursive = false) {
|
||||
function checkFiles (folder, all = false, recursive = false) {
|
||||
const files = fs.readdirSync(folder)
|
||||
for (const file of files) {
|
||||
const fullPath = path.join(folder, file)
|
||||
if (file === 'ui.js') {
|
||||
if (file === 'ui.js' || file === 'prompts.js') {
|
||||
checkLinks(fullPath)
|
||||
} else if (fs.statSync(fullPath).isDirectory()) {
|
||||
if (file === 'ui') {
|
||||
checkLinks(path.join(fullPath, 'index.js'))
|
||||
} else if (recursive) {
|
||||
checkFiles(fullPath)
|
||||
}
|
||||
checkFiles(fullPath, file === 'ui' || file === 'prompts')
|
||||
} else if (all) {
|
||||
checkLinks(fullPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkFiles(root, true)
|
||||
checkFiles(path.resolve(__dirname, '../packages/@vue'), false, true)
|
||||
checkFiles(path.resolve(__dirname, '../packages/@vue/cli/lib/promptModules'), true, true)
|
||||
Promise.all(promises).catch(() => {
|
||||
process.exit(1)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user