From 6f466c349ad3c90668fee6e45a5ee347ca816c60 Mon Sep 17 00:00:00 2001 From: Brian Hicks Date: Thu, 5 Dec 2019 20:58:17 -0600 Subject: [PATCH] deprecate non-styled modules --- Makefile | 6 +++++- script/deprecated-imports.py | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a69c536e..5b870057 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ SHELL:=env PATH=${PATH} /bin/sh +export DEPRECATED_MODULES=Html,Accessibility,Accessibility.Aria,Accessibility.Key,Accessibility.Landmark,Accessibility.Live,Accessibility.Role,Accessibility.Style,Accessibility.Widget .PHONY: test test: node_modules @@ -22,10 +23,13 @@ percy-tests: tests/deprecated-imports-report.txt: $(shell find src -type f) script/deprecated-imports.py script/deprecated-imports.py report > $@ +script/deprecated-imports.csv: $(shell find src -type f) script/deprecated-imports.py + script/deprecated-imports.py --imports-file $@ update + .PHONY: deprecated-imports-report deprecated-imports-report: tests/deprecated-imports-report.txt script/deprecated-imports.py @cat tests/deprecated-imports-report.txt - @script/deprecated-imports.py check + @script/deprecated-imports.py --check-message-fix-command='make script/deprecated-imports.csv' check .PHONY: checks checks: diff --git a/script/deprecated-imports.py b/script/deprecated-imports.py index 100786f3..7da42387 100755 --- a/script/deprecated-imports.py +++ b/script/deprecated-imports.py @@ -60,10 +60,15 @@ class NriUiModules: class Import: """a single import.""" + DEPRECATED = "DEPRECATED" + def __init__(self, filename, name, version): self.filename = filename self.name = name - self.version = int(version) + try: + self.version = int(version) + except ValueError: # DEPRECATED + self.version = self.DEPRECATED def to_dict(self): return {"filename": self.filename, "name": self.name, "version": self.version} @@ -359,7 +364,7 @@ def parser(): '--deprecate', help="explicitly deprecate a module by name", action="append", - default=[], + default=[m for m in os.environ.get("DEPRECATED_MODULES", "").split(",") if m], ) sub = out.add_subparsers()