Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianWielga committed Jun 13, 2024
0 parents commit 32f0c3e
Show file tree
Hide file tree
Showing 18 changed files with 15,047 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"sourceType": "unambiguous",
"presets": [
[
"@babel/preset-env",
{
"targets": {
"chrome": 100,
"safari": 15,
"firefox": 91
}
}
],
"@babel/preset-typescript",
"@babel/preset-react"
],
"plugins": []
}
13 changes: 13 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
node_modules
lib/
esm/
cjs/
types/
storybook-static
.idea

.nyc_output
coverage
cypress/videos
cypress/screenshots
cypress/**/__image_snapshots__/*
23 changes: 23 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"settings": {
"react": {
"version": "detect"
}
},
"extends": [
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"plugin:prettier/recommended"
],
"rules": {}
}
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
target-branch: "dev"
open-pull-requests-limit: 20
schedule:
interval: "daily"
labels:
- "dependencies"
140 changes: 140 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: CI

on:
push:
branches: [ master, dev ]
pull_request:
branches: [ master, dev ]

jobs:
setup:
runs-on: ubuntu-latest
outputs:
git_source_branch: ${{ steps.variables.outputs.git_source_branch }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 100
- name: Define variables
id: variables
shell: bash
run: |
GIT_SOURCE_BRANCH=`([ "${GITHUB_HEAD_REF}" != "" ] && echo "${GITHUB_HEAD_REF}" || echo "${GITHUB_REF}") | sed 's/refs\/heads\///g'`
echo "git_source_branch=$GIT_SOURCE_BRANCH" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
needs: [ setup ]

strategy:
matrix:
node-version: [ 20 ]

steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test

- name: Find diffs
if: failure() && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
id: snapshots_diffs
shell: bash
run: |
echo "found=$(find . -iname '*.diff.png' | wc -l)" >> $GITHUB_OUTPUT
- name: update snapshots
if: ${{ always() && steps.snapshots_diffs.outputs.found > 0 }}
run: npm run test:cypress:ci:update
- name: Create Pull Request
id: update_snapshots
if: always() && steps.snapshots_diffs.outputs.found > 0 && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
env:
HASH: ${{ format('#{0}', github.event.number) }}
BRANCH: ${{ needs.setup.outputs.git_source_branch }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
base: ${{ env.BRANCH }}
branch: snapshots-patch/${{ env.BRANCH }}
title: Update Cypress snapshots in ${{ env.BRANCH }}
commit-message: Updated snapshots
body: Updated snapshots in ${{ github.event_name == 'pull_request' && env.HASH || env.BRANCH}}
uses: peter-evans/create-pull-request@v4
- name: Comment PR
if: ${{ always() && github.event_name == 'pull_request' && steps.update_snapshots.outputs.pull-request-number }}
uses: thollander/actions-comment-pull-request@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
message: '${{ steps.update_snapshots.outputs.pull-request-operation }}: #${{ steps.update_snapshots.outputs.pull-request-number }}'

- uses: codecov/codecov-action@v3
- name: Store test results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results
path: |
cypress/**/__image_snapshots__/**/*.diff.*
cypress/**/__image_snapshots__/**/*.actual.*
cypress/screenshots/
cypress/videos/
if-no-files-found: ignore

release:
name: Release
needs: [ "build" ]
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/cache@v3
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- uses: actions/setup-node@v3
with:
node-version: 20
- run: npm ci
- run: npm run build
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release

# docs:
# runs-on: ubuntu-latest
# needs: [ "build", "release" ]
# if: ${{ github.ref == 'refs/heads/master' }}
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-node@v3
# with:
# node-version: 20
# - uses: actions/cache@v3
# with:
# path: |
# **/node_modules
# key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
# - run: npm ci
# - run: npm run deploy-storybook -- --ci --host-token-env-variable=GITHUB_TOKEN
# env:
# GITHUB_TOKEN: JulianWielga:${{ secrets.GITHUB_TOKEN }}
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
node_modules
cjs
esm
storybook-static
.idea
*.iml
*.tgz

.nyc_output
coverage
cypress/videos
cypress/screenshots
.DS_Store
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact=true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.12.1
16 changes: 16 additions & 0 deletions .nycrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"report-dir": "coverage/cypress",
"reporter": [
"text",
"json",
"lcov"
],
"all": true,
"include": [
"src/**/*.{js,jsx,ts,tsx}"
],
"exclude": [
"**/*.{stories,test,spec}.{js,jsx,ts,tsx}",
"**/{stories,test,spec}.{js,jsx,ts,tsx}"
]
}
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": true,
"trailingComma": "all",
"printWidth": 140,
"tabWidth": 4
}
34 changes: 34 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"branches": [
"master",
{"name": "dev", "prerelease": "beta"}
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"releaseRules": [
{
"scope": "deps",
"release": "patch"
}
]
}
],
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
[
"@semantic-release/npm",
{
"tarballDir": "release"
}
],
[
"@semantic-release/github",
{
"assets": "release/*.tgz"
}
],
"@semantic-release/git"
]
}
13 changes: 13 additions & 0 deletions .syncpackrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"source": ["package.json"],
"dependencyTypes": ["prod", "dev", "local"],
"semverGroups": [
{
"label": "use exact version numbers in production and dev",
"dependencyTypes": ["prod", "dev"],
"range": ""
}
],
"indent": " ",
"sortAz": ["bin", "contributors", "dependencies", "devDependencies", "keywords", "peerDependencies", "resolutions"]
}
Loading

0 comments on commit 32f0c3e

Please sign in to comment.