Skip to content
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1a5bfd6
refactor: remove cypress and fix storybook
lucasoares Jun 11, 2025
8ab0682
fix: add build on run dev for first-time runs
lucasoares Jun 11, 2025
8b7948f
feat(ci): add PR storybook preview workflow
lucasoares Jun 11, 2025
158784e
fix: add environment configuration for GitHub pages deploy
lucasoares Jun 11, 2025
ffdef59
ci: change pipeline job names
lucasoares Jun 11, 2025
0573ee0
fix: storybook should not modify existing files on the pages directory
lucasoares Jun 11, 2025
380586a
ci: change job name
lucasoares Jun 11, 2025
e11eb14
style: format
lucasoares Jun 11, 2025
554f73e
ci: make sure it runs in an environment
lucasoares Jun 11, 2025
e4a0a73
fix: remove previews folder
lucasoares Jun 11, 2025
119c63c
fix(storybook): add base path configuration for PR preview subdirecto…
lucasoares Jun 11, 2025
ce5fd01
fix(storybook): change base path
lucasoares Jun 11, 2025
161ea62
fix(storybook): update base path handling for Storybook build and dep…
lucasoares Jun 11, 2025
8f30c27
fix: update environment for Storybook preview jobs in GitHub Actions …
lucasoares Jun 11, 2025
c32e1bb
fix: test changing storybook static definitions
lucasoares Jun 11, 2025
97e4156
fix(storybook): update base path configuration in main.js
lucasoares Jun 11, 2025
c3c421a
fix(storybook): update base path for Storybook preview and cleanup
lucasoares Jun 11, 2025
a29b88d
fix(storybook): refine manager configuration for improved sidebar and…
lucasoares Jun 11, 2025
bea1fcf
feat: add GitHub Actions workflows for publishing and testing Storybook
lucasoares Jun 11, 2025
5213a92
fix: remove unused CI and deploy scripts from package.json
lucasoares Jun 11, 2025
d8c2c0b
fix: remove build step from CI workflow and update testing configuration
lucasoares Jun 11, 2025
84206f9
fix: set CI environment variable for Storybook deployment in workflows
lucasoares Jun 11, 2025
2064c25
chore(githook): remove ghooks and use husky instead
lucasoares Jun 11, 2025
540b980
fix: link for getting started releases
lucasoares Jun 11, 2025
95b1aa3
fix: add instruction to ensure StencilJS component runs correctly wit…
lucasoares Jun 11, 2025
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
1 change: 1 addition & 0 deletions .cz-config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
types: [
{ value: 'ci', name: 'ci: Change in the CI' },
{ value: 'feat', name: 'feat: A new feature' },
{ value: 'fix', name: 'fix: A bug fix' },
{ value: 'docs', name: 'docs: Documentation only changes' },
Expand Down
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ node_modules
dist
www
loader
cypress
# don't lint nyc coverage output
coverage

Expand Down
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = {
settings: {
react: {
pragma: 'h',
version: 'detect', // Automatically detect the React version
},
},
};
75 changes: 75 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Blip Design System (blip-ds) - Copilot Instructions

## Project Overview

Blip Design System (blip-ds) is a design system component library built with Web Components using StencilJS. The project provides UI components that follow Blip's design guidelines and can be used in various web applications.

## Project Structure

- `/src/` - Source code of the component library
- `/assets/` - Static assets like images and SVGs
- `/components/` - Individual web components
- `/globals/` - Global styles and variables
- `/pages/` - Documentation pages in MDX format for Storybook, including guides, integration docs, and framework-specific usage
- `/snippets/` - Reusable code examples demonstrating UI patterns and component combinations as Storybook stories
- `/templates/` - Full page layout templates showing how components can be combined into complete interfaces
- `/utils/` - Utility functions and helpers
- `/view_components/` - View-specific components
- `/blip-ds-react/` - React wrapper components (generated from StencilJS components)

## Core Technologies

### StencilJS

The project uses [StencilJS](https://stenciljs.com/) (v2.16.1) as the core technology for building web components. StencilJS is a compiler that generates standard Web Components that can work in any framework or with no framework at all.

Stencil config is located in #file:../stencil.config.ts

#### React Integration

React wrapper components are auto-generated using `@stencil/react-output-target` to allow usage of these components in React applications.

### Styling

- **SASS** is used for styling via `@stencil/sass`
- **blip-tokens** design tokens are imported for consistent theming

### Testing

We use stencil unit tests and e2e tests.

Tests are located in each component's directory in a `test` folder. We prioritize unit tests for component logic and e2e tests for integration scenarios.

Must follow stencil's testing guidelines and use the `@stencil/core/testing` package.

### Documentation

- **Storybook** for component documentation and development

## Build & Development Commands

- `npm run dev` - Starts development environment with Stencil and Storybook
- `npm run build` - Builds the component library
- `npm run build:react` - Builds the React wrapper components
- `npm run test` - Runs all tests
- `npm run storybook` - Starts Storybook for component development
- `npm run storybook:build` - Builds static Storybook documentation

## Key Integration Points

1. When adding new components:

- Create the StencilJS component in `/src/components/`
- React wrappers will be auto-generated in `/blip-ds-react/` with `npm run build:react`
- Add Storybook documentation. Use an existing component as a reference for structure and format.
- Ensure unit tests are written in the component's `test` folder
- Ensure e2e tests cover integration scenarios
- Review and update documentation as necessary

2. The project follows semantic versioning and uses conventional commits for releases.

3. Design tokens come from the `blip-tokens` package which should be kept updated.

## Resources

- [GitHub Repository](https://github.com/takenet/blip-ds)
54 changes: 54 additions & 0 deletions .github/workflows/pr-storybook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: PR Storybook Preview

on:
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- master
- main

permissions:
contents: write
pull-requests: write

concurrency:
group: 'pr-preview-${{ github.event.pull_request.number }}'
cancel-in-progress: true

jobs:
deploy-storybook-preview:
runs-on: ubuntu-latest
environment: storybook-preview

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20

- name: NPM Install and build
if: github.event.action != 'closed'
run: |
npm install
npm run build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HUSKY: 0

- name: Build Storybook for PR
if: github.event.action != 'closed'
run: |
npm run storybook:build -- --output-dir ./storybook-static
env:
STORYBOOK_BASE_PATH: /test-before-migrate/pr-preview/pr-${{ github.event.pull_request.number }}
HUSKY: 0

- name: Deploy PR Preview (separate from main)
uses: rossjrw/pr-preview-action@v1
env:
CI: true
with:
source-dir: ./storybook-static
19 changes: 15 additions & 4 deletions .github/workflows/nodejs.yml → .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- main

permissions:
contents: write
Expand All @@ -29,13 +30,23 @@ jobs:
npm run build
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
HUSKY: 0

- name: Build and Deploy to Storybook
- name: Build Storybook
run: |
npm run storybook:build
npm run storybook:deploy
npm run storybook:build -- --output-dir ./storybook-static
env:
GH_TOKEN: ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}
HUSKY: 0

- name: Deploy Storybook to Root (preserving previews)
uses: JamesIves/github-pages-deploy-action@v4
env:
CI: true
with:
folder: ./storybook-static
clean: true
clean-exclude: |
'pr-preview/**'

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Run Tests

on:
pull_request:
branches:
- main
- master

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20

- name: NPM Install and build
run: |
npm install

- name: Lint
run: |
npm run eslint

- name: Test
run: |
npm run test
9 changes: 1 addition & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,4 @@ package-lock.json
icons/
scripts/*.js

/screenshot

cypress/assets/
cypress/build/
cypress/dist/
cypress/screenshots/
cypress/host.config.json
cypress/index.html
/screenshot
6 changes: 6 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# Simple commit message validation using commitizen config
# This ensures commit messages follow conventional commit format
npx --no-install commitizen --hook || true
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run eslint && npm run test
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run eslint
11 changes: 11 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ module.exports = {
'@storybook/addon-actions',
'@storybook/addon-docs',
'@storybook/addon-console',
// '@storybook/addon-notes', // Remove this as it's causing compatibility issues
'@storybook/preset-create-react-app',
],
typescript: {
reactDocgen: false,
Expand All @@ -18,4 +20,13 @@ module.exports = {
autodocs: true,
defaultName: 'Visão Geral'
},
staticDirs: ['../dist'], // Include the Stencil build output
// Use managerWebpack for base path configuration instead of webpackFinal
managerWebpack: async (config) => {
if (process.env.STORYBOOK_BASE_PATH) {
config.output = config.output || {};
config.output.publicPath = process.env.STORYBOOK_BASE_PATH;
}
return config;
},
};
11 changes: 10 additions & 1 deletion .storybook/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,24 @@ addons.setConfig({
showToolbar: true,
selectedPanel: 'undefined',
initialActive: 'sidebar',
isFullscreen: false,
showNav: true,
showPanel: true,
layoutCustomisations: {
showSidebar: true, // Force sidebar to be always visible
},
sidebar: {
showRoots: true,
collapsedRoots: ['other'],
collapsedRoots: [],
renderLabel: (item) => item.name,
},
toolbar: {
title: { hidden: false },
zoom: { hidden: false },
eject: { hidden: false },
copy: { hidden: false },
fullscreen: { hidden: false },
'storybook/background': { hidden: false },
'storybook/viewport': { hidden: false },
},
});
4 changes: 2 additions & 2 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<link href="https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,wght@0,200;0,300;0,400;0,600;0,700;0,800;1,200;1,300;1,400;1,600;1,700;1,800&display=swap" rel="stylesheet">
<script type="module" src="./build/blip-ds.esm.js"></script>
<script nomodule src="./build/blip-ds.js"></script>
<script type="module" src="./blip-ds/blip-ds.esm.js"></script>
<script nomodule src="./blip-ds/blip-ds.js"></script>
3 changes: 2 additions & 1 deletion .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { defineCustomElements } from '../dist/esm/loader';
import { withConsole } from '@storybook/addon-console';
import './preview.css';

defineCustomElements();
// Load the custom elements
defineCustomElements(window);

export const globalTypes = {
hasTheme: {
Expand Down
10 changes: 0 additions & 10 deletions cypress.config.ts

This file was deleted.

Loading