@royaloperahouse/harmonic 0.14.0 → 0.15.0-b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -0
- package/README.md +268 -43
- package/dist/components/atoms/Dropdown/Dropdown.d.ts +1 -1
- package/dist/components/atoms/Tab/Tab.d.ts +1 -1
- package/dist/components/atoms/TextField/TextField.style.d.ts +1 -1
- package/dist/components/index.d.ts +3 -3
- package/dist/components/molecules/BodyContent/BodyContent.d.ts +6 -1
- package/dist/components/molecules/Card/Card.style.d.ts +1 -1
- package/dist/components/molecules/ContentSummary/ContentSummary.style.d.ts +1 -1
- package/dist/components/molecules/Information/Information.style.d.ts +1 -1
- package/dist/components/molecules/PageHeading/Highlight/Highlight.d.ts +4 -0
- package/dist/components/molecules/PageHeading/Highlight/Highlight.style.d.ts +9 -0
- package/dist/components/molecules/PageHeading/Highlight/index.d.ts +2 -0
- package/dist/components/molecules/PageHeading/HighlightCarousel/HighlightCarousel.d.ts +4 -0
- package/dist/components/molecules/PageHeading/HighlightCarousel/HighlightCarousel.style.d.ts +14 -0
- package/dist/components/molecules/PageHeading/HighlightCarousel/index.d.ts +2 -0
- package/dist/components/molecules/PageHeading/index.d.ts +3 -1
- package/dist/components/molecules/Pagination/Pagination.style.d.ts +1 -1
- package/dist/components/molecules/Paywall/Paywall.d.ts +4 -0
- package/dist/components/molecules/Paywall/Paywall.styles.d.ts +292 -0
- package/dist/components/molecules/Paywall/index.d.ts +2 -0
- package/dist/components/molecules/PeopleListing/PeopleListing.d.ts +1 -1
- package/dist/components/molecules/PeopleListing/PeopleListing.style.d.ts +2 -2
- package/dist/components/molecules/PromoWithTags/PromoWithTags.style.d.ts +273 -3
- package/dist/components/molecules/PromoWithTitle/PromoWithTitle.style.d.ts +273 -3
- package/dist/components/molecules/SkipToMain/SkipToMain.d.ts +20 -0
- package/dist/components/molecules/SkipToMain/SkipToMain.style.d.ts +6 -0
- package/dist/components/molecules/SkipToMain/index.d.ts +2 -0
- package/dist/components/molecules/UpsellCard/UpsellCard.style.d.ts +276 -11
- package/dist/components/molecules/index.d.ts +4 -2
- package/dist/components/organisms/Carousels/Carousel/Carousel.style.d.ts +271 -1
- package/dist/components/organisms/Navigation/Navigation.d.ts +1 -1
- package/dist/components/organisms/UpsellSection/UpsellSection.style.d.ts +272 -1
- package/dist/harmonic.cjs.development.css +340 -8
- package/dist/harmonic.cjs.development.js +6189 -5870
- package/dist/harmonic.cjs.development.js.map +1 -1
- package/dist/harmonic.cjs.production.min.js +1 -1
- package/dist/harmonic.cjs.production.min.js.map +1 -1
- package/dist/harmonic.esm.js +6960 -6641
- package/dist/harmonic.esm.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/styles/HarmonicThemeProvider/HarmonicThemeProvider.d.ts +1 -0
- package/dist/types/anchorBar.d.ts +3 -0
- package/dist/types/impactHeader.d.ts +20 -2
- package/dist/types/navigation.d.ts +4 -0
- package/dist/types/types.d.ts +44 -4
- package/dist/types/upsell.d.ts +7 -15
- package/package.json +1 -1
- package/README.GIT +0 -294
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Accordion, Accordions, AnchorBar, AnnouncementBanner, AltHeader, AnchorTabBar, AuxiliaryNav, BodyText, Card, Cards, Carousel, CinemaBadge, ContactCard, ContentSummary, ControlledDropdown, CreditListing, Editorial, Footer, GlobalStyles, Grid, GridItem, Header, HighlightsCarousel, HighlightsCarouselCinema, HighlightsCarouselCore, HighlightsCarouselStream, HotFilters, Icon, ImageAspectRatioWrapper, ImageWithCaption, Information, Navigation, MinimalCarousel, Overline, PageHeading, PageHeadingCompact, PageHeadingImpact, PageHeadingPanel, PageHeadingPromo, Pagination, PasswordStrength, PeopleListing, PrimaryButton, Progress, PromoWithTags, PromoWithTitle, Radio, Radio2, RadioGroup, RadioGroup2, ReadMore, RotatorButtons, StatusBanner, SearchBar, SecondaryButton, SecondaryLogo, SectionSplitter, SectionTitle, Select, Select2, Select2Async, SignUpForm, Sponsorship, StickyBar, Stepper, StreamBadge, Subtitle, TertiaryButton, ThemeProvider, TitleWithCTA, Tab, Table, TabLink, Tabs, TextArea, TextField, TextFieldLegacy, TextLink, Tickbox, Tickbox2, Timer, TypeTags, UpsellCard, UpsellSection, VideoControls, VideoWithControls } from './components';
|
|
1
|
+
import { Accordion, Accordions, AnchorBar, AnnouncementBanner, AltHeader, AnchorTabBar, AuxiliaryNav, BodyText, Card, Cards, Carousel, CinemaBadge, ContactCard, ContentSummary, ControlledDropdown, CreditListing, Editorial, Footer, GlobalStyles, Grid, GridItem, Header, HighlightsCarousel, HighlightsCarouselCinema, HighlightsCarouselCore, HighlightsCarouselStream, HotFilters, Icon, ImageAspectRatioWrapper, ImageWithCaption, Information, Navigation, MinimalCarousel, Overline, PageHeading, PageHeadingCompact, PageHeadingImpact, PageHeadingPanel, PageHeadingHighlight, PageHeadingPromo, PageHeadingHighlightCarousel, Pagination, PasswordStrength, Paywall, PeopleListing, PrimaryButton, Progress, PromoWithTags, PromoWithTitle, Radio, Radio2, RadioGroup, RadioGroup2, ReadMore, RotatorButtons, StatusBanner, SearchBar, SecondaryButton, SecondaryLogo, SectionSplitter, SectionTitle, Select, Select2, Select2Async, SignUpForm, Sponsorship, StickyBar, Stepper, StreamBadge, Subtitle, TertiaryButton, ThemeProvider, TitleWithCTA, Tab, Table, TabLink, Tabs, TextArea, TextField, TextFieldLegacy, TextLink, Tickbox, Tickbox2, Timer, TypeTags, UpsellCard, UpsellSection, VideoControls, VideoWithControls } from './components';
|
|
2
2
|
import BodyContent from './components/molecules/BodyContent';
|
|
3
3
|
import Quote from './components/molecules/Quote';
|
|
4
4
|
import { devices, breakpoints } from './styles/viewports';
|
|
@@ -11,4 +11,4 @@ import HarmonicThemeProvider, { useHarmonicTheme } from './styles/HarmonicThemeP
|
|
|
11
11
|
import { HarmonicSize } from './types/typography';
|
|
12
12
|
import { HarmonicHeader, HarmonicSubtitle, BodyCopyHarmonic, HarmonicOverline, ButtonText, Caption, NavigationText } from './components/Typography';
|
|
13
13
|
export { useHarmonicTheme };
|
|
14
|
-
export { Accordion, Accordions, AnchorBar, AnnouncementBanner, AltHeader, AnchorTabBar, AuxiliaryButton, AuxiliaryNav, AspectRatio, BodyContent, BodyText, breakpoints, ButtonType, Card, Cards, CarouselType, Carousel, CinemaBadge, Colors, ContactCard, ContentSummary, ControlledDropdown, CreditListing, devices, Editorial, EditorialLink, Footer, GlobalStyles, Grid, GridItem, HarmonicSize, HarmonicThemeProvider, Header, HighlightsCarousel, HighlightsCarouselCinema, HighlightsCarouselCore, HighlightsCarouselStream, HotFilters, Icon, IconNameType, ImageAspectRatioWrapper, ImageWithCaption, Information, IInformationCTAProps, IInformationTitleProps, ITimerProps, IntegratedTimerProps, MinimalCarousel, MiniCard, ModalWindow, Navigation, Overline, PageHeading, PageHeadingCompact, PageHeadingImpact, PageHeadingPanel, PageHeadingPromo, Pagination, PasswordStrength, PeopleListing, PrimaryButton, Progress, PromoWithTags, PromoWithTitle, Radio, Radio2, RadioGroup, RadioGroup2, ReadMore, RotatorButtons, StatusBanner, SearchBar, SecondaryButton, SecondaryLogo, SectionSplitter, SectionTitle, Select, Select2, Select2Async, SignUpForm, Sponsorship, StickyBar, Stepper, StreamBadge, Subtitle, Tab, Table, TabLink, Tabs, TertiaryButton, TextArea, TextField, TextFieldLegacy, TextLink, ThemeColor, ThemeProvider, ThemeType, TitleWithCTA, Tickbox, Tickbox2, TickboxMode, Timer, TypeTags, UpsellCard, UpsellSection, Quote, VideoControls, VideoWithControls, zIndexes, HarmonicHeader, HarmonicSubtitle, BodyCopyHarmonic, HarmonicOverline, ButtonText, Caption, NavigationText, };
|
|
14
|
+
export { Accordion, Accordions, AnchorBar, AnnouncementBanner, AltHeader, AnchorTabBar, AuxiliaryButton, AuxiliaryNav, AspectRatio, BodyContent, BodyText, breakpoints, ButtonType, Card, Cards, CarouselType, Carousel, CinemaBadge, Colors, ContactCard, ContentSummary, ControlledDropdown, CreditListing, devices, Editorial, EditorialLink, Footer, GlobalStyles, Grid, GridItem, HarmonicSize, HarmonicThemeProvider, Header, HighlightsCarousel, HighlightsCarouselCinema, HighlightsCarouselCore, HighlightsCarouselStream, HotFilters, Icon, IconNameType, ImageAspectRatioWrapper, ImageWithCaption, Information, IInformationCTAProps, IInformationTitleProps, ITimerProps, IntegratedTimerProps, MinimalCarousel, MiniCard, ModalWindow, Navigation, Overline, PageHeading, PageHeadingCompact, PageHeadingImpact, PageHeadingPanel, PageHeadingHighlight, PageHeadingPromo, PageHeadingHighlightCarousel, Pagination, PasswordStrength, Paywall, PeopleListing, PrimaryButton, Progress, PromoWithTags, PromoWithTitle, Radio, Radio2, RadioGroup, RadioGroup2, ReadMore, RotatorButtons, StatusBanner, SearchBar, SecondaryButton, SecondaryLogo, SectionSplitter, SectionTitle, Select, Select2, Select2Async, SignUpForm, Sponsorship, StickyBar, Stepper, StreamBadge, Subtitle, Tab, Table, TabLink, Tabs, TertiaryButton, TextArea, TextField, TextFieldLegacy, TextLink, ThemeColor, ThemeProvider, ThemeType, TitleWithCTA, Tickbox, Tickbox2, TickboxMode, Timer, TypeTags, UpsellCard, UpsellSection, Quote, VideoControls, VideoWithControls, zIndexes, HarmonicHeader, HarmonicSubtitle, BodyCopyHarmonic, HarmonicOverline, ButtonText, Caption, NavigationText, };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { EditorialLink } from './editorial';
|
|
3
|
+
import { IGridItemProps } from './types';
|
|
3
4
|
export interface IAnchorBarProps {
|
|
4
5
|
/** CTA for anchor bar */
|
|
5
6
|
cta: EditorialLink;
|
|
@@ -13,4 +14,6 @@ export interface IAnchorBarProps {
|
|
|
13
14
|
className?: string;
|
|
14
15
|
/** Flag indicating whether the anchor bar should have a shadow */
|
|
15
16
|
withShadow?: boolean;
|
|
17
|
+
/** Optional grid item props to allow for different page alignments */
|
|
18
|
+
grid?: IGridItemProps;
|
|
16
19
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { EditorialLink } from '../types';
|
|
1
|
+
import { ImgHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { EditorialLink, ThemeColor } from '../types';
|
|
3
3
|
import { HeaderHierarchy, TypographyLevel } from './typography';
|
|
4
4
|
export interface CustomSponsorImageData {
|
|
5
5
|
/**
|
|
@@ -190,3 +190,21 @@ export interface IPageHeadingPromoProps {
|
|
|
190
190
|
/** Custom CSS classes */
|
|
191
191
|
className?: string;
|
|
192
192
|
}
|
|
193
|
+
export interface IPageHeadingHighlightProps {
|
|
194
|
+
/**
|
|
195
|
+
* Image to display in the right hand panel, aspect ratio 4:3
|
|
196
|
+
*/
|
|
197
|
+
image: ImgHTMLAttributes<HTMLImageElement>;
|
|
198
|
+
/**
|
|
199
|
+
* Optional change to background color
|
|
200
|
+
*/
|
|
201
|
+
background?: ThemeColor;
|
|
202
|
+
/**
|
|
203
|
+
* The component(s) to be wrapped in the page header
|
|
204
|
+
*/
|
|
205
|
+
children: ReactNode;
|
|
206
|
+
/**
|
|
207
|
+
* Custom CSS classes
|
|
208
|
+
*/
|
|
209
|
+
className?: string;
|
|
210
|
+
}
|
|
@@ -203,6 +203,10 @@ export interface INavigationProps {
|
|
|
203
203
|
* Additional CSS class names to apply to the navigation component.
|
|
204
204
|
*/
|
|
205
205
|
className?: string;
|
|
206
|
+
/**
|
|
207
|
+
* Defines which tag the button should skip to. Default: 'main-content'.
|
|
208
|
+
*/
|
|
209
|
+
skipToId?: string;
|
|
206
210
|
}
|
|
207
211
|
export interface ISearchBarProps {
|
|
208
212
|
/**
|
package/dist/types/types.d.ts
CHANGED
|
@@ -147,6 +147,10 @@ export interface ITabProps {
|
|
|
147
147
|
* Additional CSS class names to apply to the navigation component.
|
|
148
148
|
*/
|
|
149
149
|
className?: string;
|
|
150
|
+
/**
|
|
151
|
+
* The unique ID to assign to the link element.
|
|
152
|
+
*/
|
|
153
|
+
tabLinkId?: string;
|
|
150
154
|
/**
|
|
151
155
|
* Defines the ARIA role of the element for accessibility purposes.
|
|
152
156
|
*/
|
|
@@ -163,6 +167,10 @@ export interface ITabProps {
|
|
|
163
167
|
* Defines if it is needed to trim the text of the Tab and add 3 dots in the end
|
|
164
168
|
*/
|
|
165
169
|
trimText?: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* data-testid string for easier testing
|
|
172
|
+
*/
|
|
173
|
+
dataTestId?: string;
|
|
166
174
|
/**
|
|
167
175
|
* Boolean indicating if the Tab is open.
|
|
168
176
|
*/
|
|
@@ -218,7 +226,11 @@ export interface IDropdownProps {
|
|
|
218
226
|
*/
|
|
219
227
|
ariaLabel?: string;
|
|
220
228
|
/**
|
|
221
|
-
*
|
|
229
|
+
* The unique ID to assign to the link element inside the tab.
|
|
230
|
+
*/
|
|
231
|
+
tabLinkId?: string;
|
|
232
|
+
/**
|
|
233
|
+
* Defines if it is needed to trim the text of the Tab and add 3 dots in the end
|
|
222
234
|
*/
|
|
223
235
|
trimTabText?: boolean;
|
|
224
236
|
}
|
|
@@ -342,10 +354,10 @@ export declare type ListingRole = {
|
|
|
342
354
|
dataROH?: string;
|
|
343
355
|
};
|
|
344
356
|
export interface IPeopleListing {
|
|
345
|
-
/**
|
|
346
|
-
* List of roles to be displayed
|
|
347
|
-
*/
|
|
357
|
+
/** List of roles to be displayed */
|
|
348
358
|
roles: ListingRole[];
|
|
359
|
+
/** Custom CSS classes */
|
|
360
|
+
className?: string;
|
|
349
361
|
}
|
|
350
362
|
export interface IPagination {
|
|
351
363
|
/**
|
|
@@ -540,6 +552,10 @@ export interface IBodyContentProps {
|
|
|
540
552
|
columnSpanDevice?: number;
|
|
541
553
|
/** Custom CSS classes */
|
|
542
554
|
className?: string;
|
|
555
|
+
/** Set to true to wrap the content in a Grid component */
|
|
556
|
+
renderGrid?: boolean;
|
|
557
|
+
/** Set to true to render the GridItem component */
|
|
558
|
+
renderGridItem?: boolean;
|
|
543
559
|
}
|
|
544
560
|
export declare type SectionTitleSize = 'small' | 'large';
|
|
545
561
|
export interface ISectionTitleProps {
|
|
@@ -723,3 +739,27 @@ export declare enum LinkTarget {
|
|
|
723
739
|
*/
|
|
724
740
|
Blank = "_blank"
|
|
725
741
|
}
|
|
742
|
+
export interface ISkipToMainProps {
|
|
743
|
+
/**
|
|
744
|
+
* Defines which tag the button should skip to.
|
|
745
|
+
*/
|
|
746
|
+
skipToId?: string;
|
|
747
|
+
}
|
|
748
|
+
export declare type PaywallProps = {
|
|
749
|
+
/** Custom CSS classes */
|
|
750
|
+
className?: string;
|
|
751
|
+
/** Heading text */
|
|
752
|
+
title: string;
|
|
753
|
+
/** Introduction text */
|
|
754
|
+
intro?: string;
|
|
755
|
+
/** Body HTML */
|
|
756
|
+
description: string;
|
|
757
|
+
/** CTA text */
|
|
758
|
+
buttonText: string;
|
|
759
|
+
/** CTA URL */
|
|
760
|
+
buttonUrl: string;
|
|
761
|
+
/** Text before sign-in link (required to show sign-in link) */
|
|
762
|
+
signInPromptText?: string;
|
|
763
|
+
/** Sign-in link URL (required to show sign-in link) */
|
|
764
|
+
signInLinkUrl?: string;
|
|
765
|
+
};
|
package/dist/types/upsell.d.ts
CHANGED
|
@@ -68,24 +68,16 @@ export interface IUpsellCardsProps {
|
|
|
68
68
|
theme?: ThemeType;
|
|
69
69
|
}
|
|
70
70
|
export interface IUpsellSectionProps {
|
|
71
|
-
/**
|
|
72
|
-
* Upsell Section title
|
|
73
|
-
*/
|
|
71
|
+
/** Upsell Section title */
|
|
74
72
|
title?: string;
|
|
75
|
-
/**
|
|
76
|
-
* Richtext section
|
|
77
|
-
*/
|
|
73
|
+
/** Richtext section */
|
|
78
74
|
richText?: string;
|
|
79
|
-
/**
|
|
80
|
-
* CTA link. Eg. for sign in.
|
|
81
|
-
*/
|
|
75
|
+
/** CTA link. Eg. for sign in. */
|
|
82
76
|
link?: EditorialLink;
|
|
83
|
-
/**
|
|
84
|
-
* Array of upsellCards
|
|
85
|
-
*/
|
|
77
|
+
/** Array of upsellCards */
|
|
86
78
|
upsellCards?: IUpsellCardProps[];
|
|
87
|
-
/**
|
|
88
|
-
* Theme options
|
|
89
|
-
*/
|
|
79
|
+
/** Theme options */
|
|
90
80
|
theme?: ThemeType;
|
|
81
|
+
/** Custom CSS classes */
|
|
82
|
+
className?: string;
|
|
91
83
|
}
|
package/package.json
CHANGED
package/README.GIT
DELETED
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
# Royal Opera House Harmonic - Front End Design System
|
|
2
|
-
|
|
3
|
-
Welcome to The Royal Opera House Front End Design System, `@royaloperahouse/harmonic`
|
|
4
|
-
|
|
5
|
-
This package is a library of UI components intended to be used in the ROH website.
|
|
6
|
-
|
|
7
|
-
It uses React, TypeScript, TSDX and Storybook.
|
|
8
|
-
|
|
9
|
-
The NPM packages are published at [Royal Opera House - Harmonic](https://www.npmjs.com/package/@royaloperahouse/harmonic)
|
|
10
|
-
|
|
11
|
-
The Storybook for the latest version of the library is hosted at [Storybook - Harmonic] TODO: S3 deployment
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## Prerequisites
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
* Make sure the required package dependencies are installed using `yarn install`
|
|
18
|
-
* If this is the first time you are working on Harmonic, make sure to run `yarn build` to build all the modules.
|
|
19
|
-
|
|
20
|
-
* **To deploy the storybook publicly** you will need credentials for the **parent** 'Royal Opera House' AWS account in your `~/.aws/credentials` file.
|
|
21
|
-
* The deploy script expects these to be called `[parent]`.
|
|
22
|
-
|
|
23
|
-
* You can find these values at:
|
|
24
|
-
|
|
25
|
-
*AWS 'Your Applications' page -> 'Royal Opera House' -> 'Developer Access' -> 'Command line or programmatic access'*
|
|
26
|
-
|
|
27
|
-
* **To deploy a preview** for demo / QA you will need:
|
|
28
|
-
|
|
29
|
-
* A Chromatic account with a **Developer** role in the `roh-ml` project in Chromatic
|
|
30
|
-
* [Mari Lovell](mari.lovell@roh.org.uk) is the current owner of this project, you can contact her to invite you
|
|
31
|
-
* The `CHROMATIC_PROJECT_TOKEN` -- find this in 1Password or ask the project owner.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
* **To enable publishing to the NPM package**:
|
|
35
|
-
* Create account / log in to NPM
|
|
36
|
-
* Ask a colleague with admin rights to be added as a contributer
|
|
37
|
-
* Generate your own ROH `NPM_TOKEN` (store this token in 1Password)
|
|
38
|
-
* Set up Two-Factor Authentication for NPM, as you will be prompted by the publishing script
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## Versioning
|
|
42
|
-
---
|
|
43
|
-
> NOTE: The following applies while the Harmonic project is in Alpha (before a version 1.0.0 release)
|
|
44
|
-
|
|
45
|
-
We are **not** yet using semantic versioning.
|
|
46
|
-
|
|
47
|
-
When proposing changes to the Harmonic library, increment the patch version (the last number) by one, **only** in the changelog (alternatively, leave the version in the changelog as TBC) along with a note about your changes.
|
|
48
|
-
|
|
49
|
-
Only increment the version in the package.json for releasing snapshots.
|
|
50
|
-
|
|
51
|
-
Once your changes are merged to the main branch and released in a new version, the release manager will be responsible for incrementing that release version.
|
|
52
|
-
|
|
53
|
-
> NOTE: The following **may** apply once the Harmonic project is out of Alpha, but is subject to change before then.
|
|
54
|
-
|
|
55
|
-
We use [Semantic Versioning](https://semver.org/) for Harmonic.
|
|
56
|
-
|
|
57
|
-
Given a version number MAJOR.MINOR.PATCH, increment the:
|
|
58
|
-
|
|
59
|
-
* MAJOR version when you make incompatible library changes
|
|
60
|
-
* MINOR version when you add functionality in a backwards compatible manner
|
|
61
|
-
* PATCH version when you make backwards compatible bug fixes
|
|
62
|
-
|
|
63
|
-
When you create a new release always update the `CHANGELOG` and `package.json`
|
|
64
|
-
|
|
65
|
-
Increment your version from the latest stable version on [Royal Opera House - Harmonic](https://www.npmjs.com/package/@royaloperahouse/harmonic?activeTab=versions)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
## Deploying the Storybook
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
### **1. To build and deploy locally**
|
|
72
|
-
|
|
73
|
-
You can quickly build and serve the contents of `/storybook-static` from your local machine, for development and manual testing. To do this run:
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
yarn storybook
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
By default the storybook will be accessible at
|
|
80
|
-
[http://localhost:6006/]()
|
|
81
|
-
|
|
82
|
-
The server will hot-reload on most changes.
|
|
83
|
-
|
|
84
|
-
### **2. To deploy a preview version remotely**
|
|
85
|
-
|
|
86
|
-
You can deploy a release candidate, or work-in-progress to [Chromatic](https://www.chromatic.com/) for showcase or QA.
|
|
87
|
-
|
|
88
|
-
**NOTE:** you will need the `CHROMATIC_PROJECT_TOKEN` and to be invited as a contributor to the Harmonic project in Chromatic, as described in *Prerequisites* above.
|
|
89
|
-
|
|
90
|
-
Either set the token as a shell variable or use a `.env` file in the `harmonic` root directory containing the token, as so:
|
|
91
|
-
|
|
92
|
-
```
|
|
93
|
-
CHROMATIC_PROJECT_TOKEN=tokengoeshere
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
Run:
|
|
97
|
-
```
|
|
98
|
-
CHROMATIC_PROJECT_TOKEN=tokengoeshere yarn deploy-storybook-dev
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
to build and deploy the storybook from your repo to Chromatic.
|
|
102
|
-
|
|
103
|
-
You will find the address of your deployed storybook in the console output, looking something like this:
|
|
104
|
-
|
|
105
|
-
`→ View your Storybook at https://randomHexString-randomAlphabeticalString.chromatic.com`
|
|
106
|
-
|
|
107
|
-
### **3. To deploy a release version**
|
|
108
|
-
|
|
109
|
-
You can deploy the contents of `./storybook-static` to S3 as a static site, which is permanently accessible at [WIP] TODO: S3 deployment
|
|
110
|
-
|
|
111
|
-
**NOTE:** To do this you will need the correct `AWS` credentials set up, as described in *Prerequisites* above.
|
|
112
|
-
|
|
113
|
-
First build the storybook using:
|
|
114
|
-
|
|
115
|
-
```
|
|
116
|
-
yarn build-storybook
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
then run:
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
yarn deploy-storybook
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
> **IMPORTANT:** This URL is intended to showcase the latest stable version of Harmonic, it should be kept up to date with the `main` Harmonic branch and should **only** be used for release versions. If you want to deploy a development version follow the steps above under *To deploy a preview version remotely*.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
## Releasing a New Package Version
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
This is the procedure for releasing a new Harmonic NPM package.
|
|
132
|
-
|
|
133
|
-
There are two types of package:
|
|
134
|
-
|
|
135
|
-
A **snapshot** can be published to use a development version of the Harmonic library in our frontend staging environments, to perform integrated, manual testing.
|
|
136
|
-
|
|
137
|
-
A **stable** package is published for use in production.
|
|
138
|
-
|
|
139
|
-
**NOTE:** You will need the `NPM_TOKEN`, as described in 'Prerequisites' above.
|
|
140
|
-
|
|
141
|
-
### **1. To release a snapshot version**
|
|
142
|
-
|
|
143
|
-
> **IMPORTANT:** Make sure you always publish your **snapshots** from `development` after merging in your feature branch.
|
|
144
|
-
|
|
145
|
-
For snapshots, `RELEASE_VERSION` should be the same as the latest **stable** version of the Harmonic Library, as found in [npm Harmonic - Versions](https://www.npmjs.com/package/@royaloperahouse/harmonic?activeTab=versions), followed by an **unused** lowercase letter.
|
|
146
|
-
|
|
147
|
-
For example, if the latest stable release was 1.42.0, and the last snapshot published to NPM was 1.42.0-w, you would use RELEASE_VERSION `1.42.0-x`
|
|
148
|
-
|
|
149
|
-
To publish a snapshot use:
|
|
150
|
-
|
|
151
|
-
```bash
|
|
152
|
-
NPM_ROH_TOKEN={NPM_TOKEN} RELEASE_VERSION={RELEASE_VERSION} yarn publish-snapshot
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
The version published to NPM will be named, e.g. `1.42.0-a-harmonic-development`, use this to install the snapshot package in the frontend repos.
|
|
156
|
-
|
|
157
|
-
### **2. To release a stable version**
|
|
158
|
-
|
|
159
|
-
> **IMPORTANT:** Make sure you always publish your **stable** packages from `main` after merging in your feature branch.
|
|
160
|
-
|
|
161
|
-
For stable releases, increment your version from the latest **stable** version found on [npm Harmonic - Versions](https://www.npmjs.com/package/@royaloperahouse/harmonic?activeTab=versions), following the rules described in *Versioning* above, and use this as `RELEASE_VERSION`. (Make sure it matches the version in your `package.json` and `CHANGELOG.md`!)
|
|
162
|
-
|
|
163
|
-
To publish a stable package use:
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
NPM_ROH_TOKEN={NPM_TOKEN} RELEASE_VERSION={RELEASE_VERSION} yarn publish-release
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
## Using the Package
|
|
171
|
-
---
|
|
172
|
-
|
|
173
|
-
The package is deployed to NPM, and can be installed using yarn or npm:
|
|
174
|
-
|
|
175
|
-
```bash
|
|
176
|
-
npm i --save @royaloperahouse/harmonic
|
|
177
|
-
```
|
|
178
|
-
```bash
|
|
179
|
-
yarn add @royaloperahouse/harmonic
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
## Testing
|
|
184
|
-
---
|
|
185
|
-
|
|
186
|
-
To **Lint** the package use:
|
|
187
|
-
|
|
188
|
-
```bash
|
|
189
|
-
yarn lint
|
|
190
|
-
# Use the --fix option to perform automatic fixes
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
To run the **unit tests** (using Jest) use:
|
|
194
|
-
|
|
195
|
-
```bash
|
|
196
|
-
yarn test
|
|
197
|
-
|
|
198
|
-
# Use the -u option to update snapshots if needed
|
|
199
|
-
# Run `yarn test:watch` to re-run tests on changes
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
To **run and and store the unit tests** for display in storybook use:
|
|
203
|
-
|
|
204
|
-
```bash
|
|
205
|
-
yarn test-storybook
|
|
206
|
-
# Use the -u option to update snapshots if needed
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
## Development Process
|
|
211
|
-
---
|
|
212
|
-
|
|
213
|
-
### **1. Branching Model**
|
|
214
|
-
* The Harmonic project lives in the `harmonic-library/harmonic` *repository*
|
|
215
|
-
* When working on Harmonic, treat the `harmonic` directory as your root
|
|
216
|
-
* The Harmonic **development** branch is for QA
|
|
217
|
-
* The Harmonic **main** branch is currently for stable releases
|
|
218
|
-
* All work should be done on a correctly named **feature branch** of the format: `issueType/ticketNumber-short-description-of-feature`, e.g. `feature/RD-12345-add-example-component`
|
|
219
|
-
* Always create your feature branch FROM, and submit pull requests TO, the **main** branch
|
|
220
|
-
* For **QA / UAT** of a Harmonic component in isolation: following review you should deploy a preview version to Chromatic straight from your **feature branch** _without_ merging to development
|
|
221
|
-
* For releasing an **NPM snapshot**: merge your feature branch into the **development** branch and publish the NPM snapshot from there
|
|
222
|
-
|
|
223
|
-
### **2. Detailed Workflow**
|
|
224
|
-
|
|
225
|
-
#### **Before review:**
|
|
226
|
-
|
|
227
|
-
* Git pull the latest version of Harmonic from `main`
|
|
228
|
-
* Checkout a new, correctly-named feature branch from `main`
|
|
229
|
-
* Do your work on this feature branch
|
|
230
|
-
* Run: `yarn lint --fix`
|
|
231
|
-
* Run: `yarn test -u`
|
|
232
|
-
* Commit your changes
|
|
233
|
-
* Create a pull request from your feature branch to `main`
|
|
234
|
-
* Add the appropriate reviewers
|
|
235
|
-
|
|
236
|
-
#### **Before QA / UAT:**
|
|
237
|
-
|
|
238
|
-
After your PR is approved, you have two options:
|
|
239
|
-
|
|
240
|
-
**i.** For QA of a component in isolation:
|
|
241
|
-
|
|
242
|
-
* Follow the steps above in *Deploying the Storybook -> 2. Deploying a preview version remotely*
|
|
243
|
-
* Share the generated Chromatic URL with the appropriate people for QA / UAT
|
|
244
|
-
|
|
245
|
-
**ii.** For integrated testing of a component in the frontend staging environments:
|
|
246
|
-
|
|
247
|
-
* Check out the `development` branch
|
|
248
|
-
* Merge your work in to `development`
|
|
249
|
-
* Follow the steps above under *Publishing a New Package Version -> 1. To release a snapshot version*
|
|
250
|
-
* Git push the updated `development` branch to remote
|
|
251
|
-
* Finally, in the frontend repo:
|
|
252
|
-
|
|
253
|
-
1. Update the `package.json` to reference the new snapshot version
|
|
254
|
-
2. Run: `yarn install`
|
|
255
|
-
3. Deploy the frontend to a staging environment
|
|
256
|
-
|
|
257
|
-
#### **When ready for production:**
|
|
258
|
-
|
|
259
|
-
* Return to your Harmonic **feature branch**
|
|
260
|
-
* Update the HArmonic version in `package.json`, incrementing from the last **stable** release, found in [npm Harmonic - Versions](https://www.npmjs.com/package/@royaloperahouse/harmonic?activeTab=versions), and following the rules described in the *Versioning* section
|
|
261
|
-
* Update `CHANGELOG.md`, adding the new version number and a short description of your changes
|
|
262
|
-
* Run: `yarn lint --fix`
|
|
263
|
-
* Run: `yarn test -u`
|
|
264
|
-
* Run: `yarn test-storybook -u`
|
|
265
|
-
* Run: `yarn build-storybook`
|
|
266
|
-
* Git commit, push, and update your PR for final approval
|
|
267
|
-
* Merge your approved PR to `main`
|
|
268
|
-
* Follow the steps in *Publishing a New Package Version -> 2. To release a stable version* to publish the NPM package
|
|
269
|
-
* Finally, follow the steps in *Deploying The Storybook -> 3. To deploy a release version*, to update the public Harmonic Storybook page
|
|
270
|
-
|
|
271
|
-
Once you have successfully published a new release version, you can open a ticket to update to this version in any of the frontend repos.
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
## Notes
|
|
275
|
-
---
|
|
276
|
-
### The `storybook-static` folder
|
|
277
|
-
|
|
278
|
-
This folder contains all the HTML / JS required to deploy the Storybook as a static site. It's autogenerated whenever the Storybook is built and therefore will show up a lot of merge conflicts when you merge other branches into your feature branch. It is best to leave generating the storybook until the later part of your workflow, but in case you run into conflicts earlier, it's ok to just delete the folder and regenerate using:
|
|
279
|
-
|
|
280
|
-
```bash
|
|
281
|
-
yarn build-storybook
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
For the same reason changes to this folder will cause a lot of big diffs, when looking at a PR, but can mostly be skimmed over unless something looks unusual.
|
|
285
|
-
|
|
286
|
-
---
|
|
287
|
-
### Examples
|
|
288
|
-
|
|
289
|
-
There is an example implementation in the example folder. Alternatively there are also integration examples in storybook. Make sure to keep these updated so as to showcase the current components available.
|
|
290
|
-
|
|
291
|
-
---
|
|
292
|
-
### Bundle analysis
|
|
293
|
-
|
|
294
|
-
Calculate the real cost of your library using [size-limit](https://github.com/ai/size-limit) with `yarn size` and visualize it with `yarn analyze`.
|