Skip to content

Commit

Permalink
Merge branch 'main' into chervyakovru-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
chervyakovru authored Jan 17, 2024
2 parents 177cb62 + 252229e commit 379d1f1
Show file tree
Hide file tree
Showing 993 changed files with 50,405 additions and 38,583 deletions.
16 changes: 16 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"sourceType": "unambiguous",
"presets": [
[
"@babel/preset-env",
{
"targets": {
"chrome": 100
}
}
],
"@babel/preset-typescript",
"@babel/preset-react"
],
"plugins": []
}
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
storybook-static
build
!/.storybook
47 changes: 42 additions & 5 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,20 +1,57 @@
{
"extends": ["@gravity-ui/eslint-config", "@gravity-ui/eslint-config/prettier"],
"extends": [
"@gravity-ui/eslint-config",
"@gravity-ui/eslint-config/client",
"@gravity-ui/eslint-config/prettier",
"@gravity-ui/eslint-config/a11y"
],
"root": true,
"env": {
"node": true,
"jest": true
"rules": {
"react/jsx-fragments": ["error", "element"],
"no-restricted-syntax": [
"error",
{
"selector": "ImportDeclaration[source.value='react'] :matches(ImportNamespaceSpecifier, ImportSpecifier)",
"message": "Please use import React from 'react' instead."
},
{
"selector": "TSTypeReference>TSQualifiedName[left.name='React'][right.name='FC']",
"message": "Don't use React.FC"
}
],
"jsx-a11y/no-autofocus": 0
},
"overrides": [
{
"files": ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"],
"extends": ["plugin:testing-library/react"]
"env": {
"node": true,
"jest": true
},
"extends": ["plugin:testing-library/react"],
"rules": {
"jsx-a11y/no-static-element-interactions": 0
},
"excludedFiles": "**/__tests__/**/*.visual.test.*"
},
{
"files": ["**/__stories__/**/*.[jt]s?(x)"],
"rules": {
"no-console": "off"
}
},
{
"files": ["**/*.js", "!src/**/*"],
"env": {
"node": true
}
},
{
"files": ["**/__tests__/**/*.visual.test.*"],
"env": {
"node": true,
"jest": true
}
}
]
}
20 changes: 8 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: '14.x'
cache: 'npm'
node-version: 18
cache: npm
- name: Install Packages
run: npm ci
- name: Lint Files
Expand All @@ -31,14 +29,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: '14.x'
cache: 'npm'
node-version: 18
cache: npm
- name: Install Packages
run: npm ci
- name: Unit Tests
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/main-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 14
node-version: 18
cache: npm
- name: Install Packages
run: npm ci
shell: bash
- name: Build Storybook
run: npx build-storybook
run: npx sb build
shell: bash
env:
TS_NODE_PROJECT: .storybook/tsconfig.json
- name: Upload to S3
uses: gravity-ui/preview-upload-to-s3-action@v1
with:
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Playwright Tests

on:
# push:
# branches: [main, next]
pull_request:

jobs:
test:
name: Test component
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npm run playwright
env:
CI: 'true'
- name: Upload Playwright playwright report to GitHub Actions Artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: playwright-report
path: playwright-report
retention-days: 1
- name: Upload Playwright report
if: always()
env:
AWS_ACCESS_KEY_ID: ${{ secrets.STORYBOOK_S3_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}
AWS_DEFAULT_REGION: ru-central1
AWS_EC2_METADATA_DISABLED: true
run: aws s3 cp ./playwright-report s3://playwright-reports/uikit/pulls/${{ github.event.pull_request.number }}/ --endpoint-url=https://storage.yandexcloud.net --recursive
shell: bash
- name: Create Comment
if: always()
uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }}
number: ${{ github.event.pull_request.number }}
header: playwright test
message: '[Playwright Test Component](https://storage.yandexcloud.net/playwright-reports/uikit/pulls/${{ github.event.pull_request.number }}/index.html) is ready.'

4 changes: 2 additions & 2 deletions .github/workflows/pr-preview-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: gravity-ui/preview-build-action@v1
env:
TS_NODE_PROJECT: .storybook/tsconfig.json
with:
node-version: 18
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
with:
github-token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }}
npm-token: ${{ secrets.GRAVITY_UI_BOT_NPM_TOKEN }}
node-version: 14
node-version: 18
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
.idea
.vscode
.history
.DS_Store
*.log

node_modules

/storybook-static
/build
/styles/**/*.css
/coverage
/playwright/playwright/.cache
/playwright-report
/test-results
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
registry=https://registry.npmjs.org
legacy-peer-deps=true
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14
18
6 changes: 4 additions & 2 deletions .storybook/decorators/withLang.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React from 'react';
import type {DecoratorFn} from '@storybook/react';

import type {Decorator} from '@storybook/react';

import {Lang, configure} from '../../src';

export const withLang: DecoratorFn = (Story, context) => {
export const WithLang: Decorator = (Story, context) => {
const lang = context.globals.lang;

configure({
Expand Down
6 changes: 4 additions & 2 deletions .storybook/decorators/withMobile.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React from 'react';
import type {DecoratorFn} from '@storybook/react';

import type {Decorator} from '@storybook/react';

import {useMobile} from '../../src';

export const withMobile: DecoratorFn = (Story, context) => {
export const WithMobile: Decorator = (Story, context) => {
const mobileValue = context.globals.platform === 'mobile';

const [, setMobile] = useMobile(); // eslint-disable-line react-hooks/rules-of-hooks
Expand Down
16 changes: 0 additions & 16 deletions .storybook/decorators/withTheme.tsx

This file was deleted.

13 changes: 10 additions & 3 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import type {StorybookConfig} from '@storybook/core-common';
import type {StorybookConfig} from '@storybook/react-webpack5';

const config: StorybookConfig = {
stories: ['../src/**/*.stories.@(ts|tsx)'],
framework: {
name: '@storybook/react-webpack5',
options: {fastRefresh: true},
},
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(ts|tsx)'],
docs: {
defaultName: 'Docs',
},
addons: [
'@storybook/preset-scss',
{name: '@storybook/addon-essentials', options: {backgrounds: false}},
'./theme-addon/register.tsx',
],
};

module.exports = config;
export default config;
1 change: 1 addition & 0 deletions .storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {addons} from '@storybook/addons';

import {themes} from './theme';

addons.setConfig({
Expand Down
2 changes: 2 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
Loading

0 comments on commit 379d1f1

Please sign in to comment.