chore: Монорепо с общими пакетами

This commit is contained in:
2026-03-04 16:31:57 +03:00
parent 8f2c799235
commit 915c56351b
420 changed files with 13403 additions and 7071 deletions

215
README.md
View File

@@ -1,193 +1,60 @@
# @tach/video-player
# hublib-web
Single package with three entrypoints:
Monorepo for shared UI packages distributed with Yarn workspaces.
- `@tach/video-player/core`
- `@tach/video-player/react`
- `@tach/video-player/angular`
External projects install these packages directly from Git tags. Package `dist/` artifacts must be committed.
This folder is prepared to be moved into a dedicated repository as-is.
## Structure
## What Is Included
- `packages/tach-typography` - typography tokens and adapters for React/Angular.
- `packages/video-player` - cross-framework video player runtime and adapters.
- `packages/content-suggestions` - content text/title with mention/tag/link parsing for React/Angular.
- Build pipeline to `dist/`:
- `npm run build`
- `npm run typecheck`
- Storybook playground for framework entrypoints:
- `npm run storybook`
- `npm run build-storybook`
- `dist`-first flow for git-based installation:
- `dist/` is committed to the repository.
- consumers do not depend on `prepare` at install time.
- Version bump scripts:
- `npm run release:patch`
- `npm run release:minor`
- `npm run release:major`
- Optional framework peers:
- React peers are optional if only `core/angular` is used.
- Angular peers are optional if only `core/react` is used.
## Package READMEs
## Repo Transfer Checklist
- [tach-typography](./packages/tach-typography/README.md)
- [video-player](./packages/video-player/README.md)
- [content-suggestions](./packages/content-suggestions/README.md)
1. Create a new repository (for example `tach/video-player`).
2. Copy everything from this folder to the new repo root.
3. In the new repo run:
## Development
```bash
npm install
npm run build
corepack enable
yarn set version 4.12.0
yarn install
yarn build
yarn test
```
4. Commit and push (including `dist/`):
## Add a new package
1. Create a folder inside `packages/<name>`.
2. Add `package.json` with a unique package name.
3. Link internal dependencies with `workspace:*` (or `workspace:^`).
4. Run `yarn install` and then `yarn build`.
## Installation from Git (SSH)
This repository is consumed by tag-based Git dependencies.
- Full install guide: [docs/git-installation.md](./docs/git-installation.md)
- Release workflow: [docs/release-policy.md](./docs/release-policy.md)
Command template:
```bash
git add .
git commit -m "feat: initial @tach/video-player package"
git push origin main
yarn add "@hublib-web/<package>@git+ssh://git@github.com/ORG/REPO.git#workspace=@hublib-web/<package>&tag=<package>-vX.Y.Z"
```
5. Create a release tag:
## Releases
```bash
git tag v0.1.0
git push origin v0.1.0
```
Releases are done with Git tags (no Changesets, no npm publish).
## Build Output
Short flow:
`npm run build` compiles TypeScript into `dist/` and copies required assets (`css/scss/svg/...`).
`dist/` must be committed before creating a new version tag.
1. Bump version in `packages/<package>/package.json`.
2. Build package and commit updated `dist/` artifacts.
3. Create an annotated package tag: `<package>-vX.Y.Z`.
4. Push commit and tags to origin.
Entrypoints are exported from `dist`:
- `@tach/video-player/core`
- `@tach/video-player/react`
- `@tach/video-player/angular`
## Storybook
Local Storybook exposes two pages for development and prop testing:
- `React/VideoPlayer` - React component entrypoint with controls for player props.
- `Angular/VideoPlayerAdapter` - adapter entrypoint with controls for runtime options (`attach/update`).
Run Storybook:
```bash
npm run storybook
```
Build static Storybook:
```bash
npm run build-storybook
```
## Installation From Git (Without npm Registry)
### npm
By tag:
```bash
npm i git+ssh://git@github.com/<org>/video-player.git#v0.1.0
```
By commit:
```bash
npm i git+ssh://git@github.com/<org>/video-player.git#<commit-sha>
```
By semver tag range:
```bash
npm i github:<org>/video-player#semver:^0.1.0
```
### pnpm
```bash
pnpm add git+ssh://git@github.com/<org>/video-player.git#v0.1.0
```
### yarn
```bash
yarn add git+ssh://git@github.com/<org>/video-player.git#v0.1.0
```
## Versioning Workflow
1. Build and bump version:
```bash
npm run release:patch
# or release:minor / release:major
```
2. Commit generated `dist` changes and `package.json` version bump:
```bash
git add .
git commit -m "chore(release): vX.Y.Z"
```
3. Push commit and tags:
```bash
git push origin main --follow-tags
```
4. Consumers update git tag/version in their `package.json`.
## Why Optional Peers
Consumers install only the framework they need:
- React app: install `react` and `react-dom`, use `@tach/video-player/react`.
- Angular app: install `@angular/*`, use `@tach/video-player/angular`.
- Shared utilities only: use `@tach/video-player/core`.
## Entrypoints
### Core
```ts
import {
isHlsSource,
selectPlaybackEngine,
VideoPlayerRuntime,
setVideoPlayerTokenProvider,
} from "@tach/video-player/core";
setVideoPlayerTokenProvider(async () => {
// Provide host-app token retrieval here.
return null;
});
const runtime = new VideoPlayerRuntime();
await runtime.init({
container: document.getElementById("player")!,
source: { src: "https://example.com/video.m3u8" },
});
```
### React
```tsx
import VideoPlayer from "@tach/video-player/react";
```
### Angular
```ts
import { AngularVideoPlayerAdapter } from "@tach/video-player/angular";
const adapter = new AngularVideoPlayerAdapter();
await adapter.attach(containerElement, {
source: { src: "https://example.com/video.m3u8" },
});
```
`AngularVideoPlayerAdapter` is intentionally framework-light: it wraps `VideoPlayerRuntime` (`attach/update/destroy/on`) and does not depend on React code.
Detailed policy and examples: [docs/release-policy.md](./docs/release-policy.md).