Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Storybook): upgrade v7 #280

Merged
merged 90 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
ac9ca89
feature(Storybook): starts initial upgrade to v7
arwehrman Jun 29, 2023
4d0c20c
feature(Storybook): changes addons to use storybook blocks where nece…
arwehrman Jun 29, 2023
f72ae5e
feature(Storybook): changes tile to use string
arwehrman Jun 29, 2023
50132dc
feature(Storybook): adds mdx1 addon
arwehrman Jun 29, 2023
ac11fdb
feature(Storybook): updates mdx files with proper imports and renames…
arwehrman Jul 3, 2023
68b6da4
feature(Storybook): adds linter fixes for MDX files"
arwehrman Jul 5, 2023
31e97ff
feature(Storybook): updates mdx files to new docs config requirements
arwehrman Jul 6, 2023
f5f9e51
feature(Storybook): adds globalTypes for announce and stageColor
arwehrman Jul 7, 2023
88d8dd9
feature(Storybook): updates add-ons to use manager-api
arwehrman Jul 10, 2023
47ed392
feature(Storybook): fix DocsLink in TabBar
arwehrman Jul 10, 2023
22ef65f
feature(Storybook): updates autodocs to use tags for manual opt in
arwehrman Jul 10, 2023
19c84d0
feature(Storybook): adds new config for add-ons stageColor working co…
arwehrman Jul 11, 2023
259da92
feature(Storybook): updates ThemeDownload addon to v7 config
arwehrman Jul 11, 2023
5faf387
feature(Storybook): updates to addons
arwehrman Jul 11, 2023
1e66ee8
feature(Storybook): removes unused devDependencies"
arwehrman Jul 12, 2023
12e7119
feature(Storybook): fixes announce add-on toggle logic
arwehrman Jul 12, 2023
99885e6
feature(Storybook): adds globals for announce and stagecolor
arwehrman Jul 12, 2023
7da35be
feature(Storybook): adds minor comments for troubleshooting
arwehrman Jul 13, 2023
90b6d04
feature(Storybook): changes exports in package to conditionals
arwehrman Jul 13, 2023
1463e0a
feature(Storybook): updates templates for component creation
arwehrman Jul 13, 2023
acefeb8
feature(Storybook): adds overrides for essential addons
arwehrman Jul 14, 2023
205cb37
feature(Storybook): cleans up webpack config and index files
arwehrman Jul 17, 2023
3ebfb78
feature(Storybook): changes theme.js to index.js for consistancy of e…
arwehrman Jul 18, 2023
f3070d3
feature(Storybook): updates dark theme config for SB
arwehrman Jul 18, 2023
bb027ee
feature(Storybook): makes minor djsuts ments to package.json files fo…
arwehrman Jul 18, 2023
59de7fd
feature(Storybook): updates generate storybook link to take title fro…
arwehrman Jul 19, 2023
7d7b439
feature(Storybook): removes old createModeControl file
arwehrman Jul 19, 2023
0f4662e
feature(Storybook): removes old console logs
arwehrman Jul 19, 2023
141bd47
feature(Storybook): updates CardRadio with v7 config
arwehrman Jul 19, 2023
aa5c834
feature(Storybook): updates new test docs to v7 changes
arwehrman Jul 19, 2023
5a4b434
feature(Storybook): adds Figma addon for design panel
arwehrman Jul 20, 2023
4bc7a29
fix(Storybook): adds minor tweaks need from rebasing
arwehrman Aug 15, 2023
f4ce792
feature(Storybook): updates categories to match the latests changes
arwehrman Aug 15, 2023
612bccc
feature(Storybook): adds notes and fixes minor mdx syntax errors
arwehrman Aug 16, 2023
bbb3051
fix: update storybook module resolution and revert package.json for u…
joshhowenstine Aug 28, 2023
0cf847a
feat(Storybook): merges two Storybook docs into one file
arwehrman Aug 28, 2023
13270ce
feat(Storybook): removes console logs from Control Panel troubleshooting
arwehrman Aug 28, 2023
ae79a2e
feat(Storybook): updates OptionsControl options to use argTypes
arwehrman Aug 29, 2023
bf69d11
feat(Storybook): updates docs template to use updated MDX comments
arwehrman Aug 29, 2023
fd7e4ae
feat(Storybook): removes comment typo in license block
arwehrman Aug 29, 2023
11597a2
feat(Storybook): changes order of build in add-ons
arwehrman Aug 29, 2023
f17e30a
feat(Storybook): adds configPlugin flag to rollup
arwehrman Aug 29, 2023
3f65a2e
fix(Button): removes Figma test demo
arwehrman Aug 31, 2023
f5f44fc
fix(Card): removes tag from config
arwehrman Aug 31, 2023
6e40c75
fix(CardRadio): removes tag from config
arwehrman Aug 31, 2023
04e5574
fix(Card): removes tag from Card stories
arwehrman Aug 31, 2023
0f36efd
fix(Input): fixes typo in docs
arwehrman Aug 31, 2023
53cfcff
fix(MetadataTile): removes comments
arwehrman Aug 31, 2023
2bed73d
fix(Key): updates props and style props
arwehrman Aug 31, 2023
520295e
feat(Storybook): updates import of NavigationManagerStories
arwehrman Aug 31, 2023
aa5b05b
fix(Storybook): upgrades to 7.4
arwehrman Sep 6, 2023
6fa18d3
fix(Storybook): removes getAbsolutePath that was auto added during 7.…
arwehrman Sep 6, 2023
0e9a303
feat(Storybook): adds tone to value for tone Component Panel control
arwehrman Sep 6, 2023
c2789fa
fix(Button): removes old comment
arwehrman Sep 6, 2023
d6d31b0
fix(CardRadio): fixes typo on Title
arwehrman Sep 6, 2023
c021847
fix(Keyboard): updates a header to proper level
arwehrman Sep 6, 2023
9f1b6e5
fix(Storybook): removes old code for lightning inspector in docs
arwehrman Sep 6, 2023
8b10fad
fix(Storybook): removes old commented out code in themesUtils
arwehrman Sep 6, 2023
a3f030f
fix(TestRender): removes rogue br tag
arwehrman Sep 6, 2023
9610ac3
fix(withSelections): removes description for component no longer bein…
arwehrman Sep 6, 2023
047f41f
fix(Storybook): removes reference to internal links from Resources doc"
arwehrman Sep 6, 2023
11ecabb
fix(Key): updates Key docs to match current docs in Dev
arwehrman Sep 6, 2023
b7ba7eb
fix(Key): adds escape to headers with code so MDX ignores
arwehrman Sep 6, 2023
c9c8c3a
fix(Storybook): removes storybook mdx addon that is no longer needed
arwehrman Sep 7, 2023
789be90
fix(Storybook): removes duplicate rollup config file
arwehrman Sep 7, 2023
c933977
fix(Storybook): removes fullscreen layout in preview
arwehrman Sep 8, 2023
6a578a7
fix(Tooltip): removes old comment in test
arwehrman Sep 12, 2023
95371ed
fix(Storybook): changes file ext to just mdx stories.mdx is no longer…
arwehrman Sep 12, 2023
9e6c975
fix(Storybook): removes docs from gitignore for MDX linting
arwehrman Sep 13, 2023
d38af2d
fix(Storybook): updates formatting of license on MDX files
arwehrman Sep 13, 2023
d34250b
fix(Storybook): adds semicolon to import to fix lint error
arwehrman Sep 13, 2023
5187c2c
fix(ToolTip): fix DocsLink import issue
arwehrman Sep 13, 2023
a145015
fix(Storybook): minor config edits to ThemePicker and preview
arwehrman Sep 14, 2023
84476b3
fix(Storybook): fixes mdx lint issue for docs
arwehrman Sep 18, 2023
df38403
fix(Storybook): fixes ThemePicker closing issue
arwehrman Sep 18, 2023
edd558d
fix(Storybook): removes args set to undefined and updates autodocs co…
arwehrman Oct 5, 2023
76fe68c
fix(Storybook): updates version to 7.4.6 to match inner source
arwehrman Oct 6, 2023
ea487b5
fix(Storybook): removes Markdown from imports in Storybook docs
arwehrman Oct 6, 2023
5c1b095
fix(Storybook): updates ThemePicker config to match Josh fix in inner…
arwehrman Oct 9, 2023
68b102a
feat(Storybook): upgrades to v 7.5
arwehrman Oct 18, 2023
8aa1456
fix(Storybook): fix lockfile after rebase
arwehrman Oct 25, 2023
7c6256a
fix(Storybook): updates import paths for ui-components in SB config f…
arwehrman Oct 25, 2023
6a7981a
fix(Storybook): adds example of implementing ArgTypes for props in docs
arwehrman Oct 27, 2023
200f21e
fix(Storybook): adds subcategory to some components for docs org
arwehrman Oct 30, 2023
daf77b3
fix(Storybook): adds back src to the import path for ui-components
arwehrman Oct 30, 2023
8fbdb43
fix(Storybook): fixes minor code errors
arwehrman Nov 2, 2023
0b01c2b
fix(Storybook): updates Readme and Contributing stories
arwehrman Nov 2, 2023
662d200
fix(Storybook): fix yarnlock after rebase issue
arwehrman Nov 2, 2023
23925aa
fix(Storybook): fixes typos and adds back removed code in docs
arwehrman Nov 6, 2023
4b2a14b
fix(Storybook): updates yarnlock after rebase
arwehrman Nov 8, 2023
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
12 changes: 11 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ module.exports = {
'**/*.json'
],
plugins: ['jest', 'prettier'],
extends: ['eslint:recommended', 'plugin:prettier/recommended', 'prettier'],
extends: [
'eslint:recommended',
'plugin:prettier/recommended',
'prettier',
'plugin:mdx/recommended'
],
rules: {
'import/no-useless-path-segments': 'error', // Please note this rule has been patched with Yarn to allow imports from npm packages to apply. The open issue can be found here https://github.com/import-js/eslint-plugin-import/issues/1280
'no-console': 'off',
Expand Down Expand Up @@ -113,6 +118,11 @@ module.exports = {
'@typescript-eslint/no-redeclare': [1, { ignoreDeclarationMerge: true }]
},
plugins: ['@typescript-eslint', 'eslint-plugin-import']
},
{
files: '*.mdx',
parser: 'eslint-mdx',
extends: 'plugin:mdx/recommended'
}
]
};
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
docs
reports
dist
ci
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class MyComponent extends lng.Component {
_getFocused() {
return this.tag('FocusManager');
}
};
}
```

## Questions???
Expand Down
59 changes: 0 additions & 59 deletions STORYBOOK.md

This file was deleted.

91 changes: 45 additions & 46 deletions bin/templates/docs.template.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,48 @@
/**
* Copyright 2023 Comcast Cable Communications Management, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/

const urlBase = 'https://github.com/rdkcentral/Lightning-UI-Components/tree/develop/packages/%40lightningjs/ui-components/src/components/';

module.exports = (name, dir) => `<!--
Copyright 2023 Comcast Cable Communications Management, LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

SPDX-License-Identifier: Apache-2.0
-->

import { Canvas, Story } from '@storybook/addon-docs';
import ${name} from '.';

# ${name}
{/* prettier-ignore */}
{
/**
* Copyright 2023 Comcast Cable Communications Management, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
}

const urlBase =
'https://github.com/rdkcentral/Lightning-UI-Components/tree/develop/packages/%40lightningjs/ui-components/src/components/';

module.exports = name => `{/* prettier-ignore */}
{/*Copyright 2023 Comcast Cable Communications Management, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
SPDX-License-Identifier: Apache-2.0 */}

import { Meta, Title } from '@storybook/blocks';
import * ${name}Stories from './${name}.stories';

<Meta of={${name}Stories} />

<Title />

## Source

Expand All @@ -61,10 +64,6 @@ class Basic extends lng.Component {
};
\`\`\`

<Canvas>
<Story id="${dir}-${name.toLowerCase()}--basic" />
</Canvas>

## API

### Properties
Expand Down
8 changes: 1 addition & 7 deletions bin/templates/story.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

module.exports = (name) => {
module.exports = name => {
return `/**
* Copyright 2023 Comcast Cable Communications Management, LLC
*
Expand All @@ -37,17 +37,11 @@ module.exports = (name) => {

import lng from '@lightningjs/core';
import ${name} from '.';
import mdx from './${name}.mdx';
import { CATEGORIES } from '../../docs/constants';

export default {
// TODO: replace categoryIndex with key for which category this component's story should be nested in. See CATEGORIES object in packages/apps/lightning-ui-docs/index.js
title: 'CATEGORIES[categoryIndex]/${name}',
parameters: {
docs: {
page: mdx
}
}
};

export const Basic = () =>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-jest": "^24.3.2",
"eslint-plugin-mdx": "^2.1.0",
"eslint-plugin-n": "^15.0.0",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-promise": "^6.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{/* prettier-ignore */}
{/*
Copyright 2023 Comcast Cable Communications Management, LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

SPDX-License-Identifier: Apache-2.0
\*/}

import { Meta } from '@storybook/blocks';

<Meta title="Docs / Unit Testing / Overview" />

# @lightningjs/ui-components-test-utils

The `@lightningjs/ui-components-test-utils` package provides 2 artifacts to assist with unit testing Lightning components.

1. **Test Renderer**

- [create](/story/docs-unit-testing-test-renderer-create--page): Generates a `testRenderer` object with built in utilities for unit testing Lightning Components.
- [toJSON](/story/docs-unit-testing-test-renderer-tojson--page): Converts Lightning components to JSON to be used in [Jest Snapshot Tests](https://jestjs.io/docs/snapshot-testing)

2. **Test Utils**

- [makeCreateComponent](/story/docs-unit-testing-test-utils-makecreatecomponent--page): Returns a `createComponent` function which is used to generate an instance of a component to run unit test cases against.
- [completeAnimation](/story/docs-unit-testing-test-utils-completeanimation--page): Returns a Promise that resolves once all animating properties have updated to their target value(s).
- [fastForward](/story/docs-unit-testing-test-utils-fastforward--page): Force all running Lightning Transitions on one or more Lightning Elements to finish and update the transitioning property to its target value immediately.
- [nextTick](/story/docs-unit-testing-test-utils-nexttick--page): Creates a Promise that resolves after a defined amount of time. If no amount of time is specified, the Promise will resolve immediately.

```js
// jest.config.js

const config = {
// ...other Jest config properties
setupFiles: ['jest-webgl-canvas-mock'],
transformIgnorePatterns: [
'/node_modules/(?!(@lightningjs/ui-components-test-utils)/)'
]
// ...other Jest config properties
};

export default config;
```

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<!--
Copyright 2023 Comcast Cable Communications Management, LLC
{/* prettier-ignore */}
{/*
Copyright 2023 Comcast Cable Communications Management, LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

SPDX-License-Identifier: Apache-2.0
-->
SPDX-License-Identifier: Apache-2.0
\*/}

import { Meta } from '@storybook/addon-docs';
import { Meta } from '@storybook/blocks';

<Meta title="Docs / Unit Testing / Test Renderer / create" />

Expand Down
Loading
Loading