Skip to content

Commit 3d8aef3

Browse files
committed
use new toc gen
1 parent aa93f3f commit 3d8aef3

File tree

4 files changed

+141
-114
lines changed

4 files changed

+141
-114
lines changed

.remarkrc.mjs

Lines changed: 0 additions & 11 deletions
This file was deleted.

README.md

Lines changed: 44 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
<h1 align="center">⚡ global-cache</h1>
22

3-
<div align="center">
4-
5-
<p>A key-value cache for sharing data between parallel workers and test runs</p>
6-
7-
[![lint](https://github.com/vitalets/global-cache/actions/workflows/lint.yaml/badge.svg)](https://github.com/vitalets/global-cache/actions/workflows/lint.yaml)
8-
[![test](https://github.com/vitalets/global-cache/actions/workflows/test.yaml/badge.svg)](https://github.com/vitalets/global-cache/actions/workflows/test.yaml)
9-
![license](https://img.shields.io/github/license/vitalets/global-cache)
3+
<p align="center">
4+
A key-value cache for sharing data between parallel workers and test runs
5+
</p>
106

11-
</div>
7+
<p align="center">
8+
<a href="https://github.com/vitalets/global-cache/actions/workflows/lint.yaml">
9+
<img alt="lint" src="https://github.com/vitalets/global-cache/actions/workflows/lint.yaml/badge.svg" />
10+
</a>
11+
<a href="https://github.com/vitalets/global-cache/actions/workflows/test.yaml">
12+
<img alt="test" src="https://github.com/vitalets/global-cache/actions/workflows/test.yaml/badge.svg" />
13+
</a>
14+
<a href="https://github.com/vitalets/global-cache/blob/main/LICENSE">
15+
<img alt="license" src="https://img.shields.io/github/license/vitalets/global-cache" />
16+
</a>
17+
</p>
1218

1319
> \[!IMPORTANT]
1420
> **The package was renamed** from `@vitalets/global-cache` to `@global-cache/playwright` to provide better Playwright integration.
@@ -39,66 +45,43 @@ Under the hood, Global Cache spins up a tiny HTTP server, with a simple REST API
3945

4046
</details>
4147

42-
## Index
43-
44-
<details><summary>Click to expand</summary>
45-
46-
* [Usage (Playwright)](#usage-playwright)
47-
* [Install](#install)
48-
* [Configure](#configure)
49-
* [Use in tests](#use-in-tests)
50-
* [Dynamic keys](#dynamic-keys)
51-
* [Persistent values](#persistent-values)
52-
* [Examples](#examples)
53-
* [Authentication (single user)](#authentication-single-user)
54-
* [Authentication (multi user)](#authentication-multi-user)
55-
* [Sharing a variable (BeforeAll)](#sharing-a-variable-beforeall)
56-
* [Caching network request](#caching-network-request)
57-
* [Cleanup (single value)](#cleanup-single-value)
58-
* [Cleanup (dynamic keys)](#cleanup-dynamic-keys)
59-
* [Typed cache](#typed-cache)
60-
* [Configuration](#configuration)
61-
* [API](#api)
62-
* [`globalCache.wrap(config)`](#globalcachewrapconfig)
63-
* [`globalCache.defineConfig(config)`](#globalcachedefineconfigconfig)
64-
* [`globalCache.get(key,[ params,] computeFn)`](#globalcachegetkey-params-computefn)
65-
* [`globalCache.getStale(key)`](#globalcachegetstalekey)
66-
* [`globalCache.getStaleList(prefix)`](#globalcachegetstalelistprefix)
67-
* [`globalCache.clearTestRun()`](#globalcachecleartestrun)
68-
* [`globalCache.setup`](#globalcachesetup)
69-
* [`globalCache.teardown`](#globalcacheteardown)
70-
* [`globalCache.reporter`](#globalcachereporter)
71-
* [Debug](#debug)
72-
* [Changelog](#changelog)
73-
* [FAQ](#faq)
74-
* [How to use Global Cache in the AfterAll hook?](#how-to-use-global-cache-in-the-afterall-hook)
75-
* [Feedback](#feedback)
76-
* [License](#license)
48+
## `@global-cache/playwright`
7749

78-
</details>
50+
Currently Global Cache is primarily focused on [Playwright](https://playwright.dev/) and provides a dedicated package `@global-cache/playwright`.
7951

80-
## Usage (Playwright)
52+
<!-- section-toc start -->
53+
54+
* [Installation](#installation)
55+
* [Configuration](#configuration)
56+
* [Usage](#usage)
57+
* [Dynamic keys](#dynamic-keys)
58+
* [Persistent values](#persistent-values)
8159

82-
Currently Global Cache is primarily developed for [Playwright](https://playwright.dev/), but can be integrated with other frameworks.
60+
<!-- section-toc end -->
8361

84-
### Install
62+
### Installation
8563

8664
Install via any package manager.
8765

8866
Npm:
67+
8968
```sh
9069
npm i -D @global-cache/playwright
9170
```
71+
9272
Pnpm:
73+
9374
```sh
9475
pnpm add -D @global-cache/playwright
9576
```
77+
9678
Yarn:
79+
9780
```sh
9881
yarn add -D @global-cache/playwright
9982
```
10083

101-
### Configure
84+
### Configuration
10285

10386
Wrap your Playwright config with `globalCache.wrap()`:
10487

@@ -135,7 +118,19 @@ export default defineConfig({
135118

136119
</details>
137120

138-
### Use in tests
121+
To provide [Global Cache options](#globalcachedefineconfigconfig), call `globalCache.config()`:
122+
123+
```ts
124+
import { globalCache } from '@global-cache/playwright';
125+
126+
globalCache.config({
127+
// ...global cache options
128+
});
129+
130+
// ...
131+
```
132+
133+
### Usage
139134

140135
In tests and hooks, wrap heavy operations with `globalCache.get(key, computeFn)` to compute the value once and share between workers:
141136

@@ -500,20 +495,6 @@ const value = await globalCache.get('foo', fn);
500495
> \[!TIP]
501496
> Check out a fully working example of [typed cache](/examples/typed-cache/).
502497
503-
## Configuration
504-
505-
To provide configuration options, call `globalCache.config()`:
506-
507-
```ts
508-
import { globalCache } from '@global-cache/playwright';
509-
510-
globalCache.config({
511-
// ...global cache options
512-
});
513-
```
514-
515-
[Available options](#globalcachedefineconfigconfig).
516-
517498
## API
518499

519500
`globalCache` is a singleton used to manage cache values. Import it directly from the package:

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535
"publint": "^0.3.7",
3636
"release-it": "^19.0.4",
3737
"remark-cli": "^12.0.1",
38-
"remark-collapse": "^0.1.2",
39-
"remark-toc": "^9.0.0",
38+
"remark-section-toc": "^1.0.0",
4039
"remark-validate-links": "^13.1.0",
4140
"turbo": "latest",
4241
"typescript": "^5.9.3",
@@ -51,5 +50,11 @@
5150
"semi": true,
5251
"trailingComma": "all",
5352
"bracketSpacing": true
53+
},
54+
"remarkConfig": {
55+
"plugins": [
56+
"remark-section-toc",
57+
"remark-validate-links"
58+
]
5459
}
5560
}

0 commit comments

Comments
 (0)