Skip to content

Commit 655613c

Browse files
Merge pull request #464 from thejackshelton/cloudflare-shiki
revert to pr 458
2 parents 5e07bcb + 0682243 commit 655613c

File tree

10 files changed

+1237
-26
lines changed

10 files changed

+1237
-26
lines changed

apps/website/README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,3 @@ The production build will generate client and server modules by running both cli
6363
```shell
6464
pnpm build # or `yarn build`
6565
```
66-
67-
## Static Site Generator (Node.js)
68-
69-
```
70-
pnpm build.server
71-
```

apps/website/adapters/static/vite.config.ts renamed to apps/website/adapters/cloudflare-pages/vite.config.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { staticAdapter } from '@builder.io/qwik-city/adapters/static/vite';
1+
import { cloudflarePagesAdapter } from '@builder.io/qwik-city/adapters/cloudflare-pages/vite';
22
import { extendConfig } from '@builder.io/qwik-city/vite';
33
import baseConfig from '../../vite.config';
44

@@ -7,12 +7,14 @@ export default extendConfig(baseConfig, () => {
77
build: {
88
ssr: true,
99
rollupOptions: {
10-
input: ['@qwik-city-plan'],
10+
input: ['apps/website/src/entry.cloudflare-pages.tsx', '@qwik-city-plan'],
1111
},
1212
},
1313
plugins: [
14-
staticAdapter({
15-
origin: 'https://qwikui.com/',
14+
cloudflarePagesAdapter({
15+
// ssg: {
16+
// include: ['/*'],
17+
// }
1618
}),
1719
],
1820
};

apps/website/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,5 @@
99
"@qwik-ui/fluffy": "workspace:*",
1010
"@qwik-ui/material": "workspace:*",
1111
"@qwik-ui/primitives": "workspace:*"
12-
},
13-
"scripts": {
14-
"build.server": "vite build -c adapters/static/vite.config.ts"
1512
}
1613
}

apps/website/project.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"mode": "production"
5656
},
5757
"production": {
58-
"configFile": "apps/website/adapters/static/vite.config.ts"
58+
"configFile": "apps/website/adapters/cloudflare-pages/vite.config.ts"
5959
}
6060
},
6161
"dependsOn": []
@@ -67,6 +67,22 @@
6767
"cwd": "apps/website"
6868
}
6969
},
70+
"deploy": {
71+
"executor": "@k11r/nx-cloudflare-wrangler:deploy-page",
72+
"options": {
73+
"dist": "dist/apps/website/client",
74+
"branch": "main",
75+
"projectName": "qwik-ui"
76+
},
77+
"dependsOn": ["build-cloudflare"]
78+
},
79+
"preview-cloudflare": {
80+
"executor": "@k11r/nx-cloudflare-wrangler:serve-page",
81+
"options": {
82+
"dist": "dist/apps/website/client"
83+
},
84+
"dependsOn": ["build-cloudflare"]
85+
},
7086
"build-cloudflare": {
7187
"executor": "nx:run-commands",
7288
"options": {
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* WHAT IS THIS FILE?
3+
*
4+
* It's the entry point for cloudflare-pages when building for production.
5+
*
6+
* Learn more about the cloudflare integration here:
7+
* - https://qwik.builder.io/integrations/deployments/cloudflare-pages/
8+
*
9+
*/
10+
import {
11+
createQwikCity,
12+
type PlatformCloudflarePages,
13+
} from '@builder.io/qwik-city/middleware/cloudflare-pages';
14+
import qwikCityPlan from '@qwik-city-plan';
15+
import { manifest } from '@qwik-client-manifest';
16+
import render from './entry.ssr';
17+
18+
declare global {
19+
interface QwikCityPlatform extends PlatformCloudflarePages {}
20+
}
21+
22+
const fetch = createQwikCity({ render, qwikCityPlan, manifest });
23+
24+
export { fetch };

apps/website/src/routes/docs/_components/highlight/highlight.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export const Highlight = component$(
4242
modifiedCode = partsOfCode[0];
4343
}
4444

45+
console.log(highlighter);
4546
codeSig.value = highlighter.codeToHtml(modifiedCode, { lang: language });
4647
});
4748

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import { component$, useStylesScoped$ } from '@builder.io/qwik';
2+
import { Badge } from '@qwik-ui/headless';
3+
4+
export default component$(() => {
5+
useStylesScoped$(`
6+
h1 { margin: 0.5rem 0 1rem 0; padding-top: 1rem; font-weight: bold; }
7+
.container { display: flex; gap: 10px; } .customBtnCls { background-color: lightcoral;}
8+
svg { width: 1rem; height: 1rem; stroke: currentColor }
9+
.badge-lg {height: 1.5rem;
10+
font-size: 1rem;
11+
line-height: 1.5rem;
12+
padding-left: 0.688rem;
13+
padding-right: 0.688rem;
14+
}
15+
`);
16+
return (
17+
<>
18+
<h2>This is the documentation for the Badge</h2>
19+
20+
<h1>Badge Example</h1>
21+
22+
<Badge class="badge">badge</Badge>
23+
24+
<h1>Color</h1>
25+
26+
<div class="container">
27+
<Badge class="badge">neutral</Badge>
28+
<Badge class="badge" style="background-color: lightblue">
29+
lightblue
30+
</Badge>
31+
</div>
32+
33+
<h1>Badge sizes</h1>
34+
<Badge class="badge badge-lg">Badge lg</Badge>
35+
36+
<h1>Empty badge</h1>
37+
<Badge class="badge" />
38+
39+
<h1>Badge with state colors</h1>
40+
<Badge class="badge">
41+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
42+
<path
43+
stroke-linecap="round"
44+
stroke-linejoin="round"
45+
stroke-width="2"
46+
d="M6 18L18 6M6 6l12 12"
47+
></path>
48+
</svg>
49+
info
50+
</Badge>
51+
52+
<h1>Badge in a text</h1>
53+
<h2>
54+
Heading
55+
<Badge class="badge">NEW</Badge>
56+
</h2>
57+
</>
58+
);
59+
});

apps/website/src/routes/docs/headless/(components)/toggle/index.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ A toggle component is a primitive that us used to quickly switch between two pos
1616

1717
{' '}
1818

19+
<Example01>
20+
```tsx
21+
<Toggle pressed onClick$={$(() => console.log('Toggle'))} />
22+
```
23+
</Example01>
24+
1925
## Building blocks
2026

2127
<CodeExample>

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"@fontsource-variable/inter": "5.0.8",
3535
"@frsource/cypress-plugin-visual-regression-diff": "^3.3.10",
3636
"@jscutlery/semver": "^3.1.0",
37+
"@k11r/nx-cloudflare-wrangler": "2.7.1",
3738
"@nx/cypress": "16.9.1",
3839
"@nx/eslint-plugin": "16.9.1",
3940
"@nx/js": "16.9.1",

0 commit comments

Comments
 (0)