Skip to content
Permalink
Browse files
fixed xml comment and update check-license
  • Loading branch information
hufeng committed Jun 9, 2021
1 parent 66c9a2c commit ce0a68bb35da70200b786de165013f5ea7aa396f
Showing 1 changed file with 13 additions and 1 deletion.
@@ -111,7 +111,7 @@ const meta = {

const haveNoLicenceFiles = []

// 2. check wether include license or not
// 2. check weather include license or not
for await (let { file, content } of asyncReadFiles(files)) {
const cfg = getMeta(file)
const hasLicense = content.includes(cfg.license)
@@ -178,6 +178,18 @@ function* asyncWriteFiles(files: Array<{ file: string; content: string }>) {
file
}))
} else {
// 如果是xml
if (
cfg.license === XML_LICENSE &&
content.includes(`<?xml version="1.0" encoding="UTF-8"?>`)
) {
const [firstLine, ...rest] = content.split('\n')
yield fs
.writeFile(file, `${firstLine}\n${XML_LICENSE}\n${rest.join('\n')}`)
.then(() => ({ file }))
return
}

yield fs
.writeFile(file, `${cfg.license}\n\n${content}`)
//@ts-ignore

0 comments on commit ce0a68b

Please sign in to comment.