Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
beliarh authored May 13, 2024
0 parents commit ede7dc4
Show file tree
Hide file tree
Showing 32 changed files with 20,407 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"sourceType": "unambiguous",
"presets": [
"@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
8 changes: 8 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": ["@gravity-ui/eslint-config", "@gravity-ui/eslint-config/prettier"],
"root": true,
"env": {
"node": true,
"jest": true
}
}
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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: npx build-storybook
shell: bash
- name: Upload to S3
uses: gravity-ui/preview-upload-to-s3-action@v1
with:
src-path: storybook-static
dest-path: /package-example/main/
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}
15 changes: 15 additions & 0 deletions .github/workflows/pr-preview-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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
env:
TS_NODE_PROJECT: .storybook/tsconfig.json
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: package-example
github-token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }}
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}
14 changes: 14 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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 }}
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# IDE settings
.idea
.vscode

# Dependencies
node_modules

# Artifacts
dist
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx commitlint -e
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

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
dist
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');
24 changes: 24 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type {StorybookConfig} from '@storybook/react-webpack5';

const config: StorybookConfig = {
stories: ['../src/**/*.stories.@(ts|tsx)'],
addons: [
'@storybook/preset-scss',
{name: '@storybook/addon-essentials', options: {backgrounds: false}},
'@storybook/addon-webpack5-compiler-babel'
],

framework: {
name: '@storybook/react-webpack5',
options: {}
},

docs: {
autodocs: true
},
core: {
disableTelemetry: true,
},
};

module.exports = config;
7 changes: 7 additions & 0 deletions .storybook/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "..",
"compilerOptions": {
"module": "commonjs",
"target": "ES2017"
}
}
3 changes: 3 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["@gravity-ui/stylelint-config", "@gravity-ui/stylelint-config/prettier"]
}
36 changes: 36 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Notice to external contributors

## General info

Hello! In order for us (YANDEX LLC) to accept patches and other contributions from you, you will have to adopt our Yandex Contributor License Agreement (the “**CLA**”). The current version of the CLA can be found here:

1. https://yandex.ru/legal/cla/?lang=en (in English) and
2. https://yandex.ru/legal/cla/?lang=ru (in Russian).

By adopting the CLA, you state the following:

- You obviously wish and are willingly licensing your contributions to us for our open source projects under the terms of the CLA,
- You have read the terms and conditions of the CLA and agree with them in full,
- You are legally able to provide and license your contributions as stated,
- We may use your contributions for our open source projects and for any other our project too,
- We rely on your assurances concerning the rights of third parties in relation to your contributions.

If you agree with these principles, please read and adopt our CLA. By providing us your contributions, you hereby declare that you have already read and adopt our CLA, and we may freely merge your contributions with our corresponding open source project and use it in further in accordance with terms and conditions of the CLA.

## Provide contributions

If you have already adopted terms and conditions of the CLA, you are able to provide your contributions. When you submit your pull request, please add the following information into it:

```
I hereby agree to the terms of the CLA available at: [link].
```

Replace the bracketed text as follows:

- [link] is the link to the current version of the CLA: https://yandex.ru/legal/cla/?lang=en (in English) or https://yandex.ru/legal/cla/?lang=ru (in Russian).

It is enough to provide us such notification once.

## Other questions

If you have any questions, please mail us at [email protected].
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2023 YANDEX LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# @gravity-ui/package-example · [![npm package](https://img.shields.io/npm/v/@gravity-ui/package-example)](https://www.npmjs.com/package/@gravity-ui/package-example) [![CI](https://img.shields.io/github/actions/workflow/status/gravity-ui/package-example/.github/workflows/ci.yml?label=CI&logo=github)](https://github.com/gravity-ui/package-example/actions/workflows/ci.yml?query=branch:main) [![storybook](https://img.shields.io/badge/Storybook-deployed-ff4685)](https://preview.gravity-ui.com/package-example/)

This is a template for typical package.

1. Create a new repository and use this repository as a template.
2. Replace `package-example` through the whole repository with your name.
3. Overwrite other things at your desire.

## Install

```shell
npm install --save-dev @gravity-ui/package-example
```

## Usage
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {extends: ['@commitlint/config-conventional']};
11 changes: 11 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
verbose: true,
moduleFileExtensions: ['js', 'json', 'ts', 'tsx'],
rootDir: '.',
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
transformIgnorePatterns: ['node_modules/(?!(@gravity-ui)/)'],
coverageDirectory: './coverage',
collectCoverageFrom: ['src/**/*.{ts,tsx}', '!**/__stories__/**/*', '!**/*/*.stories.{ts,tsx}'],
};
Loading

0 comments on commit ede7dc4

Please sign in to comment.