@adaptive-js/create-adaptive-app 0.1.8 → 0.1.9

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/README.md CHANGED
@@ -12,18 +12,46 @@ npm install
12
12
  npm run dev
13
13
  ```
14
14
 
15
+ ## Optional extensions
16
+
17
+ During creation the CLI lists the available extensions and asks which ones to install. Press Enter to install none of them.
18
+
19
+ ```bash
20
+ create-adaptive-app my-app --ext i18n,icons # skip the prompt, pick extensions
21
+ create-adaptive-app my-app --no-ext # skip the prompt, no extensions
22
+ ```
23
+
24
+ Keys: `components`, `auth`, `security`, `i18n`, `icons` (the full package name or the `extension/` folder name also work). Non-interactive runs (CI, piped stdin) skip the prompt automatically, so the command never blocks in a pipeline.
25
+
15
26
  ## Framework development
16
27
 
17
- When running the scaffold from an AdaptiveJS checkout, `--local` points `@adaptive-js/web` and `@adaptive-js/ci` at the local packages. This option is for framework development; application users should omit it.
28
+ When running the scaffold from an AdaptiveJS checkout, `--local` points `@adaptive-js/adapter`, `@adaptive-js/web`, `@adaptive-js/ci` and `@adaptive-js/shared` at the local packages. This option is for framework development; application users should omit it.
18
29
 
19
30
  ## What you get
20
31
 
21
32
  - `src/pages` file-based routes
22
33
  - an SSR-rendered page
23
34
  - a `"hydrate"` island using signals and `memo`
35
+ - `dependency.ts`, the global client entry (theme bootstrapping, global UI libraries)
24
36
  - Tailwind 4 through `public/styles.css`
37
+ - `generateMetadata` for `<title>`, description, canonical and Open Graph/Twitter tags (injected into the `<!--adaptive-head-->` marker of `index.html`)
38
+ - `@adaptive-js/adapter` available for deploy presets (`--preset vercel`, `netlify`, …) and build plugins
25
39
  - `adaptive.config.ts` support from `@adaptive-js/ci`
26
40
 
41
+ ## Page metadata
42
+
43
+ `src/pages/index.tsx` exports `generateMetadata({ url })`. The `url` is absolute, so
44
+ `canonical` and `og:url` work in production without extra setup. Set `SITE_URL` in
45
+ `.env` to force a fixed public origin, and add `public/og-image.png` to enable
46
+ `og:image`/`twitter:image`.
47
+
48
+ ```tsx
49
+ export function generateMetadata({ url }: { url: string }) {
50
+ const origin = new URL(url, "http://localhost").origin;
51
+ return { title: "My App", description: "…", canonical: `${origin}/` };
52
+ }
53
+ ```
54
+
27
55
  ## License
28
56
 
29
57
  MIT
package/index.mjs CHANGED
@@ -1,105 +1,355 @@
1
1
  #!/usr/bin/env node
2
- import fs from "node:fs/promises";
3
- import path from "node:path";
4
- import { fileURLToPath } from "node:url";
5
-
6
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
- const templateDir = path.join(__dirname, "template");
8
- const monorepoRoot = path.resolve(__dirname, "..");
9
-
10
- // Kept in sync with packages/web and packages/ci by scripts/check-packages.mjs.
11
- const WEB_VERSION = "0.0.1";
12
- const CI_VERSION = "0.0.1";
13
-
14
- const args = process.argv.slice(2);
15
- const projectName = args.find((arg) => !arg.startsWith("--"));
16
- const localMode = args.includes("--local");
17
- const unsupportedOption = args.find((arg) => arg.startsWith("--") && arg !== "--local");
18
-
19
- if (!projectName || args.filter((arg) => !arg.startsWith("--")).length > 1) {
20
- console.error("Usage: create-adaptive-app <project-name> [--local]");
21
- process.exit(1);
22
- }
23
-
24
- if (unsupportedOption) {
25
- console.error(`Unsupported option: ${unsupportedOption}. This scaffold uses Tailwind 4.`);
26
- process.exit(1);
27
- }
28
-
29
- const targetDir = path.resolve(process.cwd(), projectName);
30
- const appName = path.basename(targetDir);
31
-
32
- if (!/^[a-z0-9][a-z0-9._-]*$/i.test(appName)) {
33
- console.error(`Invalid project name: ${appName}`);
34
- process.exit(1);
35
- }
36
-
37
- try {
38
- await fs.access(targetDir);
39
- console.error(`Directory already exists: ${targetDir}`);
40
- process.exit(1);
41
- } catch (error) {
42
- if (error?.code !== "ENOENT") throw error;
43
- }
44
-
45
- const replacements = createReplacements(targetDir);
46
- await copyDir(templateDir, targetDir, replacements);
47
-
48
- console.log(`Adaptive app created at ${targetDir}`);
49
- console.log("");
50
- console.log("Next steps:");
51
- console.log(` cd ${projectName}`);
52
- console.log(" npm install");
53
- console.log(" npm run dev");
54
-
55
- function createReplacements(targetDir) {
56
- const replacements = {
57
- __APP_NAME__: appName,
58
- __WEB_DEP__: `^${WEB_VERSION}`,
59
- __CI_DEP__: `^${CI_VERSION}`,
60
- __ADAPTIVE_DEV__: "adaptive dev .",
61
- __ADAPTIVE_BUILD__: "adaptive build .",
62
- };
63
-
64
- if (!localMode) return replacements;
65
-
66
- const relativeRoot = normalizePath(path.relative(targetDir, monorepoRoot));
67
- const ciEntry = normalizePath(path.join(relativeRoot, "packages", "ci", "dist", "index.js"));
68
-
69
- replacements.__WEB_DEP__ = `file:${normalizePath(path.join(relativeRoot, "packages", "web"))}`;
70
- replacements.__CI_DEP__ = `file:${normalizePath(path.join(relativeRoot, "packages", "ci"))}`;
71
- replacements.__ADAPTIVE_DEV__ = jsonStringContent(`node "${ciEntry}" dev .`);
72
- replacements.__ADAPTIVE_BUILD__ = jsonStringContent(`node "${ciEntry}" build .`);
73
-
74
- return replacements;
75
- }
76
-
77
- function jsonStringContent(value) {
78
- return JSON.stringify(value).slice(1, -1);
79
- }
80
-
81
- function normalizePath(value) {
82
- return value.split(path.sep).join("/");
83
- }
84
-
85
- async function copyDir(fromDir, toDir, replacements) {
86
- await fs.mkdir(toDir, { recursive: true });
87
- const entries = await fs.readdir(fromDir, { withFileTypes: true });
88
-
89
- for (const entry of entries) {
90
- const sourcePath = path.join(fromDir, entry.name);
91
- const targetName = entry.name === "_gitignore" ? ".gitignore" : entry.name;
92
- const targetPath = path.join(toDir, targetName);
93
-
94
- if (entry.isDirectory()) {
95
- await copyDir(sourcePath, targetPath, replacements);
96
- continue;
97
- }
98
-
99
- let content = await fs.readFile(sourcePath, "utf8");
100
- for (const [token, replacement] of Object.entries(replacements)) {
101
- content = content.replaceAll(token, replacement);
102
- }
103
- await fs.writeFile(targetPath, content, "utf8");
104
- }
105
- }
2
+ import fs from "node:fs/promises";
3
+ import path from "node:path";
4
+ import readline from "node:readline/promises";
5
+ import { fileURLToPath } from "node:url";
6
+
7
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
+ const templateDir = path.join(__dirname, "template");
9
+ const monorepoRoot = path.resolve(__dirname, "..");
10
+
11
+ // Kept in sync with packages/* and extension/* by scripts/check-packages.mjs.
12
+ const ADAPTER_VERSION = "0.1.1";
13
+ const WEB_VERSION = "0.0.2";
14
+ const CI_VERSION = "0.0.2";
15
+ const SHARED_VERSION = "0.0.1";
16
+ const EXT_COMPONENTS_VERSION = "0.0.2";
17
+ const EXT_AUTH_VERSION = "0.0.2";
18
+ const EXT_SECURITY_VERSION = "0.0.1";
19
+ const EXT_I18N_VERSION = "0.0.2";
20
+ const EXT_ICONS_VERSION = "0.0.2";
21
+
22
+ const EXTENSIONS = [
23
+ {
24
+ key: "components",
25
+ dir: "components",
26
+ packageName: "@adaptive-js/components",
27
+ version: EXT_COMPONENTS_VERSION,
28
+ description: "UI primitives, virtualization and Reveal",
29
+ },
30
+ {
31
+ key: "auth",
32
+ dir: "auth",
33
+ packageName: "@adaptive-js/extension-auth",
34
+ version: EXT_AUTH_VERSION,
35
+ description: "server-first authentication and sessions",
36
+ },
37
+ {
38
+ key: "security",
39
+ dir: "security",
40
+ packageName: "@adaptive-js/extension-security",
41
+ version: EXT_SECURITY_VERSION,
42
+ description: "security headers, rate limiting and runtime guards",
43
+ },
44
+ {
45
+ key: "i18n",
46
+ dir: "i18n",
47
+ packageName: "@adaptive-js/extension-i18n",
48
+ version: EXT_I18N_VERSION,
49
+ description: "reactive translations, fallback and server-side loader",
50
+ },
51
+ {
52
+ key: "icons",
53
+ dir: "lucide-animation-icons",
54
+ packageName: "@adaptive-js/extension-lucide-animation-icons",
55
+ version: EXT_ICONS_VERSION,
56
+ description: "animated Lucide icons",
57
+ },
58
+ ];
59
+
60
+ const args = process.argv.slice(2);
61
+ const positionals = [];
62
+ const unsupportedOptions = [];
63
+ let localMode = false;
64
+ // undefined = ask, "" = none, "i18n,icons" = explicit list.
65
+ let extensionSelection;
66
+
67
+ for (let index = 0; index < args.length; index += 1) {
68
+ const arg = args[index];
69
+
70
+ if (arg === "--local") {
71
+ localMode = true;
72
+ continue;
73
+ }
74
+
75
+ if (arg === "--no-ext") {
76
+ extensionSelection = "";
77
+ continue;
78
+ }
79
+
80
+ if (arg === "--ext") {
81
+ extensionSelection = args[index + 1] ?? "";
82
+ index += 1;
83
+ continue;
84
+ }
85
+
86
+ if (arg.startsWith("--ext=")) {
87
+ extensionSelection = arg.slice("--ext=".length);
88
+ continue;
89
+ }
90
+
91
+ if (arg.startsWith("-")) {
92
+ unsupportedOptions.push(arg);
93
+ continue;
94
+ }
95
+
96
+ positionals.push(arg);
97
+ }
98
+
99
+ if (positionals.length === 0 || positionals.length > 1) {
100
+ console.error("Usage: create-adaptive-app <project-name> [--local] [--ext <list> | --no-ext]");
101
+ console.error("");
102
+ console.error("Extensions:");
103
+ for (const extension of EXTENSIONS) {
104
+ console.error(` ${extension.key.padEnd(12)} ${extension.packageName}`);
105
+ }
106
+ process.exit(1);
107
+ }
108
+
109
+ if (unsupportedOptions.length > 0) {
110
+ console.error(`Unsupported option: ${unsupportedOptions[0]}`);
111
+ console.error("Supported options: --local, --ext <list>, --no-ext");
112
+ process.exit(1);
113
+ }
114
+
115
+ const projectName = positionals[0];
116
+ const targetDir = path.resolve(process.cwd(), projectName);
117
+ const appName = path.basename(targetDir);
118
+
119
+ if (!/^[a-z0-9][a-z0-9._-]*$/i.test(appName)) {
120
+ console.error(`Invalid project name: ${appName}`);
121
+ process.exit(1);
122
+ }
123
+
124
+ try {
125
+ await fs.access(targetDir);
126
+ console.error(`Directory already exists: ${targetDir}`);
127
+ process.exit(1);
128
+ } catch (error) {
129
+ if (error?.code !== "ENOENT") throw error;
130
+ }
131
+
132
+ const selectedExtensions = await selectExtensions();
133
+
134
+ const replacements = createReplacements(targetDir);
135
+ await copyDir(templateDir, targetDir, replacements);
136
+
137
+ if (selectedExtensions.length > 0) {
138
+ await addExtensionDependencies(targetDir, selectedExtensions);
139
+ }
140
+
141
+ console.log(`Adaptive app created at ${targetDir}`);
142
+
143
+ if (selectedExtensions.length > 0) {
144
+ console.log(`Extensions: ${selectedExtensions.map((extension) => extension.packageName).join(", ")}`);
145
+ }
146
+
147
+ console.log("");
148
+ console.log("Next steps:");
149
+ console.log(` cd ${projectName}`);
150
+ console.log(" npm install");
151
+ console.log(" npm run dev");
152
+
153
+ function createReplacements(targetDir) {
154
+ const replacements = {
155
+ __APP_NAME__: appName,
156
+ __ADAPTER_DEP__: `^${ADAPTER_VERSION}`,
157
+ __WEB_DEP__: `^${WEB_VERSION}`,
158
+ __CI_DEP__: `^${CI_VERSION}`,
159
+ __SHARED_DEP__: `^${SHARED_VERSION}`,
160
+ __ADAPTIVE_DEV__: "adaptive dev .",
161
+ __ADAPTIVE_BUILD__: "adaptive build .",
162
+ };
163
+
164
+ if (!localMode) return replacements;
165
+
166
+ const relativeRoot = normalizePath(path.relative(targetDir, monorepoRoot));
167
+ const ciEntry = normalizePath(path.join(relativeRoot, "packages", "ci", "dist", "index.js"));
168
+
169
+ replacements.__ADAPTER_DEP__ = `file:${normalizePath(path.join(relativeRoot, "packages", "adaptive-adapter"))}`;
170
+ replacements.__WEB_DEP__ = `file:${normalizePath(path.join(relativeRoot, "packages", "web"))}`;
171
+ replacements.__CI_DEP__ = `file:${normalizePath(path.join(relativeRoot, "packages", "ci"))}`;
172
+ replacements.__SHARED_DEP__ = `file:${normalizePath(path.join(relativeRoot, "packages", "shared"))}`;
173
+ replacements.__ADAPTIVE_DEV__ = jsonStringContent(`node "${ciEntry}" dev .`);
174
+ replacements.__ADAPTIVE_BUILD__ = jsonStringContent(`node "${ciEntry}" build .`);
175
+
176
+ return replacements;
177
+ }
178
+
179
+ async function selectExtensions() {
180
+ if (extensionSelection !== undefined) {
181
+ return resolveExtensionSelection(extensionSelection);
182
+ }
183
+
184
+ if (!process.stdin.isTTY) {
185
+ console.log("No extensions selected (non-interactive run). Pass --ext <list> to add them.");
186
+ return [];
187
+ }
188
+
189
+ printExtensionMenu();
190
+
191
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
192
+
193
+ try {
194
+ while (true) {
195
+ const answer = await askLine(rl, "Which extensions? (numbers separated by comma, Enter for none): ");
196
+
197
+ // null = stdin fechou (EOF) no meio do prompt: segue sem extensões.
198
+ if (answer === null || answer.trim() === "") return [];
199
+
200
+ const selection = parseExtensionNumbers(answer);
201
+ if (selection) return selection;
202
+
203
+ console.log("Invalid selection. Use the numbers from the list, for example: 1,3");
204
+ }
205
+ } catch (error) {
206
+ if (error?.name === "AbortError" || error?.code === "ERR_USE_AFTER_CLOSE") {
207
+ console.log("");
208
+ console.log("Cancelled.");
209
+ process.exit(1);
210
+ }
211
+ throw error;
212
+ } finally {
213
+ rl.close();
214
+ }
215
+ }
216
+
217
+ /**
218
+ * `rl.question` nunca resolve se o stdin fechar antes da resposta, então
219
+ * corremos a pergunta contra o evento "close".
220
+ */
221
+ function askLine(rl, prompt) {
222
+ return new Promise((resolve) => {
223
+ let settled = false;
224
+
225
+ const onClose = () => {
226
+ if (settled) return;
227
+ settled = true;
228
+ resolve(null);
229
+ };
230
+
231
+ rl.once("close", onClose);
232
+
233
+ rl.question(prompt).then(
234
+ (value) => {
235
+ if (settled) return;
236
+ settled = true;
237
+ rl.off("close", onClose);
238
+ resolve(value);
239
+ },
240
+ () => {
241
+ if (settled) return;
242
+ settled = true;
243
+ rl.off("close", onClose);
244
+ resolve(null);
245
+ },
246
+ );
247
+ });
248
+ }
249
+
250
+ function printExtensionMenu() {
251
+ console.log("");
252
+ console.log("Optional extensions:");
253
+ for (const [index, extension] of EXTENSIONS.entries()) {
254
+ console.log(` ${`${index + 1})`.padEnd(3)} ${extension.packageName.padEnd(48)} ${extension.description}`);
255
+ }
256
+ console.log("");
257
+ }
258
+
259
+ function parseExtensionNumbers(value) {
260
+ const tokens = value.split(/[\s,]+/).filter(Boolean);
261
+ if (tokens.length === 0) return null;
262
+
263
+ const selected = [];
264
+
265
+ for (const token of tokens) {
266
+ const index = Number(token);
267
+ if (!Number.isInteger(index) || index < 1 || index > EXTENSIONS.length) return null;
268
+
269
+ const extension = EXTENSIONS[index - 1];
270
+ if (!selected.includes(extension)) selected.push(extension);
271
+ }
272
+
273
+ return selected;
274
+ }
275
+
276
+ function resolveExtensionSelection(value) {
277
+ const tokens = String(value).split(/[\s,]+/).filter(Boolean);
278
+ if (tokens.length === 0) return [];
279
+
280
+ const selected = [];
281
+
282
+ for (const token of tokens) {
283
+ const normalized = token.toLowerCase();
284
+ const extension = EXTENSIONS.find(
285
+ (item) =>
286
+ item.key === normalized ||
287
+ item.dir === normalized ||
288
+ item.packageName === normalized,
289
+ );
290
+
291
+ if (!extension) {
292
+ console.error(`Unknown extension: ${token}`);
293
+ console.error(`Available: ${EXTENSIONS.map((item) => item.key).join(", ")}`);
294
+ process.exit(1);
295
+ }
296
+
297
+ if (!selected.includes(extension)) selected.push(extension);
298
+ }
299
+
300
+ return selected;
301
+ }
302
+
303
+ async function addExtensionDependencies(targetDir, extensions) {
304
+ const packageJsonPath = path.join(targetDir, "package.json");
305
+ const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf8"));
306
+ const dependencies = packageJson.dependencies ?? {};
307
+
308
+ for (const extension of extensions) {
309
+ dependencies[extension.packageName] = localMode
310
+ ? `file:${localExtensionSpec(targetDir, extension)}`
311
+ : `^${extension.version}`;
312
+ }
313
+
314
+ packageJson.dependencies = sortKeys(dependencies);
315
+ await fs.writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`, "utf8");
316
+ }
317
+
318
+ function localExtensionSpec(targetDir, extension) {
319
+ const relativeRoot = normalizePath(path.relative(targetDir, monorepoRoot));
320
+ return normalizePath(path.join(relativeRoot, "extension", extension.dir));
321
+ }
322
+
323
+ function sortKeys(record) {
324
+ return Object.fromEntries(Object.entries(record).sort(([a], [b]) => a.localeCompare(b)));
325
+ }
326
+
327
+ function jsonStringContent(value) {
328
+ return JSON.stringify(value).slice(1, -1);
329
+ }
330
+
331
+ function normalizePath(value) {
332
+ return value.split(path.sep).join("/");
333
+ }
334
+
335
+ async function copyDir(fromDir, toDir, replacements) {
336
+ await fs.mkdir(toDir, { recursive: true });
337
+ const entries = await fs.readdir(fromDir, { withFileTypes: true });
338
+
339
+ for (const entry of entries) {
340
+ const sourcePath = path.join(fromDir, entry.name);
341
+ const targetName = entry.name === "_gitignore" ? ".gitignore" : entry.name;
342
+ const targetPath = path.join(toDir, targetName);
343
+
344
+ if (entry.isDirectory()) {
345
+ await copyDir(sourcePath, targetPath, replacements);
346
+ continue;
347
+ }
348
+
349
+ let content = await fs.readFile(sourcePath, "utf8");
350
+ for (const [token, replacement] of Object.entries(replacements)) {
351
+ content = content.replaceAll(token, replacement);
352
+ }
353
+ await fs.writeFile(targetPath, content, "utf8");
354
+ }
355
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptive-js/create-adaptive-app",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Create an AdaptiveJS application with SSR, DOM-first hydration, and Tailwind 4.",
5
5
  "keywords": [
6
6
  "adaptive-js",
package/template/.env CHANGED
@@ -1 +1,5 @@
1
1
  ADAPTIVE_ENABLED_CLIENT=1
2
+
3
+ # Domínio público usado em canonical, og:url e og:image.
4
+ # Sem esta variável o AdaptiveJS usa a origem da requisição.
5
+ # SITE_URL=https://seudominio.com
@@ -0,0 +1,21 @@
1
+ /*
2
+ * Entrada global do cliente.
3
+ *
4
+ * O AdaptiveJS empacota este arquivo em todas as páginas. Não precisa de
5
+ * "client" nem de `export {}`: use para efeitos globais (tema, bibliotecas de
6
+ * UI, listeners da aplicação).
7
+ */
8
+
9
+ const THEME_KEY = "adaptive-theme";
10
+
11
+ try {
12
+ const theme = localStorage.getItem(THEME_KEY);
13
+ if (theme === "light" || theme === "dark") {
14
+ document.documentElement.dataset.theme = theme;
15
+ }
16
+ } catch {
17
+ // localStorage pode estar bloqueado (modo privado, iframe restrito).
18
+ }
19
+
20
+ // Marca no <html> que o bundle global do cliente carregou.
21
+ document.documentElement.dataset.adaptiveClient = "ready";
@@ -8,11 +8,14 @@
8
8
  "typecheck": "tsc -p tsconfig.json --noEmit"
9
9
  },
10
10
  "dependencies": {
11
+ "@adaptive-js/adapter": "__ADAPTER_DEP__",
11
12
  "@adaptive-js/ci": "__CI_DEP__",
13
+ "@adaptive-js/shared": "__SHARED_DEP__",
12
14
  "@adaptive-js/web": "__WEB_DEP__"
13
15
  },
14
16
  "devDependencies": {
15
17
  "@tailwindcss/postcss": "^4.1.7",
18
+ "@types/node": "^25.6.0",
16
19
  "postcss": "^8.5.6",
17
20
  "tailwindcss": "^4.1.7",
18
21
  "typescript": "^6.0.3"
@@ -1,34 +1,46 @@
1
1
  import Counter from "../components/counter";
2
+ import type { AdaptiveMetadata, AdaptiveMetadataContext } from "@adaptive-js/shared";
3
+
4
+ const TITLE = "__APP_NAME__ · AdaptiveJS";
5
+ const DESCRIPTION =
6
+ "Aplicação AdaptiveJS com SSR, hidratação DOM-first, reatividade granular e Tailwind 4.";
2
7
 
3
8
  /**
4
- * Metadados de compartilhamento da home.
5
- * O AdaptiveJS injeta estas tags no <head> (via <!--adaptive-head-->):
6
- * title, description, og:* e twitter:*.
7
- * Para usar imagem, coloque o arquivo em public/og-image.png e adicione
8
- * `image: "/og-image.png"` (ou a URL absoluta) nos dois objetos abaixo.
9
+ * Metadados da página (SEO / Open Graph). O AdaptiveJS chama esta função no
10
+ * servidor e injeta as tags no <head>, no lugar do <!--adaptive-head-->.
11
+ * `url` chega absoluta, então o canonical já sai correto em produção.
12
+ *
13
+ * Para og:image/twitter:image, coloque a arte em public/og-image.png e
14
+ * descomente as linhas `image`.
9
15
  */
10
- export const metadata = {
11
- title: "__APP_NAME__ · AdaptiveJS",
12
- description:
13
- "Aplicação AdaptiveJS com SSR, hidratação DOM-first, reatividade granular e Tailwind 4.",
14
- siteName: "__APP_NAME__",
15
- locale: "pt_BR",
16
- type: "website",
17
- openGraph: {
18
- title: "__APP_NAME__ · AdaptiveJS",
19
- description:
20
- "Aplicação AdaptiveJS com SSR, hidratação DOM-first, reatividade granular e Tailwind 4.",
16
+ export function generateMetadata({ url }: AdaptiveMetadataContext): AdaptiveMetadata {
17
+ const origin = new URL(url, "http://localhost").origin;
18
+
19
+ return {
20
+ title: TITLE,
21
+ description: DESCRIPTION,
22
+ canonical: `${origin}/`,
23
+ // image: `${origin}/og-image.png`,
21
24
  siteName: "__APP_NAME__",
22
25
  locale: "pt_BR",
23
26
  type: "website",
24
- },
25
- twitter: {
26
- card: "summary_large_image",
27
- title: "__APP_NAME__ · AdaptiveJS",
28
- description:
29
- "Aplicação AdaptiveJS com SSR, hidratação DOM-first, reatividade granular e Tailwind 4.",
30
- },
31
- };
27
+ openGraph: {
28
+ title: TITLE,
29
+ description: DESCRIPTION,
30
+ url: `${origin}/`,
31
+ // image: `${origin}/og-image.png`,
32
+ siteName: "__APP_NAME__",
33
+ locale: "pt_BR",
34
+ type: "website",
35
+ },
36
+ twitter: {
37
+ card: "summary_large_image",
38
+ title: TITLE,
39
+ description: DESCRIPTION,
40
+ // image: `${origin}/og-image.png`,
41
+ },
42
+ };
43
+ }
32
44
 
33
45
  export default function HomePage() {
34
46
  return (
@@ -4,11 +4,12 @@
4
4
  "module": "ESNext",
5
5
  "moduleResolution": "Bundler",
6
6
  "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
+ "types": ["node"],
7
8
  "jsx": "react-jsx",
8
9
  "jsxImportSource": "@adaptive-js/web",
9
10
  "strict": true,
10
11
  "skipLibCheck": true,
11
12
  "noEmit": true
12
13
  },
13
- "include": ["src"]
14
+ "include": ["src", "dependency.ts"]
14
15
  }