Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update dependencies #159

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
}
],
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
"@typescript-eslint/consistent-type-imports": [
"error",
{"prefer": "type-imports", "fixStyle": "separate-type-imports"}
],
"jsx-a11y/no-autofocus": [
"error",
{
Expand All @@ -36,6 +32,15 @@
]
},
"overrides": [
{
"files": ["**/*.tsx?"],
"rules": {
"@typescript-eslint/consistent-type-imports": [
"error",
{"prefer": "type-imports", "fixStyle": "separate-type-imports"}
]
}
},
{
"files": ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"],
"extends": ["plugin:testing-library/react"],
Expand Down
30 changes: 29 additions & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,42 @@
import type {StorybookConfig} from '@storybook/react-webpack5';
import * as sass from 'sass';

const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(ts|tsx)'],
addons: [
'@storybook/preset-scss',
{name: '@storybook/addon-essentials', options: {backgrounds: false}},
'@storybook/addon-a11y',
'./theme-addon/register.tsx',
'@storybook/addon-webpack5-compiler-babel',
'@storybook/addon-storysource',
'@storybook/addon-styling-webpack',
{
name: '@storybook/addon-styling-webpack',
options: {
rules: [
{
test: /\.css$/,
sideEffects: true,
use: ['style-loader', 'css-loader'],
},
{
test: /\.scss$/,
sideEffects: true,
use: [
'style-loader',
{
loader: 'css-loader',
options: {importLoaders: 1},
},
{
loader: 'sass-loader',
options: {implementation: sass},
},
],
},
],
},
},
],
framework: '@storybook/react-webpack5',
typescript: {
Expand Down
2 changes: 1 addition & 1 deletion .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// eslint-disable-next-line import/order
import '@gravity-ui/uikit/styles/styles.scss';
import '@gravity-ui/uikit/styles/styles.css';

import React from 'react';

Expand Down
62 changes: 0 additions & 62 deletions gulpfile.js

This file was deleted.

90 changes: 90 additions & 0 deletions gulpfile.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import path from 'node:path';

import {addVirtualFile, createTypescriptProject} from '@gravity-ui/gulp-utils';
import {dest, parallel, series, src, task} from 'gulp';
import gulpSass from 'gulp-sass';
import sourcemaps from 'gulp-sourcemaps';
import * as rimraf from 'rimraf';
import * as sass from 'sass';

const BUILD_DIR = path.resolve('dist');
const sassLoader = gulpSass(sass);

task('clean', (done) => {
rimraf.sync(BUILD_DIR);
done();
});

async function compileTs(modules = false) {
const tsProject = await createTypescriptProject({
compilerOptions: {
declaration: true,
...(modules ? undefined : {verbatimModuleSyntax: false}),
module: modules ? 'esnext' : 'NodeNext',
moduleResolution: modules ? 'bundler' : 'NodeNext',
},
});

const transformers = [
tsProject.customTransformers.transformScssImports,
tsProject.customTransformers.transformLocalModules,
];

return new Promise((resolve) => {
src([
'src/**/*.{ts,tsx}',
'!src/demo/**/*',
'!src/**/__stories__/**/*',
'!src/**/__tests__/**/*',
'!src/**/*.test.{ts,tsx}',
])
.pipe(sourcemaps.init())
.pipe(
tsProject({
customTransformers: {
before: transformers,
afterDeclarations: transformers,
},
}),
)
.pipe(sourcemaps.write('.', {includeContent: true, sourceRoot: '../../src'}))
.pipe(
addVirtualFile({
fileName: 'package.json',
text: JSON.stringify({type: modules ? 'module' : 'commonjs'}),
}),
)
.pipe(dest(path.resolve(BUILD_DIR, modules ? 'esm' : 'cjs')))
.on('end', resolve);
});
}

task('compile-to-esm', () => {
return compileTs(true);
});

task('compile-to-cjs', () => {
return compileTs();
});

task('copy-i18n', () => {
return src(['src/**/i18n/*.json'])
.pipe(dest(path.resolve(BUILD_DIR, 'esm')))
.pipe(dest(path.resolve(BUILD_DIR, 'cjs')));
});

task('styles', () => {
return src(['src/**/*.scss', '!src/demo/**/*', '!src/**/__stories__/**/*'])
.pipe(sourcemaps.init())
.pipe(sassLoader({loadPaths: ['./node_modules/']}).on('error', sassLoader.logError))
.pipe(sourcemaps.write('.'))
.pipe(dest(path.resolve(BUILD_DIR, 'esm')))
.pipe(dest(path.resolve(BUILD_DIR, 'cjs')));
});

task(
'build',
series(['clean', parallel(['compile-to-esm', 'compile-to-cjs']), 'copy-i18n', 'styles']),
);

task('default', series(['build']));
5 changes: 2 additions & 3 deletions jest.config.ts → jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type {Config} from 'jest';

const config: Config = {
/** @type {import('ts-jest').JestConfigWithTsJest} */
const config = {
verbose: true,
moduleFileExtensions: ['js', 'json', 'ts', 'tsx'],
rootDir: '.',
Expand Down
Loading
Loading