synthesisui 0.4.6 → 0.4.7
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.
|
@@ -19,22 +19,25 @@ export async function template(slug, name, opts) {
|
|
|
19
19
|
console.log(`→ generating "${name}" from "${slug}" (${target}) …`);
|
|
20
20
|
const generated = await fetchTemplate(base, slug, name, target, opts.version);
|
|
21
21
|
// --out targets the page (1st file); sibling files (e.g. the CSS) land in the
|
|
22
|
-
// same directory. Without --out, everything goes under
|
|
22
|
+
// same directory. Without --out, everything goes under templates/<name>/ -
|
|
23
|
+
// a loose landing.tsx at the app/ root read as a route without being one,
|
|
24
|
+
// and a second template turned the app dir into soup.
|
|
23
25
|
const [pageFile, ...siblings] = generated.files;
|
|
24
|
-
const
|
|
26
|
+
const defaultDir = join("templates", name);
|
|
27
|
+
const pageRel = opts.out ?? join(defaultDir, pageFile.filename);
|
|
25
28
|
const pageDir = dirname(join(root, pageRel));
|
|
26
29
|
await mkdir(pageDir, { recursive: true });
|
|
27
30
|
await writeFile(join(root, pageRel), pageFile.code, "utf8");
|
|
28
31
|
console.log(`✓ wrote ${pageRel} (${slug} v${generated.version})`);
|
|
29
32
|
for (const f of siblings) {
|
|
30
|
-
const rel =
|
|
31
|
-
? join(dirname(pageRel), f.filename)
|
|
32
|
-
: join(config.pagesDir, f.filename);
|
|
33
|
+
const rel = join(dirname(pageRel), f.filename);
|
|
33
34
|
await writeFile(join(root, rel), f.code, "utf8");
|
|
34
35
|
console.log(`✓ wrote ${rel}`);
|
|
35
36
|
}
|
|
36
37
|
console.log("");
|
|
37
38
|
console.log("Next steps:");
|
|
39
|
+
console.log(` • use it in a route, e.g. ${join(config.pagesDir, "page.tsx")}:`);
|
|
40
|
+
console.log(` import Page from "@/${defaultDir.replace(/\\/g, "/")}/${pageFile.filename.replace(/\.tsx$/, "")}";`);
|
|
38
41
|
console.log(` • ensure the DS is installed: synthesisui add ${slug} (provides tokens.css)`);
|
|
39
42
|
console.log(` • @import "_synthesisui/ds/${slug}/tokens.css" in your global CSS`);
|
|
40
43
|
console.log(" • refine the file: wire real data, split into components, swap placeholders");
|