@taujs/create-taujs 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +17 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -160,7 +160,7 @@ async function generateFiles(targetDir, config) {
|
|
|
160
160
|
);
|
|
161
161
|
await fs.writeFile(
|
|
162
162
|
path.join(targetDir, "src/client/index.html"),
|
|
163
|
-
generateIndexHtml(
|
|
163
|
+
generateIndexHtml()
|
|
164
164
|
);
|
|
165
165
|
await fs.writeFile(
|
|
166
166
|
path.join(targetDir, "src/client/App.tsx"),
|
|
@@ -214,7 +214,7 @@ function generatePackageJson(projectName, packageManager) {
|
|
|
214
214
|
"build:client": "tsx build.ts",
|
|
215
215
|
"build:entry-server": "BUILD_MODE=ssr tsx build.ts",
|
|
216
216
|
"build:server": "esbuild src/server/index.ts --bundle --platform=node --format=esm --outfile=dist/server/index.js --external:fastify --external:@taujs/server --external:@taujs/react",
|
|
217
|
-
build: "
|
|
217
|
+
build: "tsx build.ts && BUILD_MODE=ssr tsx build.ts && esbuild src/server/index.ts --bundle --platform=node --format=esm --outfile=dist/server/index.js --external:fastify --external:@taujs/server --external:@taujs/react",
|
|
218
218
|
start: "NODE_ENV=production node dist/server/index.js",
|
|
219
219
|
lint: "tsc --noEmit"
|
|
220
220
|
},
|
|
@@ -239,7 +239,7 @@ function generatePackageJson(projectName, packageManager) {
|
|
|
239
239
|
function generateBuildTs() {
|
|
240
240
|
return `import path from "node:path";
|
|
241
241
|
import { taujsBuild } from "@taujs/server";
|
|
242
|
-
import config from "./taujs.config.
|
|
242
|
+
import config from "./taujs.config.ts";
|
|
243
243
|
|
|
244
244
|
await taujsBuild({
|
|
245
245
|
clientBaseDir: path.resolve(process.cwd(), "src/client"),
|
|
@@ -317,8 +317,9 @@ export default defineConfig({
|
|
|
317
317
|
}),
|
|
318
318
|
// meta recommended for streaming routes for SEO/social and render timing
|
|
319
319
|
meta: {
|
|
320
|
-
title:
|
|
321
|
-
description:
|
|
320
|
+
title: "\u03C4js \u2014 Streaming",
|
|
321
|
+
description:
|
|
322
|
+
"Streaming SSR route (Suspense progressively reveals content).",
|
|
322
323
|
},
|
|
323
324
|
},
|
|
324
325
|
},
|
|
@@ -442,16 +443,13 @@ ${projectName}/
|
|
|
442
443
|
MIT
|
|
443
444
|
`;
|
|
444
445
|
}
|
|
445
|
-
function generateIndexHtml(
|
|
446
|
+
function generateIndexHtml() {
|
|
446
447
|
return `<!DOCTYPE html>
|
|
447
448
|
<html lang="en">
|
|
448
449
|
<head>
|
|
449
450
|
<meta charset="UTF-8" />
|
|
450
451
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
451
|
-
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
452
|
-
<link rel="stylesheet" href="/styles.css" />
|
|
453
452
|
<!--ssr-head-->
|
|
454
|
-
<title>${title}</title>
|
|
455
453
|
</head>
|
|
456
454
|
<body>
|
|
457
455
|
<main id="root"><!--ssr-html--></main>
|
|
@@ -463,6 +461,8 @@ function generateAppComponent() {
|
|
|
463
461
|
return `import { Suspense } from 'react';
|
|
464
462
|
import { useSSRStore } from '@taujs/react';
|
|
465
463
|
|
|
464
|
+
import "./styles.css";
|
|
465
|
+
|
|
466
466
|
type GreetingData = {
|
|
467
467
|
message: string;
|
|
468
468
|
timestamp: string;
|
|
@@ -646,7 +646,7 @@ code {
|
|
|
646
646
|
}
|
|
647
647
|
|
|
648
648
|
.app-title::before {
|
|
649
|
-
background: url("favicon.svg") no-repeat;
|
|
649
|
+
background: url("/favicon.svg") no-repeat;
|
|
650
650
|
background-size: 50px 50px;
|
|
651
651
|
content: "";
|
|
652
652
|
border-radius: 4px;
|
|
@@ -784,12 +784,13 @@ import { App } from './App';
|
|
|
784
784
|
|
|
785
785
|
export const { renderSSR, renderStream } = createRenderer({
|
|
786
786
|
appComponent: () => <App />,
|
|
787
|
-
headContent: ({ data }) => \`
|
|
788
|
-
<meta
|
|
789
|
-
<meta name="
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
787
|
+
headContent: ({ data, meta }) => \`
|
|
788
|
+
<title>\${meta?.title || "\u03C4js - Composing systems, not just apps"}</title>
|
|
789
|
+
<meta name="description" content="\${
|
|
790
|
+
meta?.description ||
|
|
791
|
+
data?.message ||
|
|
792
|
+
"\u03C4js - Composing systems, not just apps"
|
|
793
|
+
}">
|
|
793
794
|
\`,
|
|
794
795
|
enableDebug: process.env.NODE_ENV === "development",
|
|
795
796
|
});
|