Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 3 additions & 6 deletions .github/workflows/branch-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,15 @@ jobs:
cache: pnpm

- name: Install dependencies
run: pnpm run deps:ci

- name: Install Storybook CLI
run: pnpm i @storybook/cli@8.4.1
run: pnpm run ci:deps

- name: Build Storybook
run: pnpm run sb:build
run: pnpm run ci:demo:build

- name: Upload to S3
uses: gravity-ui/preview-upload-to-s3-action@v1
with:
src-path: storybook-static
src-path: demo/storybook-static
dest-path: /md-editor/branches/${{ github.ref_name }}/
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
cache: pnpm

- name: Install dependencies
run: pnpm run deps:ci
run: pnpm run ci:deps

- name: Lint Files
run: pnpm run lint
Expand All @@ -48,13 +48,13 @@ jobs:
cache: pnpm

- name: Install dependencies
run: pnpm run deps:ci
run: pnpm run ci:deps

- name: Unit Tests
run: pnpm run test
run: pnpm ci:test:unit

- name: ESBuild compatability
run: pnpm run test:esbuild
run: pnpm ci:test:esbuild

check_circular_deps:
name: Check Circular Dependencies
Expand All @@ -73,7 +73,7 @@ jobs:
cache: pnpm

- name: Install dependencies
run: pnpm run deps:ci
run: pnpm run ci:deps

- name: Check circular dependencies
run: pnpm run check-circular-deps
run: pnpm ci:test:circular-deps
9 changes: 3 additions & 6 deletions .github/workflows/main-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,15 @@ jobs:
cache: pnpm

- name: Install dependencies
run: pnpm run deps:ci

- name: Install Storybook CLI
run: pnpm i @storybook/cli@8.4.1
run: pnpm run ci:deps

- name: Build Storybook
run: pnpm run sb:build
run: pnpm run ci:demo:build

- name: Upload to S3
uses: gravity-ui/preview-upload-to-s3-action@v1
with:
src-path: storybook-static
src-path: demo/storybook-static
dest-path: /md-editor/main/
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}
9 changes: 3 additions & 6 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,15 @@ jobs:
cache: pnpm

- name: Install dependencies
run: pnpm run deps:ci

- name: Install Storybook CLI
run: pnpm i @storybook/cli@8.4.1
run: pnpm run ci:deps

- name: Build Storybook
run: pnpm run sb:build
run: pnpm run ci:demo:build

- name: Upload to S3
uses: gravity-ui/preview-upload-to-s3-action@v1
with:
src-path: storybook-static
src-path: demo/storybook-static
dest-path: /md-editor/pulls/${{ github.event.pull_request.number }}/
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-title-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
cache: pnpm

- name: Install dependencies
run: pnpm run deps:ci
run: pnpm run ci:deps

- name: Run Commitlint
run: echo '${{github.event.pull_request.title}}' | pnpm commitlint
6 changes: 3 additions & 3 deletions .github/workflows/pr-visual-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
cache: pnpm

- name: Install dependencies
run: pnpm run deps:ci
run: pnpm run ci:deps

- name: Run Visual Tests
run: pnpm run playwright
run: pnpm run ci:test:visual
env:
CI: 'true'

Expand All @@ -35,7 +35,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: ./playwright-report
path: ./demo/playwright-report
retention-days: 1

- name: Save PR ID
Expand Down
21 changes: 9 additions & 12 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ on:
# Manually trigger the publish workflow
workflow_dispatch:
inputs:
version:
description: 'Override version to publish'
required: false
type: string
default: ''
package:
description: 'Package to publish'
required: true
type: choice
default: 'packages/editor'
options:
- 'packages/editor'
tag:
description: 'Publish with tag'
required: true
Expand Down Expand Up @@ -49,22 +51,17 @@ jobs:
cache: pnpm

- name: Install dependencies
run: pnpm run deps:ci
run: pnpm run ci:deps

- name: Configure npm authentication
shell: bash
run: echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
env:
NODE_AUTH_TOKEN: ${{ secrets.GRAVITY_UI_BOT_NPM_TOKEN }}

- name: Set package version
if: ${{ github.event.inputs.version != '' }}
shell: bash
run: pnpm pkg set version="${{ github.event.inputs.version }}"

- name: Publish package
shell: bash
run: pnpm publish --tag ${{ github.event.inputs.tag }} --access public --report-summary --no-git-checks --dry-run ${{ github.event.inputs.dry_run }}
run: pnpm publish ${{ github.event.inputs.package }} --tag ${{ github.event.inputs.tag }} --access public --report-summary --no-git-checks --dry-run ${{ github.event.inputs.dry_run }}
env:
NODE_AUTH_TOKEN: ${{ secrets.GRAVITY_UI_BOT_NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
21 changes: 5 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,21 @@ jobs:
cache: pnpm

- name: Install dependencies
run: pnpm run deps:ci
run: pnpm run ci:deps

- name: Run tests
shell: bash
run: pnpm test

- name: Get package info
uses: codex-team/action-nodejs-package-info@v1.1
id: package

- name: Release please
uses: google-github-actions/release-please-action@v3
uses: google-github-actions/release-please-action@v4
id: release
with:
token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }}
release-type: node
package-name: ${{ steps.package.outputs.name }}
bump-minor-pre-major: true
default-branch: ${{ github.ref_name != 'main' && github.ref_name || null }}
changelog-types: >
[{"type":"feat","section":"Features","hidden":false},
{"type":"fix","section":"Bug Fixes","hidden":false},
{"type":"refactor","section":"Refactoring","hidden":false},
{"type":"perf","section":"Performance Improvements","hidden":false}]
config-file: .release-please/config.json
manifest-file: .release-please/manifest.json

- name: Publish version
if: steps.release.outputs.release_created == 'true'
if: steps.release.outputs.releases_created == 'true'
shell: bash
run: echo "Please run publish workflow manually"
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ build/
coverage/
storybook-static/
.eslintcache
demo/docs
demo/src/docs
debug-storybook.log

# tests
playwright-report*
test-results/

# nx
.nx/cache
.nx/workspace-data
16 changes: 16 additions & 0 deletions .release-please/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"release-type": "node",
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"separate-pull-requests": true,
"changelog-sections": [
{"type": "feat", "section": "Features", "hidden": false},
{"type": "fix", "section": "Bug Fixes", "hidden": false},
{"type": "refactor", "section": "Refactoring", "hidden": false},
{"type": "perf", "section": "Performance Improvements", "hidden": false}
],
"packages": {
".": {}
}
}
3 changes: 3 additions & 0 deletions .release-please/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"packages/editor": "15.34.5"
}
9 changes: 4 additions & 5 deletions README-ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,10 @@ function Editor({onSubmit}) {

### Разработка

Для запуска Storybook в режиме разработки выполните следующую команду:

```shell
npm start
```
1. Установите оркжуение Nodejs, нужная версия указано в файле `.nvmrc`. Мы рекомендуем использовать [NVM](https://github.com/nvm-sh/nvm) или похожий инструмент.
2. Установите [pnpm](https://pnpm.io/installation), нужная версия указана в файле `package.json` в поле "packageManager".
3. Установите зависимости: `pnpm i`
4. Запустите дев-сервер Storybook: `pnpm start`

### i18n

Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ Read more:

1. Install Nodejs environment, version is specified in `.nvmrc` file. We recommend using [NVM](https://github.com/nvm-sh/nvm) or a similar tool.
2. Install [pnpm](https://pnpm.io/installation), version is specified in `package.json` in "packageManager" property.

You can use [Corepack](https://nodejs.org/api/corepack.html), or just install via npm: run `npm deps:global --force`.
3. Install dependencies: `pnpm i`
4. Run storybook dev-server: `pnpm start`

Expand Down
2 changes: 1 addition & 1 deletion commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default {
extends: ['@commitlint/config-conventional'],
extends: ['@commitlint/config-conventional'],
};
File renamed without changes.
12 changes: 6 additions & 6 deletions .storybook/generateDocs.ts → demo/.storybook/generateDocs.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as fs from 'fs/promises';
import * as path from 'path';
import {dirname} from 'path';
/* eslint-disable no-console */
import * as fs from 'node:fs/promises';
import * as path from 'node:path';
import {fileURLToPath} from 'url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const __dirname = path.dirname(__filename);

const inputDir = path.join(__dirname, '../docs');
const outputDir = path.join(__dirname, '../demo/docs');
const inputDir = path.join(__dirname, '../../docs');
const outputDir = path.join(__dirname, '../src/docs');

/**
* Converts a kebab-case string to camelCase
Expand Down
19 changes: 4 additions & 15 deletions .storybook/main.ts → demo/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {createRequire} from 'node:module';
import {dirname, resolve} from 'node:path';
import {fileURLToPath} from 'node:url';

import type {StorybookConfig} from '@storybook/react-webpack5';
import webpack from 'webpack';
Expand All @@ -11,18 +9,15 @@
await generateDocs();

const require = createRequire(import.meta.url);
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const pkg = require('../package.json');
const tsConfig = require('../tsconfig.json');
import pkg from '../../packages/editor/package.json' with {type: 'json'};

const config: StorybookConfig = {
framework: {
name: '@storybook/react-webpack5',
options: {},
},
stories: ['../demo/**/*.mdx', '../demo/**/*.stories.@(js|jsx|ts|tsx)'],
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/preset-scss',
'@storybook/addon-webpack5-compiler-babel',
Expand All @@ -32,7 +27,7 @@
check: true,
reactDocgen: 'react-docgen-typescript',
},
webpackFinal: (config) => {

Check warning on line 30 in demo/.storybook/main.ts

View workflow job for this annotation

GitHub Actions / Verify Files

'config' is already declared in the upper scope on line 15 column 7
config.plugins?.push(
new webpack.DefinePlugin({
__VERSION__: `'${pkg.version}-storybook'`,
Expand All @@ -42,12 +37,12 @@
}),
);

config.resolve ||= {};

Check warning on line 40 in demo/.storybook/main.ts

View workflow job for this annotation

GitHub Actions / Verify Files

Assignment to property of function parameter 'config'
config.resolve.alias ||= {};

Check warning on line 41 in demo/.storybook/main.ts

View workflow job for this annotation

GitHub Actions / Verify Files

Assignment to property of function parameter 'config'
config.resolve.fallback ||= {};

Check warning on line 42 in demo/.storybook/main.ts

View workflow job for this annotation

GitHub Actions / Verify Files

Assignment to property of function parameter 'config'

// Node.js polyfills for browser
config.resolve.fallback = {

Check warning on line 45 in demo/.storybook/main.ts

View workflow job for this annotation

GitHub Actions / Verify Files

Assignment to property of function parameter 'config'
...config.resolve.fallback,
fs: false,
path: require.resolve('path-browserify'),
Expand All @@ -55,14 +50,8 @@
process: require.resolve('process/browser'),
};

const baseUrl = resolve(__dirname, '..', tsConfig.compilerOptions.baseUrl);
const paths = tsConfig.compilerOptions.paths;

for (const alias in paths) {
config.resolve.alias[alias] = resolve(baseUrl, paths[alias][0]);
}

config.resolve.alias['demo/*'] = resolve(__dirname, '..', 'demo/*');
config.watchOptions ||= {};

Check warning on line 53 in demo/.storybook/main.ts

View workflow job for this annotation

GitHub Actions / Verify Files

Assignment to property of function parameter 'config'
config.watchOptions.ignored = /node_modules([\\]+|\/)+(?!@gravity-ui\/markdown-editor)/;

Check warning on line 54 in demo/.storybook/main.ts

View workflow job for this annotation

GitHub Actions / Verify Files

Assignment to property of function parameter 'config'

return config;
},
Expand Down
1 change: 1 addition & 0 deletions .storybook/manager.ts → demo/.storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {addons} from 'storybook/manager-api';

import {themes} from './theme';

addons.setConfig({
Expand Down
7 changes: 4 additions & 3 deletions .storybook/preview.ts → demo/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type {Preview} from '@storybook/react-webpack5';
import {MINIMAL_VIEWPORTS} from 'storybook/viewport';
import {withThemeProvider} from '../demo/hocs/withThemeProvider';
import {withLang} from '../demo/hocs/withLang';
import {withToaster} from '../demo/hocs/withToaster';

import {withLang} from '../src/hocs/withLang';
import {withThemeProvider} from '../src/hocs/withThemeProvider';
import {withToaster} from '../src/hocs/withToaster';

const preview: Preview = {
decorators: [withThemeProvider, withLang, withToaster],
Expand Down
File renamed without changes.
Loading
Loading