Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
beliarh committed May 16, 2024
0 parents commit 2687083
Show file tree
Hide file tree
Showing 143 changed files with 31,075 additions and 0 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": []
}
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 100
trim_trailing_whitespace = true

[{*.json, *.yaml, *.yml}]
indent_size = 2

[*.md]
max_line_length = 0
trim_trailing_whitespace = false
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
storybook-static
build
!/.storybook
79 changes: 79 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"extends": [
"@gravity-ui/eslint-config",
"@gravity-ui/eslint-config/client",
"@gravity-ui/eslint-config/prettier",
"@gravity-ui/eslint-config/import-order",
"@gravity-ui/eslint-config/a11y"
],
"root": true,
"rules": {
"@typescript-eslint/consistent-type-imports": [
"warn",
{
"prefer": "type-imports",
"disallowTypeAnnotations": false
}
],
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-shadow": "warn",
"import/consistent-type-specifier-style": [
"error",
"prefer-top-level"
],
"import/no-extraneous-dependencies": "off",
"jsx-a11y/no-autofocus": "off",
"no-param-reassign": "warn",
"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"
}
],
"react/jsx-fragments": [
"error",
"element"
],
"valid-jsdoc": "warn"
},
"overrides": [
{
"files": [
"**/__tests__/**/*.[jt]s?(x)",
"**/?(*.)+(spec|test).[jt]s?(x)"
],
"env": {
"node": true,
"jest": true
},
"extends": [
"plugin:testing-library/react"
],
"rules": {
"jsx-a11y/no-static-element-interactions": 0
}
},
{
"files": [
"**/__stories__/**/*.[jt]s?(x)"
],
"rules": {
"no-console": "off"
}
},
{
"files": [
"**/*.js",
"!src/**/*"
],
"env": {
"node": true
}
}
]
}
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
verify_files:
name: Verify Files
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
- name: Install Packages
run: npm ci
- name: Lint Files
run: npm run lint
- name: Typecheck
run: npm run typecheck

tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
- name: Install Packages
run: npm ci
- name: Unit Tests
run: npm run test
32 changes: 32 additions & 0 deletions .github/workflows/main-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Main Preview

on:
push:
branches: [main]

jobs:
main:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Packages
run: npm ci
shell: bash
- name: Build Storybook
run: npm run build-storybook
shell: bash
- name: Upload to S3
uses: gravity-ui/preview-upload-to-s3-action@v1
with:
src-path: storybook-static
dest-path: /table/main/
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}
13 changes: 13 additions & 0 deletions .github/workflows/pr-preview-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: PR Preview Build

on:
pull_request:

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: gravity-ui/preview-build-action@v1
with:
node-version: 18
22 changes: 22 additions & 0 deletions .github/workflows/pr-preview-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: PR Preview Deploy

on:
workflow_run:
workflows: ['PR Preview Build']
types:
- completed

jobs:
deploy:
name: Deploy
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- uses: gravity-ui/preview-deploy-action@v1
with:
project: table
github-token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }}
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}
15 changes: 15 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Release

on:
push:
branches: [main]

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: gravity-ui/release-action@v1
with:
github-token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }}
npm-token: ${{ secrets.GRAVITY_UI_BOT_NPM_TOKEN }}
node-version: 18
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# IDE settings
.idea
.vscode

# Dependencies
node_modules

# Artifacts
build
storybook-static
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx commitlint -e
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx nano-staged
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://registry.npmjs.org
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
storybook-static
build
CHANGELOG.md
CONTRIBUTING.md
1 change: 1 addition & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@gravity-ui/prettier-config');
12 changes: 12 additions & 0 deletions .storybook/decorators/withLang.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';

import {configure} from '@gravity-ui/uikit';
import type {Decorator} from '@storybook/react';

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

configure({lang});

return <Story key={lang} {...context} />;
};
14 changes: 14 additions & 0 deletions .storybook/decorators/withMobile.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';

import {MobileProvider} from '@gravity-ui/uikit';
import type {Decorator} from '@storybook/react';

export const withMobile: Decorator = (Story, context) => {
const platform = context.globals.platform;

return (
<MobileProvider mobile={platform === 'mobile'} platform={platform}>
<Story key={platform} {...context} />
</MobileProvider>
);
};
13 changes: 13 additions & 0 deletions .storybook/decorators/withStrictMode.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';

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

export const withStrictMode: Decorator = (Story, context) => {
const children = <Story {...context} />;

if (context.parameters?.disableStrictMode) {
return children;
}

return <React.StrictMode>{children}</React.StrictMode>;
};
12 changes: 12 additions & 0 deletions .storybook/decorators/withTheme.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';

import {ThemeProvider} from '@gravity-ui/uikit';
import type {Decorator} from '@storybook/react';

export const withTheme: Decorator = (Story, context) => {
return (
<ThemeProvider theme={context.globals.theme} direction={context.globals.direction}>
<Story {...context} />
</ThemeProvider>
);
};
25 changes: 25 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type {StorybookConfig} from '@storybook/react-webpack5';

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

export default config;
7 changes: 7 additions & 0 deletions .storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {addons} from '@storybook/manager-api';

import {themes} from './theme';

addons.setConfig({
theme: themes.light,
});
Loading

0 comments on commit 2687083

Please sign in to comment.