-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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/calcite-ui-icons@3.29.0/): ``` .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
- Loading branch information
1 parent
cc81399
commit 05264ea
Showing
3,512 changed files
with
19,670 additions
and
559 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
const { | ||
teams: { admins, iconDesigners }, | ||
labels: { snapshots }, | ||
} = require("./support/resources"); | ||
|
||
/** @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments */ | ||
module.exports = async ({ github, context, core }) => { | ||
const { repo, owner } = context.repo; | ||
|
||
const payload = /** @type {import('@octokit/webhooks-types').PullRequestEvent} */ (context.payload); | ||
const { | ||
pull_request: { | ||
number: pull_number, | ||
user: { login: author }, | ||
}, | ||
} = payload; | ||
|
||
core.debug("Checking author/reviewers because there are diffs outside of package/calcite-ui-icons"); | ||
core.debug(`Author: ${author}`); | ||
|
||
const iconTeamMembers = ( | ||
await github.rest.teams.listMembersInOrg({ | ||
org: owner, | ||
team_slug: iconDesigners, | ||
}) | ||
).data.map((member) => member.login); | ||
|
||
core.debug(`Members of "${iconDesigners}" GitHub Team: ${JSON.stringify(iconTeamMembers)}`); | ||
|
||
const adminTeamMembers = ( | ||
await github.rest.teams.listMembersInOrg({ | ||
org: owner, | ||
team_slug: admins, | ||
}) | ||
).data.map((member) => member.login); | ||
|
||
core.debug(`Members of "${admins}" GitHub Team: ${JSON.stringify(adminTeamMembers)}`); | ||
|
||
// passes when an admin approves the PR | ||
if (github.event?.review?.state == "APPROVED" && adminTeamMembers.includes(github.event?.review?.user?.login)) { | ||
core.debug(`Approved by admin: ${github.event?.review?.user?.login}`); | ||
core.debug("Passing because an admin has approved this pull request"); | ||
process.exit(0); | ||
} | ||
|
||
// passes if the author isn't on the icon designers team or if the author is on the admin team | ||
// admin(s) may be on the icon designers team for maintenance purposes | ||
if (adminTeamMembers.includes(author) || !iconTeamMembers.includes(author)) { | ||
core.debug("Passing because the author is an admin and/or isn't an icon designer"); | ||
process.exit(0); | ||
} | ||
|
||
const { data: reviews } = await github.rest.pulls.listReviews({ owner, repo, pull_number }); | ||
|
||
// passes if there was a previous approval from an admin | ||
reviews.forEach((review) => { | ||
if (review.state == "APPROVED" && adminTeamMembers.includes(review.user.login)) { | ||
core.debug(`Approved by admin: ${review.user.login}`); | ||
core.debug("Passing because an admin has approved this pull request"); | ||
process.exit(0); | ||
} | ||
}); | ||
|
||
const { data: requestedReviewers } = await github.rest.pulls.listRequestedReviewers({ | ||
owner, | ||
repo, | ||
pull_number, | ||
}); | ||
|
||
if (!requestedReviewers.teams.map((reviewer) => reviewer.slug).includes(admins)) { | ||
core.debug(`Requesting review from the "${admins}" GitHub team`); | ||
await github.rest.pulls.requestReviewers({ | ||
owner, | ||
repo, | ||
pull_number, | ||
team_reviewers: [admins], | ||
}); | ||
} | ||
|
||
await github.rest.issues.addLabels({ | ||
owner, | ||
repo, | ||
issue_number: pull_number, | ||
labels: [snapshots.skip], | ||
}); | ||
core.setFailed( | ||
`An admin needs to review these changes because a file outside of package/calcite-ui-icons was changed.`, | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Icon Team Diff Check | ||
on: | ||
pull_request: | ||
branches: [main, rc, dev] | ||
pull_request_review: | ||
types: [submitted] | ||
jobs: | ||
check-diff: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: Check changed files | ||
id: check-diff | ||
run: | | ||
non_icon_changes="$( | ||
git diff --name-only HEAD "$( | ||
git merge-base HEAD origin/${{ github.base_ref }} | ||
)" -- . ':!**/calcite-ui-icons/**' | ||
)" | ||
printf "changed non-icon files:\n%s" "$non_icon_changes" | ||
# skip if the only changes are in package/calcite-ui-icons | ||
if [ -z "$non_icon_changes" ]; then | ||
echo "SKIP=true" >> "$GITHUB_OUTPUT" | ||
else | ||
echo "SKIP=false" >> "$GITHUB_OUTPUT" | ||
fi | ||
- if: steps.check-diff.outputs.SKIP == 'false' | ||
name: Check pull request author and reviewers | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{ secrets.ADMIN_TOKEN }} | ||
script: | | ||
const action = require('${{ github.workspace }}/.github/scripts/iconTeamDiffCheck.js') | ||
await action({github, context, core}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.