patternfly / patternfly/patternfly-org

Bug - CodeSandbox - examples fail because package.json includes CSS dependency

Open
#4,455 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
74
Forks
147
Avg merge
4d 11h
Merged PRs (30d)
2

Description

Describe the problem
The CodeSandbox examples include additional package dependencies via parsing import statements found in PatternFly examples. However, this inadvertently includes CSS imports as well. As a result, multiple CodeSandbox examples fail because a CSS file is not a valid package dependency.

How do you reproduce the problem?

  1. Run latest code locally
  2. Navigate to the chart sparkline or tooltip examples
  3. Open any CodeSandbox example from these pages
  4. View the package.json file
  5. See the CSS file as a dependency, for example:

"react-charts/src/victory/components/Sparkline/examples/./sparkline.css": "latest",

Expected behavior
This regex statement in documentation-framework should omit CSS files from the CodeSandbox dependencies

Screenshots
Sparkline examples
http://localhost:8002/charts/sparkline-chart

image

Any other information?
Even after removing the extra dependency manually, the CSS file no longer loads as expected. CodeSandbox appears to be importing 'react-charts/src/victory/components/Sparkline/examples/./sparkline.css' instead of './sparkline.css'.

image


Jira Issue: PF-1968

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/documentation-framework/helpers/codesandbox.js at the regex around line 172, then reproduce the sparkline or tooltip CodeSandbox examples and inspect their generated package.json. Verify that CSS imports are omitted as dependencies and that the remaining CSS import uses the expected relative path; the examples should load without the invalid package dependency.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, javascript
Domain
documentation, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.