Skip to content

Commit 89b56d9

Browse files
committed
Try Turborepo
1 parent 28c36e5 commit 89b56d9

File tree

6 files changed

+183
-171
lines changed

6 files changed

+183
-171
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -11,189 +11,52 @@ on:
1111
- "LICENSE.txt"
1212

1313
jobs:
14-
# Fast job to install dependencies and cache them for other jobs
15-
setup:
14+
# Main CI job - using Turborepo for dependency management
15+
ci:
1616
runs-on: ubuntu-latest
17-
outputs:
18-
cache-key: ${{ steps.cache-key.outputs.key }}
1917
steps:
2018
- uses: actions/checkout@v4
2119
- name: Install pnpm
2220
uses: pnpm/action-setup@v2
2321
with:
2422
version: 9.12.0
25-
- name: Generate cache key
26-
id: cache-key
27-
run: echo "key=node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}" >> $GITHUB_OUTPUT
2823
- name: Use Node.js 20.x
2924
uses: actions/setup-node@v4
3025
with:
3126
node-version: 20.x
3227
cache: "pnpm"
3328
- name: Install Dependencies
3429
run: pnpm install --frozen-lockfile
35-
36-
# Build job - Vite build for demo site
37-
build:
38-
runs-on: ubuntu-latest
39-
needs: setup
40-
steps:
41-
- uses: actions/checkout@v4
42-
- name: Install pnpm
43-
uses: pnpm/action-setup@v2
44-
with:
45-
version: 9.12.0
46-
- name: Use Node.js 20.x
47-
uses: actions/setup-node@v4
48-
with:
49-
node-version: 20.x
50-
cache: "pnpm"
51-
- name: Install Dependencies
52-
run: pnpm install --frozen-lockfile
53-
- name: Build Vite Demo
30+
- name: Build all packages
5431
run: |
55-
# Set CI environment variable for optimized builds
5632
export CI=true
57-
pnpm --filter ani-cursor build
58-
pnpm --filter winamp-eqf build
59-
pnpm --filter webamp build
33+
npx turbo build build-library
6034
env:
6135
NODE_ENV: production
62-
- name: Cache build artifacts
63-
uses: actions/cache@v4
64-
with:
65-
path: |
66-
packages/ani-cursor/dist
67-
packages/winamp-eqf/built
68-
packages/webamp/dist
69-
key: build-artifacts-${{ github.sha }}
70-
71-
# Build Library job - Rollup build for library bundles
72-
build-library:
73-
runs-on: ubuntu-latest
74-
needs: setup
75-
steps:
76-
- uses: actions/checkout@v4
77-
- name: Install pnpm
78-
uses: pnpm/action-setup@v2
79-
with:
80-
version: 9.12.0
81-
- name: Use Node.js 20.x
82-
uses: actions/setup-node@v4
83-
with:
84-
node-version: 20.x
85-
cache: "pnpm"
86-
- name: Install Dependencies
87-
run: pnpm install --frozen-lockfile
88-
- name: Build Library Bundles
36+
- name: Lint and type-check
37+
run: |
38+
npx turbo lint type-check
39+
- name: Run tests
8940
run: |
90-
# Set CI environment variable for optimized builds
41+
touch packages/skin-database/config.js
9142
export CI=true
92-
pnpm --filter ani-cursor build
93-
pnpm --filter winamp-eqf build
94-
pnpm --filter webamp build-library
43+
npx turbo test -- -- --maxWorkers=2
9544
env:
96-
NODE_ENV: production
97-
- name: Cache library artifacts
98-
uses: actions/cache@v4
99-
with:
100-
path: |
101-
packages/ani-cursor/dist
102-
packages/winamp-eqf/built
103-
packages/webamp/built
104-
key: library-artifacts-${{ github.sha }}
105-
106-
# Lint job - depends on build-library for type declarations
107-
lint:
108-
runs-on: ubuntu-latest
109-
needs: [setup, build-library]
110-
steps:
111-
- uses: actions/checkout@v4
112-
- name: Install pnpm
113-
uses: pnpm/action-setup@v2
114-
with:
115-
version: 9.12.0
116-
- name: Use Node.js 20.x
117-
uses: actions/setup-node@v4
118-
with:
119-
node-version: 20.x
120-
cache: "pnpm"
121-
- name: Install Dependencies
122-
run: pnpm install --frozen-lockfile
123-
- name: Restore library artifacts
124-
uses: actions/cache@v4
125-
with:
126-
path: |
127-
packages/ani-cursor/dist
128-
packages/winamp-eqf/built
129-
packages/webamp/built
130-
key: library-artifacts-${{ github.sha }}
131-
fail-on-cache-miss: true
132-
- name: Lint
133-
run: |
134-
pnpm lint
135-
pnpm type-check
136-
137-
# Test job - waits for build artifacts
138-
test:
139-
runs-on: ubuntu-latest
140-
needs: [setup, build]
141-
steps:
142-
- uses: actions/checkout@v4
143-
- name: Install pnpm
144-
uses: pnpm/action-setup@v2
145-
with:
146-
version: 9.12.0
147-
- name: Use Node.js 20.x
148-
uses: actions/setup-node@v4
149-
with:
150-
node-version: 20.x
151-
cache: "pnpm"
152-
- name: Install Dependencies
153-
run: pnpm install --frozen-lockfile
154-
- name: Restore build artifacts
45+
NODE_ENV: test
46+
- name: Cache build artifacts for release
15547
uses: actions/cache@v4
15648
with:
15749
path: |
15850
packages/ani-cursor/dist
15951
packages/winamp-eqf/built
16052
packages/webamp/dist
161-
key: build-artifacts-${{ github.sha }}
162-
fail-on-cache-miss: true
163-
- name: Run Unit Tests
164-
run: |
165-
touch packages/skin-database/config.js
166-
# Run tests with optimizations for CI
167-
export CI=true
168-
pnpm test -- --maxWorkers=2
169-
pnpm --filter webamp test -- --maxWorkers=2
170-
env:
171-
NODE_ENV: test
172-
# - name: Run Integration Tests
173-
# run: yarn workspace webamp integration-tests
174-
# env:
175-
# CI: true
176-
# - name: Upload Screenshot Diffs
177-
# if: failure()
178-
# uses: actions/upload-artifact@v4
179-
# with:
180-
# name: image_diffs
181-
# path: packages/webamp/js/__tests__/__image_snapshots__/__diff_output__/
182-
# - name: Generate New Screenshots
183-
# if: failure()
184-
# run: |
185-
# yarn workspace webamp integration-tests -u
186-
# - name: Upload New Screenshots
187-
# if: failure()
188-
# uses: actions/upload-artifact@v4
189-
# with:
190-
# name: new_images
191-
# path: packages/webamp/js/__tests__/__image_snapshots__/
192-
main-release:
53+
key: release-artifacts-${{ github.sha }}
54+
# Release job - publish packages to NPM
55+
release:
19356
name: Publish packages to NPM
19457
runs-on: ubuntu-latest
19558
if: github.event_name == 'push' && github.repository == 'captbaritone/webamp'
196-
needs: [build, build-library, lint, test]
59+
needs: [ci]
19760
steps:
19861
- uses: actions/checkout@v4
19962
- name: Install pnpm
@@ -214,16 +77,8 @@ jobs:
21477
packages/ani-cursor/dist
21578
packages/winamp-eqf/built
21679
packages/webamp/dist
217-
key: build-artifacts-${{ github.sha }}
218-
fail-on-cache-miss: true
219-
- name: Restore library artifacts
220-
uses: actions/cache@v4
221-
with:
222-
path: |
223-
packages/ani-cursor/dist
224-
packages/winamp-eqf/built
22580
packages/webamp/built
226-
key: library-artifacts-${{ github.sha }}
81+
key: release-artifacts-${{ github.sha }}
22782
fail-on-cache-miss: true
22883
- name: Set version for all packages
22984
if: github.ref == 'refs/heads/master'

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
node_modules
22
.vscode
3-
dist
3+
dist
4+
5+
# Turborepo cache
6+
.turbo

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,52 @@ Nullsoft, the code within this project is released under the [MIT
6565
License](LICENSE.txt). That being said, if you do anything interesting with
6666
this code, please let me know. I'd love to see it.
6767

68+
## Development
69+
70+
This repository uses [Turborepo](https://turbo.build/) for efficient monorepo management. Turborepo provides intelligent caching and parallel execution of tasks across all packages.
71+
72+
### Quick Start
73+
74+
```bash
75+
# Install dependencies
76+
pnpm install
77+
78+
# Build all packages (automatically handles dependencies)
79+
npx turbo build
80+
81+
# Build library bundles for packages that need them
82+
npx turbo build-library
83+
84+
# Run all tests
85+
npx turbo test
86+
87+
# Lint and type-check all packages
88+
npx turbo lint type-check
89+
90+
# Work on a specific package and its dependencies
91+
npx turbo dev --filter="webamp"
92+
```
93+
94+
### Package Dependencies
95+
96+
The monorepo dependency graph is automatically managed by Turborepo:
97+
98+
- `ani-cursor` and `winamp-eqf` are standalone packages built with TypeScript
99+
- `webamp` depends on both `ani-cursor` and `winamp-eqf` for workspace linking
100+
- All packages are built in the correct topological order
101+
- Builds are cached and only rebuild what has changed
102+
103+
### Available Tasks
104+
105+
- `build` - Main build output (Vite for demos, TypeScript compilation for libraries)
106+
- `build-library` - Library bundles for NPM publishing (only applies to `webamp`)
107+
- `test` - Run unit tests with Jest
108+
- `type-check` - TypeScript type checking without emitting files
109+
- `lint` - ESLint code quality checks
110+
- `dev` - Development server (for packages that support it)
111+
112+
For more details on individual packages, see their respective README files.
113+
68114
[techcrunch]: https://techcrunch.com/2018/02/09/whip-the-llamas-ass-with-this-javascript-winamp-emulator/
69115
[motherboard]: https://motherboard.vice.com/en_us/article/qvebbv/winamp-2-mp3-music-player-emulator
70116
[gizmodo]: https://gizmodo.com/winamp-2-has-been-immortalized-in-html5-for-your-pleasu-1655373653

package.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,11 @@
3131
"jest-environment-jsdom": "^29.7.0",
3232
"prettier": "^2.3.2",
3333
"stream-browserify": "^3.0.0",
34+
"turbo": "^2.5.4",
3435
"typescript": "^5.3.3"
3536
},
3637
"prettier": {
3738
"trailingComma": "es5"
3839
},
39-
"jest": {
40-
"projects": [
41-
"config/jest.*.js",
42-
"packages/ani-cursor",
43-
"packages/winamp-eqf"
44-
]
45-
},
46-
"dependencies": {},
4740
"version": "0.0.0-next-87012d8d"
4841
}

pnpm-lock.yaml

Lines changed: 64 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)