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
44 changes: 24 additions & 20 deletions .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,31 @@ jobs:
- name: Run source e2e tests
run: pnpm test:e2e

- name: Build library and docs
run: pnpm build
- name: Build docs E2E assets
run: pnpm build:docs:e2e

- name: Run docs page e2e tests
run: pnpm test:e2e:docs:preview

- name: Run coverage on main
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: pnpm coverage

- name: Upload coverage to Codecov
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: site-build
if-no-files-found: error
path: |
dist
docs/dist

smoke:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: verify
Expand Down Expand Up @@ -75,20 +93,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v6

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v6
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
node-version: 20
cache: pnpm

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

- name: Build library and docs
run: pnpm build
name: site-build
path: .

- name: Deploy docs
uses: crazy-max/ghaction-github-pages@v4
Expand All @@ -97,8 +106,3 @@ jobs:
build_dir: docs/dist
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# [0.6.0](https://github.com/remanufacturing/react-truncate/compare/v0.5.2...v0.6.0) (2026-03-08)


### Bug Fixes

* **truncate:** cover middle truncation edge cases ([2a4ce82](https://github.com/remanufacturing/react-truncate/commit/2a4ce82b27b4cd343a2b90c863a6412e47bcb78d))


### Features

* **Truncate:** add opt-in preserveMarkup rendering ([03b0b51](https://github.com/remanufacturing/react-truncate/commit/03b0b51fd788403eda6e513a2ddfe6c9599bb1f2))
* **Truncate:** make preserveMarkup measurement style-aware ([3719968](https://github.com/remanufacturing/react-truncate/commit/3719968ed832c7ffa6604a53bdd74d409714e8d7))



## [0.5.2](https://github.com/remanufacturing/react-truncate/compare/v0.5.1...v0.5.2) (2025-08-19)


Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

Provides `Truncate`, `MiddleTruncate` and `ShowMore` React components for truncating multi-line spans and adding an ellipsis.

When you need the collapsed state to keep rendered inline markup such as links, classes, or inline styles, enable the opt-in `preserveMarkup` prop on `Truncate` or `ShowMore`. The default path remains optimized for plain-text truncation.

## Installation

With npm(or yarn, or pnpm):
Expand Down
20 changes: 19 additions & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
import defaultConfig from '@commitlint/config-conventional'
import { RuleConfigSeverity } from '@commitlint/types'

const baseTypes = defaultConfig.rules['type-enum'][2]

export default {
extends: ['@commitlint/config-conventional'],
...defaultConfig,
rules: {
...defaultConfig.rules,
'type-enum': [
RuleConfigSeverity.Error,
'always',
[
...baseTypes,
'release', // Release new version
'wip', // Work in Progress
'deprecated', // Deprecated API
],
],
},
}
176 changes: 176 additions & 0 deletions docs/plans/2026-03-08-docs-e2e-ci-speedup-implementation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
# Docs E2E CI Speedup Implementation Plan

> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.

**Goal:** Reduce CI time for docs-page E2E by separating docs build work from docs preview test execution, so the docs suite does not rebuild the library and docs site inside Playwright setup.

**Architecture:** Keep `pnpm test:e2e:docs` as the convenient all-in-one local entry point, but split CI-facing responsibilities into two layers: a build layer that produces `dist/` and `docs/dist/`, and a preview-only Playwright layer that only launches `astro preview` against prebuilt assets. Wire CI to build once, then run docs E2E against the prebuilt output. Avoid artifact orchestration for now; rely on job-local reuse inside the same checkout to keep the change small and stable.

**Tech Stack:** pnpm, Playwright, Astro preview, GitHub Actions, Node.js 20

---

### Task 1: Add a preview-only docs E2E path

**Files:**
- Modify: `e2e/docs-global-setup.mjs`
- Modify: `package.json`
- Test: `playwright.docs.config.ts`

**Step 1: Write the failing expectation**

Define the intended split in commands:

```bash
pnpm test:e2e:docs
pnpm test:e2e:docs:preview e2e/tests/docs-pages.spec.ts
```

The first remains all-in-one. The second must only preview and test already-built docs.

**Step 2: Run command to verify it fails**

Run: `pnpm test:e2e:docs:preview --list`
Expected: FAIL because the script does not exist yet.

**Step 3: Write minimal implementation**

Update the docs E2E entrypoints so:

- `test:e2e:docs` still works as the all-in-one developer command
- `test:e2e:docs:preview` runs the same Playwright config with an env flag such as `SKIP_DOCS_E2E_BUILD=1`
- `e2e/docs-global-setup.mjs` skips `pnpm build:lib` and `pnpm -F docs build` when that env flag is set
- the setup still always starts and health-checks `astro preview`

**Step 4: Run command to verify it passes**

Run: `pnpm test:e2e:docs:preview --list`
Expected: PASS and list the docs-page specs.

**Step 5: Commit**

```bash
git add package.json e2e/docs-global-setup.mjs
git commit -m "test: split docs e2e preview from build"
```

### Task 2: Add a dedicated build command for CI reuse

**Files:**
- Modify: `package.json`

**Step 1: Write the failing expectation**

Define a single explicit command that CI can run once before docs-page Playwright:

```bash
pnpm build:docs:e2e
```

It should build both the library output and the docs static output needed by preview.

**Step 2: Run command to verify it fails**

Run: `pnpm build:docs:e2e`
Expected: FAIL because the script does not exist yet.

**Step 3: Write minimal implementation**

Add a script such as:

```json
{
"scripts": {
"build:docs:e2e": "run-s build:lib build:docs"
}
}
```

Keep it small and explicit. Do not over-abstract the build matrix.

**Step 4: Run command to verify it passes**

Run: `pnpm build:docs:e2e`
Expected: PASS and produce `dist/` plus `docs/dist/`.

**Step 5: Commit**

```bash
git add package.json
git commit -m "build: add docs e2e build entrypoint"
```

### Task 3: Rewire CI so docs E2E reuses the prebuilt output

**Files:**
- Modify: `.github/workflows/github-ci.yml`

**Step 1: Write the failing checklist**

The `verify` job should satisfy this updated sequence:

- install dependencies once
- install Playwright Chromium once
- run `pnpm test:run`
- run `pnpm test:e2e`
- run `pnpm build:docs:e2e`
- run `pnpm test:e2e:docs:preview e2e/tests/docs-pages.spec.ts`
- only then continue to coverage or downstream jobs

**Step 2: Compare current workflow to the checklist**

Inspect: `.github/workflows/github-ci.yml`
Expected: FAIL because docs-page E2E is not yet wired as a preview-only post-build step.

**Step 3: Write minimal implementation**

Update CI so the `verify` job:

- builds docs-page E2E assets once with `pnpm build:docs:e2e`
- runs docs-page Playwright via `pnpm test:e2e:docs:preview e2e/tests/docs-pages.spec.ts`
- does not trigger a second docs rebuild inside Playwright setup

Do not add artifacts or extra jobs yet.

**Step 4: Verify the workflow definition**

Run: `sed -n '1,260p' .github/workflows/github-ci.yml`
Expected: the verify job clearly builds once and runs preview-only docs E2E after that build.

**Step 5: Commit**

```bash
git add .github/workflows/github-ci.yml
git commit -m "ci: reuse built docs output for docs e2e"
```

### Task 4: Run focused verification for the split flow

**Files:**
- Verify only

**Step 1: Run the build command**

Run: `pnpm build:docs:e2e`
Expected: PASS.

**Step 2: Run preview-only docs E2E**

Run: `pnpm test:e2e:docs:preview e2e/tests/docs-pages.spec.ts`
Expected: PASS without rebuilding docs inside Playwright setup.

**Step 3: Run the all-in-one command**

Run: `pnpm test:e2e:docs e2e/tests/docs-pages.spec.ts`
Expected: PASS so local developer ergonomics remain unchanged.

**Step 4: Review changed files**

Run:

```bash
git status --short
git diff --stat
```

Expected: only docs E2E entrypoints, scripts, and CI wiring changed for this speedup task.
57 changes: 57 additions & 0 deletions docs/plans/2026-03-08-e2e-suite-isolation-implementation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# E2E Suite Isolation Implementation Plan

> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.

**Goal:** Prevent docs-only Playwright specs from ever being picked up by the main source E2E suite again.

**Architecture:** Split Playwright specs by responsibility at the filesystem level. Keep source-app browser tests under `e2e/tests` for the main Vite-backed config, and move docs-page browser tests into `e2e/docs` for the Astro-preview-backed config. This removes suite overlap without depending on `testIgnore` filters.

**Tech Stack:** Playwright, pnpm, Astro preview, Vite

---

### Task 1: Separate docs specs from source specs

**Files:**
- Create: `e2e/docs/docs-pages.spec.ts`
- Modify: `playwright.docs.config.ts`
- Modify: `playwright.config.ts`
- Remove: `e2e/tests/docs-pages.spec.ts`

**Step 1: Write the failing expectation**

Define the intended suite boundaries:

```bash
pnpm test:e2e --list
pnpm test:e2e:docs:preview --list
```

The first should list only source-app tests. The second should list only docs-page tests.

**Step 2: Run commands to show current overlap risk**

Run: `pnpm test:e2e --list`
Expected: PASS but currently relies on `testIgnore`, proving the suite boundary is config-based instead of directory-based.

**Step 3: Write minimal implementation**

- Move `docs-pages.spec.ts` into `e2e/docs/`
- Point `playwright.docs.config.ts` at `./e2e/docs`
- Remove the temporary `testIgnore` from `playwright.config.ts`

**Step 4: Run commands to verify the split**

Run: `pnpm test:e2e --list`
Expected: PASS and list only `components.spec.ts`

Run: `pnpm test:e2e:docs:preview e2e/docs/docs-pages.spec.ts --workers=1`
Expected: PASS and run only the 2 docs-page tests

**Step 5: Commit**

```bash
git add playwright.config.ts playwright.docs.config.ts e2e/docs/docs-pages.spec.ts
git rm e2e/tests/docs-pages.spec.ts
git commit -m "test: isolate docs e2e suite"
```
Loading