mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
fix: fix pjax api logic error
This commit is contained in:
parent
5e295ee203
commit
2a34c17c85
1 changed files with 7 additions and 5 deletions
|
|
@ -9,11 +9,13 @@ function modify(source = '', pairs = []) {
|
|||
for (const [original, replace] of pairs) {
|
||||
if (source.includes(original)) {
|
||||
source = source.replace(original, replace)
|
||||
if (source.includes(original)) {
|
||||
throw new Error(`More than one original string found`, JSON.stringify(original))
|
||||
}
|
||||
} else {
|
||||
throw new Error(`Original string not found: ${JSON.stringify(original)}`)
|
||||
}
|
||||
|
||||
if (source.includes(original)) {
|
||||
throw new Error(`More than one original string found`, JSON.stringify(original))
|
||||
}
|
||||
throw new Error(`Original string not found`, JSON.stringify(original))
|
||||
}
|
||||
|
||||
return source
|
||||
|
|
@ -59,7 +61,7 @@ async function fixPJAXAPI(loose) {
|
|||
await fs.writeFile(filePath, modified, 'utf-8')
|
||||
} catch (err) {
|
||||
console.error((err && err.message) || err)
|
||||
const shouldTerminate = true
|
||||
const shouldTerminate = process.env.IGNORE_FIX_PJAX_API_FAILURE !== 'true'
|
||||
if (shouldTerminate) process.exit(1)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue