@royaloperahouse/harmonic 0.12.0 → 0.12.1-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 +252 -43
- package/dist/components/Typography/Typography.d.ts +5 -5
- package/dist/components/atoms/Buttons/Secondary/utils.d.ts +4 -4
- package/dist/components/atoms/Dropdown/Dropdown.d.ts +1 -1
- package/dist/components/atoms/RotatorButtons/RotatorButtons.d.ts +1 -1
- package/dist/components/atoms/RotatorButtons/RotatorButtons.style.d.ts +1 -0
- package/dist/components/atoms/SectionSplitter/SectionSplitter.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/Accordion/Accordion.style.d.ts +8 -4
- package/dist/components/molecules/BodyContent/BodyContent.d.ts +4 -0
- package/dist/components/molecules/BodyContent/BodyContent.style.d.ts +1 -0
- package/dist/components/molecules/BodyContent/index.d.ts +2 -0
- package/dist/components/molecules/Card/Card.style.d.ts +1 -1
- package/dist/components/molecules/CastFilter/CastFilters.d.ts +4 -0
- package/dist/components/molecules/CastFilter/CastFilters.style.d.ts +14 -0
- package/dist/components/molecules/CastFilter/index.d.ts +2 -0
- package/dist/components/molecules/ContactCard/ContactCard.style.d.ts +5 -4
- package/dist/components/molecules/ContentSummary/ContentSummary.style.d.ts +1 -1
- package/dist/components/molecules/Editorial/Editorial.style.d.ts +2 -2
- package/dist/components/molecules/ImageWithCaption/ImageWithCaption.style.d.ts +1 -1
- package/dist/components/molecules/Information/Information.style.d.ts +3 -2
- 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/Promo/Promo.d.ts +1 -2
- package/dist/components/molecules/PageHeading/index.d.ts +2 -1
- package/dist/components/molecules/Pagination/Pagination.style.d.ts +1 -1
- package/dist/components/molecules/PromoWithTags/PromoWithTags.style.d.ts +3 -6
- package/dist/components/molecules/PromoWithTitle/PromoWithTitle.style.d.ts +2 -2
- package/dist/components/molecules/SectionTitle/SectionTitle.d.ts +1 -1
- package/dist/components/molecules/SkipToMain/SkipToMain.d.ts +17 -0
- package/dist/components/molecules/SkipToMain/SkipToMain.style.d.ts +7 -0
- package/dist/components/molecules/SkipToMain/index.d.ts +2 -0
- package/dist/components/molecules/index.d.ts +3 -3
- package/dist/components/organisms/AnchorTabBar/AnchorTabBar.style.d.ts +8 -3
- package/dist/components/organisms/Carousels/Carousel/Carousel.style.d.ts +1 -0
- package/dist/components/organisms/StickyBar/StickyBar.style.d.ts +1 -1
- package/dist/harmonic.cjs.development.css +345 -16
- package/dist/harmonic.cjs.development.js +6700 -6592
- 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 +6706 -6597
- package/dist/harmonic.esm.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/styles/HarmonicThemeProvider/HarmonicThemeProvider.d.ts +4 -0
- package/dist/styles/HarmonicThemeProvider/index.d.ts +2 -1
- package/dist/types/buttonTypes.d.ts +6 -2
- package/dist/types/contactCard.d.ts +8 -22
- package/dist/types/editorial.d.ts +6 -20
- package/dist/types/impactHeader.d.ts +22 -2
- package/dist/types/information.d.ts +23 -43
- package/dist/types/navigation.d.ts +31 -61
- package/dist/types/promoWithTags.d.ts +9 -1
- package/dist/types/types.d.ts +101 -72
- package/dist/types/typography.d.ts +4 -0
- package/package.json +1 -1
- package/README.GIT +0 -278
- package/dist/components/molecules/TextOnly/TextOnly.d.ts +0 -4
- package/dist/components/molecules/TextOnly/TextOnly.style.d.ts +0 -1
- package/dist/components/molecules/TextOnly/index.d.ts +0 -2
package/dist/types/types.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ReactNode, AnchorHTMLAttributes, MouseEventHandler, ReactElement } from 'react';
|
|
2
2
|
import { StyledProps } from 'styled-components';
|
|
3
3
|
import { IconNameType, DirectionType } from './iconTypes';
|
|
4
|
-
import { TypographyLevel, TypographyType } from './typography';
|
|
5
4
|
import type { ExternalLink } from './links';
|
|
6
5
|
export declare enum Colors {
|
|
7
6
|
White = "white",
|
|
@@ -53,14 +52,8 @@ export declare enum ThemeType {
|
|
|
53
52
|
Cinema = "cinema",
|
|
54
53
|
Schools = "schools"
|
|
55
54
|
}
|
|
56
|
-
export declare type ThemeChildProps = {
|
|
57
|
-
className?: string;
|
|
58
|
-
theme?: ThemeType;
|
|
59
|
-
};
|
|
60
55
|
export interface IThemeProviderProps {
|
|
61
|
-
/**
|
|
62
|
-
* The theme to use for the child elements
|
|
63
|
-
*/
|
|
56
|
+
/** The theme to use for the child elements */
|
|
64
57
|
theme: ThemeType;
|
|
65
58
|
children: ReactNode;
|
|
66
59
|
}
|
|
@@ -154,6 +147,10 @@ export interface ITabProps {
|
|
|
154
147
|
* Additional CSS class names to apply to the navigation component.
|
|
155
148
|
*/
|
|
156
149
|
className?: string;
|
|
150
|
+
/**
|
|
151
|
+
* The unique ID to assign to the link element.
|
|
152
|
+
*/
|
|
153
|
+
tabLinkId?: string;
|
|
157
154
|
/**
|
|
158
155
|
* Defines the ARIA role of the element for accessibility purposes.
|
|
159
156
|
*/
|
|
@@ -221,7 +218,11 @@ export interface IDropdownProps {
|
|
|
221
218
|
*/
|
|
222
219
|
ariaLabel?: string;
|
|
223
220
|
/**
|
|
224
|
-
*
|
|
221
|
+
* The unique ID to assign to the link element inside the tab.
|
|
222
|
+
*/
|
|
223
|
+
tabLinkId?: string;
|
|
224
|
+
/**
|
|
225
|
+
* Defines if it is needed to trim the text of the Tab and add 3 dots in the end
|
|
225
226
|
*/
|
|
226
227
|
trimTabText?: boolean;
|
|
227
228
|
}
|
|
@@ -424,6 +425,62 @@ export declare type IHotFilterProps = {
|
|
|
424
425
|
selectedIndex?: number;
|
|
425
426
|
onSelect?: (index: number) => void;
|
|
426
427
|
};
|
|
428
|
+
export declare type ICastFilterItem = Pick<AnchorHTMLAttributes<HTMLAnchorElement>, 'aria-label' | 'role'> & {
|
|
429
|
+
/**
|
|
430
|
+
* Name of the cast member shown below the image circle. Required.
|
|
431
|
+
*/
|
|
432
|
+
name: string;
|
|
433
|
+
/**
|
|
434
|
+
* Image source for the image to be shown. Optional but if not included an unaesthetic placeholder will show.
|
|
435
|
+
*/
|
|
436
|
+
image?: string;
|
|
437
|
+
onClick?: () => void;
|
|
438
|
+
};
|
|
439
|
+
export declare type ICastFiltersProps = {
|
|
440
|
+
/**
|
|
441
|
+
* Array of cast to filter by.
|
|
442
|
+
*/
|
|
443
|
+
cast: ICastFilterItem[];
|
|
444
|
+
/**
|
|
445
|
+
* A classname is required for the HarmonicThemeProvider to provide styles properly.
|
|
446
|
+
* If it is not provided here it will default to 'cast-filters'.
|
|
447
|
+
*/
|
|
448
|
+
className?: string;
|
|
449
|
+
/**
|
|
450
|
+
* Indices of currently selected cast in the `cast` array.
|
|
451
|
+
*/
|
|
452
|
+
selectedIndices?: number[];
|
|
453
|
+
/**
|
|
454
|
+
* Text shown at the top of the component, e.g. 'Filter by cast'. If this is not provided
|
|
455
|
+
* the component will render without any.
|
|
456
|
+
*/
|
|
457
|
+
headingText?: string;
|
|
458
|
+
/**
|
|
459
|
+
* Override the text of the primary CTA. Default is 'Apply'.
|
|
460
|
+
*/
|
|
461
|
+
ctaText?: string;
|
|
462
|
+
/**
|
|
463
|
+
* Override the text of the text link. Default is 'Clear'.
|
|
464
|
+
*/
|
|
465
|
+
textLinkText?: string;
|
|
466
|
+
/**
|
|
467
|
+
* Default image to show in cases where a cast member image prop is missing.
|
|
468
|
+
* If this is undefined then a light grey background will be displayed instead.
|
|
469
|
+
*/
|
|
470
|
+
placeholderImage?: string;
|
|
471
|
+
/**
|
|
472
|
+
* Handle selecting individual cast filters.
|
|
473
|
+
*/
|
|
474
|
+
onSelect?: (index: number) => void;
|
|
475
|
+
/**
|
|
476
|
+
* Handle clicking the primary CTA.
|
|
477
|
+
*/
|
|
478
|
+
onApply?: (indices: number[]) => void;
|
|
479
|
+
/**
|
|
480
|
+
* Handle clicking the text link.
|
|
481
|
+
*/
|
|
482
|
+
onClear?: () => void;
|
|
483
|
+
};
|
|
427
484
|
export interface ISponsorshipProps {
|
|
428
485
|
/**
|
|
429
486
|
* Source URL for Sponsorship IFRAME.
|
|
@@ -458,10 +515,10 @@ export interface ITextLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement>
|
|
|
458
515
|
textColor?: ThemeColor;
|
|
459
516
|
}
|
|
460
517
|
export interface ISectionSplitterProps {
|
|
461
|
-
/**
|
|
462
|
-
* Set the width of the Section to full
|
|
463
|
-
*/
|
|
518
|
+
/** Set the width of the Section to full */
|
|
464
519
|
fullWidth?: boolean;
|
|
520
|
+
/** Custom CSS classes */
|
|
521
|
+
className?: string;
|
|
465
522
|
}
|
|
466
523
|
export interface ITypeTagsProps {
|
|
467
524
|
/**
|
|
@@ -469,46 +526,30 @@ export interface ITypeTagsProps {
|
|
|
469
526
|
*/
|
|
470
527
|
list: string[];
|
|
471
528
|
}
|
|
472
|
-
export interface
|
|
473
|
-
/**
|
|
474
|
-
* Text placed in the TextOnly component
|
|
475
|
-
*/
|
|
529
|
+
export interface IBodyContentProps {
|
|
530
|
+
/** Text placed in the BodyContent component */
|
|
476
531
|
text: string;
|
|
477
|
-
/**
|
|
478
|
-
* Set columnstart in Desktop
|
|
479
|
-
*/
|
|
532
|
+
/** Set columnStart in Desktop */
|
|
480
533
|
columnStartDesktop?: number;
|
|
481
|
-
/**
|
|
482
|
-
* Set columnSpan in Desktop
|
|
483
|
-
*/
|
|
534
|
+
/** Set columnSpan in Desktop */
|
|
484
535
|
columnSpanDesktop?: number;
|
|
485
|
-
/**
|
|
486
|
-
* Set columnstart in Device
|
|
487
|
-
*/
|
|
536
|
+
/** Set columnStart in Device */
|
|
488
537
|
columnStartDevice?: number;
|
|
489
|
-
/**
|
|
490
|
-
* Set columnSpam in Device
|
|
491
|
-
*/
|
|
538
|
+
/** Set columnSpan in Device */
|
|
492
539
|
columnSpanDevice?: number;
|
|
540
|
+
/** Custom CSS classes */
|
|
541
|
+
className?: string;
|
|
493
542
|
}
|
|
494
543
|
export declare type SectionTitleSize = 'small' | 'large';
|
|
495
544
|
export interface ISectionTitleProps {
|
|
496
|
-
/**
|
|
497
|
-
* Title to display.
|
|
498
|
-
*/
|
|
545
|
+
/** Title to display. */
|
|
499
546
|
title: string;
|
|
500
|
-
/**
|
|
501
|
-
* Size of title to display - by default small, which renders as an H2 (and large is an H1).
|
|
502
|
-
*/
|
|
547
|
+
/** Size of title to display - by default small, which renders as an H2 (and large is an H1). */
|
|
503
548
|
size?: SectionTitleSize;
|
|
504
|
-
/**
|
|
505
|
-
* Optional description that can be rendered below the title.
|
|
506
|
-
*/
|
|
549
|
+
/** Optional description that can be rendered below the title. */
|
|
507
550
|
description?: string;
|
|
508
|
-
/**
|
|
509
|
-
|
|
510
|
-
*/
|
|
511
|
-
semanticLevel?: TypographyLevel;
|
|
551
|
+
/** Custom CSS classes */
|
|
552
|
+
className?: string;
|
|
512
553
|
}
|
|
513
554
|
export interface ILogosProps {
|
|
514
555
|
/**
|
|
@@ -531,44 +572,22 @@ export interface ILogosStyledProps extends StyledProps<any> {
|
|
|
531
572
|
fillColor?: Colors.White | Colors.Black;
|
|
532
573
|
}
|
|
533
574
|
export interface IAccordionProps {
|
|
534
|
-
/**
|
|
535
|
-
* Title to display.
|
|
536
|
-
*/
|
|
575
|
+
/** Title to display. */
|
|
537
576
|
title?: string;
|
|
538
|
-
/**
|
|
539
|
-
* The component to be wrapped into the accordion
|
|
540
|
-
*/
|
|
577
|
+
/** The component to be wrapped into the accordion */
|
|
541
578
|
children?: ReactNode;
|
|
542
|
-
/**
|
|
543
|
-
* Components wrapped into the accordion that are always visible
|
|
544
|
-
*/
|
|
545
|
-
visibleStandfirst?: ReactNode;
|
|
546
|
-
/**
|
|
547
|
-
* Set if accordions are stacked
|
|
548
|
-
*/
|
|
579
|
+
/** Set if accordions are stacked */
|
|
549
580
|
showLine?: boolean;
|
|
550
|
-
/**
|
|
551
|
-
* Set init open
|
|
552
|
-
*/
|
|
581
|
+
/** Set init open */
|
|
553
582
|
initOpen?: boolean;
|
|
554
|
-
/**
|
|
555
|
-
|
|
556
|
-
*/
|
|
557
|
-
contentType?: TypographyType;
|
|
558
|
-
/**
|
|
559
|
-
* Set display level - aesthetic
|
|
560
|
-
*/
|
|
561
|
-
displayLevel?: TypographyLevel;
|
|
562
|
-
/**
|
|
563
|
-
* Set semantic level - not to be used for aesthetic
|
|
564
|
-
*/
|
|
565
|
-
semanticLevel?: TypographyLevel;
|
|
583
|
+
/** Custom CSS classes */
|
|
584
|
+
className?: string;
|
|
566
585
|
}
|
|
567
586
|
export interface IAccordionsProps {
|
|
568
|
-
/**
|
|
569
|
-
* Array of Accordion component
|
|
570
|
-
*/
|
|
587
|
+
/** Array of Accordion component */
|
|
571
588
|
items: IAccordionProps[];
|
|
589
|
+
/** Custom CSS classes */
|
|
590
|
+
className?: string;
|
|
572
591
|
}
|
|
573
592
|
export declare const BannerVariants: {
|
|
574
593
|
readonly 'service-persistent': "service-persistent";
|
|
@@ -703,3 +722,13 @@ export declare enum LinkTarget {
|
|
|
703
722
|
*/
|
|
704
723
|
Blank = "_blank"
|
|
705
724
|
}
|
|
725
|
+
export interface ISkipToMainProps {
|
|
726
|
+
/**
|
|
727
|
+
* Custom CSS class
|
|
728
|
+
*/
|
|
729
|
+
className?: string;
|
|
730
|
+
/**
|
|
731
|
+
* Defines which tag the button should skip to. Default: "main"
|
|
732
|
+
*/
|
|
733
|
+
skipToTag?: string;
|
|
734
|
+
}
|
|
@@ -25,6 +25,10 @@ export interface IGenericTypographyProps<T extends HTMLElement = HTMLParagraphEl
|
|
|
25
25
|
export interface IHarmonicHeaderProps extends IGenericTypographyProps {
|
|
26
26
|
hierarchy: HeaderHierarchy;
|
|
27
27
|
}
|
|
28
|
+
export interface ITaggedTypographyProps extends IGenericTypographyProps {
|
|
29
|
+
/** Specifies the HTML tag for rendering typography. The default is 'p'. */
|
|
30
|
+
tag?: React.ElementType;
|
|
31
|
+
}
|
|
28
32
|
export declare type TypographyLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
29
33
|
export declare type AltHeaderLevel = 3 | 4 | 5 | 6;
|
|
30
34
|
export declare type BodyLevel = 1 | 2 | 3;
|
package/package.json
CHANGED
package/README.GIT
DELETED
|
@@ -1,278 +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 the `CHROMATIC_PROJECT_TOKEN` -- find this in 1Password. Creating your own Chromatic account is advised if multiple builds are necessary.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* **To enable publishing to the NPM package**:
|
|
31
|
-
* Create account / log in to NPM
|
|
32
|
-
* Ask a colleague with admin rights to be added as a contributer
|
|
33
|
-
* Generate your own ROH `NPM_TOKEN` (store this token in 1Password)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Versioning
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
We use [Semantic Versioning](https://semver.org/) for Harmonic.
|
|
40
|
-
|
|
41
|
-
Given a version number MAJOR.MINOR.PATCH, increment the:
|
|
42
|
-
|
|
43
|
-
* MAJOR version when you make incompatible library changes
|
|
44
|
-
* MINOR version when you add functionality in a backwards compatible manner
|
|
45
|
-
* PATCH version when you make backwards compatible bug fixes
|
|
46
|
-
|
|
47
|
-
When you create a new release always update the `CHANGELOG` and `package.json`
|
|
48
|
-
|
|
49
|
-
Increment your version from the latest stable version on [Royal Opera House - Harmonic](https://www.npmjs.com/package/@royaloperahouse/harmonic?activeTab=versions)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
## Deploying the Storybook
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
### **1. To build and deploy locally**
|
|
56
|
-
|
|
57
|
-
You can quickly build and serve the contents of `/storybook-static` from your local machine, for development and manual testing. To do this run:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
yarn storybook
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
By default the storybook will be accessible at
|
|
64
|
-
[http://localhost:6006/]()
|
|
65
|
-
|
|
66
|
-
The server will hot-reload on most changes.
|
|
67
|
-
|
|
68
|
-
### **2. To deploy a preview version remotely**
|
|
69
|
-
|
|
70
|
-
You can deploy a release candidate, or work-in-progress to [Chromatic](https://www.chromatic.com/) for showcase or QA.
|
|
71
|
-
|
|
72
|
-
**NOTE:** you will need the `CHROMATIC_PROJECT_TOKEN` as described in *Prerequisites* above.
|
|
73
|
-
|
|
74
|
-
Either set the token as a shell variable or use a `.env` file in the `harmonic` root directory containing the token, as so:
|
|
75
|
-
|
|
76
|
-
```
|
|
77
|
-
CHROMATIC_PROJECT_TOKEN=tokengoeshere
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
Run:
|
|
81
|
-
```
|
|
82
|
-
CHROMATIC_PROJECT_TOKEN=tokengoeshere yarn deploy-storybook-dev
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
to build and deploy the storybook from your repo to Chromatic.
|
|
86
|
-
|
|
87
|
-
You will find the address of your deployed storybook in the console output, looking something like this:
|
|
88
|
-
|
|
89
|
-
`→ View your Storybook at https://randomHexString-randomAlphabeticalString.chromatic.com`
|
|
90
|
-
|
|
91
|
-
### **3. To deploy a release version**
|
|
92
|
-
|
|
93
|
-
You can deploy the contents of `./storybook-static` to S3 as a static site, which is permanently accessible at [WIP] TODO: S3 deployment
|
|
94
|
-
|
|
95
|
-
**NOTE:** To do this you will need the correct `AWS` credentials set up, as described in *Prerequisites* above.
|
|
96
|
-
|
|
97
|
-
First build the storybook using:
|
|
98
|
-
|
|
99
|
-
```
|
|
100
|
-
yarn build-storybook
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
then run:
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
yarn deploy-storybook
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
> **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*.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
## Releasing a New Package Version
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
This is the procedure for releasing a new Harmonic NPM package.
|
|
116
|
-
|
|
117
|
-
There are two types of package:
|
|
118
|
-
|
|
119
|
-
A **snapshot** can be published to use a development version of the Harmonic library in our frontend staging environments, to perform integrated, manual testing.
|
|
120
|
-
|
|
121
|
-
A **stable** package is published for use in production.
|
|
122
|
-
|
|
123
|
-
**NOTE:** You will need the `NPM_TOKEN`, as described in 'Prerequisites' above.
|
|
124
|
-
|
|
125
|
-
### **1. To release a snapshot version**
|
|
126
|
-
|
|
127
|
-
> **IMPORTANT:** Make sure you always publish your **snapshots** from `development` after merging in your feature branch.
|
|
128
|
-
|
|
129
|
-
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.
|
|
130
|
-
|
|
131
|
-
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`
|
|
132
|
-
|
|
133
|
-
To publish a snapshot use:
|
|
134
|
-
|
|
135
|
-
```bash
|
|
136
|
-
NPM_ROH_TOKEN={NPM_TOKEN} RELEASE_VERSION={RELEASE_VERSION} yarn publish-snapshot
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
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.
|
|
140
|
-
|
|
141
|
-
### **2. To release a stable version**
|
|
142
|
-
|
|
143
|
-
> **IMPORTANT:** Make sure you always publish your **stable** packages from `main` after merging in your feature branch.
|
|
144
|
-
|
|
145
|
-
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`!)
|
|
146
|
-
|
|
147
|
-
To publish a stable package use:
|
|
148
|
-
|
|
149
|
-
```bash
|
|
150
|
-
NPM_ROH_TOKEN={NPM_TOKEN} RELEASE_VERSION={RELEASE_VERSION} yarn publish-release
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
## Using the Package
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
The package is deployed to NPM, and can be installed using yarn or npm:
|
|
158
|
-
|
|
159
|
-
```bash
|
|
160
|
-
npm i --save @royaloperahouse/harmonic
|
|
161
|
-
```
|
|
162
|
-
```bash
|
|
163
|
-
yarn add @royaloperahouse/harmonic
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
## Testing
|
|
168
|
-
---
|
|
169
|
-
|
|
170
|
-
To **Lint** the package use:
|
|
171
|
-
|
|
172
|
-
```bash
|
|
173
|
-
yarn lint
|
|
174
|
-
# Use the --fix option to perform automatic fixes
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
To run the **unit tests** (using Jest) use:
|
|
178
|
-
|
|
179
|
-
```bash
|
|
180
|
-
yarn test
|
|
181
|
-
|
|
182
|
-
# Use the -u option to update snapshots if needed
|
|
183
|
-
# Run `yarn test:watch` to re-run tests on changes
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
To **run and and store the unit tests** for display in storybook use:
|
|
187
|
-
|
|
188
|
-
```bash
|
|
189
|
-
yarn test-storybook
|
|
190
|
-
# Use the -u option to update snapshots if needed
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
## Development Process
|
|
195
|
-
---
|
|
196
|
-
|
|
197
|
-
### **1. Branching Model**
|
|
198
|
-
* The Harmonic project lives in the `harmonic-library/harmonic` *repository*
|
|
199
|
-
* When working on Harmonic, treat the `harmonic` directory as your root
|
|
200
|
-
* The Harmonic **development** branch is for QA
|
|
201
|
-
* The Harmonic **main** branch is currently for stable releases
|
|
202
|
-
* 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`
|
|
203
|
-
* Always create your feature branch FROM, and submit pull requests TO, the **main** branch
|
|
204
|
-
* 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
|
|
205
|
-
* For releasing an **NPM snapshot**: merge your feature branch into the **development** branch and publish the NPM snapshot from there
|
|
206
|
-
|
|
207
|
-
### **2. Detailed Workflow**
|
|
208
|
-
|
|
209
|
-
#### **Before review:**
|
|
210
|
-
|
|
211
|
-
* Git pull the latest version of Harmonic from `main`
|
|
212
|
-
* Checkout a new, correctly-named feature branch from `main`
|
|
213
|
-
* Do your work on this feature branch
|
|
214
|
-
* Run: `yarn lint --fix`
|
|
215
|
-
* Run: `yarn test -u`
|
|
216
|
-
* Commit your changes
|
|
217
|
-
* Create a pull request from your feature branch to `main`
|
|
218
|
-
* Add the appropriate reviewers
|
|
219
|
-
|
|
220
|
-
#### **Before QA / UAT:**
|
|
221
|
-
|
|
222
|
-
After your PR is approved, you have two options:
|
|
223
|
-
|
|
224
|
-
**i.** For QA of a component in isolation:
|
|
225
|
-
|
|
226
|
-
* Follow the steps above in *Deploying the Storybook -> 2. Deploying a preview version remotely*
|
|
227
|
-
* Share the generated Chromatic URL with the appropriate people for QA / UAT
|
|
228
|
-
|
|
229
|
-
**ii.** For integrated testing of a component in the frontend staging environments:
|
|
230
|
-
|
|
231
|
-
* Check out the `development` branch
|
|
232
|
-
* Merge your work in to `development`
|
|
233
|
-
* Follow the steps above under *Publishing a New Package Version -> 1. To release a snapshot version*
|
|
234
|
-
* Git push the updated `development` branch to remote
|
|
235
|
-
* Finally, in the frontend repo:
|
|
236
|
-
|
|
237
|
-
1. Update the `package.json` to reference the new snapshot version
|
|
238
|
-
2. Run: `yarn install`
|
|
239
|
-
3. Deploy the frontend to a staging environment
|
|
240
|
-
|
|
241
|
-
#### **When ready for production:**
|
|
242
|
-
|
|
243
|
-
* Return to your Harmonic **feature branch**
|
|
244
|
-
* 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
|
|
245
|
-
* Update `CHANGELOG.md`, adding the new version number and a short description of your changes
|
|
246
|
-
* Run: `yarn lint --fix`
|
|
247
|
-
* Run: `yarn test -u`
|
|
248
|
-
* Run: `yarn test-storybook -u`
|
|
249
|
-
* Run: `yarn build-storybook`
|
|
250
|
-
* Git commit, push, and update your PR for final approval
|
|
251
|
-
* Merge your approved PR to `main`
|
|
252
|
-
* Follow the steps in *Publishing a New Package Version -> 2. To release a stable version* to publish the NPM package
|
|
253
|
-
* Finally, follow the steps in *Deploying The Storybook -> 3. To deploy a release version*, to update the public Harmonic Storybook page
|
|
254
|
-
|
|
255
|
-
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.
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
## Notes
|
|
259
|
-
---
|
|
260
|
-
### The `storybook-static` folder
|
|
261
|
-
|
|
262
|
-
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:
|
|
263
|
-
|
|
264
|
-
```bash
|
|
265
|
-
yarn build-storybook
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
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.
|
|
269
|
-
|
|
270
|
-
---
|
|
271
|
-
### Examples
|
|
272
|
-
|
|
273
|
-
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.
|
|
274
|
-
|
|
275
|
-
---
|
|
276
|
-
### Bundle analysis
|
|
277
|
-
|
|
278
|
-
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`.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const TextContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|