Skip to content

Commit

Permalink
feat(deps-dev): upgrade @carbon/icons 11.31 -> 11.36 (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
metonym authored Feb 20, 2024
1 parent 0b2db90 commit 4249d01
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 8 deletions.
6 changes: 5 additions & 1 deletion ICON_INDEX.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Icon Index

> 2229 icons from [@carbon/icons@11.31.0-rc.0](https://unpkg.com/browse/@carbon/icons@11.31.0-rc.0/)
> 2233 icons from [@carbon/icons@11.36.0](https://unpkg.com/browse/@carbon/icons@11.36.0/)
- Accessibility
- AccessibilityAlt
Expand All @@ -22,6 +22,7 @@
- AiGovernanceLifecycle
- AiGovernanceTracked
- AiGovernanceUntracked
- AiLaunch
- AirlineDigitalGate
- AirlineManageGates
- AirlinePassengerCare
Expand Down Expand Up @@ -199,6 +200,7 @@
- CarbonForIbmDotcom
- CarbonForIbmProduct
- CarbonForMobile
- CarbonForSalesforce
- CarbonUiBuilder
- CaretDown
- CaretDownGlyph
Expand Down Expand Up @@ -1007,6 +1009,7 @@
- IncreaseLevel
- Industry
- Infinity
- InfinitySymbol
- Information
- InformationDisabled
- InformationFilled
Expand Down Expand Up @@ -1772,6 +1775,7 @@
- SwitchLayer_2
- SwitchLayer_3
- Switcher
- SyncSettings
- SysProvision
- Table
- TableAlias
Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/src/build-info.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
},
"devDependencies": {
"@carbon/icon-helpers": "latest",
"@carbon/icons": "11.31.0-rc.0",
"@carbon/icons": "11.36.0",
"@carbon/icons-11.31": "npm:@carbon/[email protected]",
"@types/bun": "latest",
"@types/carbon__icon-helpers": "latest",
"svelte": "latest",
Expand Down
2 changes: 1 addition & 1 deletion src/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ declare module "@carbon/icons" {
}

export interface BuildIcons {
icons: ReadonlyArray<{
icons: Array<{
name: string;
friendlyName: string;
namespace: [];
Expand Down
33 changes: 30 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,40 @@
import type { BuildIcons, IconOutput, ModuleName } from "@carbon/icons";
import metadata from "@carbon/icons/metadata.json";
import metadata_11_31 from "@carbon/icons-11.31/metadata.json";
import metadata_latest from "@carbon/icons/metadata.json";
import fsp from "fs/promises";
import { devDependencies, name } from "../package.json";
import { template, templateSvg } from "./template";

const VERSION = devDependencies["@carbon/icons"];

/**
* This library is built using the `@carbon/icons` package.
* However, `@carbon/icons` may remove icons between minor versions.
* This library has a different contract; icons are not removed
* in minor versions. To ensure that icons are not removed, we
* maintain a list of deprecated icons that are merged in.
*/
const DEPRECATED_ICONS = new Set([
// From 11.31.x
"FoundationModel",
"Infinity",
]);

const metadata = { ...metadata_latest } as BuildIcons;

// Merge in deprecated icons
(metadata_11_31 as BuildIcons).icons.forEach((icon) => {
icon.output.forEach((output) => {
const iconName = output.moduleName.slice(0, -2);

if (DEPRECATED_ICONS.has(iconName)) {
metadata.icons.push(icon);
}
});
});

export const buildIcons = async () => {
console.time("Built in");
console.time("buildIcons");
const iconMap = new Map<ModuleName, IconOutput>();
const iconModuleNames = (metadata as BuildIcons).icons
.map((icon) =>
Expand Down Expand Up @@ -139,7 +166,7 @@ ${iconModuleNames
})
);

console.timeEnd("Built in");
console.timeEnd("buildIcons");

return iconModuleNames;
};
4 changes: 4 additions & 0 deletions tests/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ exports[`imports 1`] = `
"AiGovernanceLifecycle",
"AiGovernanceTracked",
"AiGovernanceUntracked",
"AiLaunch",
"AirlineDigitalGate",
"AirlineManageGates",
"AirlinePassengerCare",
Expand Down Expand Up @@ -199,6 +200,7 @@ exports[`imports 1`] = `
"CarbonForIbmDotcom",
"CarbonForIbmProduct",
"CarbonForMobile",
"CarbonForSalesforce",
"CarbonUiBuilder",
"CaretDown",
"CaretDownGlyph",
Expand Down Expand Up @@ -1007,6 +1009,7 @@ exports[`imports 1`] = `
"IncreaseLevel",
"Industry",
"Infinity",
"InfinitySymbol",
"Information",
"InformationDisabled",
"InformationFilled",
Expand Down Expand Up @@ -1772,6 +1775,7 @@ exports[`imports 1`] = `
"SwitchLayer_2",
"SwitchLayer_3",
"Switcher",
"SyncSettings",
"SysProvision",
"Table",
"TableAlias",
Expand Down
2 changes: 1 addition & 1 deletion tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { template } from "../src/template";

test("imports", async () => {
const icons = await buildIcons();
expect(icons.length).toEqual(2229);
expect(icons.length).toEqual(2233);
expect(icons).toMatchSnapshot();
});

Expand Down

0 comments on commit 4249d01

Please sign in to comment.