Skip to content

Commit

Permalink
Release v0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksey Legotkin committed Oct 18, 2023
1 parent 48d97b1 commit 5bd63c8
Show file tree
Hide file tree
Showing 111 changed files with 10,841 additions and 3 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# editorconfig.org

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
dist-sdk/
dist-demo/
dist-docs/
dist-coverage/
dist-specification/
9 changes: 9 additions & 0 deletions .eslintrc-es5.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
env: {
browser: true,
node: true,
},
parserOptions: {
ecmaVersion: 5,
},
};
40 changes: 40 additions & 0 deletions .eslintrc-ts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module.exports = {
parserOptions: {
project: './tsconfig.eslint.json',
tsconfigRootDir: __dirname,
},
extends: ['@vkontakte/eslint-config/typescript'],
plugins: ['eslint-plugin-import'],
rules: {
'import/order': [
'error',
{
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
'newlines-between': 'always',
'alphabetize': {
order: 'asc',
},
'pathGroups': [
{
pattern: '#/**',
group: 'internal',
},
],
},
],

// Disabled because: no configurable options for .length > 0, arr[0] and similar constructions.
'no-magic-numbers': 'off',
'@typescript-eslint/no-magic-numbers': 'off',

// Disabled because: errors on 'displayMode || '5min'' expression with nullable variable.
'@typescript-eslint/no-unnecessary-condition': 'off',

// Disabled: covered with stricter tsc settings
'@typescript-eslint/typedef': 'off',

'@typescript-eslint/prefer-string-starts-ends-with': 'off',

'no-shadow': 'off',
},
};
26 changes: 26 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
overrides: [{
files: ['demo/**/*.ts', 'src/**/*.ts', '__tests__/**/*.ts'],
extends: ['./.eslintrc-ts.js']
}],
env: {
browser: true,
node: true,
es6: true,
jest: true
},
parserOptions: {
ecmaVersion: 2018,
// Allows for the parsing of modern ECMAScript features
sourceType: 'module',
// Allows for the use of imports
ecmaFeatures: {
restParams: true,
spread: true
}
},
globals: {
process: true
},
extends: ["plugin:storybook/recommended", "plugin:storybook/recommended"]
};
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules
npm-debug.log
.idea/
.vscode/
yarn-error.log
vscode
dist-sdk/
dist-demo/
dist-specification/
dist-coverage/
.eslintcache
coverage
*.DS_Store
allure-report/
allure-results/
37 changes: 37 additions & 0 deletions .gitlab/merge_request_templates/Default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## Merge Checklist
<!--
Список шагов, которые необходимо проверить перед влитием этого MR.
-->
* [ ] Подлит свежий develop
* [ ] Код проверен на тесте и он работает
* [ ] Код покрыт тестами (если возможно)
* [ ] В демку внесены изменения (если возможно)
* [ ] Документация обновлена

## Описание изменений
<!--
Краткое описание выполненной работы, включая список изменений, исправлений или новых функций. Если задача была связана с устранением ошибок, укажите проблему, которая была исправлена. Если это новая функциональность, объясните ее суть и значение для проекта.
-->

## Обоснование изменений
<!--
Здесь можно предоставить дополнительную информацию о необходимости и цели внесенных изменений. Объясните, почему эти изменения важны и как они улучшают проект. Укажите связанные проблемы, требования или запросы от пользователей, которые эти изменения решают.
-->

## Реализация
<!--
Опишите, как вы реализовали изменения. Укажите используемые технологии, методы или алгоритмы. Если есть вспомогательные материалы, такие как диаграммы, схемы или ссылки на документацию, приведите их здесь.
-->

## Тестирование
<!--
Укажите, как вы проверили внесенные изменения. Если были добавлены новые тесты, укажите их объем и описание. Если выполнялись ручное тестирование или автоматические тесты, укажите использованные подходы и результаты.
После изменения UI нужно приложить скриншот из демки.
Для этого скопируйте <img src="/uploads/hash/image.png" width="400"/> и замените hash на хэш изображения.
-->

## Примечания
<!--
В этом разделе вы можете указать дополнительные примечания или инструкции для ревьюера. Если есть известные ограничения, проблемы или замечания, которые не были решены в этом MR, укажите их здесь.
-->
8 changes: 8 additions & 0 deletions .husky/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
command_exists () {
command -v "$1" >/dev/null 2>&1
}

# Windows 10, Git Bash and Yarn workaround
if command_exists winpty && test -t 1; then
exec < /dev/tty
fi
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
. "$(dirname "$0")/common.sh"

yarn lint-staged && yarn docs:prod && git add ./.wiki
5 changes: 5 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
. "$(dirname "$0")/common.sh"

yarn tests
1 change: 1 addition & 0 deletions .wiki/.nojekyll
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
101 changes: 101 additions & 0 deletions .wiki/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
@vkid/sdk / [Modules](modules.md)

<div align="center">
<h1 align="center">
<img width="150" class="figure" src="https://unpkg.com/@vkid/[email protected]/logo.svg"/>
</h1>
<p align="center">
<!-- Заменить @vkontakte/superappkit на @vkid/sdk -->
<a href="LICENSE">
<img src="https://img.shields.io/npm/l/@vkid/sdk?maxAge=3600">
</a>
<a href="https://npmjs.com/package/@vkontakte/superappkit">
<img src="https://img.shields.io/npm/v/@vkid/sdk/latest.svg?maxAge=3600">
</a>
<a href="https://npmjs.com/package/@vkid/sdk">
<img alt="npm" src="https://img.shields.io/npm/dw/%40vkid%2Fsdk">
</a>
<a href="https://npmjs.com/package/@vkid/sdk">
<img alt="npm bundle size" src="https://img.shields.io/bundlephobia/minzip/%40vkid%2Fsdk">
</a>
</p>
<p align="center">
VK ID SDK — это библиотека для безопасной и удобной авторизации пользователей в вашем сервисе через VK ID.
</p>
</div>

## Демонстрация

Чтобы изучить возможности VK ID SDK, перейдите на [демо-стенд](https://demo.vksak.com)

## Установка

**NPM:**

```sh
npm i @vkid/sdk
```

**YARN:**

```sh
yarn add @vkid/sdk
```

**PNPM:**

```sh
pnpm add @vkid/sdk
```

**CDN:**

```html
<script src="https://unpkg.com/@vkid/sdk/dist/index-umd.js"></script>
```

## Пример

```javascript
import * as VKID from '@vkid/sdk';

VKID.Config.set({
app: APP_ID
});

const handleSuccess = (token) => {
console.log(token);
}

const authButton = document.createElement('button');
authButton.onclick = () => {
VKID.Auth.login()
.then(handleSuccess)
.catch(console.error);
};

document.getElementById('container')
.appendChild(authButton);
```

> Обратите внимание: Для работы авторизации нужен APP_ID. Вы получите его, когда [создадите](https://id.vk.com/business/go/docs/vkid/latest/create-application) приложение в кабинете подключения VK ID.
## Документация

- [Что такое VK ID](https://id.vk.com/business/go/docs/vkid/latest/start-page)
- [Создание приложения](https://id.vk.com/business/go/docs/vkid/latest/create-application)
- [Требования к дизайну](https://id.vk.com/business/go/docs/vkid/latest/guidelines/design-rules)
- [Спецификация](.wiki/README.md)

## Contributing

Проект VK ID SDK имеет открытый исходный код на GitHub, и вы можете присоединиться к его доработке — мы будем благодарны за внесение улучшений и исправление возможных ошибок.

### Code of Conduct

Если вы собираетесь вносить изменения в проект VK ID SDK, следуйте правилам [разработки](CODE_OF_CONDUCT.md). Они помогут понять, какие действия возможны, а какие недопустимы.

### Contributing Guide

В [руководстве](CONTRIBUTING.md) вы можете подробно ознакомиться с процессом разработки и узнать, как предлагать улучшения и исправления, а ещё — как добавлять и тестировать свои изменения в VK ID SDK.
Также рекомендуем ознакомиться с общими [правилами оформления кода](CODE_STYLE.md) в проекте.
47 changes: 47 additions & 0 deletions .wiki/classes/auth.Auth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[@vkid/sdk - v0.0.1](../README.md) / [Modules](../modules.md) / [auth](../modules/auth.md) / Auth

# Class: Auth

[auth](../modules/auth.md).Auth

## Table of contents

### Constructors

- [constructor](auth.Auth.md#constructor)

### Properties

- [\_\_config](auth.Auth.md#__config)

### Methods

- [login](auth.Auth.md#login)

## Constructors

### constructor

**new Auth**()

## Properties

### \_\_config

`Static` **\_\_config**: [`Config`](core_config.Config.md)

## Methods

### login

`Readonly` **login**(`params?`): `Promise`<[`AuthResponse`](../interfaces/auth.AuthResponse.md)\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `params?` | [`AuthParams`](../interfaces/auth.AuthParams.md) |

#### Returns

`Promise`<[`AuthResponse`](../interfaces/auth.AuthResponse.md)\>
48 changes: 48 additions & 0 deletions .wiki/classes/core_config.Config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[@vkid/sdk - v0.0.1](../README.md) / [Modules](../modules.md) / [core/config](../modules/core_config.md) / Config

# Class: Config

[core/config](../modules/core_config.md).Config

## Table of contents

### Constructors

- [constructor](core_config.Config.md#constructor)

### Methods

- [get](core_config.Config.md#get)
- [set](core_config.Config.md#set)

## Constructors

### constructor

**new Config**()

## Methods

### get

**get**(): [`ConfigData`](../interfaces/core_config.ConfigData.md)

#### Returns

[`ConfigData`](../interfaces/core_config.ConfigData.md)

___

### set

**set**(`config`): [`Config`](core_config.Config.md)

#### Parameters

| Name | Type |
| :------ | :------ |
| `config` | `Partial`<[`ConfigData`](../interfaces/core_config.ConfigData.md)\> |

#### Returns

[`Config`](core_config.Config.md)
Loading

0 comments on commit 5bd63c8

Please sign in to comment.