Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ npm init qwik@latest

## Docs

- [Official Docs](https://qwik.builder.io)
- [Official Docs](https://qwik.builder.io/)

## Blog Posts

Expand All @@ -43,8 +43,13 @@ npm init qwik@latest
## Community

- Ping us at [@QwikDev](https://twitter.com/QwikDev)
- Join our [Discord](https://qwik.builder.io/chat) community.
- Join our [weekly office hours](https://calendar.google.com/calendar/u/0?cid=Y180ZG91YjR2NTZ1cW43YmgzbW1oZGJ2M3R2c0Bncm91cC5jYWxlbmRhci5nb29nbGUuY29t)
- Join our [Discord](https://qwik.builder.io/chat) community

## Related

- [Partytown](https://partytown.builder.io/): Relocate resource intensive third-party scripts off of the main thread and into a web worker 🎉.
- [Mitosis](https://github.com/BuilderIO/mitosis): Write components once, run everywhere. Compiles to Vue, React, Solid, Angular, Svelte, and more.
- [Builder](https://github.com/BuilderIO/builder): Drag and drop page builder and CMS for React, Vue, Angular, and more.

---

Expand Down
14 changes: 13 additions & 1 deletion packages/qwik-city/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# Qwik City 🏙

`@builder.io/qwik-city`
The meta-framework for [Qwik](https://qwik.builder.io/).

## Community

- Ping us at [@QwikDev](https://twitter.com/QwikDev)
- Join our [Discord](https://qwik.builder.io/chat) community

## Related

- [Qwik](https://qwik.builder.io/): An open-source framework designed for best possible time to interactive, by focusing on resumability of server-side-rendering of HTML, and fine-grained lazy-loading of code.
- [Partytown](https://partytown.builder.io/): Relocate resource intensive third-party scripts off of the main thread and into a web worker 🎉.
- [Mitosis](https://github.com/BuilderIO/mitosis): Write components once, run everywhere. Compiles to Vue, React, Solid, Angular, Svelte, and more.
- [Builder](https://github.com/BuilderIO/builder): Drag and drop page builder and CMS for React, Vue, Angular, and more.
2 changes: 1 addition & 1 deletion packages/qwik-city/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@builder.io/qwik-city",
"version": "0.0.24",
"version": "0.0.25",
"description": "Static Site Generator for Qwik",
"main": "./lib/index.qwik.cjs",
"module": "./lib/index.qwik.mjs",
Expand Down
53 changes: 29 additions & 24 deletions scripts/qwik-city.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,26 @@ import semver from 'semver';
import mri from 'mri';
import { execa } from 'execa';
import { fileURLToPath } from 'url';
import { copyFile } from 'fs/promises';

const PACKAGE = 'qwik-city';
const __dirname = fileURLToPath(new URL('.', import.meta.url));

export async function buildQwikCity(config: BuildConfig) {
const input = join(config.packagesDir, PACKAGE);
const output = join(input, 'lib');
const inputDir = join(config.packagesDir, PACKAGE);
const outputDir = join(inputDir, 'lib');

await Promise.all([
buildVite(config, input, output),
buildCloudflarePages(config, input, output),
buildExpress(config, input, output),
buildNetlifyEdge(config, input, output),
buildVite(config, inputDir, outputDir),
buildCloudflarePages(config, inputDir, outputDir),
buildExpress(config, inputDir, outputDir),
buildNetlifyEdge(config, inputDir, outputDir),
]);

await buildRuntime(config, input);
await buildRuntime(inputDir);

const loaderPkg = {
...(await readPackageJson(input)),
...(await readPackageJson(inputDir)),
main: './index.qwik.cjs',
module: './index.qwik.mjs',
qwik: './index.qwik.mjs',
Expand Down Expand Up @@ -59,12 +60,16 @@ export async function buildQwikCity(config: BuildConfig) {
devDependencies: undefined,
scripts: undefined,
};
await writePackageJson(output, loaderPkg);
await writePackageJson(outputDir, loaderPkg);

const srcReadmePath = join(inputDir, 'README.md');
const distReadmePath = join(outputDir, 'README.md');
await copyFile(srcReadmePath, distReadmePath);

console.log(`🏙 ${PACKAGE}`);
}

async function buildRuntime(config: BuildConfig, input: string) {
async function buildRuntime(input: string) {
const result = await execa('yarn', ['build.runtime'], {
stdout: 'inherit',
cwd: input,
Expand All @@ -74,14 +79,14 @@ async function buildRuntime(config: BuildConfig, input: string) {
}
}

async function buildVite(config: BuildConfig, input: string, output: string) {
const entryPoints = [join(input, 'buildtime', 'vite', 'index.ts')];
async function buildVite(config: BuildConfig, inputDir: string, outputDir: string) {
const entryPoints = [join(inputDir, 'buildtime', 'vite', 'index.ts')];

const external = ['source-map', 'vfile', '@mdx-js/mdx', 'typescript'];

await build({
entryPoints,
outfile: join(output, 'vite', 'index.mjs'),
outfile: join(outputDir, 'vite', 'index.mjs'),
bundle: true,
platform: 'node',
target: nodeTarget,
Expand All @@ -92,7 +97,7 @@ async function buildVite(config: BuildConfig, input: string, output: string) {

await build({
entryPoints,
outfile: join(output, 'vite', 'index.cjs'),
outfile: join(outputDir, 'vite', 'index.cjs'),
bundle: true,
platform: 'node',
target: nodeTarget,
Expand All @@ -102,12 +107,12 @@ async function buildVite(config: BuildConfig, input: string, output: string) {
});
}

async function buildCloudflarePages(config: BuildConfig, input: string, output: string) {
const entryPoints = [join(input, 'middleware', 'cloudflare-pages', 'index.ts')];
async function buildCloudflarePages(config: BuildConfig, inputDir: string, outputDir: string) {
const entryPoints = [join(inputDir, 'middleware', 'cloudflare-pages', 'index.ts')];

await build({
entryPoints,
outfile: join(output, 'middleware', 'cloudflare-pages', 'index.mjs'),
outfile: join(outputDir, 'middleware', 'cloudflare-pages', 'index.mjs'),
bundle: true,
platform: 'node',
target: nodeTarget,
Expand All @@ -116,14 +121,14 @@ async function buildCloudflarePages(config: BuildConfig, input: string, output:
});
}

async function buildExpress(config: BuildConfig, input: string, output: string) {
const entryPoints = [join(input, 'middleware', 'express', 'index.ts')];
async function buildExpress(config: BuildConfig, inputDir: string, outputDir: string) {
const entryPoints = [join(inputDir, 'middleware', 'express', 'index.ts')];

const external = ['express', 'node-fetch', 'path'];

await build({
entryPoints,
outfile: join(output, 'middleware', 'express', 'index.mjs'),
outfile: join(outputDir, 'middleware', 'express', 'index.mjs'),
bundle: true,
platform: 'node',
target: nodeTarget,
Expand All @@ -134,7 +139,7 @@ async function buildExpress(config: BuildConfig, input: string, output: string)

await build({
entryPoints,
outfile: join(output, 'middleware', 'express', 'index.cjs'),
outfile: join(outputDir, 'middleware', 'express', 'index.cjs'),
bundle: true,
platform: 'node',
target: nodeTarget,
Expand All @@ -144,12 +149,12 @@ async function buildExpress(config: BuildConfig, input: string, output: string)
});
}

async function buildNetlifyEdge(config: BuildConfig, input: string, output: string) {
const entryPoints = [join(input, 'middleware', 'netlify-edge', 'index.ts')];
async function buildNetlifyEdge(config: BuildConfig, inputDir: string, outputDir: string) {
const entryPoints = [join(inputDir, 'middleware', 'netlify-edge', 'index.ts')];

await build({
entryPoints,
outfile: join(output, 'middleware', 'netlify-edge', 'index.mjs'),
outfile: join(outputDir, 'middleware', 'netlify-edge', 'index.mjs'),
bundle: true,
platform: 'node',
target: nodeTarget,
Expand Down