Skip to content

Commit 05264ea

Browse files
benelangithub-actions[bot]
authored andcommitted
chore: add calcite-ui-icons to monorepo (#9835)
**Related Issue:** #9255 ## Summary Good news, everyone! `@esri/calcite-ui-icons` is joining the Calcite Design System monorepo. This change will ensure Calcite components always uses the latest and greatest version of the icons. Additionally, the icons will benefit from the monorepo's continuous integration, including automatic changelog generation and deployment. This will give the designers more time to do what they do best! Some much needed cleanup was accomplished during this transition. The following items will no longer be [published to npm](https://unpkg.com/browse/@esri/[email protected]/): ``` .github/* CONTRIBUTE.md bin/build.js bin/cli.js bin/convert-mobile.js bin/optimize.js bin/path-data.js bin/server.js bin/templates/* bower.json docs/app.js docs/index.html docs/resources/* launch-calcite.command launch-meridian.command ``` Additionally, the autogenerated, build files will not longer be committed into version control. This includes: ``` docs/icons.json index.d.ts index.js js/* sprite-16.svg sprite-24.svg sprite-32.svg ``` These files can be generated via `npm run build`. The build files will be attached to GitHub releases for users who do not consume the icons via NPM. Note that I removed `bower.json` since [they recommended](https://bower.io/blog/2017/how-to-migrate-away-from-bower/) using other software back in 2017, and there hasn't been any activity in the [repo](https://github.com/bower/bower) for a few years now. However, I'm open to deprecating bower support and removing it in the next major release if people prefer that route. Release-As: 3.30.0
1 parent cc81399 commit 05264ea

File tree

3,512 files changed

+19670
-559
lines changed

Some content is hidden

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

3,512 files changed

+19670
-559
lines changed

.github/scripts/assignForVerification.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// @ts-check
2-
const { handoff, issueWorkflow } = require("./support/resources");
2+
const {
3+
labels: { handoff, issueWorkflow },
4+
} = require("./support/resources");
35
const { removeLabel } = require("./support/utils");
46

57
/** @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments */

.github/scripts/iconTeamDiffCheck.js

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
const {
2+
teams: { admins, iconDesigners },
3+
labels: { snapshots },
4+
} = require("./support/resources");
5+
6+
/** @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments */
7+
module.exports = async ({ github, context, core }) => {
8+
const { repo, owner } = context.repo;
9+
10+
const payload = /** @type {import('@octokit/webhooks-types').PullRequestEvent} */ (context.payload);
11+
const {
12+
pull_request: {
13+
number: pull_number,
14+
user: { login: author },
15+
},
16+
} = payload;
17+
18+
core.debug("Checking author/reviewers because there are diffs outside of package/calcite-ui-icons");
19+
core.debug(`Author: ${author}`);
20+
21+
const iconTeamMembers = (
22+
await github.rest.teams.listMembersInOrg({
23+
org: owner,
24+
team_slug: iconDesigners,
25+
})
26+
).data.map((member) => member.login);
27+
28+
core.debug(`Members of "${iconDesigners}" GitHub Team: ${JSON.stringify(iconTeamMembers)}`);
29+
30+
const adminTeamMembers = (
31+
await github.rest.teams.listMembersInOrg({
32+
org: owner,
33+
team_slug: admins,
34+
})
35+
).data.map((member) => member.login);
36+
37+
core.debug(`Members of "${admins}" GitHub Team: ${JSON.stringify(adminTeamMembers)}`);
38+
39+
// passes when an admin approves the PR
40+
if (github.event?.review?.state == "APPROVED" && adminTeamMembers.includes(github.event?.review?.user?.login)) {
41+
core.debug(`Approved by admin: ${github.event?.review?.user?.login}`);
42+
core.debug("Passing because an admin has approved this pull request");
43+
process.exit(0);
44+
}
45+
46+
// passes if the author isn't on the icon designers team or if the author is on the admin team
47+
// admin(s) may be on the icon designers team for maintenance purposes
48+
if (adminTeamMembers.includes(author) || !iconTeamMembers.includes(author)) {
49+
core.debug("Passing because the author is an admin and/or isn't an icon designer");
50+
process.exit(0);
51+
}
52+
53+
const { data: reviews } = await github.rest.pulls.listReviews({ owner, repo, pull_number });
54+
55+
// passes if there was a previous approval from an admin
56+
reviews.forEach((review) => {
57+
if (review.state == "APPROVED" && adminTeamMembers.includes(review.user.login)) {
58+
core.debug(`Approved by admin: ${review.user.login}`);
59+
core.debug("Passing because an admin has approved this pull request");
60+
process.exit(0);
61+
}
62+
});
63+
64+
const { data: requestedReviewers } = await github.rest.pulls.listRequestedReviewers({
65+
owner,
66+
repo,
67+
pull_number,
68+
});
69+
70+
if (!requestedReviewers.teams.map((reviewer) => reviewer.slug).includes(admins)) {
71+
core.debug(`Requesting review from the "${admins}" GitHub team`);
72+
await github.rest.pulls.requestReviewers({
73+
owner,
74+
repo,
75+
pull_number,
76+
team_reviewers: [admins],
77+
});
78+
}
79+
80+
await github.rest.issues.addLabels({
81+
owner,
82+
repo,
83+
issue_number: pull_number,
84+
labels: [snapshots.skip],
85+
});
86+
core.setFailed(
87+
`An admin needs to review these changes because a file outside of package/calcite-ui-icons was changed.`,
88+
);
89+
};

.github/scripts/labelPullRequestWithCommitType.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// @ts-check
2-
const { issueType } = require("./support/resources");
2+
const {
3+
labels: { issueType },
4+
} = require("./support/resources");
35

46
/** @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments */
57
module.exports = async ({ github, context }) => {

.github/scripts/notifyWhenReadyForDev.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
// The secret is formatted like so: person1, person2, person3
88
//
99
// Note the script automatically adds the "@" character in to notify the project manager(s)
10-
const { issueWorkflow, planning } = require("./support/resources");
10+
const {
11+
labels: { issueWorkflow, planning },
12+
} = require("./support/resources");
1113
const { removeLabel } = require("./support/utils");
1214

1315
/** @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments */

.github/scripts/notifyWhenSpikeComplete.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
// The secret is formatted like so: person1, person2, person3
88
//
99
// Note the script automatically adds the "@" character in to notify the project manager(s)
10-
const { issueWorkflow, planning } = require("./support/resources");
10+
const {
11+
labels: { issueWorkflow, planning },
12+
} = require("./support/resources");
1113
const { removeLabel } = require("./support/utils");
1214

1315
/** @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments */

.github/scripts/support/resources.js

Lines changed: 45 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,50 @@
11
const resources = {
2-
bug: {
3-
regression: "regression",
2+
labels: {
3+
bug: {
4+
regression: "regression",
5+
},
6+
handoff: {
7+
readyForDev: "ready for dev",
8+
figmaChanges: "figma changes",
9+
},
10+
issueType: {
11+
bug: "bug",
12+
chore: "chore",
13+
docs: "docs",
14+
enhancement: "enhancement",
15+
perf: "perf",
16+
refactor: "refactor",
17+
test: "testing",
18+
tooling: "tooling",
19+
},
20+
issueWorkflow: {
21+
new: "0 - new",
22+
assigned: "1 - assigned",
23+
inDevelopment: "2 - in development",
24+
installed: "3 - installed",
25+
verified: "4 - verified",
26+
},
27+
planning: {
28+
needsMilestone: "needs milestone",
29+
spike: "spike",
30+
spikeComplete: "spike complete",
31+
},
32+
priority: {
33+
low: "p - low",
34+
high: "p - high",
35+
critical: "p - critical",
36+
},
37+
risk: {
38+
low: "low risk",
39+
},
40+
snapshots: {
41+
skip: "skip visual snapshots",
42+
run: "pr ready for visual snapshots",
43+
},
444
},
5-
handoff: {
6-
readyForDev: "ready for dev",
7-
figmaChanges: "figma changes",
8-
},
9-
issueType: {
10-
bug: "bug",
11-
chore: "chore",
12-
docs: "docs",
13-
enhancement: "enhancement",
14-
perf: "perf",
15-
refactor: "refactor",
16-
test: "testing",
17-
tooling: "tooling",
18-
},
19-
issueWorkflow: {
20-
new: "0 - new",
21-
assigned: "1 - assigned",
22-
inDevelopment: "2 - in development",
23-
installed: "3 - installed",
24-
verified: "4 - verified",
25-
},
26-
planning: {
27-
needsMilestone: "needs milestone",
28-
spike: "spike",
29-
spikeComplete: "spike complete",
30-
},
31-
priority: {
32-
low: "p - low",
33-
high: "p - high",
34-
critical: "p - critical",
35-
},
36-
risk: {
37-
low: "low risk",
45+
teams: {
46+
admins: "calcite-design-system-admins",
47+
iconDesigners: "calcite-icon-designers",
3848
},
3949
};
4050

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Icon Team Diff Check
2+
on:
3+
pull_request:
4+
branches: [main, rc, dev]
5+
pull_request_review:
6+
types: [submitted]
7+
jobs:
8+
check-diff:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
ref: ${{ github.event.pull_request.head.sha }}
15+
- name: Check changed files
16+
id: check-diff
17+
run: |
18+
non_icon_changes="$(
19+
git diff --name-only HEAD "$(
20+
git merge-base HEAD origin/${{ github.base_ref }}
21+
)" -- . ':!**/calcite-ui-icons/**'
22+
)"
23+
24+
printf "changed non-icon files:\n%s" "$non_icon_changes"
25+
26+
# skip if the only changes are in package/calcite-ui-icons
27+
if [ -z "$non_icon_changes" ]; then
28+
echo "SKIP=true" >> "$GITHUB_OUTPUT"
29+
else
30+
echo "SKIP=false" >> "$GITHUB_OUTPUT"
31+
fi
32+
- if: steps.check-diff.outputs.SKIP == 'false'
33+
name: Check pull request author and reviewers
34+
uses: actions/github-script@v7
35+
with:
36+
github-token: ${{ secrets.ADMIN_TOKEN }}
37+
script: |
38+
const action = require('${{ github.workspace }}/.github/scripts/iconTeamDiffCheck.js')
39+
await action({github, context, core})

.github/workflows/pr-e2e.yml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,38 @@ on:
55
branches: [main, rc, dev]
66
jobs:
77
e2e:
8-
runs-on: ubuntu-20.04
8+
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/checkout@v4
1111
with:
1212
fetch-depth: 0
13-
- name: skip for markdown only prs
14-
id: markdown-check
13+
- name: Check diff for testable changes
14+
id: diff-check
1515
run: |
16-
current_branch="$(git rev-parse --abbrev-ref HEAD)"
17-
# diff of branch excluding md
18-
testable_changes=$(git diff --name-only "$current_branch" $(git merge-base "$current_branch" origin/${{ github.base_ref }}) -- . ':(exclude)*.md*')
16+
testable_changes="$(
17+
git diff --name-only HEAD "$(
18+
git merge-base HEAD origin/${{ github.base_ref }}
19+
)" -- . ':!*.md*' ':!**/calcite-ui-icons/**'
20+
)"
21+
1922
echo "changed files: $testable_changes"
2023
# skip if there are only md changes
2124
if [ -z "$testable_changes" ]; then
22-
echo "skip e2e"
23-
echo "SKIP=true" >> $GITHUB_OUTPUT
25+
echo "SKIP=true" >> "$GITHUB_OUTPUT"
2426
else
25-
echo "run e2e"
26-
echo "SKIP=false" >> $GITHUB_OUTPUT
27+
echo "SKIP=false" >> "$GITHUB_OUTPUT"
2728
fi
28-
- if: steps.markdown-check.outputs.SKIP == 'false'
29+
- if: steps.diff-check.outputs.SKIP == 'false'
2930
uses: actions/setup-node@v4
3031
with:
3132
node-version-file: package.json
32-
- if: steps.markdown-check.outputs.SKIP == 'false'
33+
- if: steps.diff-check.outputs.SKIP == 'false'
34+
name: Run tests for testable changes
3335
run: npm install && npm run build && npm run test
36+
- if: steps.diff-check.outputs.SKIP == 'true'
37+
name: Skip visual snapshots for non-testable changes
38+
env:
39+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
PR_NUMBER: ${{ github.event.pull_request.number }}
41+
run: |
42+
gh pr edit "$PR_NUMBER" --add-label "skip visual snapshots"

.release-please-manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"packages/calcite-components": "2.10.1",
33
"packages/calcite-components-react": "2.10.1",
44
"packages/calcite-design-tokens": "2.2.0",
5+
"packages/calcite-ui-icons": "3.29.0",
56
"packages/eslint-plugin-calcite-components": "1.2.0",
67
"packages/calcite-components-angular/projects/component-library": "2.10.1"
78
}

.renovaterc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"ts-jest",
2929
"typescript"
3030
],
31+
"ignorePaths": ["packages/calcite-ui-icons/**"],
3132
"packageRules": [
3233
{
3334
"matchPackagePatterns": ["*"],

0 commit comments

Comments
 (0)