Skip to content

Commit a565603

Browse files
committed
Initial commit
0 parents  commit a565603

31 files changed

+18019
-0
lines changed

.editorconfig

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
max_line_length = 100
10+
trim_trailing_whitespace = true
11+
12+
[{*.json, *.yaml, *.yml}]
13+
indent_size = 2
14+
15+
[*.md]
16+
max_line_length = 0
17+
trim_trailing_whitespace = false

.eslintrc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": ["@gravity-ui/eslint-config", "@gravity-ui/eslint-config/prettier"],
3+
"root": true,
4+
"env": {
5+
"node": true,
6+
"jest": true
7+
}
8+
}

.github/workflows/ci.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
verify_files:
11+
name: Verify Files
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0
18+
- name: Setup Node
19+
uses: actions/setup-node@v2
20+
with:
21+
node-version: '14.x'
22+
cache: 'npm'
23+
- name: Install Packages
24+
run: npm ci
25+
- name: Lint Files
26+
run: npm run lint
27+
- name: Typecheck
28+
run: npm run typecheck
29+
30+
tests:
31+
name: Tests
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v2
36+
with:
37+
fetch-depth: 0
38+
- name: Setup Node
39+
uses: actions/setup-node@v2
40+
with:
41+
node-version: '14.x'
42+
cache: 'npm'
43+
- name: Install Packages
44+
run: npm ci
45+
- name: Unit Tests
46+
run: npm run test
47+

.github/workflows/main-preview.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Main Preview
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
main:
9+
name: Build and Deploy
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
- name: Setup Node
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: 14
20+
- name: Install Packages
21+
run: npm ci
22+
shell: bash
23+
- name: Build Storybook
24+
run: npx build-storybook
25+
shell: bash
26+
- name: Upload to S3
27+
uses: gravity-ui/preview-upload-to-s3-action@v1
28+
with:
29+
src-path: storybook-static
30+
dest-path: /package-example/main/
31+
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
32+
s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: PR Preview Build
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build:
8+
name: Build
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: gravity-ui/preview-build-action@v1
12+
env:
13+
TS_NODE_PROJECT: .storybook/tsconfig.json
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: PR Preview Deploy
2+
3+
on:
4+
workflow_run:
5+
workflows: ['PR Preview Build']
6+
types:
7+
- completed
8+
9+
jobs:
10+
deploy:
11+
name: Deploy
12+
if: >
13+
github.event.workflow_run.event == 'pull_request' &&
14+
github.event.workflow_run.conclusion == 'success'
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: gravity-ui/preview-deploy-action@v1
18+
with:
19+
project: package-example
20+
github-token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }}
21+
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
22+
s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}

.github/workflows/release.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: gravity-ui/release-action@v1
12+
with:
13+
github-token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }}
14+
npm-token: ${{ secrets.GRAVITY_UI_BOT_NPM_TOKEN }}

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# IDE settings
2+
.idea
3+
.vscode
4+
5+
# Dependencies
6+
node_modules
7+
8+
# Artifacts
9+
dist

.husky/commit-msg

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx commitlint -e

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx nano-staged

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
registry=https://registry.npmjs.org

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
14

.prettierignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
storybook-static
2+
dist
3+
CHANGELOG.md
4+
CONTRIBUTING.md

.prettierrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('@gravity-ui/prettier-config');

.storybook/main.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type {StorybookConfig} from '@storybook/core-common';
2+
3+
const config: StorybookConfig = {
4+
stories: ['../src/**/*.stories.@(ts|tsx)'],
5+
addons: [
6+
'@storybook/preset-scss',
7+
{name: '@storybook/addon-essentials', options: {backgrounds: false}},
8+
],
9+
};
10+
11+
module.exports = config;

.storybook/tsconfig.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "..",
3+
"compilerOptions": {
4+
"module": "commonjs",
5+
"target": "ES2017"
6+
}
7+
}

.stylelintrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["@gravity-ui/stylelint-config", "@gravity-ui/stylelint-config/prettier"]
3+
}

CONTRIBUTING.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Notice to external contributors
2+
3+
## General info
4+
5+
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:
6+
7+
1. https://yandex.ru/legal/cla/?lang=en (in English) and
8+
2. https://yandex.ru/legal/cla/?lang=ru (in Russian).
9+
10+
By adopting the CLA, you state the following:
11+
12+
- You obviously wish and are willingly licensing your contributions to us for our open source projects under the terms of the CLA,
13+
- You have read the terms and conditions of the CLA and agree with them in full,
14+
- You are legally able to provide and license your contributions as stated,
15+
- We may use your contributions for our open source projects and for any other our project too,
16+
- We rely on your assurances concerning the rights of third parties in relation to your contributions.
17+
18+
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.
19+
20+
## Provide contributions
21+
22+
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:
23+
24+
```
25+
I hereby agree to the terms of the CLA available at: [link].
26+
```
27+
28+
Replace the bracketed text as follows:
29+
30+
- [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).
31+
32+
It is enough to provide us such notification once.
33+
34+
## Other questions
35+
36+
If you have any questions, please mail us at [email protected].

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2022 YANDEX LLC
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# @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.yandexcloud.dev/package-example/)
2+
3+
This is a template for typical package.
4+
5+
1. Create a new repository and use this repository as a template.
6+
2. Replace `package-example` through the whole repository with your name.
7+
3. Overwrite other things at your desire.
8+
9+
## Install
10+
11+
```shell
12+
npm install --save-dev @gravity-ui/package-example
13+
```
14+
15+
## Usage

commitlint.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = {extends: ['@commitlint/config-conventional']};

jest.config.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
verbose: true,
3+
moduleFileExtensions: ['js', 'json', 'ts', 'tsx'],
4+
rootDir: '.',
5+
transform: {
6+
'^.+\\.tsx?$': 'ts-jest',
7+
},
8+
transformIgnorePatterns: ['node_modules/(?!(@gravity-ui)/)'],
9+
coverageDirectory: './coverage',
10+
collectCoverageFrom: ['src/**/*.{ts,tsx}', '!**/__stories__/**/*', '!**/*/*.stories.{ts,tsx}'],
11+
};

0 commit comments

Comments
 (0)