Skip to content

Commit e71198d

Browse files
jguddasericfennis
andauthored
chore: icon alias improvements (#2861)
Co-authored-by: Eric Fennis <[email protected]>
1 parent 57714e3 commit e71198d

File tree

173 files changed

+1074
-226
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+1074
-226
lines changed

docs/scripts/writeIconRelatedIcons.mjs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ const MAX_RELATED_ICONS = 4 * 17; // grid of 4x17 icons, = 68 icons
2121
const arrayMatches = (a, b) => a.filter((item) => b.includes(item)).length;
2222

2323
const nameParts = (icon) =>
24-
[
25-
icon.name,
26-
...(icon.aliases?.map((alias) => (typeof alias === 'string' ? alias : alias.name)) ?? []),
27-
]
24+
[icon.name, ...(icon.aliases?.map((alias) => alias.name) ?? [])]
2825
.join('-')
2926
.split('-')
3027
.filter((word) => word.length > 2);

docs/scripts/writeReleaseMetadata.mjs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,14 @@ try {
159159
const aliases = iconMetaData.aliases ?? [];
160160

161161
if (aliases.length) {
162-
aliases
163-
.map((alias) => (typeof alias === 'string' ? alias : alias.name))
164-
.forEach((alias) => {
165-
if (!(alias in newReleaseMetaData)) {
166-
return;
167-
}
168-
169-
contents.createdRelease =
170-
newReleaseMetaData[alias].createdRelease ?? defaultReleaseMetaData.createdRelease;
171-
});
162+
aliases.forEach((alias) => {
163+
if (!(alias.name in newReleaseMetaData)) {
164+
return;
165+
}
166+
167+
contents.createdRelease =
168+
newReleaseMetaData[alias.name].createdRelease ?? defaultReleaseMetaData.createdRelease;
169+
});
172170
}
173171

174172
const output = JSON.stringify(contents, null, 2);

docs/scripts/writeVercelOutput.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ const iconMetaData = await getIconMetaData(path.resolve(scriptDir, '../../icons'
1111
const iconAliasesRedirectRoutes = Object.entries(iconMetaData)
1212
.filter(([, { aliases }]) => aliases?.length)
1313
.map(([iconName, { aliases }]) => {
14-
aliases = aliases.map((alias) => (typeof alias === 'object' ? alias.name : alias));
15-
16-
const aliasRouteMatches = aliases.join('|');
14+
const aliasRouteMatches = aliases.map((alias) => alias.name).join('|');
1715

1816
return {
1917
src: `/icons/${aliasRouteMatches}`,

icon.schema.json

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,29 @@
2121
"aliases": {
2222
"type": "array",
2323
"items": {
24-
"oneOf": [
25-
{
24+
"type": "object",
25+
"additionalProperties": false,
26+
"required": ["name"],
27+
"properties": {
28+
"name": {
2629
"type": "string"
2730
},
28-
{
29-
"type": "object",
30-
"properties": {
31-
"name": {
32-
"type": "string"
33-
},
34-
"deprecated": {
35-
"const": true
36-
},
37-
"deprecationReason": {
38-
"$ref": "#/$defs/aliasDeprecationReasons"
39-
},
40-
"toBeRemovedInVersion": {
41-
"$ref": "#/$defs/versionNumber",
42-
"description": "The version this icon will be removed in."
43-
}
44-
},
45-
"dependentRequired": {
46-
"deprecated": ["deprecationReason", "toBeRemovedInVersion"]
47-
}
31+
"deprecated": {
32+
"const": true
33+
},
34+
"deprecationReason": {
35+
"$ref": "#/$defs/aliasDeprecationReasons"
36+
},
37+
"toBeRemovedInVersion": {
38+
"$ref": "#/$defs/versionNumber",
39+
"description": "The version this icon will be removed in."
4840
}
49-
]
41+
},
42+
"dependentRequired": {
43+
"deprecated": ["deprecationReason", "toBeRemovedInVersion"],
44+
"deprecationReason": ["deprecated"],
45+
"toBeRemovedInVersion": ["deprecated"]
46+
}
5047
},
5148
"uniqueItems": true
5249
},
@@ -130,7 +127,9 @@
130127
}
131128
},
132129
"dependentRequired": {
133-
"deprecated": ["deprecationReason", "toBeRemovedInVersion"]
130+
"deprecated": ["deprecationReason", "toBeRemovedInVersion"],
131+
"deprecationReason": ["deprecated"],
132+
"toBeRemovedInVersion": ["deprecated"]
134133
},
135134
"$defs": {
136135
"iconDeprecationReasons": {

icons/alarm-clock-check.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
"time"
2020
],
2121
"aliases": [
22-
"alarm-check"
22+
{
23+
"name": "alarm-check",
24+
"deprecationReason": "alias.name",
25+
"deprecated": true,
26+
"toBeRemovedInVersion": "v1.0"
27+
}
2328
]
2429
}

icons/alarm-clock-minus.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
"time"
1616
],
1717
"aliases": [
18-
"alarm-minus"
18+
{
19+
"name": "alarm-minus",
20+
"deprecationReason": "alias.name",
21+
"deprecated": true,
22+
"toBeRemovedInVersion": "v1.0"
23+
}
1924
]
2025
}

icons/alarm-clock-plus.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
"time"
1616
],
1717
"aliases": [
18-
"alarm-plus"
18+
{
19+
"name": "alarm-plus",
20+
"deprecationReason": "alias.name",
21+
"deprecated": true,
22+
"toBeRemovedInVersion": "v1.0"
23+
}
1924
]
2025
}

icons/arrow-down-0-1.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
"arrows"
2222
],
2323
"aliases": [
24-
"arrow-down-01"
24+
{
25+
"name": "arrow-down-01",
26+
"deprecationReason": "alias.name",
27+
"deprecated": true,
28+
"toBeRemovedInVersion": "v1.0"
29+
}
2530
]
2631
}

icons/arrow-down-1-0.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
"arrows"
2222
],
2323
"aliases": [
24-
"arrow-down-10"
24+
{
25+
"name": "arrow-down-10",
26+
"deprecationReason": "alias.name",
27+
"deprecated": true,
28+
"toBeRemovedInVersion": "v1.0"
29+
}
2530
]
2631
}

icons/arrow-down-a-z.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
"arrows"
2222
],
2323
"aliases": [
24-
"arrow-down-az"
24+
{
25+
"name": "arrow-down-az",
26+
"deprecationReason": "alias.name",
27+
"deprecated": true,
28+
"toBeRemovedInVersion": "v1.0"
29+
}
2530
]
2631
}

0 commit comments

Comments
 (0)