Skip to content

Commit ce3f682

Browse files
authored
Merge pull request #2341 from CDCgov/dev
4.25.9 dev > test
2 parents 582af14 + 91b9a99 commit ce3f682

File tree

352 files changed

+18924
-10501
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

352 files changed

+18924
-10501
lines changed

.github/workflows/storybook-deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313

1414
steps:
1515
- uses: actions/checkout@v4
16-
- name: Use Node.js 18.x
16+
- name: Use Node.js 20.x
1717
uses: actions/setup-node@v3
1818
with:
19-
node-version: 18.x
19+
node-version: 20.x
2020
cache: 'npm'
2121
- run: npx yarn install
2222
- run: npm install -g storybook
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: Test Storybook
22

33
on:
44
workflow_dispatch:
5+
pull_request:
6+
branches: [main, dev]
57

68
jobs:
79
storybook-tests:
@@ -14,7 +16,7 @@ jobs:
1416
- name: Setup Node
1517
uses: actions/setup-node@v3
1618
with:
17-
node-version: 18
19+
node-version: 20
1820
cache: yarn
1921

2022
- name: Install dependencies
@@ -23,9 +25,6 @@ jobs:
2325
- name: Build Packages
2426
run: lerna run build
2527

26-
- name: Build Storybook
27-
run: yarn build-storybook --output-dir storybook-static
28-
2928
- name: Add Playwright
3029
run: npx playwright install
3130

@@ -36,4 +35,4 @@ jobs:
3635
run: npx wait-on http://localhost:6006
3736

3837
- name: Run Storybook tests
39-
run: yarn test-storybook
38+
run: yarn test-storybook --no-watch --reporter=default

.github/workflows/unit-test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ jobs:
1313

1414
steps:
1515
- uses: actions/checkout@v4
16-
- name: Use Node.js 18.x
16+
- name: Use Node.js 20.x
1717
uses: actions/setup-node@v3
1818
with:
19-
node-version: 18.x
19+
node-version: 20.x
2020
cache: 'npm'
2121
- run: npx yarn install
22+
- run: lerna run build
2223
- run: npm run test --workspaces

.storybook/coveSbThemes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// COVE Storybook Themes
2-
import { create } from '@storybook/theming'
2+
import { create } from 'storybook/theming'
33
import logo from './assets/cove-logo-long.svg'
44

55
export const managerTheme = create({

.storybook/main.ts

Lines changed: 59 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,94 @@
1+
import { createRequire } from 'node:module'
2+
import { dirname, join } from 'node:path'
13
import { mergeConfig } from 'vite'
24
import type { StorybookConfig } from '@storybook/react-vite'
35
import react from '@vitejs/plugin-react'
46
import svgr from 'vite-plugin-svgr' // Svg Support
57

8+
const require = createRequire(import.meta.url)
9+
610
const config: StorybookConfig = {
711
stories: [
8-
'../_stories/*.mdx',
9-
'../packages/**/_stories/*.stories.@(js|jsx|ts|tsx|mdx)',
12+
'../_stories/*.stories.@(js|jsx|ts|tsx)',
13+
'../packages/**/_stories/*.stories.@(js|jsx|ts|tsx)',
1014
'../_stories/private/**/*.stories.@(js|jsx|ts|tsx)'
1115
],
16+
1217
addons: [
13-
'@storybook/addon-links',
14-
'@storybook/addon-essentials',
15-
'@storybook/addon-interactions',
16-
'storybook-addon-fetch-mock',
17-
'@storybook/addon-a11y',
18-
'@storybook/addon-docs'
18+
getAbsolutePath('@storybook/addon-links'),
19+
// getAbsolutePath("storybook-addon-fetch-mock"), // Incompatible with Storybook 9 - cannot resolve @storybook/preview-api
20+
getAbsolutePath('@storybook/addon-a11y'),
21+
getAbsolutePath('@storybook/addon-docs'),
22+
getAbsolutePath('@storybook/addon-vitest')
1923
],
24+
2025
staticDirs: ['./assets'],
26+
2127
framework: {
22-
name: '@storybook/react-vite',
28+
name: getAbsolutePath('@storybook/react-vite'),
2329
options: {}
2430
},
31+
2532
features: {
2633
storyStoreV7: true
2734
},
35+
2836
core: {
29-
builder: '@storybook/builder-vite',
37+
builder: getAbsolutePath('@storybook/builder-vite'),
3038
disableTelemetry: true
3139
},
32-
docs: {
33-
autodocs: 'tag'
34-
},
40+
3541
typescript: {
3642
reactDocgen: false // https://github.com/storybookjs/storybook/issues/22164#issuecomment-1603627308
3743
},
44+
45+
docs: {
46+
autodocs: 'tag'
47+
},
48+
3849
viteFinal: async (config, { configType }) => {
3950
console.log('Storybook build mode: ', configType)
4051

52+
// Common SVG configuration for both dev and build
53+
const svgrConfig = {
54+
svgrOptions: {
55+
exportType: 'default',
56+
ref: true,
57+
svgo: false,
58+
titleProp: true
59+
},
60+
include: '**/*.svg'
61+
}
62+
4163
if (configType === 'DEVELOPMENT') {
4264
// run Storybook locally
4365
return mergeConfig(config, {
44-
plugins: [svgr({ exportAsDefault: true })]
66+
css: {
67+
preprocessorOptions: {
68+
scss: {
69+
// Suppress SASS @import deprecation warnings (same as packages)
70+
quietDeps: true,
71+
silenceDeprecations: ['legacy-js-api', 'import']
72+
}
73+
}
74+
},
75+
plugins: [react({ jsxRuntime: 'automatic' }), svgr(svgrConfig)]
4576
})
4677
}
4778

4879
return mergeConfig(config, {
4980
commonjsOptions: {
5081
include: [/@cdc\/core/, /node_modules/]
5182
},
83+
css: {
84+
preprocessorOptions: {
85+
scss: {
86+
// Suppress SASS @import deprecation warnings (same as packages)
87+
quietDeps: true,
88+
silenceDeprecations: ['legacy-js-api', 'import']
89+
}
90+
}
91+
},
5292
build: {
5393
sourcemap: false,
5494
lib: {
@@ -65,12 +105,14 @@ const config: StorybookConfig = {
65105
plugins: [
66106
// changed from classic to automatic 02/21 for import React error.
67107
react({ jsxRuntime: 'automatic' }), //https://github.com/babel/babel/discussions/13013
68-
svgr({
69-
exportAsDefault: true
70-
})
108+
svgr(svgrConfig)
71109
]
72110
})
73111
}
74112
}
75113

76114
export default config
115+
116+
function getAbsolutePath(value: string): any {
117+
return dirname(require.resolve(join(value, 'package.json')))
118+
}

.storybook/manager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { addons } from '@storybook/addons';
1+
import { addons } from 'storybook/manager-api'
22
import { managerTheme } from './coveSbThemes'
33

44
// Assets
@@ -8,4 +8,4 @@ addons.setConfig({
88
theme: managerTheme,
99
isToolshown: false,
1010
configureJsx: true
11-
});
11+
})

_stories/Guide.NewComponents.stories.mdx

Lines changed: 0 additions & 80 deletions
This file was deleted.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import type { Meta } from '@storybook/react'
2+
3+
const meta: Meta = {
4+
title: 'Guides/New Components',
5+
parameters: {
6+
docs: {
7+
page: () => (
8+
<div style={{ padding: '20px' }}>
9+
<h1>Adding New Components</h1>
10+
<p>This guide will walk you through the process of creating a new component.</p>
11+
12+
<h2>Naming Conventions</h2>
13+
<ul>
14+
<li>Because the components are imported directly from COVE related files, there is no need to reference <code>COVE</code> in the component name. For example, <code>CoveButton</code> should just be named <code>Button</code>.</li>
15+
<li>Components should be named in PascalCase, and should be named after the component itself. For example, a component that renders a button should be named <code>Button</code>, not <code>ButtonComponent</code>.</li>
16+
<li>Subcomponents should include the name of the parent component, then list its variation, subvariation, etc. The file name should have variation separated by a period in the file name.</li>
17+
</ul>
18+
19+
<h3>Example</h3>
20+
<pre><code>Map.jsx → Map.Marker.jsx → Map.Marker.Icon.jsx</code></pre>
21+
<pre><code>Map() → MapMarker() → MapMarkerIcon()</code></pre>
22+
23+
<h2>File Structure</h2>
24+
<p>All global components should be placed in its related <code>./packages/core/components/***</code> directory.</p>
25+
26+
<p>The <code>***</code> directory should be representative of the type of component being created:</p>
27+
<ul>
28+
<li><strong>editor</strong> - Components/subcomponents specific to the Editor view</li>
29+
<li><strong>element</strong> - Elements that are consumed for use in COVE</li>
30+
<li><strong>hoc</strong> - Higher-order components</li>
31+
<li><strong>input</strong> - Input components for Editor Panels</li>
32+
<li><strong>loader</strong> - Loading components</li>
33+
<li><strong>manager</strong> - Data management components</li>
34+
<li><strong>ui</strong> - Basic UI building blocks</li>
35+
</ul>
36+
</div>
37+
)
38+
}
39+
}
40+
}
41+
42+
export default meta
43+
44+
export const Guide = {
45+
render: () => (
46+
<div style={{ padding: '20px' }}>
47+
<h1>Adding New Components</h1>
48+
<p>This guide will walk you through the process of creating a new component.</p>
49+
50+
<h2>Naming Conventions</h2>
51+
<ul>
52+
<li>Because the components are imported directly from COVE related files, there is no need to reference <code>COVE</code> in the component name. For example, <code>CoveButton</code> should just be named <code>Button</code>.</li>
53+
<li>Components should be named in PascalCase, and should be named after the component itself. For example, a component that renders a button should be named <code>Button</code>, not <code>ButtonComponent</code>.</li>
54+
<li>Subcomponents should include the name of the parent component, then list its variation, subvariation, etc. The file name should have variation separated by a period in the file name.</li>
55+
</ul>
56+
57+
<h3>Example</h3>
58+
<pre><code>Map.jsx → Map.Marker.jsx → Map.Marker.Icon.jsx</code></pre>
59+
<pre><code>Map() → MapMarker() → MapMarkerIcon()</code></pre>
60+
61+
<h2>File Structure</h2>
62+
<p>All global components should be placed in its related <code>./packages/core/components/***</code> directory.</p>
63+
64+
<p>The <code>***</code> directory should be representative of the type of component being created:</p>
65+
<ul>
66+
<li><strong>editor</strong> - Components/subcomponents specific to the Editor view</li>
67+
<li><strong>element</strong> - Elements that are consumed for use in COVE</li>
68+
<li><strong>hoc</strong> - Higher-order components</li>
69+
<li><strong>input</strong> - Input components for Editor Panels</li>
70+
<li><strong>loader</strong> - Loading components</li>
71+
<li><strong>manager</strong> - Data management components</li>
72+
<li><strong>ui</strong> - Basic UI building blocks</li>
73+
</ul>
74+
</div>
75+
)
76+
}

0 commit comments

Comments
 (0)