mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-09 08:30:06 -04:00
Update lint.ts
This commit is contained in:
parent
532386af91
commit
786e95a388
1 changed files with 3 additions and 15 deletions
|
@ -1,7 +1,7 @@
|
||||||
import chalk from 'chalk'
|
import chalk from 'chalk'
|
||||||
import libxml, { ValidationError } from 'libxmljs2'
|
import libxml, { ValidationError } from 'libxmljs2'
|
||||||
import { program } from 'commander'
|
import { program } from 'commander'
|
||||||
import { Logger, Storage, File } from '@freearhey/core'
|
import { Storage, File } from '@freearhey/core'
|
||||||
|
|
||||||
const xsd = `<?xml version="1.0" encoding="UTF-8"?>
|
const xsd = `<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
|
||||||
|
@ -23,26 +23,14 @@ const xsd = `<?xml version="1.0" encoding="UTF-8"?>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
</xs:schema>`
|
</xs:schema>`
|
||||||
|
|
||||||
program
|
program.argument('[filepath]', 'Path to *.channels.xml files to validate').parse(process.argv)
|
||||||
.option(
|
|
||||||
'-c, --channels <path>',
|
|
||||||
'Path to channels.xml file to validate',
|
|
||||||
'sites/**/*.channels.xml'
|
|
||||||
)
|
|
||||||
.parse(process.argv)
|
|
||||||
|
|
||||||
const options = program.opts()
|
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const logger = new Logger()
|
|
||||||
const storage = new Storage()
|
const storage = new Storage()
|
||||||
|
|
||||||
logger.info('options:')
|
|
||||||
logger.tree(options)
|
|
||||||
|
|
||||||
let errors: ValidationError[] = []
|
let errors: ValidationError[] = []
|
||||||
|
|
||||||
const files: string[] = await storage.list(options.channels)
|
const files = program.args.length ? program.args : await storage.list('sites/**/*.channels.xml')
|
||||||
for (const filepath of files) {
|
for (const filepath of files) {
|
||||||
const file = new File(filepath)
|
const file = new File(filepath)
|
||||||
if (file.extension() !== 'xml') continue
|
if (file.extension() !== 'xml') continue
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue