Skip to content

Commit ae6fdea

Browse files
committed
feat: allow users to specify where contributors go
1 parent 34d2c29 commit ae6fdea

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

hatch_nodejs_version/metadata_source.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def __init__(self, *args, **kwargs):
2929

3030
self.__path = None
3131
self.__fields = None
32+
self.__contributors_as_maintainers = None
3233

3334
@property
3435
def path(self) -> str:
@@ -63,6 +64,14 @@ def fields(self) -> None | set[str]:
6364
self.__fields = set(fields)
6465
return self.__fields
6566

67+
@property
68+
def contributors_as_maintainers(self) -> bool:
69+
if self.__contributors_as_maintainers is None:
70+
self.__contributors_as_maintainers = self.config.get(
71+
"contributors-as-maintainers", True
72+
)
73+
return self.__contributors_as_maintainers
74+
6675
def load_package_data(self):
6776
path = os.path.normpath(os.path.join(self.root, self.path))
6877
if not os.path.isfile(path):
@@ -114,17 +123,26 @@ def update(self, metadata: dict[str, Any]):
114123
new_metadata = {"name": package["name"]}
115124

116125
authors = None
126+
maintainers = None
117127

118128
if "author" in package:
119129
authors = [self._parse_person(package["author"])]
120130

121131
if "contributors" in package:
122-
new_metadata["maintainers"] = [
132+
contributors = [
123133
self._parse_person(p) for p in package["contributors"]
124134
]
135+
if self.contributors_as_maintainers:
136+
maintainers = contributors
137+
else:
138+
authors = [*(authors or []), *contributors]
139+
125140
if authors is not None:
126141
new_metadata['authors'] = authors
127142

143+
if maintainers is not None:
144+
new_metadata['maintainers'] = maintainers
145+
128146
if "keywords" in package:
129147
new_metadata["keywords"] = package["keywords"]
130148

0 commit comments

Comments
 (0)