Skip to content

Commit

Permalink
chore: add initial changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
lucien-loua committed Sep 8, 2024
1 parent 203f78f commit c530822
Show file tree
Hide file tree
Showing 17 changed files with 489 additions and 115 deletions.
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": []
}
13 changes: 10 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
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
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -40,6 +43,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 +56,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 }}
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release

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

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

jobs:
release:
name: Release
runs-on: ubuntu-latest
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
with:
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
22 changes: 10 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,25 @@ 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
run: pnpm exec playwright install --with-deps
- name: Build
run: pnpm build
- name: Run tests
run: pnpm test
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm exec playwright install --with-deps
- run: pnpm test
- uses: actions/upload-artifact@v4
if: always()
with:
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/xyomi3" 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

0 comments on commit c530822

Please sign in to comment.