diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2fd148c..d1bf3ba 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -77,5 +77,5 @@ Name it `PowerShellUniversal.Component.`, with `New-UD` and the type ## Releasing a module -Maintainers release each module on its own. The steps and the one-time setup are in +Maintainers release each module on its own. The checklist and the one-time setup are in [Releases](docs/development/release.md). diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 0000000..b5aa9e4 --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,4 @@ +# Releasing + +Only maintainers release. The checklist for a module release and the one-time setup are on the +docs site, in one place: [Releases](docs/development/release.md). diff --git a/build/growth-baseline.json b/build/growth-baseline.json index 7e32c25..4de323c 100644 --- a/build/growth-baseline.json +++ b/build/growth-baseline.json @@ -3,7 +3,7 @@ "pages": { "README.md": [108] }, - "totalLines": 4908 + "totalLines": 5012 }, "javascript": { "complexity": { diff --git a/docs/development/release.md b/docs/development/release.md index 50c224b..4513749 100644 --- a/docs/development/release.md +++ b/docs/development/release.md @@ -1,27 +1,75 @@ --- -description: "How a module is released: CHANGELOG and ModuleVersion, the tag -v, the release workflow that publishes to the PowerShell Gallery, and the one-time setup." +description: "The maintainers' checklist for a module release: the release pull request, a walk through the docs, the tag, the approval for the PowerShell Gallery, the GitHub release and the checks before a release is complete; and the one-time setup." --- # Releases -Each module has its own SemVer `ModuleVersion` and `CHANGELOG.md` and is released on its own, from a -tag `-v` on `main`. +Only maintainers release. This page is their checklist. Each module has its own SemVer +`ModuleVersion` and `CHANGELOG.md` and is released on its own, from a tag `-v` on +`main`. A module that requires another one (a showcase app requires its component module) is +released after it: the gallery checks that the required version is there. -1. In the module's `CHANGELOG.md`, move the entries from `[Unreleased]` to `## [x.y.z] - YYYY-MM-DD`; - set `ModuleVersion` in the manifest to `x.y.z`. Merge that pull request. -2. Tag after CI has passed for that commit on `main`: the release needs its green CI run and fails - otherwise; re-run it once CI is green. Tag the merge commit: - `git tag -vx.y.z && git push origin -vx.y.z`. A tag on a commit that is not on - `main` stops the workflow before anything is built. -3. The workflow `release.yml` tests, builds and checks the module, then waits for approval in the - environment `psgallery`; after it, it publishes to the PowerShell Gallery and creates the GitHub - release with the zip, the CHANGELOG section and a link to the version's page in the gallery. For a - component module (not a demo, not a prerelease) it also starts a discussion in Announcements. +## Each release + +### 1. The release pull request + +- In the module's `CHANGELOG.md`, move the entries from `[Unreleased]` to `## [x.y.z] - YYYY-MM-DD`. + Pick the version by [Versioning](../versioning.md). A prerelease (`x.y.z-rc1`) also sets + `Prerelease` in the manifest's `PSData`. +- Set `ModuleVersion` in the module's manifest to `x.y.z`. The release stops when the tag, the + manifest or the CHANGELOG section disagree. +- For a showcase app that uses something new of its component module, raise the minimum version in + its `RequiredModules`, and release the component module first. +- Update [Upgrading](../upgrading.md). `tests/js/upgrading.test.js` checks it against the changelogs: + - A new minor version with breaks: move the module's entries from "In the next release" into a + section of their own for that version, in place of the module's section for the minor before. + - A new minor version without breaks: remove the module's section for the minor before. + - A patch release: nothing moves. +- Merge the pull request. + +### 2. Walk through the docs with the built module + +Build the module from the merge commit (`./build/Build-Module.ps1`, or the zip of a +[trial run](#trial-run)) and install it on a PSU instance. Follow +[Getting started](../getting-started.md) and the module's overview page as written. Fix what does not +run before you tag: a published version cannot be changed. + +### 3. Tag + +Wait until CI has passed for the merge commit on `main`. The release needs that green CI run and +fails otherwise; re-run it once CI is green. Then tag the merge commit: + +```bash +git tag -vx.y.z && git push origin -vx.y.z +``` + +A tag on a commit that is not on `main` stops the workflow before anything is built. + +### 4. Approve the publication + +`release.yml` tests, builds and checks the module, then waits for approval in the environment +`psgallery`. Approve it there. It then publishes the module to the PowerShell Gallery. + +After the gallery, the workflow creates the GitHub release with the zip, the CHANGELOG section and a +link to the version's page in the gallery. For a component module (not a showcase app, not a +prerelease) it also starts a discussion in Announcements. When a step fails, re-run the failed jobs: +each step skips what already exists. + +### 5. Before the release is complete + +- Check that the version is in the gallery and that the GitHub release and its announcement are there. +- **Look at the entry pages in light and dark**: the README, the docs start page and the module + overview, of this repository and of [pivotkit](https://github.com/eizedev/pivotkit), whose docs the + pivot pages hand readers over to. Each image must show, in the theme it was made for. A problem + here is fixed in the docs, or with a patch release. + +## Trial run "Run workflow" on `release.yml` with a tag name checks a release without publishing anything. That trial run checks main membership and the CI run of the ref you choose to run it on, not of the tag -you type. A module that requires another one (a demo requires its component module) is released after -it: the gallery checks that the required version is there. +you type. + +## One-time setup Once per repository: Settings > Environments > `psgallery` with the maintainers as required reviewers and deployment tags `*-v*`; in that environment (never as a repository secret) the secret diff --git a/docs/getting-started.md b/docs/getting-started.md index 7f8f601..a74382c 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -1,5 +1,5 @@ --- -description: "Install, update and first steps with the PowerShell Universal component modules: a first chart, your own data from SQL, REST or PowerShell objects, and the showcase apps." +description: "Install and first steps with the PowerShell Universal component modules: a first chart, your own data from SQL, REST or PowerShell objects, and the showcase apps." --- # Getting started @@ -22,32 +22,7 @@ when a page uses it. ## Update -1. Install the new version of each module you use, the way you installed it: - - ```powershell - Install-PSResource -Name PowerShellUniversal.Component.Pivot # repeat for each module - ``` - - `Install-PSResource` puts the new version in a folder of its own, next to the old one. From a release - zip, copy the new `` folder next to the old one in `Modules//`. - -2. Restart PSU. PowerShell imports the newest version it finds in the folder, but a process that has - already imported the module keeps that version. -3. Readers reload their open pages. The bundle's file name holds a hash of its content, so a reload - fetches the new code. -4. Remove the old version folder once nothing uses it. Installing a new version does not remove it. - -What to check: - -- **Every module carries its own copy of the code the modules share.** A fix in that code reaches a - module only with that module's own release. Update every module you use, and read each module's - `CHANGELOG.md`. -- **Readers' views (Pivot)** live outside the module folder: in the reader's browser, in - `pivot-views` next to the repository (`New-UDPivotFileTemplateStore`), or in your own storage - (`New-UDPivotTemplateStore`). A release refuses view files of a newer format than it reads, so - check before you go back to an older one: [View files](pivot/templates.md#view-files). -- **A published folder for the pivot schema** names the old version folder: - [Your own copy of the schema](pivot/schema.md#your-own-copy-of-the-schema). +How to update a module and what to change for its newest release: [Upgrading](upgrading.md). ## A first chart diff --git a/docs/upgrading.md b/docs/upgrading.md new file mode 100644 index 0000000..714bbe3 --- /dev/null +++ b/docs/upgrading.md @@ -0,0 +1,92 @@ +--- +title: Upgrading +description: How to update a module on the PowerShell Universal server, and what to change in your apps for the newest release of each module. +--- + +# Upgrading + +For everyone who runs the modules on a PSU server. The first part says how to update. The second +lists the changes of each module's newest release that need your action, and those of the next +release once `main` has any. Every other change is in the module's `CHANGELOG.md`. +[Versioning](versioning.md) says which releases may break things. + +## Update a module { #update } + +Read [what changed](#changes) first. + +1. Install the new version of each module you use, the way you installed it: + + ```powershell + Update-PSResource -Name PowerShellUniversal.Component.Pivot # repeat for each module + ``` + + `Update-PSResource` puts the newest version in a folder of its own, next to the old one. To take + a version you name instead, see [Versioning](versioning.md#before-100). From a release zip, copy + the new `` folder next to the old one in `Modules//`. + +2. Restart PSU. PowerShell imports the newest version it finds in the folder, but a process that has + already imported the module keeps that version. +3. Readers reload their open pages. The bundle's file name holds a hash of its content, so a reload + fetches the new code. +4. Remove the old version folder once nothing uses it. Installing a new version does not remove it. + +What to check: + +- **Every module carries its own copy of the code the modules share.** A fix in that code reaches a + module only with that module's own release. Update every module you use. +- **Readers' views (Pivot)** live outside the module folder: in the reader's browser, in + `pivot-views` next to the repository (`New-UDPivotFileTemplateStore`), or in your own storage + (`New-UDPivotTemplateStore`). A release refuses view files of a newer format than it reads, so + check before you go back to an older one: [View files](pivot/templates.md#view-files). +- **A published folder for the pivot schema** names the old version folder: + [Your own copy of the schema](pivot/schema.md#your-own-copy-of-the-schema). +- **A showcase app** requires a minimum version of its component module. Update the component + module first. + +## What changed { #changes } + +The breaks of each module's newest minor release and of the next release. Each entry names who is +affected and what to do. Older breaks are in the changelogs, [below](#older). + +### In the next release { #next } + +ECharts module: + +- **The chart's own texts follow `-Locale`**, or the browser's language without it: the toolbox, "Total" + in a stack's tooltip, the box plot's statistics and its "Outliers" series, the histogram's "Count" + axis, the candlestick's "Price" and "Volume" series, and "No data". + - Who is affected: an app with a `-ColorMap` entry or a click handler that names "Outliers", + "Volume" or "Price". + - What to do: set `-Locale` on that chart and name the series in that language, or set + `-Locale en-US` to keep the English names. + +### ECharts 0.3 { #echarts } + +- **A tooltip of a bar, line, area or step chart shows the element under the pointer**, with the + stack's total for a stacked segment, instead of every series at that position. + - Who is affected: readers who compare the series of a position in the tooltip. + - What to do: `-TooltipMode Axis` lists every series at the position. + +### Pivot 0.10 { #pivot } + +- **A reader's CSV or Excel file with numbers such as `1,234` or `1.500`** is read in the notation of + the report's locale, with a note that says so. + - Who is affected: readers of a report with `-AllowImport` who load such files. + - What to do: check such a column after the update. +- **`-Labels` has no key `settingsShort`.** + - Who is affected: an app that sets it. + - What to do: remove the key. +- **A shared view of a template store takes no origin from the request's headers** for a + `-SchemaUrl` path. It takes the origin of an https `PSU_COMPONENT_PIVOT_SCHEMA_URL`, else + pivotkit's schema address. A view a reader saves for themselves keeps the origin of the request. + - Who is affected: an app that publishes shared views with a `-SchemaUrl` path and no https default. + - What to do: to keep your own address in them, set `PSU_COMPONENT_PIVOT_SCHEMA_URL` to it. + +### Older releases { #older } + +The breaks of every release, marked **Breaking:**, are in each module's `CHANGELOG.md`: +[ECharts](https://github.com/eizedev/powershell-universal-components/blob/HEAD/modules/PowerShellUniversal.Component.ECharts/CHANGELOG.md), +[Perspective](https://github.com/eizedev/powershell-universal-components/blob/HEAD/modules/PowerShellUniversal.Component.Perspective/CHANGELOG.md), +[Pivot](https://github.com/eizedev/powershell-universal-components/blob/HEAD/modules/PowerShellUniversal.Component.Pivot/CHANGELOG.md), +[ECharts showcase app](https://github.com/eizedev/powershell-universal-components/blob/HEAD/modules/PowerShellUniversal.Component.ECharts.Demo/CHANGELOG.md), +[Pivot showcase app](https://github.com/eizedev/powershell-universal-components/blob/HEAD/modules/PowerShellUniversal.Component.Pivot.Demo/CHANGELOG.md). diff --git a/tests/js/docs-pages.test.js b/tests/js/docs-pages.test.js index ed04b12..1ed5382 100644 --- a/tests/js/docs-pages.test.js +++ b/tests/js/docs-pages.test.js @@ -130,6 +130,8 @@ const RELEASE_NAME = /\b(?:pivotkit(?:-[a-z]+)?|PowerShellUniversal\.Component\. */ const RELEASE_NAMES_ALLOWED = [ { file: "docs/versioning.md" }, + // the breaks of each module's newest release, by release + { file: "docs/upgrading.md" }, // the versions the modules were tested with { file: "docs/index.md", section: "Requirements" }, ]; diff --git a/tests/js/upgrading.test.js b/tests/js/upgrading.test.js new file mode 100644 index 0000000..cb10362 --- /dev/null +++ b/tests/js/upgrading.test.js @@ -0,0 +1,69 @@ +// docs/upgrading.md lists the breaks of each module's newest minor release and of the next release, as +// the CHANGELOGs mark them (**Breaking:**, newest release first). The release pull request updates the +// page with the CHANGELOG (docs/development/release.md); this test fails until both agree in the +// number of breaks. It counts, so a reworded entry is the reviewer's to catch. +import { test } from "node:test"; +import assert from "node:assert/strict"; +import { readFileSync, readdirSync } from "node:fs"; + +const root = new URL("../../", import.meta.url); +const PREFIX = "PowerShellUniversal.Component."; +const read = (path) => readFileSync(new URL(path, root), "utf8"); + +/** + * The sections of a CHANGELOG by release ("Unreleased", "0.10.1"), newest first, with the number of + * entries marked **Breaking:** in each. + * @param {string} text + * @returns {{ release: string, breaks: number }[]} + */ +function changelogReleases(text) { + return text.split(/^(?=## \[)/m).slice(1).map((part) => ({ + release: /^## \[([^\]]+)\]/.exec(part)[1], + breaks: (part.match(/^- \*\*Breaking:\*\*/gm) ?? []).length, + // a break written another way would be missed: "Breaking" in bold anywhere else + loose: (part.match(/\*\*Breaking/gi) ?? []).length, + })); +} + +/** + * The "### " sections of the upgrading page by heading, with their top-level list items. + * @param {string} text + * @returns {Map} + */ +function upgradingSections(text) { + const changes = text.slice(text.indexOf("\n## What changed")); + return new Map(changes.split(/^(?=### )/m).slice(1).map((part) => [ + /^### (.+?)(?: \{ #[\w-]+ \})?$/m.exec(part)[1], + (part.match(/^- /gm) ?? []).length, + ])); +} + +/** The name of a module's section: "Pivot", or "Pivot showcase app" for PowerShellUniversal.Component.Pivot.Demo. */ +const sectionName = (folder) => folder.slice(PREFIX.length).replace(/\.Demo$/, " showcase app"); + +test("changelogReleases and upgradingSections read releases, headings and breaks", () => { + const log = "# Changelog\n\n## [Unreleased]\n\n- **Breaking:** a\n - Who\n\n## [0.2.0] - 2026-01-01\n\n- **Breaking:** b\n- c\n"; + assert.deepEqual(changelogReleases(log), [{ release: "Unreleased", breaks: 1, loose: 1 }, { release: "0.2.0", breaks: 1, loose: 1 }]); + assert.deepEqual(changelogReleases("# Changelog\n\n## [1.0.0]\n\n - **Breaking** a\n").map((r) => [r.breaks, r.loose]), [[0, 1]]); + const page = "# U\n\n## What changed { #changes }\n\n### In the next release { #next }\n\n- **a**\n - Who\n\n### Pivot 0.2 { #pivot }\n\n- **b**\n"; + assert.deepEqual([...upgradingSections(page)], [["In the next release", 1], ["Pivot 0.2", 1]]); +}); + +test("the upgrading page lists the breaks of each module's newest minor release and of the next release", () => { + const expected = new Map(); + let next = 0; + for (const folder of readdirSync(new URL("modules/", root)).filter((name) => name.startsWith(PREFIX)).sort()) { + const releases = changelogReleases(read(`modules/${folder}/CHANGELOG.md`)); + for (const r of releases) assert.equal(r.loose, r.breaks, `${folder} ${r.release}: write each break as a top-level item "- **Breaking:** ..."`); + next += releases.find((r) => r.release === "Unreleased")?.breaks ?? 0; + const newest = releases.find((r) => r.release !== "Unreleased"); + if (!newest) continue; + const minor = newest.release.split(".").slice(0, 2).join("."); + const breaks = releases.filter((r) => r.release.startsWith(`${minor}.`)).reduce((sum, r) => sum + r.breaks, 0); + if (breaks) expected.set(`${sectionName(folder)} ${minor}`, breaks); + } + if (next) expected.set("In the next release", next); + const sections = upgradingSections(read("docs/upgrading.md")); + sections.delete("Older releases"); + assert.deepEqual(Object.fromEntries(sections), Object.fromEntries(expected), "docs/upgrading.md: one section per module whose newest minor release has breaks, one item per break; release PR: docs/development/release.md"); +}); diff --git a/zensical.toml b/zensical.toml index 108a140..b56484c 100644 --- a/zensical.toml +++ b/zensical.toml @@ -18,6 +18,7 @@ nav = [ { "Overview" = "index.md" }, { "Getting started" = "getting-started.md" }, { "Versioning" = "versioning.md" }, + { "Upgrading" = "upgrading.md" }, { "ECharts" = [ { "Overview" = "echarts/index.md" }, { "Showcase app (demo)" = "demo.md" }, @@ -116,7 +117,7 @@ PowerShell objects. Not affiliated with Devolutions. llms-full.txt holds every p """ [project.plugins.llmstxt.sections] -"Start" = ["index.md", "getting-started.md", "versioning.md"] +"Start" = ["index.md", "getting-started.md", "versioning.md", "upgrading.md"] "ECharts module" = ["echarts/*.md", "demo.md"] "Perspective module" = ["perspective/*.md"] "Pivot module" = ["pivot/*.md"]