Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
dd63f8d
Update storybook to 8.6
kasperpeulen Apr 3, 2025
622592a
Improve coverage
kasperpeulen Apr 3, 2025
87c6a44
Ignore test-stories from coverage
kasperpeulen Apr 3, 2025
7f0942d
Externalize prettier
kasperpeulen Apr 3, 2025
abc21b2
upgrade storybook
ndelangen Jan 28, 2026
96ae661
upgrade eslint
ndelangen Jan 28, 2026
68e42f7
sync versions after vitest upgrade
ndelangen Jan 28, 2026
c357da0
fix test by not using shorthand in main.ts
ndelangen Jan 28, 2026
8178cc2
fix typescript issues
ndelangen Jan 28, 2026
1e3ed96
make the local storybook function again, switching to vite builder an…
ndelangen Jan 28, 2026
abcb82e
These tests seem to not be properly mocked right, info from this repo…
ndelangen Jan 28, 2026
19cda77
minor improvement
ndelangen Jan 28, 2026
04c967a
dynamic switch to react renderer when testing
ndelangen Jan 28, 2026
79260e9
separate the test-storybook and main storybook as they no longer shar…
ndelangen Jan 28, 2026
c3f8aed
rename files to be expected to contain JSX syntax
ndelangen Jan 28, 2026
30032b9
add second storybook cnofig dir to eslint ignore list
ndelangen Jan 28, 2026
155260b
fix eslint problem
ndelangen Jan 28, 2026
8e4f21c
fixes
ndelangen Jan 28, 2026
33642b3
storybook does not work on node18 anymore
ndelangen Jan 28, 2026
acedaca
rename
ndelangen Jan 28, 2026
2baa500
simplify test-storybook config dir
ndelangen Jan 28, 2026
627e8b8
address rename in main workflow
ndelangen Jan 28, 2026
ef9ddc5
simplify css injection
ndelangen Jan 28, 2026
8c213c3
improve visualization of html stories (fix regression)
ndelangen Jan 28, 2026
8663d43
:pencil2: Add back comments showing what each section of eslint confi…
jwir3 Jan 30, 2026
46b4337
:truck: Move vitest.no-threads.config.ts to mts format to avoid ESM e…
jwir3 Feb 2, 2026
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
10 changes: 4 additions & 6 deletions .github/workflows/pull-request-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,13 @@ jobs:
needs: lint-and-test
secrets:
SMOKE_TESTS_CHROMATIC_PROJECT_TOKEN: ${{ secrets.SMOKE_TESTS_CHROMATIC_PROJECT_TOKEN }}

smoke-test-node-18:
uses: ./.github/workflows/smoke-test-node18.yml
smoke-test-node-20:
uses: ./.github/workflows/smoke-test-node20.yml
needs: lint-and-test
secrets:
SMOKE_TESTS_CHROMATIC_PROJECT_TOKEN: ${{ secrets.SMOKE_TESTS_CHROMATIC_PROJECT_TOKEN }}

smoke-test-node-20:
uses: ./.github/workflows/smoke-test-node20.yml
smoke-test-node-22:
uses: ./.github/workflows/smoke-test-node22.yml
needs: lint-and-test
secrets:
SMOKE_TESTS_CHROMATIC_PROJECT_TOKEN: ${{ secrets.SMOKE_TESTS_CHROMATIC_PROJECT_TOKEN }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Smoke test via Node 18
name: Smoke test via Node 22

on:
workflow_call:
Expand All @@ -18,7 +18,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
node-version: 22
- run: yarn
- run: yarn build
- uses: ./
Expand Down
18 changes: 18 additions & 0 deletions .storybook-test/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { StorybookConfig } from '@storybook/react-vite';

const config: StorybookConfig = {
stories: ['../test-stories/*.stories.*'],
addons: [
'@storybook/addon-docs'
],
framework: {
name: '@storybook/react-vite',
options: {}
},
typescript: {
reactDocgen: 'react-docgen-typescript',
},
staticDirs: ['../static'],
};

export default config;
45 changes: 30 additions & 15 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,43 @@
import { StorybookConfig } from '@storybook/react-webpack5';
import { StorybookConfig } from '@storybook/html-vite';
import { fileURLToPath } from 'node:url';

const config: StorybookConfig = {
stories: process.env.SMOKE_TEST
? ['../test-stories/*.stories.*']
: ['../node-src/**/*.@(mdx|stories.*)'],
addons: ['@storybook/addon-essentials', '@storybook/addon-webpack5-compiler-swc'],
framework: {
name: '@storybook/react-webpack5',
options: {},
stories: ['../node-src/**/*.@(mdx|stories.*)'],
addons: [
'@storybook/addon-docs'
],
framework: {
name: '@storybook/html-vite',
options: {}
},
webpackFinal: async (config) => {
viteFinal: async (config) => {
config.resolve = {
...config.resolve,
fallback: {
...config?.resolve?.fallback,
os: require.resolve('os-browserify/browser'),
alias: {
...config.resolve?.alias,
os: fileURLToPath(import.meta.resolve('os-browserify/browser')),
},
};

return config;
},
docs: {},
previewHead: (head) => {
return head + `
<link href="./css/global.css" rel="stylesheet" />

<script>
window.process = {
env: {
CI: '1',
NODE_ENV: 'production',
STORYBOOK_INVOKED_BY: 'chromatic',
TERM: 'xterm-256color',
},
platform: '${process.platform}',
};
</script>
`;
},
typescript: {
reactDocgen: 'react-docgen-typescript',
},
staticDirs: ['../static'],
};
Expand Down
5 changes: 0 additions & 5 deletions .storybook/preview-head.html

This file was deleted.

51 changes: 51 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* eslint-env browser */
import type { Preview } from '@storybook/html-vite';

import ansiHTML from 'ansi-html';
import chalk from 'chalk';

ansiHTML.setColors({
reset: ['c0c4cd', '16242c'],
black: '16252b',
red: 'ec5e66',
green: '99c793',
yellow: 'fac862',
blue: '6699cb',
magenta: 'c593c4',
cyan: '5fb3b2',
});

// @ts-expect-error chalk is not fully typed
chalk.enabled = true;

chalk.level = 3;

const decorators = [
(storyFn, { kind }) => {
const value = storyFn();
console.log({value, kind});
if (kind.startsWith('CLI/')) {
document.body.style.backgroundColor = '#16242c';
return `<pre class="code-style"><code>${ansiHTML(value)}</code></pre>`;
}
if (kind.startsWith('HTML/')) {
document.body.style.backgroundColor = '#F6F9FC';
return `<div class="html-style">${value}</div>`;
}
document.body.style.backgroundColor = 'paleturquoise';
return value;
},
];

const tags = ['autodocs', 'autodocs'];

const preview: Preview = {
parameters: {
layout: 'fullscreen',
},
decorators,
tags,
};

export default preview;

67 changes: 0 additions & 67 deletions .storybook/preview.tsx

This file was deleted.

3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"hichroma",
"opensource",
"rebased"
]
],
"typescript.tsdk": "node_modules/typescript/lib"
}
1 change: 0 additions & 1 deletion bin-src/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {

vi.mock('jsonfile', async (importOriginal) => {
return {
// @ts-expect-error TS does not think actual is an object, but it's fine.
...(await importOriginal()),
writeFile: vi.fn(() => Promise.resolve()),
};
Expand Down
Loading
Loading