Skip to content

Commit 7a6b0cd

Browse files
chore(build): fix build
1 parent 94211bb commit 7a6b0cd

File tree

14 files changed

+63277
-21
lines changed

14 files changed

+63277
-21
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
# AV1 Components
1+
# AV1-C
22

3-
AV1 Components is a library of UI components for building AV1 products and related projects. It is built with Tailwind CSS and React.
3+
AV1-C is a library of React UI components for building AV1 products and related projects.
44

55
## Usage
66

77
```tsx
88
import { CodeEditor } from "av1-c";
99
```
1010

11+
...
12+
13+
see the [docs](https://av1-c.up.railway.app/) for more information.
14+
1115
## Contributing
1216

1317
This project follows the [Conventional Commits](https://www.conventionalcommits.org/) specification for commit messages. Please format your commit messages accordingly:

bun.lockb

-8.93 KB
Binary file not shown.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,16 @@
3737
"devDependencies": {
3838
"@semantic-release/changelog": "^6.0.3",
3939
"@semantic-release/git": "^10.0.1",
40+
"@tailwindcss/postcss": "^4.0.1",
4041
"@types/react": "^18.3.3",
4142
"@types/react-dom": "^18.3.0",
4243
"@vitejs/plugin-react": "^4.2.1",
43-
"autoprefixer": "^10.4.17",
44+
"autoprefixer": "^10.4.20",
4445
"bun-types": "^1.2.1",
46+
"postcss": "^8.5.1",
4547
"postcss-cli": "^11.0.0",
46-
"postcss": "^8.4.35",
4748
"semantic-release": "^22.0.0",
48-
"tailwindcss": "^3.4.9",
49+
"tailwindcss": "^4.0.1",
4950
"typescript": "^4.9.5",
5051
"vite": "^5.0.12"
5152
},

src/docs/index.css

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
@tailwind base;
2-
@tailwind components;
3-
@tailwind utilities;
1+
@import "tailwindcss";
42

53
@layer base {
64
:root {

src/docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>AV1 Components</title>
6+
<title>AV1-C</title>
77
<script>
88
// Immediately invoked function to set the theme before page render
99
(function() {

src/docs/pages/GettingStartedPage.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const GettingStartedPage = () => {
1010
<div>
1111
<Title level={1}>Getting Started</Title>
1212
<p className="mt-2 text-gray-400">
13-
Learn how to install and start using AV1 Components in your project.
13+
Learn how to install and start using AV1-C in your project.
1414
</p>
1515
</div>
1616

@@ -21,16 +21,16 @@ export const GettingStartedPage = () => {
2121
<Card.Content>
2222
<div className="space-y-4">
2323
<p className="text-gray-400">
24-
Install AV1 Components using your preferred package manager:
24+
Install AV1-C using your preferred package manager:
2525
</p>
2626
<Code>
27-
npm install @aviarytech/av1-c
27+
npm install av1-c
2828
</Code>
2929
<p className="text-gray-400 mt-4">
3030
Or using yarn:
3131
</p>
3232
<Code>
33-
yarn add @aviarytech/av1-c
33+
yarn add av1-c
3434
</Code>
3535
</div>
3636
</Card.Content>
@@ -46,7 +46,7 @@ export const GettingStartedPage = () => {
4646
</p>
4747

4848
<ComponentDemo
49-
code={`import { SchemaEditor } from '@aviarytech/av1-c';
49+
code={`import { SchemaEditor } from 'av1-c';
5050
5151
function App() {
5252
return (

src/docs/pages/components/AccordionPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ const MyComponent = () => (
4646
<Accordion
4747
items={[
4848
{
49-
title: "What is AV1 Components?",
50-
content: "AV1 Components is a React component library built with TypeScript and Tailwind CSS.",
49+
title: "What is AV1-C?",
50+
content: "AV1-C is a React component library built with TypeScript and Tailwind CSS.",
5151
defaultOpen: true
5252
},
5353
{

src/docs/pages/components/CodePage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ export const CodePage = () => {
2828
2929
const MyComponent = () => (
3030
<p>
31-
Install using <Code>npm install @aviarytech/av1-c</Code>
31+
Install using <Code>npm install av1-c</Code>
3232
</p>
3333
);`}
3434
>
3535
<p className="text-gray-400">
36-
Install using <Code>npm install @aviarytech/av1-c</Code>
36+
Install using <Code>npm install av1-c</Code>
3737
</p>
3838
</ComponentDemo>
3939

src/docs/pages/features/SchemaEditorPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const SchemaEditorPage = () => {
3737
The Schema Editor is included in the main package:
3838
</p>
3939
<Code>
40-
npm install @aviarytech/av1-c
40+
npm install av1-c
4141
</Code>
4242
</div>
4343
</Card.Content>
@@ -49,7 +49,7 @@ export const SchemaEditorPage = () => {
4949
</Card.Header>
5050
<Card.Content>
5151
<ComponentDemo
52-
code={`import { SchemaEditor } from '@aviarytech/av1-c';
52+
code={`import { SchemaEditor } from 'av1-c';
5353
5454
function MySchemaBuilder() {
5555
return (

src/docs/server.ts

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import { serve, file } from "bun";
22
import { join } from "path";
3+
import { build } from "bun";
4+
import postcss from "postcss";
5+
import tailwindcss from "@tailwindcss/postcss";
6+
import autoprefixer from "autoprefixer";
37

48
const port = process.env.PORT || 5055;
59
const isProd = process.argv.includes("--prod");
@@ -19,6 +23,18 @@ const MIME_TYPES: Record<string, string> = {
1923
".ts": "text/typescript",
2024
};
2125

26+
// Process CSS with PostCSS and Tailwind
27+
async function processCss(css: string) {
28+
const result = await postcss([
29+
tailwindcss,
30+
autoprefixer,
31+
]).process(css, {
32+
from: 'src/docs/index.css'
33+
});
34+
35+
return result.css;
36+
}
37+
2238
const server = serve({
2339
port,
2440
async fetch(req) {
@@ -37,6 +53,61 @@ const server = serve({
3753
const baseDir = isProd ? "dist/docs" : "src/docs";
3854
const filePath = join(process.cwd(), baseDir, pathname);
3955

56+
// Handle TypeScript compilation in development
57+
if (!isProd && pathname.endsWith('.js')) {
58+
const tsPath = filePath.replace('.js', '.tsx');
59+
try {
60+
const result = await build({
61+
entrypoints: [tsPath],
62+
outdir: './tmp',
63+
target: 'browser',
64+
});
65+
66+
if (!result.success) {
67+
throw new Error('Build failed');
68+
}
69+
70+
return new Response(result.outputs[0], {
71+
headers: {
72+
"Content-Type": "text/javascript; charset=utf-8",
73+
"Cache-Control": "no-cache",
74+
},
75+
});
76+
} catch (err) {
77+
// If .tsx doesn't exist, try .ts
78+
const tsPath2 = filePath.replace('.js', '.ts');
79+
const result = await build({
80+
entrypoints: [tsPath2],
81+
outdir: './tmp',
82+
target: 'browser',
83+
});
84+
85+
if (!result.success) {
86+
throw new Error('Build failed');
87+
}
88+
89+
return new Response(result.outputs[0], {
90+
headers: {
91+
"Content-Type": "text/javascript; charset=utf-8",
92+
"Cache-Control": "no-cache",
93+
},
94+
});
95+
}
96+
}
97+
98+
// Handle CSS processing in development
99+
if (!isProd && pathname.endsWith('.css')) {
100+
const cssContent = await file(filePath).text();
101+
102+
const processedCss = await processCss(cssContent);
103+
return new Response(processedCss, {
104+
headers: {
105+
"Content-Type": "text/css; charset=utf-8",
106+
"Cache-Control": "no-cache",
107+
},
108+
});
109+
}
110+
40111
// Try to read the file
41112
const fileContent = await file(filePath).arrayBuffer();
42113

0 commit comments

Comments
 (0)