Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
skinread committed Aug 9, 2024
0 parents commit 8de23fd
Show file tree
Hide file tree
Showing 104 changed files with 4,221 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
!.*
.eslintrc.*
coverage
dist
node_modules
storybook-static
53 changes: 53 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
module.exports = {
root: true,
env: {
browser: true,
es2020: true,
node: true,
},
settings: {
react: {
version: 'detect',
},
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
'plugin:storybook/recommended',
'plugin:jsx-a11y/recommended',
'plugin:prettier/recommended',
],
plugins: ['jsx-a11y', 'react-refresh', 'unicorn'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
ignorePatterns: ['dist', 'postcss.config.js', 'tailwind.config.js'],
rules: {
'prettier/prettier': 'warn',
'no-duplicate-imports': 'error',
'no-template-curly-in-string': 'error',
'no-use-before-define': 'error',
'@typescript-eslint/no-unused-vars': 'error',
},
overrides: [
{
extends: ['plugin:@typescript-eslint/disable-type-checked'],
files: ['plopfile.js', './.storybook/*.{js,jsx,ts,tsx}'],
},
{
rules: {
'@typescript-eslint/no-unsafe-call': 'off',
},
files: ['**/*.stories.{jsx,tsx}'],
},
],
};
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
45 changes: 45 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish Prerelease

on:
# push:
# branches: ["develop"]

workflow_dispatch:

jobs:
publish:
name: Version and publish
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
strategy:
matrix:
node-version: [20.x]

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: "**/package-lock.json"
- name: Cache or restore dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-
- name: Install dependencies
run: npm ci
- name: Configure Git
uses: oleksiyrudenko/gha-git-credentials@v2-latest
with:
token: '${{ secrets.GITHUB_TOKEN }}'
- name: Release-It
run: |
npm run release -- --preRelease=development --'hooks.after:bump='
45 changes: 45 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish Component Library

on:
# push:
# branches: ["main"]

workflow_dispatch:

jobs:
publish:
name: Version and publish
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
strategy:
matrix:
node-version: [20.x]

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: "**/package-lock.json"
- name: Cache or restore dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-
- name: Install dependencies
run: npm ci
- name: Configure Git
uses: oleksiyrudenko/gha-git-credentials@v2-latest
with:
token: '${{ secrets.GITHUB_TOKEN }}'
- name: Release-It
run: |
npm run release
66 changes: 66 additions & 0 deletions .github/workflows/storybook-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Storybook Preview Deploy

on:
push:
branches: ["develop"]

pull_request:
branches: ["develop"]
types: [closed]

workflow_dispatch:

env:
FOLDER_NAME: preview-${{ github.event.number || 'dev' }}

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "preview"
cancel-in-progress: false

jobs:
build:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: npm ci
- name: Build Storybook
run: npx storybook build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: storybook
path: ./

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Download Pages artifact
uses: actions/download-artifact@v4
with:
name: storybook
- name: Deploy to GitHub Pages
id: deployment
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: storybook-static
target-folder: ${{ env.FOLDER_NAME }}
65 changes: 65 additions & 0 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Deploy Storybook Site

on:
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: Cache or restore dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: npm ci
- name: Build Storybook
run: npx storybook build
- name: Upload artifacts
uses: actions/upload-pages-artifact@v3
with:
path: ./storybook-static

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
55 changes: 55 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: CI Tests

on:
pull_request:
branches: ["main","develop"]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: "**/package-lock.json"
- name: Cache or restore dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-
- name: Install dependencies
run: npm ci

- name: Check formatting and linting
run: npm run prettier && npm run lint

- name: Check package build
run: npm run build

- name: Get Playwright version
run: echo "PLAYWRIGHT_VERSION=$(jq -r '.devDependencies["@playwright/test"]' package.json)" >> $GITHUB_ENV
- name: Cache or restore Playwright binaries
uses: actions/cache@v4
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
restore-keys: ${{ runner.os }}-playwright-
- name: Install Playwright
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npm run pretest
- name: Storybook test build
run: npm run storybook:build -- --test
- name: Storybook test suite
run: npm run test:ci
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
storybook-static
coverage
.env
.npmrc
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
2 changes: 2 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#npm test
npx lint-staged
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.husky
coverage
dist
storybook-static
Loading

0 comments on commit 8de23fd

Please sign in to comment.