Skip to content

Commit afd3f69

Browse files
authored
feat: add qwik-city starter (#546)
1 parent a4d1575 commit afd3f69

File tree

89 files changed

+1202
-343
lines changed

Some content is hidden

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

89 files changed

+1202
-343
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "0.0.21-0",
55
"scripts": {
66
"build": "yarn node scripts --tsc --build --api --platform-binding-wasm-copy",
7-
"build.full": "yarn node scripts --tsc --build --api --eslint --platform-binding --wasm",
7+
"build.full": "yarn node scripts --tsc --build --api --eslint --qwikcity --platform-binding --wasm",
88
"build.platform": "yarn node scripts --platform-binding",
99
"build.platform.copy": "yarn node scripts --platform-binding-wasm-copy",
1010
"build.only_javascript": "yarn node scripts --tsc --build --api",

packages/create-qwik/api/generate-starter.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,20 @@ function generateUserStarter(
6161
throw new Error(`Unable to find base app.`);
6262
}
6363

64+
if (starterServer) {
65+
const serverPkgJson = readPackageJson(starterServer.dir);
66+
const vite = serverPkgJson.qwik?.vite;
67+
replacements.push([/\/\* VITE_IMPORTS \*\//g, vite?.VITE_IMPORTS ?? '']);
68+
replacements.push([/\/\* VITE_CONFIG \*\//g, vite?.VITE_CONFIG ?? '']);
69+
replacements.push([/\/\* VITE_QWIK \*\//g, vite?.VITE_QWIK ?? '']);
70+
replacements.push([/\/\* VITE_PLUGINS \*\//g, vite?.VITE_PLUGINS ?? '']);
71+
}
72+
6473
cp(baseApp.dir, result.outDir, replacements);
6574
cp(starterApp.dir, result.outDir, replacements);
6675

6776
const pkgJson = readPackageJson(baseApp.dir);
68-
const starterPkgJson = readPackageJson(baseApp.dir);
77+
const starterPkgJson = readPackageJson(starterApp.dir);
6978
mergePackageJSONs(pkgJson, starterPkgJson);
7079

7180
let readmeContent = baseApp.readme!.trim() + '\n\n';

packages/create-qwik/api/utils-api.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { copyFileSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'fs';
2-
import { extname, join } from 'path';
2+
import { join } from 'path';
33
import type { PackageJSON } from '../../../scripts/util';
44

55
export type Replacements = [RegExp, string][];
@@ -17,7 +17,9 @@ export function cp(srcDir: string, destDir: string, replacements: Replacements)
1717
} else if (s.isFile()) {
1818
const shouldReplace =
1919
replacements.length > 0 &&
20-
['.json', '.toml', '.md', '.html'].includes(extname(srcChildPath));
20+
['.json', '.toml', '.md', '.html', 'vite.config.ts'].some((ext) =>
21+
srcChildPath.endsWith(ext)
22+
);
2123
if (shouldReplace) {
2224
let srcContent = readFileSync(srcChildPath, 'utf8');
2325
for (const regex of replacements) {

packages/docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"devDependencies": {
2121
"@builder.io/partytown": "^0.5.4",
2222
"@builder.io/qwik": "0.0.21-0",
23-
"@builder.io/qwik-city": "0.0.7",
23+
"@builder.io/qwik-city": "0.0.10",
2424
"@cloudflare/kv-asset-handler": "0.2.0",
2525
"@cloudflare/workers-types": "^3.10.0",
2626
"autoprefixer": "10.4.7",

packages/docs/pages/docs/file.mdx

Lines changed: 0 additions & 32 deletions
This file was deleted.

packages/docs/src/components/on-this-page/on-this-page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { usePage } from '@builder.io/qwik-city';
2-
import { component$, Host, $, useHostElement, useScopedStyles$ } from '@builder.io/qwik';
2+
import { component$, Host, useScopedStyles$ } from '@builder.io/qwik';
33
import { ChatIcon } from '../svgs/chat-icon';
44
import { EditIcon } from '../svgs/edit-icon';
55
import { GithubLogo } from '../svgs/github-logo';

packages/docs/src/components/repl/worker/update.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable no-console */
22
import type { InputOptions, OutputAsset, OutputChunk } from 'rollup';
33
import type { Diagnostic, QwikRollupPluginOptions } from '@builder.io/qwik/optimizer';
4-
import type { ReplInputOptions, ReplModuleInput, ReplModuleOutput, ReplResult } from '../types';
4+
import type { ReplInputOptions, ReplModuleOutput, ReplResult } from '../types';
55
import { getCtx, QwikReplContext } from './context';
66
import { loadDependencies } from './dependencies';
77
import { ssrHtml } from './ssr-html';

packages/docs/src/layouts/examples/examples.tsx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
import {
22
component$,
33
Host,
4-
useHostElement,
54
useScopedStyles$,
65
useWatch$,
76
useStore,
7+
useStyles$,
88
} from '@builder.io/qwik';
99
import { Repl } from '../../components/repl/repl';
1010
import styles from './examples.css?inline';
1111
import { Header } from '../../components/header/header';
12-
import { setHeadMeta, setHeadStyles } from '@builder.io/qwik-city';
12+
import { useHeadMeta } from '@builder.io/qwik-city';
1313
import exampleSections, { ExampleApp } from '@examples-data';
1414
import type { ReplAppInput } from '../../components/repl/types';
1515

1616
const Examples = component$((props: ExamplesProp) => {
17-
const hostElm = useHostElement();
17+
useHeadMeta({ title: `Qwik Examples` });
18+
useStyles$(`html,body { margin: 0; height: 100%; overflow: hidden; }`);
1819

1920
const store = useStore<ExamplesStore>(() => {
2021
// /examples/section/app-id
@@ -37,15 +38,6 @@ const Examples = component$((props: ExamplesProp) => {
3738
store.files = app?.inputs || [];
3839
});
3940

40-
useWatch$(() => {
41-
setHeadMeta(hostElm, { title: `Qwik Examples` });
42-
setHeadStyles(hostElm, [
43-
{
44-
style: `html,body { margin: 0; height: 100%; overflow: hidden; }`,
45-
},
46-
]);
47-
});
48-
4941
useScopedStyles$(styles);
5042

5143
return (

0 commit comments

Comments
 (0)