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: TUP-700 @tacc/core-components - Storybook #435

Draft
wants to merge 35 commits into
base: feat/TUP-700-core-components-node-pkg--wrappers
Choose a base branch
from

Conversation

wesleyboar
Copy link
Member

@wesleyboar wesleyboar commented Feb 27, 2024

Overview

Add Storybook to Core-Components.

Status

  • make Storybook work
  • add story for button(s) (most common component)
  • document how to contribute
  • author "Testing"
  • treat libs/core-components as an NPM workspace
  • investigate/fix failed actions
  • test Storybook since using NPM workspace
  • author "Changes"
  • fix test failures
  • author "UI"
  • consider usefulness of django-pattern-library (now v1.2) (research).

Related

Changes

  • documented command to start demo
  • added ./storybook config
  • documented commands for core-components in isolation
  • documented reference for Storybook
  • added command to start demo
  • updated dependencies for core-components
  • added more targets for core-components
  • added stories for Button component
  • added tup-ui support for Storybook in core-components
  • fixed core-components workspace reference

Testing

Setup

Important

0. rm -rf node_modules

Run Demo

  1. npm install --include=optional --workspace=libs/core-components
  2. npx nx serve core-components
  3. Open Storybook at URL provided.
  4. View "Button" → "Types" is available.
  5. Verify "Button" types render accurately.

Build Demo

  1. npm install --include=optional --workspace=libs/core-components
  2. npx nx build-storybook core-components
  3. npx serve dist/storybook/core-components
  4. Open Storybook at URL provided.
  5. View "Button" → "Types" is available.
  6. ❌ Verify "Button" types render accurately.
    Will probably work if "Build Lib" is fixed.

Build Lib

  1. npm install --include=optional --workspace=libs/core-components
  2. npx nx build core-components
  3. ❌ Verify build completes without error.
    Works if using npm ci.
    Works on feat: TUP-700 @tacc/core-components - core-wrappers #458.
    Fails if using npm install --include=optional --workspace=libs/core-components.

UI

tup-700 storybook preview

Issues

Important

Adds optional dependencies that are installed by default (details: 5fced48).

STEPS
1. `npm add -D @nx/storybook@17.2.8`
2. `npx nx@17.2.8 g @nx/storybook:configuration core-components --uiFramework="@storybook/react-vite" --bundler="vite"`
3. "Do you want to set up Storybook interaction tests? (Y/n) ›  false"

CONCERNS
1. Generator installed `@swc-node/register` and `@swc/core`.
2. `@vitejs/plugin-react-swc` is already isntalled.
3. [Storybook 7 does not work with @vitejs/plugin-react-swc](storybookjs/storybook#22381)
4. I worry I cannot move to Storybook 8 via NX, because it requires NX v18.
- Vite already uses `@vitejs/plugin-react-swc` (notice the SWC).
- Storybook seems to work fine without these.
- I read that in v8, Storybook will stop isntalling backup compilers.
Running npm ci at this point:
- DOES reinstall deps
- does NOT create libs/core-components/node_modules
- does NOT create libs/core-components/package-lock.json
@wesleyboar wesleyboar changed the base branch from feat/TUP-700-core-components-node-pkg to feat/TUP-700-core-components-node-pkg--wrappers May 9, 2024 23:14
…eat/TUP-700-core-components-node-pkg--storybook
…eat/TUP-700-core-components-node-pkg--storybook
…eat/TUP-700-core-components-node-pkg--storybook
…eat/TUP-700-core-components-node-pkg--storybook
…eat/TUP-700-core-components-node-pkg--storybook
…eat/TUP-700-core-components-node-pkg--storybook
This causes more work when renaming a library.
…eat/TUP-700-core-components-node-pkg--storybook
These references are outside of this lib, so yeah, reference lib name.
…eat/TUP-700-core-components-node-pkg--storybook
…eat/TUP-700-core-components-node-pkg--storybook
Optional dependencies are installed by default.

We can not disable "install optional by default", cuz NX will fail:
nrwl/nx#20617

We can not configure NPM to omit optional deps only per workspace, cuz:
npm/cli#6099
For core-components, tell dev to only install for core-components.
All this change was required to run `npx nx serve core-components`.
Error occurred as red squiggly udnerline in code editor when importing a component from within a component.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant