Add --ignore CLI argument
This commit is contained in:
Родитель
48b01ef446
Коммит
7682497d0b
6
cli.js
6
cli.js
|
@ -32,6 +32,12 @@ yargs(process.argv.slice(2))
|
|||
requiresArg: true,
|
||||
type: 'string'
|
||||
},
|
||||
ignore: {
|
||||
alias: 'i',
|
||||
desc: '.properties files to ignore; should match the file path end',
|
||||
requiresArg: true,
|
||||
type: 'array'
|
||||
},
|
||||
root: {
|
||||
alias: 'r',
|
||||
desc: 'Root of mozilla-central (usually autodetected)',
|
||||
|
|
|
@ -19,8 +19,13 @@ export async function findExternalRefs(ast, options) {
|
|||
visitLiteral(path) {
|
||||
const { value } = path.node
|
||||
if (typeof value === 'string' && value.startsWith('chrome://')) {
|
||||
if (value.endsWith('.xhtml')) xhtmlUriPaths.push(path)
|
||||
if (value.endsWith('.properties')) propertiesUriPaths.push(path)
|
||||
if (
|
||||
!options.ignore ||
|
||||
options.ignore.every((ignore) => !path.node.value.endsWith(ignore))
|
||||
) {
|
||||
if (value.endsWith('.xhtml')) xhtmlUriPaths.push(path)
|
||||
if (value.endsWith('.properties')) propertiesUriPaths.push(path)
|
||||
}
|
||||
}
|
||||
this.traverse(path)
|
||||
}
|
||||
|
@ -46,7 +51,13 @@ export async function findExternalRefs(ast, options) {
|
|||
const bundleTags = parseStringBundleTags(src)
|
||||
if (bundleTags.length > 0) {
|
||||
xhtml.push({ uri, path: fp, bundleTags, src })
|
||||
for (const tag of bundleTags) propUris.add(tag.src)
|
||||
for (const tag of bundleTags) {
|
||||
if (
|
||||
!options.ignore ||
|
||||
options.ignore.every((ignore) => !tag.src.endsWith(ignore))
|
||||
)
|
||||
propUris.add(tag.src)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ const n = types.namedTypes
|
|||
* format?: string,
|
||||
* ftlPath?: string,
|
||||
* ftlPrefix?: string,
|
||||
* ignore?: string[],
|
||||
* root?: string,
|
||||
* title?: string
|
||||
* }} TransformOptions
|
||||
|
|
Загрузка…
Ссылка в новой задаче