Skip to content

Commit 014a398

Browse files
authored
Chromatic Hosting for Storybook (#162)
* Use Chromatic for storybook * Add fetch-depth 0 to checkout * Correct links in README * Add Chromatic Thanks * Remove push on storybook branch * Update rollup dependencies * Run build-storybook in CI
1 parent c620df7 commit 014a398

File tree

7 files changed

+770
-189
lines changed

7 files changed

+770
-189
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ jobs:
1717
- name: Typescript build
1818
run: yarn build
1919
- name: Storybook build
20-
run: yarn storybook-to-ghpages --dry-run --ci
20+
run: yarn build-storybook

.github/workflows/storybook.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@master
13+
uses: actions/checkout@v3
1414
with:
15-
persist-credentials: false
15+
fetch-depth: 0
1616

1717
- name: Yarn Install
1818
run: yarn install
1919

2020
- name: Deploy Storybook
21-
run: mkdir -p storybook-build && touch storybook-build/.nojekyll && yarn storybook-to-ghpages --ci --out storybook-build
22-
env:
23-
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
21+
uses: chromaui/action@v1
22+
with:
23+
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
24+
token: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ If you're coming from versions of the library prior to 1.0.0, please give [this
1919

2020
## Upgrading to 2.0
2121

22-
If you're upgrading to 2.0, please be aware we have made some breaking changes. [This doc](/docs/upgrade-to-2.0.md) has the details.
22+
If you're upgrading to 2.0, please be aware we have made some breaking changes. [This doc](/docs/upgrade-to-2.0.md) has the details.
2323

2424
## Installation
2525

@@ -51,7 +51,7 @@ class GetStartedButton extends PureComponent {
5151

5252
### Storybook
5353

54-
A storybook containing all of the components and their usage can be found [here](https://nhsdigital.github.io/nhsuk-react-components).
54+
A storybook containing all of the components and their usage can be found [here](https://main--6422e711d7f854c1b681c505.chromatic.com).
5555

5656
## Maintainers
5757

@@ -61,6 +61,7 @@ A storybook containing all of the components and their usage can be found [here]
6161
- Sam Brown ([GitHub](https://github.com/samueldavidbrown))
6262
- Luke Pearson ([GitHub](https://github.com/lukepearson))
6363
- Kevin Kuszyk ([GitHub](https://github.com/kevinkuszyk))
64+
- Kai Spencer ([GitHub](https://github.com/KaiSpencer))
6465

6566
## Preparing Releases
6667

@@ -72,3 +73,9 @@ To prepare a release create a new release TAG in github with your release versio
7273
7374
- Create a new release with a tag like `major.minor.patch` against main.
7475
- If the change is a `beta` then select `pre-release` as true, this will make the `tag` point at `beta`. Otherwise the tag will be `latest`.
76+
77+
## Thanks
78+
79+
<a href="https://www.chromatic.com/"><img src="https://user-images.githubusercontent.com/321738/84662277-e3db4f80-af1b-11ea-88f5-91d67a5e59f6.png" width="153" height="30" alt="Chromatic" /></a>
80+
81+
Thanks to [Chromatic](https://www.chromatic.com/) for providing the visual testing platform that helps us review UI changes and catch visual regressions.

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
"@babel/cli": "^7.13.16",
1212
"@babel/core": "^7.19.6",
1313
"@babel/preset-react": "^7.18.6",
14-
"@rollup/plugin-commonjs": "^19.0.0",
15-
"@rollup/plugin-node-resolve": "^13.0.0",
14+
"@rollup/plugin-commonjs": "^24.1.0",
15+
"@rollup/plugin-node-resolve": "^15.0.2",
16+
"@rollup/plugin-typescript": "^11.1.0",
1617
"@storybook/addon-actions": "^7.0.2",
1718
"@storybook/addon-essentials": "^7.0.2",
1819
"@storybook/addon-links": "^7.0.2",
@@ -21,17 +22,18 @@
2122
"@storybook/preview-web": "^7.0.2",
2223
"@storybook/react": "^7.0.2",
2324
"@storybook/react-vite": "^7.0.2",
24-
"@storybook/storybook-deployer": "^2.8.16",
2525
"@storybook/theming": "^7.0.2",
2626
"@types/enzyme": "^3.10.8",
2727
"@types/jest": "^26.0.23",
2828
"@types/jest-axe": "^3.5.1",
2929
"@types/node": "^15.0.2",
3030
"@types/react": "16.14.0",
3131
"@types/react-dom": "^16.9.12",
32+
"@types/rollup-plugin-peer-deps-external": "^2.2.1",
3233
"@typescript-eslint/eslint-plugin": "^4.23.0",
3334
"@typescript-eslint/parser": "^4.23.0",
3435
"babel-loader": "^8.2.2",
36+
"chromatic": "^6.17.3",
3537
"enzyme": "^3.11.0",
3638
"enzyme-adapter-react-16": "^1.15.6",
3739
"enzyme-to-json": "^3.6.2",
@@ -51,9 +53,9 @@
5153
"react": "^16.14.0",
5254
"react-dom": "^16.14.0",
5355
"regenerator-runtime": "^0.13.7",
54-
"rollup": "^2.47.0",
56+
"rollup": "^3.20.2",
57+
"rollup-plugin-dts": "^5.3.0",
5558
"rollup-plugin-peer-deps-external": "^2.2.4",
56-
"rollup-plugin-typescript2": "^0.34.1",
5759
"sass": "^1.32.12",
5860
"storybook": "^7.0.2",
5961
"ts-jest": "^26.5.6",

rollup.config.js renamed to rollup.config.mjs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import commonjs from '@rollup/plugin-commonjs';
22
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
33
import resolve from '@rollup/plugin-node-resolve';
4-
import typescript from 'rollup-plugin-typescript2';
5-
6-
// eslint-disable-next-line @typescript-eslint/no-var-requires
7-
const packageJson = require('./package.json');
4+
import typescript from '@rollup/plugin-typescript';
5+
import dts from 'rollup-plugin-dts';
6+
import packageJson from './package.json' assert { type: 'json' };
87

98
const plugins = [
109
peerDepsExternal(),
1110
resolve(),
1211
commonjs(),
13-
typescript({ typescript: require('typescript') }),
12+
typescript({ tsconfig: './tsconfig.json' }),
1413
];
1514

1615
export default [
@@ -30,4 +29,9 @@ export default [
3029
],
3130
plugins,
3231
},
32+
{
33+
input: 'dist/lib/index.d.ts',
34+
output: [{ file: 'dist/index.d.ts', format: 'esm' }],
35+
plugins: [dts()],
36+
},
3337
];

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"declaration": true,
44
"declarationDir": "lib",
55
"module": "esnext",
6-
"target": "ES5",
6+
"target": "ES6",
77
"lib": ["es5", "es6", "dom", "es2016", "es2017"],
88
"sourceMap": true,
99
"jsx": "react",

0 commit comments

Comments
 (0)