Skip to content

Commit

Permalink
feat!: update to @gravity-ui/uikit v6 (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
ValeraS authored Mar 4, 2024
1 parent 7fa5232 commit 639205e
Show file tree
Hide file tree
Showing 36 changed files with 19,515 additions and 16,484 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ insert_final_newline = true
max_line_length = 120
trim_trailing_whitespace = true

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

[*.md]
max_line_length = 0
trim_trailing_whitespace = false
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
33 changes: 29 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
{
"extends": ["@gravity-ui/eslint-config", "@gravity-ui/eslint-config/prettier"],
"extends": [
"@gravity-ui/eslint-config",
"@gravity-ui/eslint-config/import-order",
"@gravity-ui/eslint-config/client",
"@gravity-ui/eslint-config/prettier"
],
"root": true,
"env": {
"node": true
}
"rules": {
"react/jsx-fragments": ["error", "element"],
"react/react-in-jsx-scope": "off",
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
"@typescript-eslint/consistent-type-imports": [
"error",
{"prefer": "type-imports", "fixStyle": "separate-type-imports"}
]
},
"overrides": [
{
"files": ["**/__stories__/**/*.[jt]s?(x)"],
"rules": {
"no-console": "off"
}
},
{
"files": ["**/*.js", "!src/**/*"],
"env": {
"node": true
}
}
]
}
33 changes: 20 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,33 @@ name: Node.js CI

on:
pull_request:
branches: [ '**' ]
branches: ['**']

jobs:
commitlint:
name: Commit Naming
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
- run: npm ci
- run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
- run: npm ci
- run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
verify_files:
name: Verify Files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
- run: npm ci
- run: npm run lint
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
- run: npm ci
- run: npm run lint
- run: npm run build # check that build works
9 changes: 5 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ jobs:
if: github.repository == 'ydb-platform/ydb-ui-components'
runs-on: ubuntu-latest
steps:
- uses: yandex-cloud/ui-release-action@main
with:
github-token: ${{ secrets.YDB_PLATFORM_BOT_TOKEN_REPO }}
npm-token: ${{ secrets.NODE_AUTH_TOKEN }}
- uses: gravity-ui/release-action@v1
with:
github-token: ${{ secrets.YDB_PLATFORM_BOT_TOKEN_REPO }}
npm-token: ${{ secrets.NODE_AUTH_TOKEN }}
node-version: 18
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea
.vscode

node_modules

Expand Down
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 .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.19.0
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
storybook-static
build

CHANGELOG.md
CONTRIBUTING.md
package-lock.json
8 changes: 3 additions & 5 deletions .storybook/decorators/withLang.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React from 'react';
import {Story as StoryType, StoryContext} from '@storybook/react';
import {configure} from '@gravity-ui/uikit';
import type {StoryContext, StoryFn} from '@storybook/react';

import {configure} from '../../src/utils';

export function withLang(Story: StoryType, context: StoryContext) {
export function withLang(Story: StoryFn, context: StoryContext) {
const lang = context.globals.lang;

configure({lang});
Expand Down
17 changes: 0 additions & 17 deletions .storybook/main.js

This file was deleted.

51 changes: 51 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import type {StorybookConfig} from '@storybook/react-webpack5';

const config: StorybookConfig = {
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/preset-scss',
{name: '@storybook/addon-essentials', options: {backgrounds: false}},
],
framework: {
name: '@storybook/react-webpack5',
options: {},
},
typescript: {
check: true,
checkOptions: {},
reactDocgen: 'react-docgen-typescript',
reactDocgenTypescriptOptions: {
setDisplayName: false,
shouldExtractLiteralValuesFromEnum: true,
compilerOptions: {
allowSyntheticDefaultImports: true,
esModuleInterop: true,
},
},
},
docs: {
autodocs: true,
},
core: {
disableTelemetry: true,
},
babel: (transformOptions) => {
return {
...transformOptions,
presets: [
[
'@babel/preset-env',
{
targets: {
chrome: 100,
},
},
],
'@babel/preset-typescript',
['@babel/preset-react', {runtime: 'automatic'}],
],
};
},
};

export default config;
66 changes: 0 additions & 66 deletions .storybook/preview.js

This file was deleted.

63 changes: 63 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// eslint-disable-next-line import/order
import '@gravity-ui/uikit/styles/styles.scss';

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

import {withLang} from './decorators/withLang';

configure({lang: 'en'});

const withContextProvider: Decorator = (Story, context) => {
const theme = context.globals.theme;

return (
<ThemeProvider theme={theme}>
<Story {...context} />
</ThemeProvider>
);
};

const preview: Preview = {
parameters: {
jsx: {showFunctions: true},
backgrounds: {
default: 'light',
values: [
{name: 'light', value: 'white'},
{name: 'dark', value: 'rgba(45, 44, 51, 1)'},
],
},
},
decorators: [withLang, withContextProvider],
globalTypes: {
theme: {
defaultValue: 'light',
toolbar: {
title: 'Theme',
icon: 'mirror',
items: [
{value: 'light', right: '☼', title: 'Light'},
{value: 'dark', right: '☾', title: 'Dark'},
{value: 'light-hc', right: '☼', title: 'High Contrast Light (beta)'},
{value: 'dark-hc', right: '☾', title: 'High Contrast Dark (beta)'},
],
dynamicTitle: true,
},
},
lang: {
defaultValue: 'en',
toolbar: {
title: 'Language',
icon: 'globe',
items: [
{value: 'en', right: '🇬🇧', title: 'En'},
{value: 'ru', right: '🇷🇺', title: 'Ru'},
],
dynamicTitle: true,
},
},
},
};

export default preview;
5 changes: 1 addition & 4 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"extends": ["@gravity-ui/stylelint-config", "@gravity-ui/stylelint-config/prettier"],
"rules": {
"declaration-colon-space-after": "always-single-line"
}
"extends": ["@gravity-ui/stylelint-config", "@gravity-ui/stylelint-config/prettier"]
}
Loading

0 comments on commit 639205e

Please sign in to comment.