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

USWDS - Web components: Initial setup #5875

Draft
wants to merge 12 commits into
base: uswds-wc
Choose a base branch
from
Draft

Conversation

mejiaj
Copy link
Contributor

@mejiaj mejiaj commented Apr 17, 2024

Summary

Initial setup of StencilJS to get an idea of getting started process. As well as how components could look in our environment.

This approach completely separates component work from the other code. We want to:

  1. See how dependencies are affected
  2. Find code duplication/redundancy
  3. Use a test component with Storybook
  4. Understand build/release process

Closes #5874.

Setup instructions

Initial setup

  1. Go into web-components directory.
  2. Run npm install.
  3. Run npm run build to get required loader.
  4. Go up to root directory and run npm start for storybook.

Development

You'll have to run two watch scripts for now, unfortunately.

  1. Go into component directory: cd ./web-components/
  2. Run watch command: runnpm run watch.
    1. You can generate new component boilerplate with npx stencil generate usa-{{ COMPONENT_NAME }}.
  3. In the root repo npm start for storybook.

Dependency updates

New dependencies for setting up stencilJS. They're listed in the web components directories' package.json.

Dependency name Previous version New version
@stencil-community/postcss - 2.2.0
@stencil/core - 4.7.0
@stencil/sass - 3.0.11
@types/autoprefixer - 10.2.0
@types/jest - 29.5.6
@types/node - 16.18.11
autoprefixer - 10.4.19
jest - 29.7.0
jest-cli - 29.7.0
puppeteer - 21.9.0

],
"scripts": {
"build": "stencil build",
"watch": "stencil build --watch",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed --server flag because we're using storybook instead of the local server stencil provides.

There's also some conflict with the loader required for Storybook not updating reliably.

@mejiaj mejiaj linked an issue Apr 26, 2024 that may be closed by this pull request
3 tasks
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.

USWDS - WC: Setup StencilJS & create simple component
1 participant