Skip to content

Commit a68de1d

Browse files
committed
introduce v4 codebase
1 parent 32cf8aa commit a68de1d

File tree

168 files changed

+71075
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+71075
-0
lines changed

Diff for: .github/workflows/ci.yml

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 15
16+
17+
strategy:
18+
matrix:
19+
node-version: [20]
20+
21+
steps:
22+
- uses: actions/checkout@v3
23+
- uses: pnpm/action-setup@v3
24+
with:
25+
version: ^8.15.0
26+
- name: Use Node.js ${{ matrix.node-version }}
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: ${{ matrix.node-version }}
30+
cache: 'pnpm'
31+
32+
# Cargo already skips downloading dependencies if they already exist
33+
- name: Cache cargo
34+
uses: actions/cache@v3
35+
with:
36+
path: |
37+
~/.cargo/bin/
38+
~/.cargo/registry/index/
39+
~/.cargo/registry/cache/
40+
~/.cargo/git/db/
41+
target/
42+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
43+
44+
# Cache the `oxide` Rust build
45+
- name: Cache oxide build
46+
uses: actions/cache@v3
47+
with:
48+
path: |
49+
./oxide/target/
50+
./oxide/crates/node/*.node
51+
./oxide/crates/node/index.js
52+
./oxide/crates/node/index.d.ts
53+
key: ${{ runner.os }}-oxide-${{ hashFiles('./oxide/crates/**/*') }}
54+
55+
- name: Install dependencies
56+
run: pnpm install
57+
58+
- name: Install Playwright Browsers
59+
run: npx playwright install --with-deps
60+
61+
- name: Build
62+
run: pnpm run build
63+
64+
- name: Lint
65+
run: pnpm run lint
66+
67+
- name: Test
68+
run: pnpm run test
69+
70+
- name: Run Playwright tests
71+
run: npm run test:ui
72+
73+
- uses: actions/upload-artifact@v3
74+
if: always()
75+
with:
76+
name: playwright-report
77+
path: packages/tailwindcss/playwright-report/
78+
retention-days: 30
79+
80+
- name: Bench
81+
run: pnpm run bench

Diff for: .github/workflows/release.yml

+214
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_channel:
7+
description: 'Release channel'
8+
required: false
9+
default: 'internal'
10+
type: string
11+
12+
permissions:
13+
contents: read
14+
15+
env:
16+
APP_NAME: tailwindcss-oxide
17+
NODE_VERSION: 20
18+
PNPM_VERSION: ^8.15.0
19+
OXIDE_LOCATION: ./oxide/crates/node
20+
21+
jobs:
22+
build:
23+
strategy:
24+
matrix:
25+
include:
26+
# Windows
27+
- os: windows-latest
28+
target: x86_64-pc-windows-msvc
29+
# macOS
30+
- os: macos-latest
31+
target: x86_64-apple-darwin
32+
strip: strip -x # Must use -x on macOS. This produces larger results on linux.
33+
- os: macos-latest
34+
target: aarch64-apple-darwin
35+
page-size: 14
36+
strip: strip -x # Must use -x on macOS. This produces larger results on linux.
37+
# Linux
38+
- os: ubuntu-latest
39+
target: x86_64-unknown-linux-gnu
40+
strip: strip
41+
container:
42+
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
43+
- os: ubuntu-latest
44+
target: aarch64-unknown-linux-gnu
45+
strip: llvm-strip
46+
container:
47+
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
48+
- os: ubuntu-latest
49+
target: armv7-unknown-linux-gnueabihf
50+
strip: llvm-strip
51+
container:
52+
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-zig
53+
- os: ubuntu-latest
54+
target: aarch64-unknown-linux-musl
55+
strip: aarch64-linux-musl-strip
56+
download: true
57+
container:
58+
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
59+
- os: ubuntu-latest
60+
target: x86_64-unknown-linux-musl
61+
strip: strip
62+
download: true
63+
container:
64+
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
65+
66+
name: Build ${{ matrix.target }} (OXIDE)
67+
runs-on: ${{ matrix.os }}
68+
container: ${{ matrix.container }}
69+
timeout-minutes: 15
70+
steps:
71+
- uses: actions/checkout@v3
72+
- uses: pnpm/action-setup@v3
73+
with:
74+
version: ${{ env.PNPM_VERSION }}
75+
76+
- name: Use Node.js ${{ env.NODE_VERSION }}
77+
uses: actions/setup-node@v3
78+
with:
79+
node-version: ${{ env.NODE_VERSION }}
80+
cache: 'pnpm'
81+
82+
# Cargo already skips downloading dependencies if they already exist
83+
- name: Cache cargo
84+
uses: actions/cache@v3
85+
with:
86+
path: |
87+
~/.cargo/bin/
88+
~/.cargo/registry/index/
89+
~/.cargo/registry/cache/
90+
~/.cargo/git/db/
91+
target/
92+
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
93+
94+
# Cache the `oxide` Rust build
95+
- name: Cache oxide build
96+
uses: actions/cache@v3
97+
with:
98+
path: |
99+
./oxide/target/
100+
./oxide/crates/node/*.node
101+
./oxide/crates/node/index.js
102+
./oxide/crates/node/index.d.ts
103+
key: ${{ runner.os }}-${{ matrix.target }}-oxide-${{ hashFiles('./oxide/crates/**/*') }}
104+
105+
- name: Install Node.JS
106+
uses: actions/setup-node@v3
107+
with:
108+
node-version: ${{ env.NODE_VERSION }}
109+
110+
- name: Setup cross compile toolchain
111+
if: ${{ matrix.setup }}
112+
run: ${{ matrix.setup }}
113+
114+
- name: Install Rust (Stable)
115+
if: ${{ matrix.download }}
116+
run: |
117+
rustup default stable
118+
119+
- name: Setup rust target
120+
run: rustup target add ${{ matrix.target }}
121+
122+
- name: Install dependencies
123+
run: pnpm install --ignore-scripts --filter=!./playgrounds/*
124+
125+
- name: Build release
126+
run: pnpm run build --filter ${{ env.OXIDE_LOCATION }}
127+
env:
128+
RUST_TARGET: ${{ matrix.target }}
129+
JEMALLOC_SYS_WITH_LG_PAGE: ${{ matrix.page-size }}
130+
131+
- name: Strip debug symbols # https://github.com/rust-lang/rust/issues/46034
132+
if: ${{ matrix.strip }}
133+
run: ${{ matrix.strip }} ${{ env.OXIDE_LOCATION }}/*.node
134+
135+
- name: Upload artifacts
136+
uses: actions/upload-artifact@v3
137+
with:
138+
name: bindings-${{ matrix.target }}
139+
path: ${{ env.OXIDE_LOCATION }}/*.node
140+
141+
release:
142+
runs-on: ubuntu-latest
143+
timeout-minutes: 15
144+
name: Build and release Tailwind CSS
145+
146+
needs:
147+
- build
148+
149+
steps:
150+
- uses: actions/checkout@v3
151+
- uses: pnpm/action-setup@v3
152+
with:
153+
version: ${{ env.PNPM_VERSION }}
154+
155+
- name: Use Node.js ${{ env.NODE_VERSION }}
156+
uses: actions/setup-node@v3
157+
with:
158+
node-version: ${{ env.NODE_VERSION }}
159+
cache: 'pnpm'
160+
registry-url: 'https://registry.npmjs.org'
161+
162+
# Cargo already skips downloading dependencies if they already exist
163+
- name: Cache cargo
164+
uses: actions/cache@v3
165+
with:
166+
path: |
167+
~/.cargo/bin/
168+
~/.cargo/registry/index/
169+
~/.cargo/registry/cache/
170+
~/.cargo/git/db/
171+
target/
172+
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
173+
174+
# Cache the `oxide` Rust build
175+
- name: Cache oxide build
176+
uses: actions/cache@v3
177+
with:
178+
path: |
179+
./oxide/target/
180+
./oxide/crates/node/*.node
181+
./oxide/crates/node/index.js
182+
./oxide/crates/node/index.d.ts
183+
key: ${{ runner.os }}-${{ matrix.target }}-oxide-${{ hashFiles('./oxide/crates/**/*') }}
184+
185+
- name: Install dependencies
186+
run: pnpm install --ignore-scripts --filter=!./playgrounds/*
187+
188+
- name: Build Tailwind CSS
189+
run: pnpm run build
190+
191+
- name: Download artifacts
192+
uses: actions/download-artifact@v3
193+
with:
194+
path: ${{ env.OXIDE_LOCATION }}
195+
196+
- name: Move artifacts
197+
run: |
198+
cd ${{ env.OXIDE_LOCATION }}
199+
cp bindings-x86_64-pc-windows-msvc/* ./npm/win32-x64-msvc/
200+
cp bindings-x86_64-apple-darwin/* ./npm/darwin-x64/
201+
cp bindings-aarch64-apple-darwin/* ./npm/darwin-arm64/
202+
cp bindings-aarch64-unknown-linux-gnu/* ./npm/linux-arm64-gnu/
203+
cp bindings-aarch64-unknown-linux-musl/* ./npm/linux-arm64-musl/
204+
cp bindings-armv7-unknown-linux-gnueabihf/* ./npm/linux-arm-gnueabihf/
205+
cp bindings-x86_64-unknown-linux-gnu/* ./npm/linux-x64-gnu/
206+
cp bindings-x86_64-unknown-linux-musl/* ./npm/linux-x64-musl/
207+
208+
- name: Lock pre-release versions
209+
run: node ./scripts/lock-pre-release-versions.mjs
210+
211+
- name: Publish
212+
run: pnpm --recursive publish --tag ${{ inputs.release_channel }} --no-git-checks
213+
env:
214+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Diff for: .gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules/
2+
dist/
3+
coverage/
4+
.turbo
5+
test-results/
6+
playwright-report/
7+
blob-report/
8+
playwright/.cache/

Diff for: .npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
auto-install-peers = true

Diff for: .prettierignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
coverage/
2+
node_modules/
3+
pnpm-lock.yaml
4+
oxide/target/
5+
oxide/crates/node/index.d.ts
6+
oxide/crates/node/index.js
7+
.next
8+
.fingerprint

Diff for: oxide/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target/

0 commit comments

Comments
 (0)