Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 14 additions & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ When you are submitting a new sample, it has to follow up below guidelines
- Include a `README.md` based on the template for its sample type: [column](../column-samples/README-template.md), [form](../form-samples/README-template.md), or [view](../view-samples/README-template.md).
- Include a picture of the sample in practice in the README file ("pics or it didn't happen"). The preview image must be located in the sample's `assets` folder and named `screenshot.png`.
- Include `assets/sample.json` with the sample metadata used by the documentation site and sample browser.
- Name the sample's primary JSON file the same as its containing folder.
- Prefer naming a single-file sample's primary JSON file the same as its containing folder. Multi-definition samples may use descriptive variant names; document every file and where to apply it.
- Every sample README must end with the tracking image `<img src="https://m365-visitor-stats.azurewebsites.net/{repository}/{sample-path}" />`. This transparent image is used to track the popularity of individual samples in GitHub.
- In this repository, use `list-formatting` for `{repository}` and the sample folder's repository-relative path for `{sample-path}`. The suffix must exactly match the sample path. For example, `column-samples/date-range-format` must end with `<img src="https://m365-visitor-stats.azurewebsites.net/list-formatting/column-samples/date-range-format" />`.
- When you are submitting new sample solution, please name the sample solution folder accordingly
Expand All @@ -60,6 +60,19 @@ When you are submitting a new sample, it has to follow up below guidelines
## Step-by-step on submitting a pull request to this repository

See [Making Changes](../docs/contributing/changes.md) for detailed steps on submitting a pull request.

## Gallery and sample checks

The [gallery development guide](../GALLERY-DEVELOPMENT.md) documents the same commands used in
pull request validation. From `site`, run `npm ci`, `npm run validate:samples`,
`npm run generate`, `npm test`, `npm run check`, and `npm run build`.
Site changes should also pass `npm run test:e2e`.

The checks cover strict JSON, metadata, exact-case image paths, README trackers,
formatting schemas, all definition variants, site links, and browser behavior.
Historical schema findings are recorded explicitly; do not broaden the quality
baseline just to make a pull request pass. Automated checks do not replace
testing a changed format in SharePoint.

## Signing the CLA

Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/deploy-gallery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Deploy gallery

on:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: gallery-pages
cancel-in-progress: true

jobs:
build:
if: github.repository == 'pnp/List-Formatting' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: site
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "22"
cache: npm
cache-dependency-path: site/package-lock.json
- run: npm ci
- run: npm run generate && npm test
- run: npm run check
- run: npm run build
- run: npx playwright install --with-deps chromium
- run: npm run test:e2e
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: site/dist
retention-days: 1
deploy:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
id: deployment
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "22"
- name: Verify published artifact identity and routes
working-directory: site
env:
SITE_URL: ${{ steps.deployment.outputs.page_url }}
EXPECTED_COMMIT_SHA: ${{ github.sha }}
run: npm run deployment:verify
64 changes: 64 additions & 0 deletions .github/workflows/validate-gallery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Validate gallery

on:
pull_request:
branches: [master]
paths:
- "column-samples/**"
- "view-samples/**"
- "form-samples/**"
- "docs/**"
- "site/**"
- "sample-template.json"
- "samples.json"
- "README.md"
- ".gitignore"
- ".github/CONTRIBUTING.md"
- ".github/workflows/*gallery.yml"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: gallery-validation-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
validate:
name: Gallery content, build, and browser checks
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: site
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "22"
cache: npm
cache-dependency-path: site/package-lock.json
- run: npm ci
- run: npm run validate:samples
- run: npm run generate && npm test
- run: npm run check
- run: npm run build
- run: npx playwright install --with-deps chromium
- run: npm run test:e2e
- name: Summarize content and remaining review items
if: always()
run: |
if [ -f .cache/quality.json ]; then
node --input-type=module -e 'import fs from "node:fs"; const q=JSON.parse(fs.readFileSync(".cache/quality.json")); fs.appendFileSync(process.env.GITHUB_STEP_SUMMARY, `## List Formatting gallery\n${q.samples} samples, ${q.definitions} definitions, ${q.advisories.length} recorded review items.\nRead-only validation; no deployment or paid application services.\n`);'
fi
- name: Browser failure diagnostics
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: gallery-browser-failure
path: |
site/playwright-report/
site/test-results/
retention-days: 3
if-no-files-found: ignore
2 changes: 1 addition & 1 deletion .github/workflows/validate-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Sample validation
on:
pull_request_target:
branches:
- "main"
- "master"

jobs:
validate:
Expand Down
14 changes: 12 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,18 @@ typings/
# dotenv environment variables file
.env

# mkdocs build folder
site/
# Generated Astro gallery output
site/.astro/
site/.cache/
site/dist/
site/public/generated/
site/public/img/
site/public/tools/
site/public/catalog.json
site/public/quality.json
site/public/deployment.json
site/playwright-report/
site/test-results/

# Mac files
.DS_Store
140 changes: 140 additions & 0 deletions GALLERY-DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# Gallery development and operations

This guide is for contributors maintaining the gallery website. None of these
tools or build steps are required to browse the gallery or copy a sample.
For sample adoption, use the [repository README](./README.md#find-and-apply-a-format).

The gallery source lives in [site](./site/) and is an Astro static site served from the case-sensitive
`https://pnp.github.io/List-Formatting/` project path.

Commands below start from the repository root. After `Set-Location site`,
run subsequent npm commands from that project directory.

## Local review

Requires Node.js 22.19 or newer.

```powershell
Set-Location site
npm ci
npm run dev -- --port 4337
```

Open `http://127.0.0.1:4337/List-Formatting/`. To test the production output:

```powershell
npm run check
npm run build
npm run preview -- --port 4337
```

## Validation

```powershell
npm run validate:samples
npm test
npm run check
npm run build
npm run test:e2e
```

The build includes internal-link/asset validation. Browser tests start their own
production preview server on port 4337; stop any manual Astro preview for this
project first (Astro permits one preview process per project).
If Playwright reports that Chromium is missing, run `npx playwright install chromium`.

The generator reads every sample's metadata and discovers every root-level JSON
definition, including multi-file forms and chart variants. It validates strict
JSON (including duplicate keys), exact-case thumbnail paths, metadata invariants,
and unique final-line README trackers. Downloads preserve original bytes.

Pinned Microsoft formatting schemas and the PnP metadata schema are checked
offline. Historical schema incompatibilities and documentation review items are
visible in `quality.json` and the checked-in quality baseline. New issues fail
validation; this is not a blanket schema-validation bypass. Fix source where
possible. Updating the baseline is an explicit maintainer operation:

```powershell
npm run quality:baseline
```

Source fingerprints normalize checkout line endings and a leading UTF-8 BOM,
so the same content matches on Windows and Linux. Other source changes still
invalidate the recorded exception.

Review the changed baseline before accepting it. Schema validation is not proof
that a sample works in a SharePoint tenant. Test changed formats in their intended
list/form context, including long/empty values and required actions/permissions.

`npm run catalog:update` deterministically refreshes the repository's existing
[aggregate catalog](./samples.json) from sample metadata. Its array shape and
original metadata IDs are preserved for external consumers; Farrier can still
consume the original metadata. The Astro site does not depend on Farrier.
Existing committed entry order is retained, with new samples appended.
Validation rejects catalog drift and tells contributors to regenerate it.

## Free-by-default operation

- GitHub Pages serves static files; no database, functions, accounts, API keys,
paid search, new Azure resource, or runtime GitHub API calls are required.
- Standard hosted Actions runners for this public repository and GitHub Pages
for the public site are available without metered application infrastructure.
Private forks and changed GitHub plans can have different billing rules.
- Pull-request validation cancels superseded runs and uses bounded concurrency.
Browser diagnostics are retained only briefly. There are no scheduled crawlers.
- Publishing requires an explicit manual workflow dispatch. Merging a pull
request or running local development/build commands does not deploy the site.
- Client search works offline after the static page and assets load. Original
README images are lazy-loaded from GitHub; gallery previews are optimized local
stills. The site does not ship a second 241 MiB copy of original sample assets.
- The legacy HTML-to-Formatter bundle is copied without rebuilding its old
React/Webpack dependencies. Do not install those dependencies for a site build.

The existing visitor-image service is **disabled by default**, avoiding additional
requests to potentially metered community infrastructure. To opt in explicitly,
set `PUBLIC_ENABLE_VISITOR_STATS=true` during the build. Each sample then emits
one image using its original family-qualified README tracking identity; cards
and downloads do not track views. Rendered README trackers are always removed.
There is no Clarity/session-replay integration in the new site.

Contributors with recorded GitHub accounts show their public profile images,
requested directly from GitHub at a small size and lazy-loaded. This requires
no GitHub API calls, token, or additional hosting service. Contributors without
a recorded GitHub account retain an initial fallback.

## Production and rollback

The approved publishing path uses GitHub Actions as the GitHub Pages source.
Manually run **Deploy gallery** on upstream `master`. It validates the site,
uploads a Pages artifact, deploys it, and checks the published commit identity,
catalog hash, sample pages, previews, and definition downloads.

Astro and this workflow are the only supported documentation publishing path.
The obsolete documentation configuration and root deployment scripts have been
removed; no local helper should independently publish over the validated artifact.

To roll back after cutover, dispatch the deployment workflow on a reviewed revert
of the site changes. Keep the last known-good Pages deployment available in
GitHub's deployment history and retain a deployable artifact before the first
cutover. Record that production baseline before replacing it. Never publish an
unreviewed local branch.

### First-cutover rollback baseline

Before the Astro cutover, the public site published from the `gh-pages` branch
at commit `10584fe34be8285184acb448af3a0f0347be7dfe`, with source path `/`.
That branch is retained. If the first release must be rolled back, confirm its
revision and restore branch-based Pages publishing from that retained artifact;
do not overwrite or delete the branch during cutover.

## Assets and provenance

The site uses the existing repositories' MIT-licensed community layout patterns
and fonts, SharePoint brand artwork, and the official Community Contributor
Credly image. See [asset notices](./site/ASSET-NOTICES.md). Product logos and badges
retain their respective owners' rights; do not alter the mark or imply official
product support.

Generated files live in `.cache`, `public/generated`, copied documentation/tool
directories, and `dist`; they are not committed. All source links continue to
target `pnp/List-Formatting` on `master`, including when previewing a fork.
Loading
Loading