2024-02-13 13:06:19 +00:00
|
|
|
|
## Виджет
|
|
|
|
|
### Сборка
|
2024-02-12 10:26:03 +00:00
|
|
|
|
```bash
|
|
|
|
|
yarn build:widget
|
|
|
|
|
```
|
2024-02-13 13:06:19 +00:00
|
|
|
|
### Использование
|
|
|
|
|
```html
|
|
|
|
|
<script type="module">
|
|
|
|
|
import widget from "https://s.hbpn.link/export/pub.js";
|
|
|
|
|
|
|
|
|
|
widget.create({
|
|
|
|
|
selector: "widget-container",
|
|
|
|
|
quizId: "...",
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
```
|
|
|
|
|
## Npm-пакет
|
|
|
|
|
### Перед использованием и публикацией
|
2024-02-12 10:26:03 +00:00
|
|
|
|
```bash
|
2024-02-13 13:06:19 +00:00
|
|
|
|
npm config set //penahub.gitlab.yandexcloud.net/api/v4/packages/npm/:_authToken=INSTANCE_TOKEN
|
|
|
|
|
npm config set //penahub.gitlab.yandexcloud.net/api/v4/projects/43/packages/npm/:_authToken=PROJECT_TOKEN
|
2024-02-12 10:26:03 +00:00
|
|
|
|
```
|
2024-02-13 13:06:19 +00:00
|
|
|
|
### Публикация
|
2024-02-12 10:26:03 +00:00
|
|
|
|
```bash
|
|
|
|
|
yarn publish
|
|
|
|
|
```
|
2024-02-13 13:06:19 +00:00
|
|
|
|
### Установка
|
2024-02-12 10:26:03 +00:00
|
|
|
|
Добавить в корень проекта файл .yarnrc с содержимым
|
|
|
|
|
```
|
|
|
|
|
"@frontend:registry" "https://penahub.gitlab.yandexcloud.net/api/v4/packages/npm/"
|
|
|
|
|
```
|
|
|
|
|
```bash
|
2024-02-12 10:58:51 +00:00
|
|
|
|
yarn add @frontend/squzanswerer
|
2024-02-12 10:26:03 +00:00
|
|
|
|
```
|
2024-02-13 13:06:19 +00:00
|
|
|
|
Peer dependencies:
|
|
|
|
|
```bash
|
|
|
|
|
yarn add @emoji-mart/data @emoji-mart/react @emotion/react @emotion/styled @mui/icons-material @mui/material @mui/x-date-pickers axios emoji-mart immer moment nanoid notistack react-dom react-error-boundary react-router-dom react swr use-debounce zustand
|
|
|
|
|
```
|
|
|
|
|
### Использование
|
|
|
|
|
```ts
|
|
|
|
|
import { QuizView } from "@frontend/squzanswerer";
|
|
|
|
|
|
|
|
|
|
export default function Component() {
|
|
|
|
|
// ...
|
|
|
|
|
return (
|
|
|
|
|
<QuizView quizId={quizId} />
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|