synthesisui 0.16.494 → 0.16.495
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mkdir, writeFile } from "node:fs/promises";
|
|
1
|
+
import { mkdir, stat, writeFile } from "node:fs/promises";
|
|
2
2
|
import { dirname, join, relative } from "node:path";
|
|
3
3
|
import { readProjectConfig, resolveRegistry } from "../config.js";
|
|
4
4
|
import { installedSheetCss, RECIPE_HEADER, recipeRulesFor, } from "../recipe-css.js";
|
|
@@ -61,7 +61,13 @@ export async function template(slug, name, opts) {
|
|
|
61
61
|
// a loose landing.tsx at the app/ root read as a route without being one,
|
|
62
62
|
// and a second template turned the app dir into soup.
|
|
63
63
|
const [pageFile, ...siblings] = generated.files;
|
|
64
|
-
|
|
64
|
+
/**
|
|
65
|
+
* DENTRO DE `src/` QUANDO O APP MORA LÁ (14/10, três agentes do zero seguidos): o `create-next-app` com `src/` aponta o
|
|
66
|
+
* `@/` para `src/`, e os templates iam para `templates/` na raiz - o import que a frase abaixo sugere não resolvia, e o
|
|
67
|
+
* agente movia a pasta à mão. Com `src/app`, a pasta é `src/templates/<nome>`; sem, a raiz de sempre.
|
|
68
|
+
*/
|
|
69
|
+
const underSrc = await stat(join(root, "src", "app")).then((s) => s.isDirectory(), () => false);
|
|
70
|
+
const defaultDir = join(underSrc ? join("src", "templates") : "templates", asName ?? name);
|
|
65
71
|
const pageRel = opts.out ?? join(defaultDir, pageFile.filename);
|
|
66
72
|
const pageDir = dirname(join(root, pageRel));
|
|
67
73
|
/**
|
|
@@ -228,7 +234,7 @@ export async function template(slug, name, opts) {
|
|
|
228
234
|
console.log("");
|
|
229
235
|
console.log("Next steps:");
|
|
230
236
|
console.log(` • use it in a route, e.g. ${join(config.pagesDir, "page.tsx")}:`);
|
|
231
|
-
console.log(` import Page from "@/${defaultDir.replace(/\\/g, "/")}/${pageFile.filename.replace(/\.tsx$/, "")}";`);
|
|
237
|
+
console.log(` import Page from "@/${defaultDir.replace(/\\/g, "/").replace(/^src\//, "")}/${pageFile.filename.replace(/\.tsx$/, "")}";`);
|
|
232
238
|
console.log(` • nothing to install: this page and its stylesheet stand on their own`);
|
|
233
239
|
console.log(" • refine the file: wire real data, split into components, swap placeholders");
|
|
234
240
|
/**
|
package/package.json
CHANGED