chore: add IDAA guardrail to migrate_fa_to_lucide.py (abort if run on src/routes/idaa)
This commit is contained in:
@@ -189,14 +189,13 @@ def parse_fa_class(class_str):
|
|||||||
elif p.startswith('fa-'):
|
elif p.startswith('fa-'):
|
||||||
if icon_name is None:
|
if icon_name is None:
|
||||||
icon_name = p # first real icon name wins
|
icon_name = p # first real icon name wins
|
||||||
else:
|
|
||||||
extra.append(p)
|
extra.append(p)
|
||||||
return icon_name, extra, has_spin
|
return icon_name, extra, has_spin
|
||||||
|
|
||||||
|
|
||||||
def replace_span(m):
|
def replace_span(m):
|
||||||
"""Regex sub callback: replace a single FA span with a Lucide component."""
|
"""Regex sub callback: replace a single FA span with a Lucide component."""
|
||||||
icon_name, extra, has_spin = parse_fa_class(m.group(1))
|
"""
|
||||||
if icon_name is None:
|
if icon_name is None:
|
||||||
return m.group(0)
|
return m.group(0)
|
||||||
|
|
||||||
@@ -292,6 +291,13 @@ def main():
|
|||||||
print('Usage: migrate_fa_to_lucide.py <directory_or_file ...>')
|
print('Usage: migrate_fa_to_lucide.py <directory_or_file ...>')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
# IDAA Guardrail: Abort if any target is src/routes/idaa or a subdirectory
|
||||||
|
for arg in sys.argv[1:]:
|
||||||
|
if Path(arg).resolve().as_posix().endswith('src/routes/idaa') or '/src/routes/idaa/' in Path(arg).resolve().as_posix():
|
||||||
|
print('ABORT: This script must not be run against src/routes/idaa or its subdirectories. IDAA content is private and protected.')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
targets = []
|
targets = []
|
||||||
for arg in sys.argv[1:]:
|
for arg in sys.argv[1:]:
|
||||||
p = Path(arg)
|
p = Path(arg)
|
||||||
|
|||||||
Reference in New Issue
Block a user