Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changesets

This folder contains release metadata generated by `@changesets/cli`.

Run `pnpm change` to describe a change that requires a package release. Changes that do not require a package release do not need a changeset.

See the [Changesets documentation](https://github.com/changesets/changesets/tree/main/docs) for more information.
59 changes: 59 additions & 0 deletions .changeset/changelog-github.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// see https://github.com/changesets/changesets/blob/main/docs/modifying-changelog-format.md
/** @type {import('@changesets/types').ChangelogFunctions} */
const changelogFunctions = {
getReleaseLine: async ({ commit, summary }, _type, options) => {
if (!options.repo) {
throw new Error('Configure the changelog generator with a GitHub repository, for example: ["./changelog-github.mjs", { "repo": "org/repo" }]');
}

const [firstLine, ...followingLines] = summary.split("\n").map((line) => line.trimEnd());
const pullRequestOrCommit = await getPullRequestLink(options.repo, commit);
let releaseLine = `- ${pullRequestOrCommit}: ${firstLine}`;

if (followingLines.length > 0) {
releaseLine += `\n${followingLines.map((line) => ` ${line}`).join("\n")}`;
}

return releaseLine;
},

getDependencyReleaseLine: async (_changesets, dependenciesUpdated) => {
if (dependenciesUpdated.length === 0) {
return "";
}

const updatedDependencies = dependenciesUpdated.map((dependency) => ` - ${dependency.name}@${dependency.newVersion}`);
return ["- Updated dependencies:", ...updatedDependencies].join("\n");
},
};

export default changelogFunctions;

async function getPullRequestLink(repository, commit) {
try {
const headers = {
Accept: "application/vnd.github+json",
...(process.env.GITHUB_TOKEN ? { Authorization: `Bearer ${process.env.GITHUB_TOKEN}` } : {}),
};

const response = await fetch(`https://api.github.com/repos/${repository}/commits/${commit}/pulls`, { headers });
if (!response.ok) {
throw new Error(`GitHub returned ${response.status} while resolving commit ${commit}.`);
}

const pullRequests = await response.json();
if (!Array.isArray(pullRequests)) {
throw new Error("GitHub returned an unexpected pull request response.");
}

const pullRequest = pullRequests.find(({ merge_commit_sha: mergeCommit }) => mergeCommit?.startsWith(commit));

if (pullRequest) {
return `[#${pullRequest.number}](https://github.com/${repository}/pull/${pullRequest.number})`;
}
} catch {
// Fall back to the commit when GitHub cannot resolve the pull request.
}

return commit;
}
14 changes: 14 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.4/schema.json",
"changelog": ["./changelog-github.mjs", { "repo": "iTwin/viewer-components-react" }],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "master",
Comment thread
aruniverse marked this conversation as resolved.
"updateInternalDependencies": "patch",
"bumpVersionsWithWorkspaceProtocolOnly": true,
"privatePackages": {
"version": false
}
}
24 changes: 14 additions & 10 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,42 @@
# review when someone opens a pull request.
* @itwin/viewer-components-reviewers

/.changeset/multi-package-* @itwin/viewer-components-reviewers @itwin/itwinjs-core-presentation

/packages/test-utilities @itwin/viewer-components-reviewers @itwin/itwinjs-core-presentation

/apps/test-viewer @itwin/viewer-components-reviewers @itwin/itwinjs-core-presentation
/apps/learning-snippets @itwin/viewer-components-reviewers @itwin/itwinjs-core-presentation
/apps/performance-tests @itwin/viewer-components-reviewers @itwin/itwinjs-core-presentation

/packages/property-grid @itwin/viewer-components-reviewers @itwin/itwinjs-core-presentation
/change/@itwin-property-grid-react* @itwin/viewer-components-reviewers @itwin/itwinjs-core-presentation
/packages/property-grid/CHANGELOG.md @itwin/viewer-components-reviewers @itwin/itwinjs-core-presentation
/.changeset/@itwin-property-grid-react-* @itwin/viewer-components-reviewers @itwin/itwinjs-core-presentation

/packages/tree-widget @itwin/viewer-components-reviewers @itwin/itwinjs-core-presentation
/change/@itwin-tree-widget-react* @itwin/viewer-components-reviewers @itwin/itwinjs-core-presentation
/packages/tree-widget/CHANGELOG.md @itwin/viewer-components-reviewers @itwin/itwinjs-core-presentation
/.changeset/@itwin-tree-widget-react-* @itwin/viewer-components-reviewers @itwin/itwinjs-core-presentation

/packages/measure-tools @itwin/viewer-components-reviewers @simnorm @a-gagnon @bsy-nicholasw
/change/@itwin-measure-tools-react* @itwin/viewer-components-reviewers @simnorm @a-gagnon @bsy-nicholasw
/packages/measure-tools/CHANGELOG.md @itwin/viewer-components-reviewers

/archive/grouping-mapping-widget @itwin/viewer-components-reviewers @itwin/insights-and-reporting-platform
/change/@itwin-grouping-mapping-widget* @itwin/viewer-components-reviewers @itwin/insights-and-reporting-platform
/archive/grouping-mapping-widget/CHANGELOG.md @itwin/viewer-components-reviewers
Comment thread
JonasDov marked this conversation as resolved.

/archive/one-click-lca-widget @itwin/viewer-components-reviewers @itwin/insights-and-reporting-platform
/change/@itwin-one-click-lca-react* @itwin/viewer-components-reviewers @itwin/insights-and-reporting-platform
/archive/one-click-lca-widget/CHANGELOG.md @itwin/viewer-components-reviewers

/archive/reports-config-widget @itwin/viewer-components-reviewers @itwin/insights-and-reporting-platform
/change/@itwin-reports-config-widget-react* @itwin/viewer-components-reviewers @itwin/insights-and-reporting-platform
/archive/reports-config-widget/CHANGELOG.md @itwin/viewer-components-reviewers

/packages/geo-tools @itwin/viewer-components-reviewers @mdastous-bentley
/change/@itwin-geo-tools-react* @itwin/viewer-components-reviewers @mdastous-bentley
/packages/geo-tools/CHANGELOG.md @itwin/viewer-components-reviewers

/archive/ec3-widget @itwin/viewer-components-reviewers @itwin/insights-and-reporting-platform
/change/@itwin-ec3-widget-react* @itwin/viewer-components-reviewers @itwin/insights-and-reporting-platform
/archive/ec3-widget/CHANGELOG.md @itwin/viewer-components-reviewers

/packages/map-layers @itwin/viewer-components-reviewers @mdastous-bentley @eringram
/change/@itwin-map-layers* @itwin/viewer-components-reviewers @mdastous-bentley @eringram
/packages/map-layers/CHANGELOG.md @itwin/viewer-components-reviewers

/packages/quantity-formatting @itwin/itwinjs-core-presentation @hl662
/change/@itwin-quantity-formatting-react* @itwin/itwinjs-core-presentation @hl662
/packages/quantity-formatting/CHANGELOG.md @itwin/viewer-components-reviewers @itwin/itwinjs-core-presentation
Comment thread
JonasDov marked this conversation as resolved.
Outdated
55 changes: 55 additions & 0 deletions .github/workflows/changeset-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# cspell:ignore NPMJS imodeljs
name: Release packages (changeset)

on:
push:
branches:
- master

env:
NPM_CONFIG_PROVENANCE: true
HUSKY: 0

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
if: github.repository_owner == 'iTwin'
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
token: ${{ secrets.IMJS_ADMIN_GH_TOKEN }}

- name: Install pnpm
uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093

- name: Use Node.js 22
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
with:
node-version: 22
registry-url: https://registry.npmjs.org/
cache: "pnpm"

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Create release PR or publish to npm
uses: changesets/action@63a615b9cd06ba9a3e6d13796c7fbcb080a60a0b
with:
publish: pnpm release
title: Release packages [publish docs]
Comment thread
saskliutas marked this conversation as resolved.
Outdated
commit: Release packages [publish docs]
commitMode: github-api
env:
GITHUB_TOKEN: ${{ secrets.IMJS_ADMIN_GH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_PUBLISH_ITWIN }}
GIT_AUTHOR_NAME: imodeljs-admin
GIT_AUTHOR_EMAIL: imodeljs-admin@users.noreply.github.com
GIT_COMMITTER_NAME: imodeljs-admin
GIT_COMMITTER_EMAIL: imodeljs-admin@users.noreply.github.com
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ jobs:
- run: pnpm install

check:
if: ${{ github.event.pull_request.head.ref != 'changeset-release/master' || github.event.pull_request.user.login != 'imodeljs-admin' }}
runs-on: ubuntu-latest
needs: install
name: Check change files
name: Check package versions
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v4
Expand All @@ -40,9 +42,8 @@ jobs:
node-version: 22
cache: 'pnpm'

- run: pnpm install

- run: pnpm check && pnpm check:dev
- name: Prevent manual package version changes
run: pnpm check:versions -- ${{ github.event.pull_request.base.sha }}

audit:
runs-on: ubuntu-latest
Expand Down
72 changes: 0 additions & 72 deletions .pipelines/publish.yaml

This file was deleted.

52 changes: 30 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Please take a read through this document to help streamline the process of getti
- [Creating Issues and Enhancements](#creating-issues-and-enhancements)
- [Writing Good Bug Reports and Feature Requests](#writing-good-bug-reports-and-feature-requests)
- [Pull Requests](#pull-requests)
- [Source Code Edit Workflow](#code-change-workflow)
- [Development Workflow](#development-workflow)
- [Changesets and Releases](#changesets-and-releases)

## Adding a New Project

Expand Down Expand Up @@ -55,36 +56,43 @@ We follow the normal [GitHub pull request workflow](https://help.github.com/en/g

Every change must be tested with proper unit tests. Integration tests are highly encouraged in libraries with critical workflows to ensure end-to-end consistency.

Every change must be described with a change log: Run "pnpm change" on your committed and always choose "patch" as the change type. Commit your change log along with your pull request.
## Development Workflow

## Source Code Edit Workflow
1. Clone the repository or pull the latest changes from `master`.
2. Install dependencies: `pnpm install`.
3. Create a branch and make your changes.
4. Add or update tests for the changed behavior.
5. Run the relevant validation commands. The root commands include:

### Build Instructions
- `pnpm build`
- `pnpm test`
- `pnpm lint`
- `pnpm prettier`
- `pnpm cspell`

1. Clone repository (first time) with `git clone` or pull updates to the repository (subsequent times) with `git pull`
2. Install dependencies: `pnpm install`
3. Clean: `pnpm run clean`
4. Rebuild source: `pnpm run build`
5. Run tests: `pnpm run test`
6. Commit and push your changes, then open a pull request.

The above commands iterate and perform their action against each package in the monorepo.

For incremental builds, the `pnpm run build` command can be used to only build packages that have changes.

> Note: It is a good idea to `pnpm install` after each `git pull` as dependencies may have changed.

### Making and testing changes
## Changesets and Releases

Every change that requires a public package release must include a changeset. Documentation, tests, tooling, and other changes that do not affect a published package do not need one. Empty changesets are not used.

Before opening a pull request:

1. Run `pnpm change`.
2. Select each affected package and its release type:

- `patch` for backward-compatible fixes.
- `minor` for backward-compatible features.
- `major` for breaking changes.

1. Make source code changes on a new Git branch
2. Ensure unit tests pass when run locally: `pnpm run test`
3. Locally commit changes: `git commit` (or use the Visual Studio Code user interface)
4. Repeat steps 1-3 until ready to push changes
5. Add changelog entry (which could potentially cover several commits): `pnpm change`
6. Follow prompts to enter a change description or press ENTER if the change does not warrant a changelog entry. If multiple packages have changed, multiple sets of prompts will be presented.
7. Completing the `pnpm change` prompts will cause new changelog entry JSON files to be created.
8. Commit the changelog JSON files.
9. Publish changes on the branch and open a pull request.
3. Enter a concise summary suitable for the package changelog.
4. Review the generated `.changeset/*.md` file. Single-package changesets use the package name in the filename for package-specific reviewer routing. Changesets affecting multiple packages use the `multi-package` prefix. The Markdown content may be expanded with examples, code snippets, migration guidance, or any other context needed for useful release notes.
5. Commit the generated file from the `.changeset` directory with your pull request.

> Note: The CI build will break if changes are pushed without running `pnpm change`. The fix will be to complete steps 5 through 9.
Do not edit package versions or package CHANGELOG.md files manually. After changesets are merged to `master`, the release workflow creates or updates a release pull request containing the generated version and changelog changes. Merging that release pull request publishes the packages to npm.

Here is a sample [changelog](https://github.com/microsoft/rushstack/blob/master/apps/rush/CHANGELOG.md) to demonstrate the level of detail expected.
14 changes: 0 additions & 14 deletions beachball.config.dev.js

This file was deleted.

Loading
Loading