Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: Changeset #1

Merged
merged 17 commits into from
Sep 8, 2024
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": true,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
8 changes: 8 additions & 0 deletions .changeset/tasty-ladybugs-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@omi3/audio': patch
'@omi3/utils': patch
'@omi3/tsup': patch
'@omi3/site': patch
---

init changeset
18 changes: 12 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
name: Build Site Docker Image
on:
push:
branches: ['main']
tags: ['v*.*.*']
pull_request:
branches: [main]
tags: [v*.*.*]
pull_request:
branches: ['main']

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-site
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-site
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}

steps:
- name: Checkout repository
Expand All @@ -40,6 +42,7 @@ jobs:
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
id: build-and-push
uses: docker/[email protected]
Expand All @@ -52,3 +55,6 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}
TURBO_TEAM=${{ vars.TURBO_TEAM }}
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release

on:
push:
branches: ["main", "dev"]
tags: ["v*.*.*"]
pull_request:
branches: ["main"]

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: pnpm/action-setup@v2
with:
version: 9.1.1

- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'

- run: pnpm install --frozen-lockfile

- name: Create Release Pull Request or Publish to npm
uses: changesets/action@v1
if: github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main'
with:
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
18 changes: 10 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,26 @@ on:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- uses: pnpm/action-setup@v2
with:
version: 9.1.1
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install Playwright
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- name: Install playwright browsers
run: pnpm exec playwright install --with-deps
- name: Build
- name: Build packages
run: pnpm build
- name: Run tests
run: pnpm test
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

---

# Dev Branch

`Omi3` is an open-source project focused on building audio processing and playback capabilities for web applications.

## Project Overview
Expand Down
4 changes: 4 additions & 0 deletions apps/site/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Use a base image with pnpm pre-installed
FROM node:18-alpine AS base
RUN npm install -g pnpm turbo
ARG TURBO_TOKEN

Check warning on line 4 in apps/site/Dockerfile

View workflow job for this annotation

GitHub Actions / build

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "TURBO_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ARG TURBO_TEAM

# Build stage
FROM base AS builder
RUN apk update && apk add --no-cache libc6-compat
WORKDIR /app
COPY . .
ENV TURBO_TOKEN=$TURBO_TOKEN

Check warning on line 12 in apps/site/Dockerfile

View workflow job for this annotation

GitHub Actions / build

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "TURBO_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ENV TURBO_TEAM=$TURBO_TEAM
RUN turbo prune @omi3/site --docker

# Install and build stage
Expand Down
13 changes: 8 additions & 5 deletions apps/site/app/_components/audio/player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { Button, Card, CardContent, CardHeader, CardTitle, Progress } from '@omi
import { useCallback, useEffect, useMemo, useState } from 'react';

import { AudioChannel } from '@omi3/audio';
import AudioVisualizer from './visualizer';
import { playtime } from '@omi3/utils';
import AudioVisualizer from './visualizer';

const sampleMusic = {
url: 'https://cdn.pixabay.com/audio/2023/12/29/audio_a1497a53af.mp3',
Expand Down Expand Up @@ -65,17 +65,20 @@ export function AudioPlayer() {
}, [audioChannel, isPlaying]);

return (
<Card className="w-full max-w-md mx-auto">
<Card className="w-full">
<CardHeader className="text-center">
<CardTitle>
Omi<span className="text-main">3</span> Player
</CardTitle>
</CardHeader>
<CardContent>
<AudioVisualizer analyser={analyser} width={300} height={150} />
<div className="w-full">
<AudioVisualizer analyser={analyser} width={300} height={150} />
</div>
<Progress value={(currentTime / duration) * 100} className="mt-4" />
<div className="text-text mt-2 w-full text-sm">
{playtime(currentTime)} / {playtime(duration)}
<div className="text-text mt-2 w-full text-sm flex justify-between">
<span>{playtime(currentTime)}</span>
<span>{playtime(duration)}</span>
</div>
<Button onClick={handlePlayPause} className="mt-4 w-full">
{isPlaying ? 'Pause' : 'Lecture'}
Expand Down
4 changes: 2 additions & 2 deletions apps/site/app/_components/layout/footer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export function Footer() {
return (
<footer className="flex items-center justify-center p-5">
© {new Date().getFullYear()} Omi3
<footer className="flex items-center justify-center p-5 z-50">
© {new Date().getFullYear()}<a href="https://github.com/xyhomi3" className="text-main"> Omi3</a>
</footer>
);
}
6 changes: 3 additions & 3 deletions apps/site/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ export default function RootLayout({
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body className={cn(silk.variable, 'font-silk antialiased flex flex-col min-h-screen')}>
<main className="flex-grow flex items-center justify-center">
<html lang="en" className="h-full">
<body className={cn(silk.variable, 'font-silk antialiased flex flex-col min-h-full')}>
<main className="flex-grow flex items-center justify-center p-5">
{children}
</main>
<Footer />
Expand Down
8 changes: 6 additions & 2 deletions apps/site/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { Metadata } from 'next';
import { AudioPlayer } from './_components/audio';
import { Metadata } from 'next';

export const metadata: Metadata = {
title: 'Player',
};

export default function Home() {
return <AudioPlayer />;
return (
<div className="w-full max-w-md">
<AudioPlayer />
</div>
);
}
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@
"dev": "turbo dev",
"lint": "turbo lint",
"test": "turbo test",
"clean": "turbo clean && rm -rf node_modules",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"clean": "turbo clean && rm -rf node_modules"
"changeset": "changeset",
"release": "turbo build lint test && changeset publish"
},
"packageManager": "[email protected]",
"engines": {
"node": ">=18"
},
"dependencies": {
"devDependencies": {
"@changesets/cli": "^2.27.8",
"@manypkg/cli": "^0.21.4",
"@omi3/typescript": "workspace:*",
"prettier": "^3.2.5",
"prettier-plugin-tailwindcss": "^0.6.5",
"turbo": "latest",
Expand Down
39 changes: 31 additions & 8 deletions packages/audio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
"version": "0.0.0",
"description": "Web Audio API",
"license": "Apache-2.0",
"types": "./dist/index.d.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"files": [
"dist",
"LICENSE",
"README.md"
],
"scripts": {
"dev": "tsup --watch",
"build": "tsup",
Expand All @@ -19,6 +11,37 @@
"test": "jest",
"prepublishOnly": "pnpm run build"
},
"types": "./dist/index.d.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"files": [
"dist/**",
"LICENSE",
"README.md"
],
"sideEffects": false,
"publishConfig": {
"access": "public"
},
"author": {
"name": "Omi3",
"url": "https://github.com/xyhomi3"
},
"repository": {
"type": "git",
"url": "https://github.com/xyhomi3/omi3.git"
},
"homepage": "https://github.com/xyhomi3/omi3/tree/main/packages/audio#readme",
"bugs": {
"url": "https://github.com/xyhomi3/omi3/issues"
},
"keywords": [
"audio",
"web audio api",
"audio library",
"audio processing",
"audio playback"
],
"devDependencies": {
"@omi3/eslint": "workspace:*",
"@omi3/tsup": "workspace:*",
Expand Down
23 changes: 20 additions & 3 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"description": "Reusable constants and utility functions",
"version": "0.0.0",
"license": "MIT",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",

"scripts": {
"dev": "tsup --watch",
"build": "tsup",
Expand All @@ -15,7 +13,26 @@
"pretest": "pnpm build",
"test": "jest"
},

"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist/**",
"README.md"
],
"sideEffects": false,
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/xyhomi3/omi3.git"
},
"homepage": "https://github.com/xyhomi3/omi3/tree/main/packages/utils#readme",
"bugs": {
"url": "https://github.com/xyhomi3/omi3/issues"
},
"dependencies": {
"clsx": "^2.1.1",
"react": "^18.3.0",
Expand Down
Loading
Loading